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

import java inner classes changed/broken in jsr06; can only import with '*'

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-6
    • 1.5
    • None
    • None
    • JDK 1.5.0_06

    Description

      In jsr-05, the following code works (where Thread.State and Message.RecipientType are inner classes):

      import java.lang.Thread.State
      import javax.mail.Message.RecipientType

      However, in jsr-06, its impossible to import inner classes by name. The only way to import them is with a promiscuous '*' import.

      For example:
      ~$ groovy --version
      Groovy Version: 1.0-JSR-06 JVM: 1.5.0_06-b05
      ~$ cat test.groovy
      import java.lang.Thread.State
      println "Running"
      ~$ groovy test.groovy
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, test.groovy: 1: unable to resolve class java.lang.Thread.State
      @ line 1, column 1.
      import java.lang.Thread.State
      ^

      1 error
      ~$ /usr/local/java/groovy-1.0-jsr-05/bin/groovy --version
      Groovy Version: 1.0-jsr-05 JVM: 1.5.0_06-b05
      ~$ /usr/local/java/groovy-1.0-jsr-05/bin/groovy test.groovy
      Running
      ~$ cat test2.groovy
      import java.lang.Thread.*
      println "Running"
      ~$ groovy test2.groovy
      Running

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            jason.madden@riskmetrics.com Jason Madden
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: