Bug 388865 - Inconsistent error markers and no code completion for ITDs
Summary: Inconsistent error markers and no code completion for ITDs
Status: RESOLVED FIXED
Alias: None
Product: AJDT
Classification: Tools
Component: UI (show other bugs)
Version: 2.2.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 2.2.1   Edit
Assignee: AJDT-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-05 13:35 EDT by Birgitta Boeckeler CLA
Modified: 2012-09-06 11:44 EDT (History)
1 user (show)

See Also:


Attachments
Attempt to reproduce error (1.88 KB, application/x-sdlc)
2012-09-05 17:07 EDT, Andrew Eisenberg CLA
no flags Details
Screenshot of sample in Juno (60.92 KB, image/pjpeg)
2012-09-05 18:19 EDT, Birgitta Boeckeler CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Birgitta Boeckeler CLA 2012-09-05 13:35:24 EDT
Scenario:
Create a Java class with an ITD that declares two additional methods for that class (in my case, with the use of Roo). Create a compile error unrelated to that ITD in that class (e.g. missing import).

Result:
- The editor area shows two errors, one for the missing import, and one for a call to the ITD-declared methods, "undefined method".
- The Problems view only shows the root cause error, which is the missing import.
- Code completion for the ITD-declared methods does not work anymore.

Expected result:
- The editor area should show the same result as the Problems view, which is only the error related to the root cause, the missing import.
- Code completion should still work for the ITD methods.

As the Problems view seems to be able to deal with this, I suspect that this has something to do with AJDT, not the AspectJ compiler?



Example to reproduce this:

DEMONSTRATE.JAVA
import org.springframework.roo.addon.javabean.RooJavaBean;
@RooJavaBean
public class Demonstrate {
      @NotNull
      private String myField;

      public void demo() {
            this.getMyField();
      }
}

DEMONSTRATE_ROO_JAVABEAN.AJ
import Demonstrate;
privileged aspect Demonstrate_Roo_JavaBean {
    
    public String Demonstrate.getMyField() {
        return this.myField;
    }

    public void Demonstrate.setMyField(String myField) {
        this.myField = myField;
    }
}
Comment 1 Andrew Eisenberg CLA 2012-09-05 17:07:41 EDT
Created attachment 220760 [details]
Attempt to reproduce error

Here is a project that I used to try to reproduce the bug you are reporting.  Unfortunately, in this project, everything behaves as you would expect (ie- there is no extra error in the file).

Can you attach a similar kind of project that does have the problem?  It may be something to do with packages or something else that is not entirely intuitive.
Comment 2 Andrew Eisenberg CLA 2012-09-05 17:08:27 EDT
And, indeed.  I move the classes from the default package and I can now reproduce the problem.
Comment 3 Andrew Eisenberg CLA 2012-09-05 17:09:53 EDT
Apologies.  I spoke too soon.  I did an incremental build of the class and the behavior remains the same as before (ie- still cannot reproduce).
Comment 4 Birgitta Boeckeler CLA 2012-09-05 18:19:06 EDT
Created attachment 220764 [details]
Screenshot of sample in Juno

I downloaded your example and imported it into my Eclipse, I still get the described behaviour, both in default package and in a non-default package. To make sure this is not just an issue of my older version, I also tested in Juno (see screenshot).

Downloaded Juno for Java EE from eclipse.org, installed AJDT for Juno from the market place, imported your project. (Had to remove a project dependency from the build path to a project that wasn't included?) Did a "Clean" build, to be sure. I also switched the JRE to Java 7, to exclude that possibility, same result.
Comment 5 Andrew Eisenberg CLA 2012-09-05 18:46:35 EDT
Comment on attachment 220764 [details]
Screenshot of sample in Juno

Right.  Now I see it.  I have made some changes since the 2.2.0 release and it looks like one of the changes inadvertently fixed this problem.  I reverted back to 2.2.0 and I now see the error.  Apologies for not checking this out sooner, but it looks like the problem is fixed in head.  If you update to the latest from:

http://download.eclipse.org/tools/ajdt/42/dev/update/

You should see this as fixed.
Comment 6 Birgitta Boeckeler CLA 2012-09-06 09:29:11 EDT
Confirmed, retest successful with the head.
That's great, this error potentially led to a lot of error markers in the editor, very confusing without the problems view.

> You can close this bug then.
Comment 7 Andrew Eisenberg CLA 2012-09-06 11:44:25 EDT
Thanks for getting back to us.  Please raise more bugs and feature requests for anything else you find.