Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2725

Semicolon required for certain generics declarations

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.4
    • 1.6-beta-1, 1.5.7
    • parser-antlr2
    • 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(); }
      
      
            }
        }
      
       }
      

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            guillaume Guillaume Sauthier
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: