Summary: | type binding marked as recovered but all is compiling | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Matt Whitlock <eclipse> | ||||||
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||
Severity: | trivial | ||||||||
Priority: | P3 | CC: | jerome_lanneluc, martinae, Olivier_Thomann | ||||||
Version: | 3.3 | ||||||||
Target Milestone: | 3.3.1 | ||||||||
Hardware: | All | ||||||||
OS: | All | ||||||||
Whiteboard: | |||||||||
Attachments: |
|
Description
Matt Whitlock
2007-06-01 23:28:22 EDT
Moving to JDT/UI The reason why organize prompts for a type is that the type binding for 'Bar' is marked as 'recovered'. As this CU is compiling, this seems to be wrong. When looking at the CU in the ASTView, another problem shows up: The Java element returned by the binding (binding.getJavaElement) returns a CU with 'null' as parent. Should be a IType (or null). CU's should never return 'null' as parent, but always a package. I marked this bug as 3.3.1, but jdt.core can decide if they prefer 3.4. Reproduced. I am investigating. (In reply to comment #2) > When looking at the CU in the ASTView, another problem shows up: The Java > element returned by the binding (binding.getJavaElement) returns a CU with > 'null' as parent. > Should be a IType (or null). CU's should never return 'null' as parent, but > always a package. I believe that the java element for a recovered type binding should always be null. Returning a fake compilation unit looks boggus. I fixed the initial problem which also fix the java element. If we don't set null for the compilation unit parent, we need to provide a package fragment and therefore we need to provide a package fragment root. I opened bug 201104 to track this issue. Jérôme, Candidate for 3.3.1? Potentially all qualified name inside annotation on a type declaration cannot properly get a binding. Released for 3.4M2. Regression test added org.eclipse.jdt.core.tests.dom.ASTConverter15Test#test0282 I agree that null is much better answer here. getJavaElement() for a ITypeBinding should always be an IType or null. In our code we assume that getParent() of a ICompilationUnit is never null. This has been true since 1.0 I believe although it hasn't been explicitly stated. Only IJavaModel.getParent returns null. Olivier, please attach the corresponding patch. Created attachment 77024 [details]
Proposed fix
Sorry, I forgot the patch.
Created attachment 77025 [details]
Regression test
+1 for 3.3.1 since this is a regression comparing to 3.2 and the fix is low risk. reopen for 3.3.1 Released for 3.3.1. Regression test added org.eclipse.jdt.core.tests.dom.ASTConverter15Test#test0282 Verified for 3.3.1 using build M20070831-2000 |