Daniel Huss created GROOVY-7411:
-----------------------------------

             Summary: IllegalAccessError: Other.staticMethod() return 
PackagePrivateType
                 Key: GROOVY-7411
                 URL: https://issues.apache.org/jira/browse/GROOVY-7411
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 2.4.3, 2.3.0, 2.2.0, 2.1.0, 2.0.0
            Reporter: Daniel Huss


(See attached example)

A weird IllegalAccessError is thrown in method

{code}
  static SomeList someMethod( Object... args ) {

        return new SomeList( args[0], args[1], args[2] ) // SomeList has 
default visibility
  }
{code}

The constructor of PackagePrivateType is successfully invoked and 
{{DefaultTypeTransformations::castToType}} seems to return without error 
right before the JVM throws IllegalAccessError.

{noformat}Thread [main] (Suspended)     
        IllegalAccessError.<init>(String) line: 56      
        Other.someList(String...) line: 6       
        Other$someList.call(Object, Object) line: not available 
        Issue$1.create(String...) line: 35      
        Issue$1(TestStringListGenerator).create(Object...) line: 44     
        Issue$1(TestStringListGenerator).create(Object[]) line: 29      
        OneSizeGenerator<T,E>.createTestSubject() line: 68      
        
CollectionAddAllTester<E>(AbstractContainerTester<C,E>).resetContainer() line: 
63       
        CollectionAddAllTester<E>(AbstractContainerTester<C,E>).setUp() line: 
45        
        CollectionAddAllTester<E>(TestCase).runBare() line: 139 
        TestResult$1.protect() line: 122        
        TestResult.runProtected(Test, Protectable) line: 142    
        TestResult.run(TestCase) line: 125      
        CollectionAddAllTester<E>(TestCase).run(TestResult) line: 129   
        TestSuite.runTest(Test, TestResult) line: 252   
        TestSuite.run(TestResult) line: 247     
        TestSuite.runTest(Test, TestResult) line: 252   
        TestSuite.run(TestResult) line: 247     
        TestSuite.runTest(Test, TestResult) line: 252   
        TestSuite.run(TestResult) line: 247     
        AllTests(JUnit38ClassRunner).run(RunNotifier) line: 86  
        JUnitCore.run(Runner) line: 137 
        JUnitCore.run(Request) line: 115        
        JUnitCore$run.call(Object, Object[]) line: not available        
        CallSiteArray.defaultCall(CallSite, Object, Object[]) line: 45  
        AbstractCallSite.call(Object, Object[]) line: 110       
        AbstractCallSite.call(Object, Object) line: 122 
        Issue.run() line: 24    
        NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not 
available [native method]  
        NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57      
        DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43  
        Method.invoke(Object, Object...) line: 606      
        TestIssue.guavaTestLibIllegalAccess() line: 28  
        NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not 
available [native method]  
        NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57      
        DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43  
        Method.invoke(Object, Object...) line: 606      
        FrameworkMethod$1.runReflectiveCall() line: 50  
        FrameworkMethod$1(ReflectiveCallable).run() line: 12    
        FrameworkMethod.invokeExplosively(Object, Object...) line: 47   
        InvokeMethod.evaluate() line: 17        
        BlockJUnit4ClassRunner(ParentRunner<T>).runLeaf(Statement, Description, 
RunNotifier) line: 325  
        BlockJUnit4ClassRunner.runChild(FrameworkMethod, RunNotifier) line: 78  
        BlockJUnit4ClassRunner.runChild(Object, RunNotifier) line: 57   
        ParentRunner$3.run() line: 290  
        ParentRunner$1.schedule(Runnable) line: 71      
        BlockJUnit4ClassRunner(ParentRunner<T>).runChildren(RunNotifier) line: 
288      
        ParentRunner<T>.access$000(ParentRunner, RunNotifier) line: 58  
        ParentRunner$2.evaluate() line: 268     
        BlockJUnit4ClassRunner(ParentRunner<T>).run(RunNotifier) line: 363      
        JUnit4Provider.execute(Class<?>, RunNotifier, String[]) line: 283       
        JUnit4Provider.executeWithRerun(Class<?>, RunNotifier, String[]) line: 
173      
        JUnit4Provider.executeTestSet(Class<?>, RunListener, RunNotifier) line: 
153     
        JUnit4Provider.invoke(Object) line: 128 
        ForkedBooter.invokeProviderInSameClassLoader(Object, Object, 
ProviderConfiguration, boolean, StartupConfiguration, boolean) line: 203   
        ForkedBooter.runSuitesInProcess(Object, StartupConfiguration, 
ProviderConfiguration, PrintStream) line: 155     
        ForkedBooter.main(String[]) line: 103   
{noformat}



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

Reply via email to