Bug 279439 - [reconciling] Errors reported for aspects using the fully qualified classname of the package they are in.
Summary: [reconciling] Errors reported for aspects using the fully qualified classname...
Status: RESOLVED FIXED
Alias: None
Product: AJDT
Classification: Tools
Component: UI (show other bugs)
Version: 2.0.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 2.0.1   Edit
Assignee: AJDT-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-08 07:09 EDT by Andreas Hartl CLA
Modified: 2009-08-12 17:16 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Hartl CLA 2009-06-08 07:09:17 EDT
If an aspect is declared with a package and uses the fully qualified name of a class inside that same package to inject fields or methods, the AJDT UI gives error messages and faulty auto-completions.

Steps to reproduce:

1. Create an AspectJ Project in Eclipse

2. Create an empty class Baz inside of package foo.bar

package foo.bar;

public class Baz {

  public Baz() {
  }

}

3. Create an aspect Baz_AJ inside of package foo.bar with the following content:

package foo.bar;

public aspect Baz_AJ {
  
  public int foo.bar.Baz.hi;

}

4. Create class Qux and try to access Bar#hi using autocompletion:

package foo.bar;

public class Qux {

  public static void main(String[] args) {
    Baz b = new Baz();
    b.<Ctrl+Space> (shows: "b.bar : int - Baz", expected: "b.hi : int - Baz")

4.1 Variant: manually access b.hi - causes an error marker to appear: "b.hi cannot be resolved or is not a field"

package foo.bar;

public class Qux {

  public static void main(String[] args) {
    Baz b = new Baz();
    b.hi = 42;
    System.out.println(b.hi);
  }
}


Despite of the errors markers displayed, the "problems" view is not updated. Running the class Qux is possible and causes prints 42 on the console, as expected.
Comment 1 Andrew Eisenberg CLA 2009-06-08 10:35:17 EDT
Yes, this is a reconciling error.  It is not a compiler error.

When performing reconciling (which is the basis for eager parsing and for content assist), AJDT translates the AspectJ buffer into a related Java buffer and passes that on to the Java reconciler.  In this case, the buffer translation is not happening correctly.

I will have a look at it, but I don't know if this will be able to get into 2.0.
Comment 2 Andrew Eisenberg CLA 2009-06-08 14:51:39 EDT
This problem has to do with how we extract the name for an ITD when creating a mock JavaElement for it.  In the past, AJDT erroneously assumed that the name would always be of the form <target>.<itd_name>, not <path.to.target>.<target>.<itd_name>.

So, it is a small fix and it is working now.  I just want to do a little more testing and I will commit.
Comment 3 Andrew Eisenberg CLA 2009-06-08 15:04:41 EDT
Commited the fix with regression test.  Will be available in next dev build.
Comment 4 Andrew Eisenberg CLA 2009-08-12 17:16:14 EDT
should be fixed.