| 
| AJDT compiler cannot compile generic class with bounds while JDT compiler compiles without any probl [message #66567] | Thu, 27 July 2006 07:01  |  | 
| Eclipse User  |  |  |  |  | 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 #594532 is a reply to message #66567] | Thu, 27 July 2006 07:20  |  | 
| Eclipse User  |  |  |  |  | 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
 |  |  |  | 
|  | 
Powered by 
FUDForum. Page generated in 0.12859 seconds