Hi guys, I have a strange problem with one generics code found in one GWT library. This compile fine with java 6 but not with java 5. In fact I can compile it in eclipse with java 5, so this problem appears only when compiling with maven.
I reproduced this error with this code: class: ----------------------------------- public class DogBean { transient protected Object bean; public <X> X getBean() { return (X) bean; } public void setBean(Object bean) { this.bean = bean; } } -------------------------------- Call to this class (simplified): ---------------------------------- DogBean stack = new DogBean(); stack.setBean("My doggie"); if(stack.getBean() instanceof String) { System.out.println("GermanShepherd"); } -------------------------------- I get this error on: if(stack.getBean() instanceof String) ------------------------------------- [INFO] Compilation failure /home/milan/projects/eclipse/workspace2/Generics/src/main/java/main/SomeClass.java:[24,32] unexpected type found : java.lang.Object required: reference ------------------------------ This is my pom.xml - only one plugin. pom.xml: ----------------------------------------------- ... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> </plugins> </build> ... -------------------------------- Maven version: -------------------------------- Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200) ----------------------- maven command used -------------------------------- mvn clean install -------------------------------- When I build it with jdk6 I can compile it without problem. But when I use jdk5 when building, I get that error. Problem is our build server use runs on jdk5, as some of our customers do use jre 5. I can cast this code like this: if((Object)stack.getBean() instanceof String) Then it compiles OK both with jdk5 and jdk6. but this is both ugly and dirty But where is the problem? I don't get this error under eclipse(neither under jd5 or jdk6) only when building with maven Any clues? Just ask for more info. Regards, Milan Chudík --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org