Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ajdt-dev] AJ handle diffs - IJavaElement.getHandleIdentifier() vs. IRelationship.getSourceHandle()

Hi there,

You are correct that there are small differences between AJ handles
and JDT handles.  There are some legitimate reasons for this and some
illegitimate.

The AJ Compilation unit issue that you mention exists because in the
AspectJ model, we need to use a different handle to distinguish
between aj files and java files.  But in the AJDT world, we do not
because, due to JDT weaving, all compilation units (whether aj files
or java files) are treated the same.

Other small differences exist due to the legacy of how the handle
identifiers in AspectJ were originally created without a full
understanding of how JDT handle identifiers work.

That being said, the AJProjectModelFacade class does the translation
between handles.  It converts from a IJavaElement to an
IProgramElement (and back).  I don't think there is explicit api to
convert from JDT to AJ handle identiiers, but you can look at the code
and determine what you need to do.

If you come up with a good api for this, I am happy to accept a patch
and include it in AJProjectModelFacade.

Also, please note that there may be some inconsistencies in the
details (ie- I know that we have some problems with how initializers
are counted).  If you find any oddities, please send an email to this
list and let us know about it.

--a

On Sun, Apr 4, 2010 at 5:48 PM, Jeffrey W. Koch <jwk043000@xxxxxxxxxxxx> wrote:
> Hello,
> I'm writing an Eclipse plug-in that uses handle identifiers to work with
> crosscutting relationship information.  I *think* I'm seeing a slight
> variation in handle identifiers within AspectJ compilation units, depending
> on whether you're looking at an IJavaElement or a relationship that involves
> the IJavaElement.
> If you get the handle from IJavaElement.getHandleIdentifier(), the AspectJ
> compilation unit's name is preceded by "{":
> =handle-demo-aspects/src<handledemoaspects{HandleDemoAspect.aj}HandleDemoAspect&before
> However, if that IJavaElement is in a crosscutting relationship, and you get
> the handle from IRelationship.getSourceHandle(), the AspectJ compilation
> unit's name is preceded by "*":
> =handle-demo-aspects/src<handledemoaspects*HandleDemoAspect.aj}HandleDemoAspect&before
> From what I can tell, this only seems to happen within AspectJ compilation
> units.  getHandleIdentifier() and getSourceHandler() both use "{" before
> Java compilation unit names:
> =handle-demo-aspects/src<handledemoaspects{HandleDemoClass.java[HandleDemoClass
> Am I doing something wrong, or should getHandleIdentifier() and
> getSourceHandler() both return the same thing?
> I've written a small plug-in that demonstrates the behavior, if you're
> interested.
> Thanks!
> Jeff
> _______________________________________________
> ajdt-dev mailing list
> ajdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/ajdt-dev
>
>


Back to the top