diff options
author | Stephan Herrmann | 2013-09-05 17:41:03 +0000 |
---|---|---|
committer | Stephan Herrmann | 2013-09-05 17:41:03 +0000 |
commit | 1538facbe020906d8e9620bcca922106c178a710 (patch) | |
tree | 5189bd1597f711822844c229786719ad4bb38c1d | |
parent | 87621a357241c8de8ae7bf1f07316036b31e3bf8 (diff) | |
download | eclipse.jdt.core-1538facbe020906d8e9620bcca922106c178a710.tar.gz eclipse.jdt.core-1538facbe020906d8e9620bcca922106c178a710.tar.xz eclipse.jdt.core-1538facbe020906d8e9620bcca922106c178a710.zip |
Bug 415269 - [compiler][null] NonNullByDefault is not always inheritedI20130916-2330I20130916-2000I20130916-0900I20130915-2000I20130914-1900I20130914-1500I20130913-2000I20130912-2000I20130911-2000I20130910-2000I20130910-0800I20130909-2000I20130908-2000I20130906-2000I20130905-2000
to nested classes
-rw-r--r-- | org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java index f486b0f24d..13f1227f1e 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java @@ -1120,7 +1120,7 @@ void initializeForStaticImports() { this.scope.buildMethods(); } -private void initializeNullDefault() { +private int getNullDefault() { // ensure nullness defaults are initialized at all enclosing levels: switch (this.nullnessDefaultInitialized) { case 0: @@ -1130,6 +1130,7 @@ private void initializeNullDefault() { getPackage().isViewedAsDeprecated(); // initialize annotations this.nullnessDefaultInitialized = 2; } + return this.defaultNullness; } /** @@ -1470,7 +1471,6 @@ public FieldBinding resolveTypeFor(FieldBinding field) { // enum constants neither have a type declaration nor can they be null field.tagBits |= TagBits.AnnotationNonNull; } else { - initializeNullDefault(); if (hasNonNullDefault()) { field.fillInDefaultNonNullness(fieldDecl, initializationScope); } @@ -1658,7 +1658,7 @@ public MethodBinding resolveTypesFor(MethodBinding method) { return method; } private void createArgumentBindings(MethodBinding method, CompilerOptions compilerOptions) { - initializeNullDefault(); + getNullDefault(); // ensure initialized AbstractMethodDeclaration methodDecl = method.sourceMethod(); if (methodDecl != null) { // while creating argument bindings we also collect explicit null annotations: @@ -1728,8 +1728,7 @@ protected void checkRedundantNullnessDefaultRecurse(ASTNode location, Annotation // return: should caller continue searching? protected boolean checkRedundantNullnessDefaultOne(ASTNode location, Annotation[] annotations, long annotationTagBits) { - initializeNullDefault(); - int thisDefault = this.defaultNullness; + int thisDefault = getNullDefault(); if (thisDefault == NONNULL_BY_DEFAULT) { if ((annotationTagBits & TagBits.AnnotationNonNullByDefault) != 0) { this.scope.problemReporter().nullDefaultAnnotationIsRedundant(location, annotations, this); @@ -1759,8 +1758,7 @@ boolean hasNonNullDefault() { case Scope.CLASS_SCOPE: currentType = ((ClassScope)currentScope).referenceContext.binding; if (currentType != null) { - currentType.initializeNullDefault(); - int foundDefaultNullness = currentType.defaultNullness; + int foundDefaultNullness = currentType.getNullDefault(); if (foundDefaultNullness != NO_NULL_DEFAULT) { return foundDefaultNullness == NONNULL_BY_DEFAULT; } |