diff options
author | kmoore | 2008-09-02 22:25:21 +0000 |
---|---|---|
committer | kmoore | 2008-09-02 22:25:21 +0000 |
commit | acba681b728b9c5fd164b81629a5bb27135590f5 (patch) | |
tree | 71f315f5862a4cb04b986a5e24b41a17bb2c1572 | |
parent | a9ca770f8373a0f938ede689406445e831fada04 (diff) | |
download | webtools.dali-acba681b728b9c5fd164b81629a5bb27135590f5.tar.gz webtools.dali-acba681b728b9c5fd164b81629a5bb27135590f5.tar.xz webtools.dali-acba681b728b9c5fd164b81629a5bb27135590f5.zip |
225332 - Exception thrown when JRE System Library on build path doesn't exist - check that TypeDeclaration.resolveBinding does not return null
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JpaCompilationUnitImpl.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JpaCompilationUnitImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JpaCompilationUnitImpl.java index 2c457ca45d..8b6775f378 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JpaCompilationUnitImpl.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JpaCompilationUnitImpl.java @@ -201,13 +201,16 @@ public class JpaCompilationUnitImpl * the same name as the compilation unit (file); * NB: this type could be in error if there is an annotation or enum * with the same name preceding it in the compilation unit + * + * Return null if resolveBinding() on the TypeDeclaration returns null + * This can occur if the project JRE is removed (bug 225332) */ protected TypeDeclaration getPrimaryType(CompilationUnit astRoot) { String primaryTypeName = this.getPrimaryTypeName(); for (AbstractTypeDeclaration atd : types(astRoot)) { if ((atd.getNodeType() == ASTNode.TYPE_DECLARATION) && atd.getName().getFullyQualifiedName().equals(primaryTypeName)) { - return (TypeDeclaration) atd; + return atd.resolveBinding() != null ? (TypeDeclaration) atd : null; } } return null; |