Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2020-07-25 21:57:16 +0000
committerStephan Herrmann2020-07-25 21:57:16 +0000
commit839f2e34d7b9105b3f5c30d1ac1b63e4ffe738a2 (patch)
treee204cc39a043ee8bab8e8e67efc5c15fe2c45b7b
parent802ca05efd3aa6085be095d6abb8d56fd1eb45f1 (diff)
downloadorg.eclipse.objectteams-839f2e34d7b9105b3f5c30d1ac1b63e4ffe738a2.tar.gz
org.eclipse.objectteams-839f2e34d7b9105b3f5c30d1ac1b63e4ffe738a2.tar.xz
org.eclipse.objectteams-839f2e34d7b9105b3f5c30d1ac1b63e4ffe738a2.zip
Bug 565545 - PDE validation triggers NPE in OT DOM
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodMappingBinding.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodMappingBinding.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodMappingBinding.java
index 430c566e5..dc964f68a 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodMappingBinding.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodMappingBinding.java
@@ -22,6 +22,8 @@
**********************************************************************/
package org.eclipse.jdt.core.dom;
+import java.util.Arrays;
+
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Argument;
@@ -127,10 +129,19 @@ class MethodMappingBinding implements IMethodMappingBinding
{
MethodBinding[] methodBindings = this.binding._baseMethods;
if (methodBindings == null)
- return new IMethodBinding[0];
+ return TypeBinding.NO_METHOD_BINDINGS;
this.baseMethods = new IMethodBinding[methodBindings.length];
- for (int i = 0; i < methodBindings.length; i++)
- this.baseMethods[i] = this.resolver.getMethodBinding(methodBindings[i]);
+ int count = 0;
+ for (int i = 0; i < methodBindings.length; i++) {
+ IMethodBinding methodBinding = this.resolver.getMethodBinding(methodBindings[i]);
+ if (methodBinding != null)
+ this.baseMethods[count++] = methodBinding;
+ }
+ if (count < this.baseMethods.length) {
+ if (count == 0)
+ this.baseMethods = TypeBinding.NO_METHOD_BINDINGS;
+ this.baseMethods = Arrays.copyOf(this.baseMethods, count);
+ }
}
return this.baseMethods;

Back to the top