Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Ambiguous methods with Java 8 (but not Java 7)

Hi,

There are some subtle changes made to the Eclipse JDT compiler when it is embedded in AspectJ - these relate to the handling of ITDs. Default methods as added in Java8 are rather similar to ITDs in some scenarios, and there can be unwanted interplay between the JDT support for default methods and AspectJ ITD modifications. We also don’t have a lot of default method test cases in AspectJ because it is a new JDK feature.  I’ve fixed something exactly like what you described before, I imagine this is the same problem somewhere else in the codebase.

AspectJ 1.8.5 is imminent so it’d be good if I could squeeze in a fix for this.

(Sometimes this is actually a bug in JDT - we could determine that by seeing if the project builds in a standard java eclipse project. If it does then it is due to the AspectJ modifications, if it doesn’t then it is a JDT bug that AspectJ is ‘inheriting’).

Please raise a bug against AspectJ at bugs.eclipse.org. I’ll need to recreate so if we can distill it down to the actual snippet that fails, that’d be great but if not I can fix it (more slowly) if I can extract the project you refer to from github and build it locally.

cheers,
Andy

> On Jan 26, 2015, at 3:42 PM, Adam Retter <adam.retter@xxxxxxxxxxxxxx> wrote:
> 
> We are using AspectJ 1.8.4 (and we also tried this with the latest
> snapshot) from Ant with the iajc task. We have a code base which is
> currently Java 7 and when we compile it using JDK 8 as Java 7 source
> and target code e.g. source="1.7" and target="1.7" then everything
> works fine.
> 
> However, we would like to migrate to Java 8, and when we switch the
> IAJC Ant task to source="1.8" and target="1.8", then we receive quite
> a few compilation errors (see below), however if we compile with JDK 8
> and don't use AspectJ then it all compiles fine. Are there any known
> problems with AspectJ iajc and Java 8 code?
> 
> 
> compile-aspectj:
> 
>     [echo] Compiling aspects with Java 1.8 from 1.8 source to 1.8
> target, debug on, optimize on, deprecation off
> 
>     [iajc] [warning] incorrect classpath:
> /Users/aretter/NetBeansProjects/exist-git/exist.jar
> 
>     [iajc] incorrect classpath:
> /Users/aretter/NetBeansProjects/exist-git/exist-optional.jar
> 
>     [iajc] incorrect classpath:
> /Users/aretter/NetBeansProjects/exist-git/start.jar
> 
>     [iajc]
> 
>     [iajc] /Users/aretter/NetBeansProjects/exist-git/src/org/exist/dom/persistent/DocumentImpl.java:652
> [error] The method getNodeId() is ambiguous for the type IStoredNode
> 
>     [iajc] newNode.setNodeId(oldNode.getNodeId());
> 
> 
> The Ant script that calls iajc is here:
> https://github.com/adamretter/exist/blob/j8/build/scripts/build-impl.xml#L212
> The code for DocumentImpl is here:
> https://github.com/adamretter/exist/blob/j8/src/org/exist/dom/persistent/DocumentImpl.java
> https://github.com/adamretter/exist/blob/j8/src/org/exist/dom/persistent/DocumentImpl.java#L661
> 
> 
> Can someone help me understand why the AspectJ compiler fails when
> switched to Java 8 source level without us making any changes to the
> code itself?
> 
> Thanks Adam.
> 
> 
> -- 
> Adam Retter
> 
> skype: adam.retter
> tweet: adamretter
> http://www.adamretter.org.uk
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top