Summary: | NullPointerException in BindingKeyResolver.consumeTypeVariable(...) | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Philipe Mulet <philippe_mulet> | ||||
Component: | Core | Assignee: | Jerome Lanneluc <jerome_lanneluc> | ||||
Status: | VERIFIED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | CC: | david_audel, markus.kell.r | ||||
Version: | 3.3 | ||||||
Target Milestone: | 3.3 M6 | ||||||
Hardware: | PC | ||||||
OS: | Windows XP | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Philipe Mulet
2007-03-13 05:14:49 EDT
Reproduced in debugger: offending signature looks like: LX~DataChangeList<LX~DataChangeList;:TT;>; Issue is located on line marked with '>>>>>>>' since both methodBinding and typeBinding are null.
public void consumeTypeVariable(char[] position, char[] typeVariableName) {
if (position.length > 0) {
int pos = Integer.parseInt(new String(position));
MethodBinding[] methods = ((ReferenceBinding) this.typeBinding).methods();
if (methods != null && pos < methods.length) {
this.methodBinding = methods[pos];
}
}
>>>>>>> TypeVariableBinding[] typeVariableBindings = this.methodBinding != null ? this.methodBinding.typeVariables() : this.typeBinding.typeVariables();
for (int i = 0, length = typeVariableBindings.length; i < length; i++) {
TypeVariableBinding typeVariableBinding = typeVariableBindings[i];
if (CharOperation.equals(typeVariableName, typeVariableBinding.sourceName())) {
this.typeBinding = typeVariableBinding;
return;
}
}
}
Missing step: the unit file name was "X.java". Looks like the decoding doesn't handle situation where no 'X' type is actually present in the unit. Feels like the support for finding secondary types could be used directly, instead of relying on ability to find a primary type. To reproduce: 1. Start a new workspace on a 1.5 VM 2. Create a new Java project (verify that compliance is 1.5) 3. Create a new type X in the default package 4. In the X.java editor, replace the whole content with: class Y<T> { public Y<T> foo() { return Y//complete here } } 5. Code complete after 2nd Y Observe: you get the NPE reported above in the .log Changed BindingKeyParser to parse the secondary type name before pausing after fully qualified name parsing. Changed BindingKeyResolver to handle null binding when looking up the primary type binding, and to default to use the secondary type lookup. Added regression test BatchASTCreationTests#test083(). Released for 3.3M6 in HEAD. *** Bug 86990 has been marked as a duplicate of this bug. *** Pls backport to 3.2.x stream. Created attachment 60778 [details]
Corresponding reverse patch
To apply, choose the Reverse patch option in the Apply patch wizard.
Patch applied in R3_2_maintenance stream (no target milestone yet) Verified for 3.3 M6 using build I20070319-1335. > Verified for 3.3 M6 using build I20070319-1335.
>
|