summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaren Butzke2012-08-31 08:09:58 (EDT)
committerKaren Butzke2012-08-31 08:09:58 (EDT)
commitfe2f822e2966f6ca3b37934fc6541746a983164c (patch)
tree0212132c4b73399e97d4e43cfacd7c8d99b19735
parent0d7335956d67ff608c20b6d4529c4ec77cfbb669 (diff)
downloadwebtools.dali-fe2f822e2966f6ca3b37934fc6541746a983164c.zip
webtools.dali-fe2f822e2966f6ca3b37934fc6541746a983164c.tar.gz
webtools.dali-fe2f822e2966f6ca3b37934fc6541746a983164c.tar.bz2
Bug 388371 - NPE adding attributes to a java entity
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceField.java2
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceMethod.java2
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JavaResourceTypeBinding.java10
3 files changed, 10 insertions, 4 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceField.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceField.java
index 778a55b..97525d1 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceField.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceField.java
@@ -84,7 +84,7 @@ final class SourceField
@Override
protected ITypeBinding getJdtTypeBinding(IBinding binding) {
- return ((IVariableBinding) binding).getType();
+ return binding == null ? null : ((IVariableBinding) binding).getType();
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceMethod.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceMethod.java
index 4602baf..75596f0 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceMethod.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceMethod.java
@@ -80,7 +80,7 @@ final class SourceMethod
@Override
protected ITypeBinding getJdtTypeBinding(IBinding binding) {
- return ((IMethodBinding) binding).getReturnType();
+ return binding == null ? null : ((IMethodBinding) binding).getReturnType();
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JavaResourceTypeBinding.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JavaResourceTypeBinding.java
index dd20d99..9c8baa5 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JavaResourceTypeBinding.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JavaResourceTypeBinding.java
@@ -54,7 +54,7 @@ public class JavaResourceTypeBinding
public JavaResourceTypeBinding(ITypeBinding jdtTypeBinding) {
- this.key = jdtTypeBinding.getKey();
+ this.key = jdtTypeBinding == null ? null : jdtTypeBinding.getKey();
this.qualifiedName = buildQualifiedName(jdtTypeBinding);
this.simpleName = buildSimpleName(jdtTypeBinding);
this.packageName = buildPackageName(jdtTypeBinding);
@@ -71,6 +71,12 @@ public class JavaResourceTypeBinding
public boolean isEquivalentTo(ITypeBinding typeBinding) {
+ if (this.key == null) {
+ return typeBinding == null;
+ }
+ if (typeBinding == null) {
+ return false;
+ }
return this.key.equals(typeBinding.getKey());
}
@@ -145,7 +151,7 @@ public class JavaResourceTypeBinding
}
private boolean buildIsGenericTypeDeclaration(ITypeBinding typeBinding) {
- return typeBinding.isGenericType();
+ return typeBinding != null && typeBinding.isGenericType();
}
public boolean isMemberTypeDeclaration() {