Permalink
Browse files

Fix NPE when editing class not on build path.

  • Loading branch information...
aeisenberg committed Oct 11, 2012
1 parent 31afb95 commit a471cb78491534eb36addb74a89cb86b1a5936b4
@@ -70,18 +70,20 @@ public final ReferenceBinding getGroovyLangMetaClassBinding() {
@Override
protected MethodBinding[] augmentMethodBindings(MethodBinding[] methodBindings) {
// Don't add these methods to annotations
- if (this.referenceContext.binding != null
- && (this.referenceContext.binding.isAnnotationType() || this.referenceContext.binding.isInterface())) {
+ SourceTypeBinding binding = this.referenceContext.binding;
+ if (binding != null && (binding.isAnnotationType() || binding.isInterface())) {
return methodBindings;
}
boolean implementsGroovyLangObject = false;
- ReferenceBinding[] superInterfaces = this.referenceContext.binding.superInterfaces;
- for (int i = 0, max = superInterfaces.length; i < max; i++) {
- char[][] interfaceName = superInterfaces[i].compoundName;
- if (CharOperation.equals(interfaceName, GROOVY_LANG_GROOVYOBJECT)) {
- implementsGroovyLangObject = true;
- break;
+ ReferenceBinding[] superInterfaces = binding.superInterfaces;
+ if (superInterfaces != null) {
+ for (int i = 0, max = superInterfaces.length; i < max; i++) {
+ char[][] interfaceName = superInterfaces[i].compoundName;
+ if (CharOperation.equals(interfaceName, GROOVY_LANG_GROOVYOBJECT)) {
+ implementsGroovyLangObject = true;
+ break;
+ }
}
}
@@ -146,7 +148,7 @@ public final ReferenceBinding getGroovyLangMetaClassBinding() {
}
if (fBinding.type == TypeBinding.BOOLEAN) {
createMethod("is" + MetaClassHelper.capitalize(name), property.isStatic(), "", /* TypeBinding.NO_TYPES, */
- null, fBinding.type, groovyMethods, methodBindings, typeDeclaration);
+ null, fBinding.type, groovyMethods, methodBindings, typeDeclaration);
}
}
}

0 comments on commit a471cb7

Please sign in to comment.