I just had this problem recently myself. The trick seems to be to change the AspectJ dependencies for the aspectj-maven-plugin. My config is below, but I use a private repo, so your artifacts would likely be different:

                        <plugin>
                                <groupId>org.codehaus.mojo</groupId>
                                <artifactId>aspectj-maven-plugin</artifactId>
                                <dependencies>
                                <dependency>
                                        <groupId>aspectj</groupId>
                                        <artifactId>aspectjrt</artifactId>
                                        <version>1.6.1</version>
                                </dependency>
                                <dependency>
                                        <groupId>aspectj</groupId>
                                        <artifactId>aspectjtools</artifactId>
                                        <version>1.6.1</version>
                                </dependency>
                                </dependencies>
                                <executions>
                                        <execution>
                                                <goals>
                                                        <goal>compile</goal>
                                                        
<goal>test-compile</goal>
                                                </goals>
                                        </execution>
                                </executions>
                                <configuration>
                                        <showWeaveInfo>true</showWeaveInfo>
                                        <verbose>true</verbose>
                                        <complianceLevel>1.5</complianceLevel>
                                        <source>1.5</source>
                                        <target>1.5</target>
                                </configuration>
                        </plugin>

On Aug 13, 2008, at 8:01 PM, Andy Clement wrote:

Hi Joel,

That is certainly fixed in more recent builds, I just tried it:

C:\temp\canoworms>ajc -version
AspectJ Compiler 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT

C:\temp\canoworms>ajc Ev*.java -1.5

C:\temp\canoworms\Ev.java:5 [error] The type new EventListener<Ev.SomeEvent>(){} must implement the inherited abstract method EventListener<Ev.SomeEvent>.handle
(EV)
EventListener<SomeEvent> s = new EventListener<SomeEvent>() {
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^

1 error


C:\temp\canoworms>c:\aspectj161\setajc.bat

C:\temp\canoworms>set ASPECTJ_HOME=c:\aspectj161

C:\temp\canoworms>ajc -version
AspectJ Compiler 1.6.1 (1.6.1 - Built: Thursday Jul 3, 2008 at 18:35:41 GMT) - Eclipse Compiler 0.785_R33x, 3.3

C:\temp\canoworms>ajc Ev*.java -1.5

no errors.

However, I don't know how to adjust your maven stuff...


Andy.

2008/8/13 <[EMAIL PROTECTED]>
I have an interface like this:

public interface EventListener<EVENTTYPE>
{
       <EV extends EVENTTYPE> void handle(EV event);
}

And I'm creating a class that implements it such as:

EventListener<SomeEvent> s = new EventListener<SomeEvent>() {
public <V extends SomeEvent> void handle(final V event)
                       {
// ...
                       }
}

I have tried it in non-anonymous case as well.
Compilation gives an error saying:

The type new EventListener<SomeEvent>(){} must implement the inherited
abstract method EventListener<SomeEvent>.handle(EV)

When using the eclipse or javac compiler, there is no error.

To complicate the question, I'm using maven for build, this for the compiler:
                               <groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</ artifactId>
                               <version>1.1-SNAPSHOT</version>

And I think that results in aspectj 1.5.4 being used, though if you
know how to change it so it will use more recent, please tell me.

Thanks!
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to