Summary: | java.util.Arrays.Sort() crashes with AbstractMethodError when compiled using JDT, but works OK when compiled with ant | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Paul Hamer <paul> |
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
Status: | RESOLVED INVALID | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | philippe_mulet |
Version: | 3.1 | ||
Target Milestone: | 3.2 M5 | ||
Hardware: | PC | ||
OS: | Windows 2000 | ||
Whiteboard: |
Description
Paul Hamer
2006-01-25 16:21:18 EST
Could you please provide steps to debug the code within Tomcat? I tried to reproduce inside a compilation unit and I could not. Thanks. The problem comes from the fact that the bridge method is missing in the anonymous class corresponding to the new Comparator<MyClass> { ... }. I tried to reproduce outside of Tomcat unsuccessfully. I will continue to investigate to understand the cause of the failure. The problem comes from the way the org.apache.jasper.compiler.JDTCompiler is defined. It sets the compiler options, but it forgot to set the compliance. I patched the org/apache/jasper/compiler/JDTCompiler.class in jasper-compiler.jar by adding the following line: settings.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); After the target and the source options have been set. If you consider that Tomcat is always running as a 1.5 compiler with 1.5 libraries, you might always want to set the compliance value to 1.5. If you want to compile 1.4 code using 1.4 libraries, then you might want to set the compliance according to the values of the source and the target platform. With this patch, I could run the jsp that you provided. So the problem is not directly coming from the jdt compiler. It comes from the way the compiler is called in org.apache.jasper.compiler.JDTCompiler. The options passed to the compiler are incomplete. I have fix it, Many thanks to find this Peter I wonder if we shouldn't be smarter, and notice incompatible compliance (1.4) and source level (1.5); like we do in batch mode. Closing as INVALID. Fix was done in Tomcat source code to set the compliance. |