Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvrubezhny2015-04-02 01:11:15 +0000
committervrubezhny2015-04-02 01:27:58 +0000
commit5b7ce0584f3f5cdbf132c898ba54fd74fa5c2bf7 (patch)
treeddfc011f73a462c6067fddb287559e94fb009652
parentaffdf04fff41fb6e1afbdc49aed608dd69fdc6a1 (diff)
downloadwebtools.jsdt-5b7ce0584f3f5cdbf132c898ba54fd74fa5c2bf7.tar.gz
webtools.jsdt-5b7ce0584f3f5cdbf132c898ba54fd74fa5c2bf7.tar.xz
webtools.jsdt-5b7ce0584f3f5cdbf132c898ba54fd74fa5c2bf7.zip
Bug 461610 - NPE in CompilationUnitBinding#sourceMethod() while updating annotations after an initial reconcile in JavaScript Editor
Issue is fixed Signed-off-by: vrubezhny <vrubezhny@exadel.com>
-rw-r--r--bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/lookup/CompilationUnitBinding.java5
-rw-r--r--bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/dom/Bindings.java10
2 files changed, 10 insertions, 5 deletions
diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/lookup/CompilationUnitBinding.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/lookup/CompilationUnitBinding.java
index 9ec7984b6..29c53b016 100644
--- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/lookup/CompilationUnitBinding.java
+++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/lookup/CompilationUnitBinding.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -80,6 +80,9 @@ public class CompilationUnitBinding extends SourceTypeBinding {
}
public AbstractMethodDeclaration sourceMethod(MethodBinding binding) {
+ if (compilationUnitScope == null)
+ return null;
+
ProgramElement[] statements = compilationUnitScope.referenceContext.statements;
for (int i = 0; i < statements.length; i++) {
if (statements[i] instanceof AbstractMethodDeclaration && ((AbstractMethodDeclaration)statements[i]).getBinding()==binding)
diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/dom/Bindings.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/dom/Bindings.java
index d512e8b62..402da86f5 100644
--- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/dom/Bindings.java
+++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/dom/Bindings.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -452,8 +452,9 @@ public class Bindings {
}
ITypeBinding type= overriding.getDeclaringClass();
- if (type.getSuperclass() != null) {
- IFunctionBinding res= findOverriddenMethodInHierarchy(type.getSuperclass(), overriding);
+ ITypeBinding superType = type != null ? type.getSuperclass() : null;
+ if (superType != null) {
+ IFunctionBinding res= findOverriddenMethodInHierarchy(superType, overriding);
if (res != null && !Modifier.isPrivate(res.getModifiers())) {
if (!testVisibility || isVisibleInHierarchy(res, overriding.getDeclaringClass().getPackage())) {
return res;
@@ -466,12 +467,13 @@ public class Bindings {
public static boolean isVisibleInHierarchy(IFunctionBinding member, IPackageBinding pack) {
int otherflags= member.getModifiers();
- ITypeBinding declaringType= member.getDeclaringClass();
if (Modifier.isPublic(otherflags) || Modifier.isProtected(otherflags)) {
return true;
} else if (Modifier.isPrivate(otherflags)) {
return false;
}
+
+ ITypeBinding declaringType= member.getDeclaringClass();
return declaringType != null && pack == declaringType.getPackage();
}

Back to the top