Community
Participate
Working Groups
I200411170800 ITypeBinding#getJavaElement() throws NPE for type variable <E extends Object>: class Y { <E extends Object> void m(E e) {} } java.lang.NullPointerException at org.eclipse.jdt.core.compiler.CharOperation.replaceOnCopy(CharOperation.java:2316) at org.eclipse.jdt.core.dom.TypeBinding.getCompilationUnit(TypeBinding.java:289) at org.eclipse.jdt.core.dom.TypeBinding.getJavaElement(TypeBinding.java:507) ...
Jérôme, do we expect a Java element to be found in this case? If not, I will attach a patch that solves the NPE issue, but returns null.
Created attachment 16002 [details] Apply on HEAD
Created attachment 16020 [details] Apply on HEAD
I would expect that we get the corresponding ITypeParameter in this case.
Changed TypeBinding#getJavaElement() to return an ITypeParameter in the case of a type variable binding. Added regression test ASTModelBridgeTests#testTypeParameter()
Jérôme, I enable the test0071 in ASTConverter15Test and I got a ClassCastException. I will attach a patch that I released in HEAD. Could you please verify that change? Thanks.
Created attachment 16119 [details] Apply on HEAD on TYpeBinding
Fix is good. Thanks Olivier.
Verified for 3.1 M4 using build I200412142000.