Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2014-11-04 19:35:01 +0000
committerStephan Herrmann2014-11-09 23:21:14 +0000
commit03fc98ba5195315789db96e8c029652af3ad1833 (patch)
tree1a33baa0d0df8e5bfa68c4f85de4d7f0e66dab94 /org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java
parent66658d3b43d13700f7c1f7016d44677bff9c371d (diff)
downloadorg.eclipse.objectteams-03fc98ba5195315789db96e8c029652af3ad1833.tar.gz
org.eclipse.objectteams-03fc98ba5195315789db96e8c029652af3ad1833.tar.xz
org.eclipse.objectteams-03fc98ba5195315789db96e8c029652af3ad1833.zip
Update jdt.core & tests to I20140918-0330 (4.5M2)
Diffstat (limited to 'org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java')
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java25
1 files changed, 13 insertions, 12 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java
index 6ae69c83d..61fff8180 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java
@@ -29,6 +29,7 @@
* Bug 438179 - [1.8][null] 'Contradictory null annotations' error on type variable with explicit null-annotation.
* Bug 440143 - [1.8][null] one more case of contradictory null annotations regarding type variables
* Bug 440759 - [1.8][null] @NonNullByDefault should never affect wildcards and uses of a type variable
+ * Bug 441693 - [1.8][null] Bogus warning for type argument annotated with @NonNull
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
@@ -923,18 +924,18 @@ public class TypeVariableBinding extends ReferenceBinding {
return readableName;
}
- public TypeBinding unannotated(boolean removeOnlyNullAnnotations) {
- if (!hasTypeAnnotations())
- return this;
- if (removeOnlyNullAnnotations && !hasNullTypeAnnotations())
+ public TypeBinding unannotated() {
+ return this.hasTypeAnnotations() ? this.environment.getUnannotatedType(this) : this;
+ }
+
+ @Override
+ public TypeBinding withoutToplevelNullAnnotation() {
+ if (!hasNullTypeAnnotations())
return this;
TypeBinding unannotated = this.environment.getUnannotatedType(this);
- if (removeOnlyNullAnnotations) {
- AnnotationBinding[] newAnnotations = this.environment.filterNullTypeAnnotations(this.typeAnnotations);
- if (newAnnotations.length > 0)
- return this.environment.createAnnotatedType(unannotated, newAnnotations);
- // FIXME: selectively keep type annotations on bounds
- }
+ AnnotationBinding[] newAnnotations = this.environment.filterNullTypeAnnotations(this.typeAnnotations);
+ if (newAnnotations.length > 0)
+ return this.environment.createAnnotatedType(unannotated, newAnnotations);
return unannotated;
}
/**
@@ -988,7 +989,7 @@ public class TypeVariableBinding extends ReferenceBinding {
this.tagBits &= ~TagBits.AnnotationNullMASK;
} else {
// implicit annotation: let the new one override
- return boundType.unannotated(true);
+ return boundType.withoutToplevelNullAnnotation();
}
return boundType;
}
@@ -1055,7 +1056,7 @@ public class TypeVariableBinding extends ReferenceBinding {
// may need to merge annotations from the original variable and from substitution:
if (hasRelevantTypeUseNullAnnotations()) {
// explicit type use null annotation overrides any annots on type parameter and concrete type arguments
- substitute = substitute.unannotated(true);
+ substitute = substitute.withoutToplevelNullAnnotation();
}
if (this.typeAnnotations != Binding.NO_ANNOTATIONS)
return this.environment.createAnnotatedType(substitute, this.typeAnnotations);

Back to the top