| Summary: | [quick fix]: Ctrl-2 + L to trigger quick fix causes NPE if the method returns an array (Mobile projects only) | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Christian <chriszi> | ||||
| Component: | UI | Assignee: | Markus Keller <markus.kell.r> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | markus.kell.r, wds057, whm012 | ||||
| Version: | 3.5 | ||||||
| Target Milestone: | 3.6 M3 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 146013 [details]
The stacktrace taken from the eclipse .log file
The error will always occur at the position noted by the stacktrace, however the stacktrace may vary ecept for the few topmost lines.
The problem occurs when the JDT (org.eclipse.jdt.internal.ui.text.correction.ASTResolving.getRelaxingTypes(AST, ITypeBinding)) tries to create an instance of "java.io.Serializable" and "java.lang.Cloneable" classes. Both classes are not present on MTJ project classpath and return a null value. This is an internal implementation for JDT, and has no extension point or OSGi services that can be used for the correction on MTJ side. (In reply to comment #2) > The problem occurs when the JDT > (org.eclipse.jdt.internal.ui.text.correction.ASTResolving.getRelaxingTypes(AST, > ITypeBinding)) tries to create an instance of "java.io.Serializable" and > "java.lang.Cloneable" classes. > Both classes are not present on MTJ project classpath and return a null value. Cant be fixed. Well sorry to say that but I guess you are making it a little bit too easy for yourselves - if this bug really can't be fixed on your side, it should be fixable by the JDT team. Then however I'm wondering why this error only occurs in MTJ projects. Therefore I reopen this bug and hope that it can be reassigned to another team which can fix it or if you decide that this bug is just too minor to be fixed, it should be stated that way. I changed the Product/Component of the bug to JDT/Pulsar, can you please reassign it to the appropriate person/list in that Project? Just wanted to add that this error occurs not only for the described Quick-Fix but also for at least the "Add Parameter to Method" Quick-Fix as well. (In reply to comment #2) > The problem occurs when the JDT > (org.eclipse.jdt.internal.ui.text.correction.ASTResolving.getRelaxingTypes(AST, > ITypeBinding)) tries to create an instance of "java.io.Serializable" and > "java.lang.Cloneable" classes. > Both classes are not present on MTJ project classpath and return a null value. That should be easy to fix for us. Should also check other usages of AST#resolveWellKnownType(String). Henrique, where can I find information about available types in the JRE that is used for MTJ projects? Are all the other types listed in AST#resolveWellKnownType(String) available? *** Bug 289315 has been marked as a duplicate of this bug. *** @Markus Keller: Unfortunately the classes in the classpath of a j2me app depend a bit on the cldc used (the java version). As of cldc 1.1 (imo the most common by now) the following classes mentioned in DefaultBindingResolver #resolveWellKnownType are not part of cldc 1.1 (as mentioned already by Henrique): - java.lang.Cloneable - java.io.Serializable The list of classes available in cldc 1.0 can be found here: http://java.sun.com/javame/reference/apis/jsr030/ however I don't think that they still matter so much. Fixed in HEAD. Checked other usages of AST#resolveWellKnownType(String), found no problematic cases. Just downloaded the M3 version of eclipse Helios and can verify - it's fixed. |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1) Gecko/20090624 Firefox/3.5 (.NET CLR 3.5.30729) Build Identifier: Pulsar for Mobile Java Developers. Build id: 20090619-0625 The Quick-Fix obtained by Ctrl-1 or Ctrl-2, L (and as well for class fields) foes not work if the resulting field/variable would be an array type. This is caused by a NPE for which the stacktrace is attached. Reproducible: Always Steps to Reproduce: 1. Create a new empty MTJ project 2. Add a class with the following methods: public class TestClass { public int[] test() { return null; } public void test2() { this.test(); } } 3. Set the cursor to "this.test();" and press Ctrl-2 and then L 4. Nothing happens, but a stacktrace will appear in the .log file of the workspace. However this shortcut works fine for the same class if contained in a normal JavaSE project. I did retest this with the 3.5. RC1 build of eclipse and the bug is still there.