Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2013-09-17 20:55:50 +0000
committerStephan Herrmann2013-09-17 20:55:50 +0000
commit93e5ff3a6545305db70cc209a35909ba11267a03 (patch)
tree43891f7e70f2cace80f485c2c9044757291bd7ca /org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java
parent43351a2f71910029138257aaee18da33f0b724b2 (diff)
downloadeclipse.jdt.core-93e5ff3a6545305db70cc209a35909ba11267a03.tar.gz
eclipse.jdt.core-93e5ff3a6545305db70cc209a35909ba11267a03.tar.xz
eclipse.jdt.core-93e5ff3a6545305db70cc209a35909ba11267a03.zip
Bug 417295 - [1.8[[null] Massage type annotated null analysis to gel
well with deep encoded type bindings. - test corrections
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java')
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java
index e3e89bd691..860cc60bf5 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java
@@ -111,6 +111,13 @@ String nonNullArrayOf(String string) {
: "Object @NonNull[]";
}
+
+String targetTypeUseIfAvailable() {
+ return this.complianceLevel >= ClassFileConstants.JDK1_8
+ ? "@Target(ElementType.TYPE_USE)\n"
+ : "";
+}
+
protected void setUp() throws Exception {
super.setUp();
if (this.complianceLevel >= ClassFileConstants.JDK1_8)
@@ -535,7 +542,10 @@ public void test_nonnull_parameter_015() {
" if (o != null)\n" +
" System.out.print(o.toString());\n" +
" }\n" +
- " void foo2(int i, @NonNull Object ... o) {\n" +
+ ((this.complianceLevel < ClassFileConstants.JDK1_8)
+ ? " void foo2(int i, @NonNull Object ... o) {\n"
+ : " void foo2(int i, Object @NonNull ... o) {\n"
+ ) +
" if (o.length > 0 && o[0] != null)\n" +
" System.out.print(o[0].toString());\n" +
" }\n" +
@@ -1939,17 +1949,19 @@ public void test_annotation_import_005() {
"package org.foo;\n" +
"import java.lang.annotation.*;\n" +
"@Retention(RetentionPolicy.CLASS)\n" +
+ targetTypeUseIfAvailable() +
"public @interface MayBeNull {}\n",
"org/foo/MustNotBeNull.java",
"package org.foo;\n" +
"import java.lang.annotation.*;\n" +
"@Retention(RetentionPolicy.CLASS)\n" +
+ targetTypeUseIfAvailable() +
"public @interface MustNotBeNull {}\n",
"Lib.java",
"public class Lib {\n" +
- " Object getObject() { return new Object(); }\n" +
+ " public Object getObject() { return new Object(); }\n" +
"}\n",
"X.java",
"import org.foo.*;\n" +

Back to the top