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

Compiler doesn't recognize fully qualified class name in method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0
    • 1.1-beta-1
    • None
    • Windows XP

    Description

      Three classes:

      package org.aaa
      class A {
      }

      class B {
      public static A = org.aaa.A.class
      public static main(args) {}
      }

      public class C {
      public static getA()

      { return org.aaa.A.class }

      public static main(args) {}
      }

      When running B.groovy via groovy or compiling via groovyc everythings fine. If I try the same with C.groovy, I'll get the following error:

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, C.groovy: 3: the name org doesn't refer to a declared variable or class. The static scope requires to declare variables before using them. If the variable should have been a class check the spelling.
      @ line 3, column 10.
      return org.aaa.A.class
      ^

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            ostrym Milan Ostry
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: