Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 367354

Summary: Invalid code generated in re-organize imports
Product: [Tools] AJDT Reporter: Brian de Alwis <bsd>
Component: UIAssignee: AJDT-inbox <AJDT-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: andrew.eisenberg
Version: 2.1.3   
Target Milestone: 2.2.0   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Brian de Alwis CLA 2011-12-21 11:52:15 EST
Version: 2.2.0.e37x-20111215-2200
AspectJ version: 1.7.0.20111215190600

I'm attempting to include the aspect defined towards the end of this article:

   http://weblogs.java.net/blog/alexfromsun/archive/2006/02/debugging_swing.html

It has a wildcard import:
-----------
import javax.swing.*;
-----------
Ctrl-Shift-O produced:
-----------
import javax.swing.import javax.swing.JComponent;
import javax.swing.SwingUtilities;
-----------

Notice that the reorganize seems to have only removed the wildcard, and forgot the rest of the "import javax.swing.".
Comment 1 Andrew Eisenberg CLA 2011-12-22 16:02:48 EST
Yep.  Easily reproducible.  Thanks for the bug report.
Comment 2 Andrew Eisenberg CLA 2011-12-22 16:03:56 EST
Simpler aspect that recreates the problem:

import javax.swing.*;

aspect EdtRuleChecker {
	JFrame j;
}

It is a problem with any * imports.
Comment 3 Andrew Eisenberg CLA 2011-12-22 16:21:22 EST
This is a source location problem.
Comment 4 Andrew Eisenberg CLA 2011-12-22 16:55:09 EST
Yes, problem was that there was a small change to how the parser creates import references since upgrading to a Java 7-based parser, but this change wasn't reflected in AJDT.  Fixed now.

It's small changes like these that I am expecting to see a few more of.  Let me know if you see any more quirks.

Fixed and committed with regression tests.