Bug 258206 - [handles] further further work on jdt handle interoperability
Summary: [handles] further further work on jdt handle interoperability
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P4 minor (vote)
Target Milestone: 1.6.4   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 249216
Blocks:
  Show dependency tree
 
Reported: 2008-12-09 18:54 EST by Andrew Eisenberg CLA
Modified: 2009-01-06 17:08 EST (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 Andrew Eisenberg CLA 2008-12-09 18:54:24 EST
Noticed that AspectJ handles do not have a package declaration, but JDT handles do.  I've been silently ignoring these for a while.

eg- 

package foo.bar;

import foo.Something;

class Frazzle { ...

}

the handle for package foo.bar; should be
=Project/src<foo.bar{Frazzle.aj%foo.bar

This is generally not a big deal, because we don't do any refactoring with the package declaration.  But, if it is easy to put in, would be nice.
Comment 1 Andrew Eisenberg CLA 2008-12-09 18:59:37 EST
Similarly, the import container should be:

=Project/src<foo.bar{Frazzle.aj#

currently, it looks like

=Project/src<foo.bar{Frazzle.aj#import declarations 

(just remove everything after the '#')

The imports themselves look fine.
Comment 2 Andrew Clement CLA 2009-01-06 13:07:32 EST
the import contains is easy to fix, the package is not.

package definitions are currently the containers for source files in the model, and not the other way around.  Here is a model with two source files (Example and Example2):

 p.q  [package] 
    hid is =Imports<p.q
    Example.java  [java source file] C:\ajcTest.tmp\Imports\p\q\Example.java:1::0
      Example  [class] C:\ajcTest.tmp\Imports\p\q\Example.java:6::84
        hid is =Imports<p.q{Example.java[Example
    Example2.java  [java file] C:\ajcTest.tmp\Imports\p\q\Example2.java:1::0
      Example2  [class] C:\ajcTest.tmp\Imports\p\q\Example2.java:19::61
        hid is =Imports<p.q{Example2.java[Example2

So I can't just change the handle for p.q to include the source file as there are multiple.

The correct fix is to change the hierarchy and move the package declarations into the source files - but I won't do that until necessary.  It might also require some changes/improvements to model search code that may be exploiting this existing structure for optimal performance.
Comment 3 Andrew Eisenberg CLA 2009-01-06 14:00:46 EST
I may not have been clear on this.  But, I still don't know if it would be an easy fix.

The package declaration is the "package foo.bar;" statement at the top of the file.  This is a different java element from the package fragment itself (ie- the folder .../foo/bar).

So, the change for the package declaration statement would require adding a new kind of ProgramElement with the appropriate handle.

The parent element of the source file (ie- the package fragment) should not change at all.
Comment 4 Andrew Clement CLA 2009-01-06 14:04:43 EST
I see, I was just not quite reading this quite right:

> AspectJ handles do not have a package declaration

meaning there is no model entry for package declarations.

That will be easier to fix, probably.
Comment 5 Andrew Clement CLA 2009-01-06 17:08:34 EST
first stab at all this is in, it made a terrible mess of the tests.