Bug 363979 - MissingImplementationException when an annotation exists with child annotations.
Summary: MissingImplementationException when an annotation exists with child annotations.
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 major with 25 votes (vote)
Target Milestone: 1.7.0   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-16 17:06 EST by jniswonger CLA
Modified: 2011-11-22 17:06 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 jniswonger CLA 2011-11-16 17:06:59 EST
Build Identifier: STS Version: 2.8.0.RELEASE Build Id: 201110171000

Currently can reproduce consistently when applying an aspect that has a declare parents declaration that uses an annotation attribute as a discriminator AND the compliation unit (class) contains another annotation that subsequently contains child annotations.

i.e.

Aspect has:
   declare parents: @SomeAnnotation(someAttribute=someValue) * extends SomeClass;

Compilation Unit contains annotations of:

   @SomeAnnotation(someAttribute = someValue)
   @YetAnotherAnnotation(value = @SomeChildAnnotation)
   public class Example { ... }


Here is the specific stack trace from my instance, but can reproduce generically.

[ERROR] Please raise an AspectJ bug.  AspectJ does not know how to convert this annotation value [@NamedQuery(name = "Department.findAll",query = "select d from Department d order by d.name ASC",hints = {@QueryHint(name = "org.hibernate.cacheable",value = "true")})]
[ERROR] org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceType$MissingImplementationException: Please raise an AspectJ bug.  AspectJ does not know how to convert this annotation value [@NamedQuery(name = "Department.findAll",query = "select d from Department d order by d.name ASC",hints = {@QueryHint(name = "org.hibernate.cacheable",value = "true")})]
[ERROR] at org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceType.generateElementValueForNonConstantExpression(EclipseSourceType.java:796)
[ERROR] at org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceType.generateElementValue(EclipseSourceType.java:765)
[ERROR] at org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceType.generateElementValueForNonConstantExpression(EclipseSourceType.java:809)
[ERROR] at org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceType.generateElementValue(EclipseSourceType.java:765)
[ERROR] at org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceType.generateAnnotation(EclipseSourceType.java:721)
[ERROR] at org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceType.convertEclipseAnnotation(EclipseSourceType.java:676)
[ERROR] at org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceType.getAnnotations(EclipseSourceType.java:656)
[ERROR] at org.aspectj.weaver.ReferenceType.getAnnotationOfType(ReferenceType.java:224)
[ERROR] at org.aspectj.weaver.patterns.ExactAnnotationTypePattern.matches(ExactAnnotationTypePattern.java:122)
[ERROR] at org.aspectj.weaver.patterns.ExactAnnotationTypePattern.matches(ExactAnnotationTypePattern.java:96)
[ERROR] at org.aspectj.weaver.patterns.AnyWithAnnotationTypePattern.matchesExactly(TypePattern.java:568)
[ERROR] at org.aspectj.weaver.patterns.TypePattern.matchesStatically(TypePattern.java:133)
[ERROR] at org.aspectj.weaver.patterns.DeclareParents.match(DeclareParents.java:63)
[ERROR] at org.aspectj.weaver.patterns.DeclareParents.findMatchingNewParents(DeclareParents.java:358)
[ERROR] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.doDeclareParents(AjLookupEnvironment.java:880)
[ERROR] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:730)

Reproducible: Always

Steps to Reproduce:
1. Define an aspect with declare parents that depends on an annotation with an attribute value
2. Define a class that has that annotation and attribute value, as well as another annotation that contains child annotations (i.e. @NamedQueries({ @NamedQuery...)
3. Compile.
Comment 1 Andrew Clement CLA 2011-11-17 13:19:33 EST
I implemented some of the missing functionality.  marker annotation values are now supported

@Foo(value=@Bar)

However, it looks like although you don't mention it in the little test example references, the original exception message indicates support is required for full nested annotations:

@Foo(value=@Bar(value=34))

that'll take a little longer to support.
Comment 2 Andrew Clement CLA 2011-11-17 16:16:44 EST
ok, i constructed a testcase based on the actual kinds of annotation from your stack trace, and fixed all that.

It should be a in a dev build later today, let me know if you still hit some of the gaps (missing impls).
Comment 3 jniswonger CLA 2011-11-17 16:21:14 EST
(In reply to comment #2)
> ok, i constructed a testcase based on the actual kinds of annotation from your
> stack trace, and fixed all that.
> 
> It should be a in a dev build later today, let me know if you still hit some of
> the gaps (missing impls).

Thanks for the quick turnaround...I will grab the dev build and test it out.

Thanks!
Comment 4 jniswonger CLA 2011-11-18 14:02:22 EST
Test it with the development build.  Looks good.  Thanks again!
Comment 5 jniswonger CLA 2011-11-22 11:30:50 EST
Andy,

I didn't see a release schedule on the site...do you have an idea of the time frame (ballpark) for the next release that will include these fixes?

Thanks!

jaime
Comment 6 Andrew Clement CLA 2011-11-22 17:06:56 EST
Hi Jaime,

Sorry about that, plans get out of date so fast :)

The big thing in 1.7.0 will be moving to the Eclipse Java7 compiler, but I think I can do a milestone before that big piece of work gets done.  I'm imagining a 1.7.0.M1 at christmas time then ideally 1.7.0 final in 1Q2012, possibly 2Q.

Does that work for you?