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 #66567] Thu, 27 July 2006 11:01 Go to next message
Thomas Darimont is currently offline Thomas DarimontFriend
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
Re: AJDT compiler cannot compile generic class with bounds while JDT compiler compiles without any [message #66588 is a reply to message #66567] Thu, 27 July 2006 11:20 Go to previous messageGo to next message
Andrew Clement is currently offline Andrew ClementFriend
Messages: 162
Registered: July 2009
Senior Member
I've raised this (with a simpler form of your program) as bug 151978:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=151978

Andy.

Thomas Darimont wrote:
> 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
Re: AJDT compiler cannot compile generic class with bounds while JDT compiler compiles without any [message #66608 is a reply to message #66588] Thu, 27 July 2006 12:59 Go to previous message
Thomas Darimont is currently offline Thomas DarimontFriend
Messages: 10
Registered: July 2009
Junior Member
Hello Andy,

thank you very much :)

Kind regards,
Thomas

Andy Clement schrieb:
> I've raised this (with a simpler form of your program) as bug 151978:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=151978
>
> Andy.
Re: AJDT compiler cannot compile generic class with bounds while JDT compiler compiles without any [message #594532 is a reply to message #66567] Thu, 27 July 2006 11:20 Go to previous message
Andrew Clement is currently offline Andrew ClementFriend
Messages: 162
Registered: July 2009
Senior Member
I've raised this (with a simpler form of your program) as bug 151978:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=151978

Andy.

Thomas Darimont wrote:
> 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
Re: AJDT compiler cannot compile generic class with bounds while JDT compiler compiles without any [message #594539 is a reply to message #66588] Thu, 27 July 2006 12:59 Go to previous message
Thomas Darimont is currently offline Thomas DarimontFriend
Messages: 10
Registered: July 2009
Junior Member
Hello Andy,

thank you very much :)

Kind regards,
Thomas

Andy Clement schrieb:
> I've raised this (with a simpler form of your program) as bug 151978:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=151978
>
> Andy.
Previous Topic:AJDT compiler cannot compile generic class with bounds while JDT compiler compiles without any probl
Next Topic:convert from jdt ast to ajdt ast
Goto Forum:
  


Current Time: Thu Nov 27 05:58:52 GMT 2014

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

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