Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.5.4
-
None
Description
According to this thread:
http://markmail.org/message/us25dkia37qif75f
It seems that sometimes a semi-colon is required after a generics declaration with type coercion.
The semi shouldn't be needed.
import java.util.concurrent.atomic.AtomicInteger public class ThreadId { // Atomic integer containing the next thread ID to be assigned private static final AtomicInteger nextId = new AtomicInteger(0) // Thread local variable containing each thread's ID private static final ThreadLocal<Integer> threadId = [ initialValue: { return nextId.getAndIncrement() } ] as ThreadLocal<Integer>; // The Semi-colon at the end of the prior line seems to be required. // Returns the current thread's unique ID, assigning it if necessary public static int get() { System.out.println( "Thread ID: " + threadId.get()); return threadId.get(); } public static void main( String[] args ) { 1.upto(3) { Thread.start { new ThreadId().get(); } } } }