Bug 306839

Summary: java.lang.IllegalAccessError: tried to access class (in different package)
Product: [Tools] AspectJ Reporter: Dmitri Mamrukov <dym>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: critical    
Priority: P3 CC: aclement
Version: unspecified   
Target Milestone: 1.6.9   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Attachments:
Description Flags
An Eclipse project with aspects/classes that reproduce the error. none

Description Dmitri Mamrukov CLA 2010-03-23 12:10:44 EDT
Build Identifier: 20100218-1602

When running a Main class that uses aspects/helper classes in a different package, java.lang.IllegalAccessError is thrown. It doesn't happen when the same aspects/helper classes reside in the package where the Main class is. This started to happen when I moved from jdk1.5.0_08 (where it worked for years) to jdk1.6.0_18.

Reproducible: Always

Steps to Reproduce:
1. Import the project from aop-illegal-access-error.zip.
2. Running error.composite.Main throws java.lang.IllegalAccessError.
3. Running no_error.composite.Main doesn't.
Comment 1 Dmitri Mamrukov CLA 2010-03-23 12:19:25 EDT
Created attachment 162782 [details]
An Eclipse project with aspects/classes that reproduce the error.
Comment 2 Andrew Clement CLA 2010-04-29 17:22:16 EDT
I just imported the project and ran the error.composite.Main - got:

======
Demonstrating the Composite design pattern (Java version)...

<<< Sample AOP implementation of Composite pattern >>>

Creating Composite structure...
done.
This is the Structure:
Directory: Directory1
    File: File1 (123 KB)
    Directory: Directory2
        File: File2 (4556 KB)
    File: File3 (16 KB)

Calling printStructure(PrintStream) on Composition.Components...
<Composite>Directory: Directory1
    <Leaf>File: File1 (123 KB)
    <Composite>Directory: Directory2
        <Leaf>File: File2 (4556 KB)
    <Leaf>File: File3 (16 KB)
...done.

Calling subSum(): on the structure...
The total size of the file system is: 4695
...done.

<<< Test completed >>>
public java.lang.String error.composite.Directory.toString()
public void error.composite.Directory.printStructure(java.io.PrintStream)
public int error.composite.Directory.subSum()
public java.lang.String error.composite.File.toString()
public int error.composite.File.getSize()
public void error.composite.File.printStructure(java.io.PrintStream)
public int error.composite.File.subSum()

...done!
===

Is that what comes out when it works?

You didn't mention what version of AJDT you were using - can you retry on the latest?
Comment 3 Andrew Clement CLA 2010-06-30 11:09:17 EDT
please reopen if still an issue on the latest AJDT