Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » AJDT compiler cannot compile generic class with bounds while JDT compiler compiles without any probl
AJDT compiler cannot compile generic class with bounds while JDT compiler compiles without any probl [message #594520] Thu, 27 July 2006 11:01
Thomas Darimont is currently offline Thomas Darimont
Messages: 10
Registered: July 2009
Junior Member
Hello,

I have some trouble with compiling some generic classes within an
Eclipse AspectJ Project:

Here is an example which reproduces this error:

A basic Message Interface:

package de.tutorials.aspectj;

public interface IMessage {
void publish();
}

An error message Interface:
package de.tutorials.aspectj;

public interface IErrorMessage extends IMessage{
StackTraceElement[] getStackTrace();
}


A generic Message:
package de.tutorials.aspectj;

public class GenericMessage {

public GenericMessage(Class<? extends IMessage> theObjectType) {
//...
}

public Object createProxy() {
// TODO ...
return null;
}
}

The generic ObjectFactory interface:

package de.tutorials.aspectj;

public interface IObjectFactory<E> {
public <T extends E> T create(Class<T> theObjectType, Object[]
theParameters);
}


A factory for creating Messages:

package de.tutorials.aspectj;

public class MessageFactory implements IObjectFactory<IMessage>{
public <T extends IMessage> T create(Class<T> theObjectType, Object[]
theParameters) {
return theObjectType.cast(new
GenericMessage(theObjectType).createProxy());
}
}

We use our MessageFactory to create an ErrorMessage without need for
casting...
package de.tutorials.aspectj;
public class Main {
public static void main(String[] args) {
IErrorMessage message = new
MessageFactory().create(IErrorMessage.class, new Object[]{"Foo","Bar"});
}
}

-> AspectJ Compiler reports:
The type MessageFactory must implement the inherited abstract method
IObjectFactory<IMessage>.create(Class<T>, Object[])
de.tutorials.aspectj/src/de/tutorials/aspectj MessageFactory.java

-> JDT Compiler compiles this without any complaints!?

Eclipse Version 3.2
AJDT Version 1.4
AspectJ Version: 1.5.2

Any hints?

Kind regards,
Thomas
Previous Topic:AJDT 1.3.2 for Eclipse 3.1 Release Candidate
Next Topic:AJDT compiler cannot compile generic class with bounds while JDT compiler compiles without any probl
Goto Forum:
  


Current Time: Sat Oct 25 18:21:39 GMT 2014

Powered by FUDForum. Page generated in 0.01530 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software