This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
See attached project - try compiling it as-is first - it will compile fine. Then try it again with Lookup on the classpath - uncomment the dependency in the pom.xml - compilation fails with COMPILATION ERROR : ------------------------------------------------------------- com/timboudreau/annotationbug/A.java:[51,54] incompatible types found : java.lang.Class<com.timboudreau.annotationbug.A.None> required: java.lang.Class<? extends java.lang.Throwable> 1 error Seems I am not the first to have this problem, but it is really not nice - I must somehow exclude the annotation processor, or stop using Lookup. http://maven.40175.n5.nabble.com/Freaking-out-javac-works-maven-compiler-plugin-does-not-td126247.html https://issues.apache.org/jira/browse/OPENJPA-1659
It's a javac bug - http://bugs.sun.com/view_bug.do?bug_id=6512707 Workaround is to add <proc>none</proc> to the maven compiler plugin. I'm sure I won't be the last person to have this problem :-/ <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <executions> <execution> <id>default-compile</id> <phase>compile</phase> <goals> <goal>compile</goal> </goals> </execution> </executions> <configuration> <!-- proc none to fix http://bugs.sun.com/view_bug.do?bug_id=6512707 --> <proc>none</proc> <debug>true</debug> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build>
Since I never attached the source, the trigger is to have an annotation class like this: public @interface A { static class None extends Throwable { private None() {} } Class<? extends Throwable> expected() default None.class; } With annotation processing enabled, the compiler thinks None.class is not the same type as ? extends Throwable.
I think Jan knows a workaround and actually if you put openide-filesystems.jar on classpath, your problem may disappear...
-proc:none is a fine workaround if no annotation processing is needed. If AP is needed, then the problem can be workarounded using: http://hg.netbeans.org/main-silver/file/tip/openide.filesystems/src/org/netbeans/modules/openide/filesystems/CleaningAnnotationProcessor.java http://hg.netbeans.org/main-silver/file/tip/openide.filesystems/src/org/netbeans/modules/openide/filesystems/CleaningAnnotationProcessorImpl.java (ideally, CAP should be the very last AP to run as it strips the attribution info which the older javacs forget to clean). Using a recent JDK7 javac should probably resolve the problem as well.