Community
Participate
Working Groups
build I20080422-0800 1) create A.java // ABC doesn't exists @ABC (name1="") public class A { } 2) open the ASTView 3) open the MemberValuePair named 'name1' in the ASTView 4) click on member value pair binding An NPE occurs java.lang.NullPointerException at org.eclipse.jdt.core.dom.MemberValuePairBinding.isDefault(MemberValuePairBinding.java:150) at org.eclipse.jdt.astview.views.Binding.getChildren(Binding.java:234) at org.eclipse.jdt.astview.views.ASTViewContentProvider.getChildren(ASTViewContentProvider.java:95) at org.eclipse.jdt.astview.views.ASTViewContentProvider.hasChildren(ASTViewContentProvider.java:227) at org.eclipse.jface.viewers.AbstractTreeViewer.isExpandable(AbstractTreeViewer.java:2076) at org.eclipse.jface.viewers.TreeViewer.isExpandable(TreeViewer.java:576)
Created attachment 98094 [details] Proposed fix
Jérôme, Frédéric, I would release this fix. It prevents the NPE when calling the isDefault() method on a member value pair binding located inside a recovered annotation binding.
+1 to fix for 3.4M7
In this case we should not return any MemberValuePairBinding for name1 since it cannot be resolved and we don't have binding recovery fully functional in this case. So I would return null when requesting the resolveMemberValuePairBinding() on the corresponding pair. Also the corresponding annotation which is recovered should return an empty list of pairs. Jérôme, do you prefer this solution ?
(In reply to comment #4) > In this case we should not return any MemberValuePairBinding for name1 since it > cannot be resolved and we don't have binding recovery fully functional in this > case. > So I would return null when requesting the resolveMemberValuePairBinding() on > the corresponding pair. > Also the corresponding annotation which is recovered should return an empty > list of pairs. > > Jérôme, do you prefer this solution ? > That sounds good to me
Created attachment 98215 [details] Proposed fix This patch: - makes sure that the annotation binding is returned only if the binding recovery is on when the annotation binding itself cannot be resolved. - makes sure that only "resolvable" member values pairs are returned from an annotation binding. In case the annotation binding is recovered, no pairs are returned. When the binding recovery will be functional inside member values pairs, this can be revisited. This doesn't seem to cause any problem with the existing specifications of IAnnotationBinding methods.
*** Bug 229615 has been marked as a duplicate of this bug. ***
It looks like the patch was released with v_858. Shouldn't it be resolved now?
Yes, released for 3.4M7.
Verified for 3.4M7 using I20080502-1000