groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shil Sinha (JIRA)" <j...@apache.org>
Subject [jira] [Created] (GROOVY-7510) Statically importing a static property causes join compilation to fail
Date Sun, 19 Jul 2015 20:35:04 GMT
Shil Sinha created GROOVY-7510:
----------------------------------

             Summary: Statically importing a static property causes join compilation to fail
                 Key: GROOVY-7510
                 URL: https://issues.apache.org/jira/browse/GROOVY-7510
             Project: Groovy
          Issue Type: Bug
          Components: Stub generator / Joint compiler
    Affects Versions: 2.4.4
         Environment: JDK 1.8.0_25
            Reporter: Shil Sinha


Due to the addition of static imports in generated stubs (per https://issues.apache.org/jira/browse/GROOVY-7366),
the following test now fails:

{code}
package org.codehaus.groovy.tools.stubgenerator


class ImportStaticPropertyTest extends StringSourcesStubTestCase {

  @Override
  Map<String, String> provideSources() {
      [
              'A.groovy': '''
                  package test
                  class A {
                      static String aString = 'aString'
                  }
              ''',

              'B.groovy': '''
                  package test
                  import static test.A.aString
                  class B {
                      String returnAString(){
                          return aString
                      }
                  }
              ''',

              'C.java': '''
                  package test;
                  public class C {
                      public static void main(String[] args) {
                          System.out.println(new B().returnAString());
                      }
                  }
              '''
      ]
  }

  @Override
  void verifyStubs() {

  }
}
{code}

The error produced is:
{code}
error: cannot find symbol
import static test.A.aString;
^
  symbol:   static aString
  location: class
{code}

Adding a {{public}} modifier to aString will cause the test to pass as aString will then be
included in the generated stub for A.








--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message