Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalAnnotations17Test.java')
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalAnnotations17Test.java362
1 files changed, 181 insertions, 181 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalAnnotations17Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalAnnotations17Test.java
index 82183a236..3a619130b 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalAnnotations17Test.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalAnnotations17Test.java
@@ -49,7 +49,7 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
public ExternalAnnotations17Test(String name) {
super(name, "1.7", "JCL17_LIB");
}
-
+
// Use this static initializer to specify subset for tests
// All specified tests which do not belong to the class are skipped...
static {
@@ -76,7 +76,7 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
protected Bundle[] getAnnotationBundles() {
return org.eclipse.jdt.core.tests.Activator.getPackageAdmin().getBundles("org.eclipse.jdt.annotation", "[1.1.0,2.0.0)");
}
-
+
public String getSourceWorkspacePath() {
// we read individual projects from within this folder:
return super.getSourceWorkspacePathBase()+"/ExternalAnnotations17";
@@ -92,7 +92,7 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
this.project.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
IMarker[] markers = this.project.getProject().findMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);
sortMarkers(markers);
- assertMarkers("Unexpected markers",
+ assertMarkers("Unexpected markers",
"Null type mismatch: required \'@NonNull Object\' but the provided value is null\n" +
"Null type mismatch: required \'@NonNull Test1\' but the provided value is null\n" +
"Potential null pointer access: The variable v may be null at this location",
@@ -112,7 +112,7 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
this.project.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
IMarker[] markers = this.project.getProject().findMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);
sortMarkers(markers);
- assertMarkers("Unexpected markers",
+ assertMarkers("Unexpected markers",
"Null type mismatch: required \'@NonNull Object\' but the provided value is null\n" +
"Null type mismatch: required \'@NonNull Test1\' but the provided value is null\n" +
"Potential null pointer access: The variable v may be null at this location",
@@ -127,37 +127,37 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
myCreateJavaProject("TestLibs");
addLibraryWithExternalAnnotations(this.project, "lib1.jar", "/TestLibs", new String[] {
"/UnannotatedLib/libs/Lib1.java",
- "package libs;\n" +
+ "package libs;\n" +
"\n" +
- "public interface Lib1 {\n" +
- " String one = \"1\";\n" +
- " String none = null;\n" +
+ "public interface Lib1 {\n" +
+ " String one = \"1\";\n" +
+ " String none = null;\n" +
"}\n"
}, null);
- createFileInProject("libs", "Lib1.eea",
+ createFileInProject("libs", "Lib1.eea",
"class libs/Lib1\n" +
- "\n" +
- "one\n" +
- " Ljava/lang/String;\n" +
- " L1java/lang/String;\n" +
- "\n" +
- "none\n" +
+ "\n" +
+ "one\n" +
+ " Ljava/lang/String;\n" +
+ " L1java/lang/String;\n" +
+ "\n" +
+ "none\n" +
" Ljava/lang/String;\n" +
" L0java/lang/String;\n" +
"\n");
IPackageFragment fragment = this.project.getPackageFragmentRoots()[0].createPackageFragment("tests", true, null);
- ICompilationUnit unit = fragment.createCompilationUnit("Test1.java",
- "package tests;\n" +
- "import org.eclipse.jdt.annotation.*;\n" +
- "\n" +
- "import libs.Lib1;\n" +
- "\n" +
- "public class Test1 {\n" +
- " @NonNull String test0() {\n" +
- " return Lib1.none;\n" +
+ ICompilationUnit unit = fragment.createCompilationUnit("Test1.java",
+ "package tests;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "import libs.Lib1;\n" +
+ "\n" +
+ "public class Test1 {\n" +
+ " @NonNull String test0() {\n" +
+ " return Lib1.none;\n" +
" }\n" +
- " @NonNull String test1() {\n" +
- " return Lib1.one;\n" +
+ " @NonNull String test1() {\n" +
+ " return Lib1.one;\n" +
" }\n" +
"}\n",
true, new NullProgressMonitor()).getWorkingCopy(new NullProgressMonitor());
@@ -175,21 +175,21 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
myCreateJavaProject("TestLibs1");
addLibraryWithExternalAnnotations(this.project, "lib1.jar", "/TestLibs1", new String[] {
"/UnannotatedLib/libs/Lib1.java",
- "package libs;\n" +
+ "package libs;\n" +
"\n" +
- "public class Lib1 {\n" +
+ "public class Lib1 {\n" +
" public static String one = \"1\";\n" + // not final!
- " public static String none = null;\n" +
+ " public static String none = null;\n" +
"}\n"
}, null);
- createFileInProject("libs", "Lib1.eea",
+ createFileInProject("libs", "Lib1.eea",
"class libs/Lib1\n" +
- "\n" +
- "one\n" +
- " Ljava/lang/String;\n" +
- " L1java/lang/String;\n" +
- "\n" +
- "none\n" +
+ "\n" +
+ "one\n" +
+ " Ljava/lang/String;\n" +
+ " L1java/lang/String;\n" +
+ "\n" +
+ "none\n" +
" Ljava/lang/String;\n" +
" L0java/lang/String;\n" +
"\n");
@@ -205,17 +205,17 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
// test project #1:
ICompilationUnit unit = fragment1.createCompilationUnit("Test1.java",
- "package tests;\n" +
- "import org.eclipse.jdt.annotation.*;\n" +
- "\n" +
- "import libs.Lib1;\n" +
- "\n" +
- "public class Test1 {\n" +
- " @NonNull String test0() {\n" +
- " return Lib1.none;\n" +
+ "package tests;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "import libs.Lib1;\n" +
+ "\n" +
+ "public class Test1 {\n" +
+ " @NonNull String test0() {\n" +
+ " return Lib1.none;\n" +
" }\n" +
- " @NonNull String test1() {\n" +
- " return Lib1.one;\n" +
+ " @NonNull String test1() {\n" +
+ " return Lib1.one;\n" +
" }\n" +
"}\n",
true, new NullProgressMonitor()).getWorkingCopy(new NullProgressMonitor());
@@ -227,17 +227,17 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
// test project #2:
unit = fragment2.createCompilationUnit("Test1.java",
- "package tests;\n" +
- "import org.eclipse.jdt.annotation.*;\n" +
- "\n" +
- "import libs.Lib1;\n" +
- "\n" +
- "public class Test1 {\n" +
- " @NonNull String test0() {\n" +
- " return Lib1.none;\n" +
+ "package tests;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "import libs.Lib1;\n" +
+ "\n" +
+ "public class Test1 {\n" +
+ " @NonNull String test0() {\n" +
+ " return Lib1.none;\n" +
" }\n" +
- " @NonNull String test1() {\n" +
- " return Lib1.one;\n" +
+ " @NonNull String test1() {\n" +
+ " return Lib1.one;\n" +
" }\n" +
"}\n",
true, new NullProgressMonitor()).getWorkingCopy(new NullProgressMonitor());
@@ -261,21 +261,21 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
myCreateJavaProject("TestLibs1");
addLibraryWithExternalAnnotations(this.project, "lib1.jar", "/TestLibs1", new String[] {
"/UnannotatedLib/libs/Lib1.java",
- "package libs;\n" +
+ "package libs;\n" +
"\n" +
- "public class Lib1 {\n" +
- " public static String one = \"1\";\n" + // not final!
- " public static String none = null;\n" +
+ "public class Lib1 {\n" +
+ " public static String one = \"1\";\n" + // not final!
+ " public static String none = null;\n" +
"}\n"
}, null);
- createFileInProject("libs", "Lib1.eea",
+ createFileInProject("libs", "Lib1.eea",
"class libs/Lib1\n" +
- "\n" +
- "one\n" +
- " Ljava/lang/String;\n" +
- " L1java/lang/String;\n" +
- "\n" +
- "none\n" +
+ "\n" +
+ "one\n" +
+ " Ljava/lang/String;\n" +
+ " L1java/lang/String;\n" +
+ "\n" +
+ "none\n" +
" Ljava/lang/String;\n" +
" L0java/lang/String;\n" +
"\n");
@@ -290,18 +290,18 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
IPackageFragment fragment2 = prj2.getPackageFragmentRoots()[0].createPackageFragment("tests", true, null);
// test project #2:
- ICompilationUnit unit = fragment2.createCompilationUnit("Test1.java",
- "package tests;\n" +
- "import org.eclipse.jdt.annotation.*;\n" +
- "\n" +
- "import libs.Lib1;\n" +
- "\n" +
- "public class Test1 {\n" +
- " @NonNull String test0() {\n" +
- " return Lib1.none;\n" +
+ ICompilationUnit unit = fragment2.createCompilationUnit("Test1.java",
+ "package tests;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "import libs.Lib1;\n" +
+ "\n" +
+ "public class Test1 {\n" +
+ " @NonNull String test0() {\n" +
+ " return Lib1.none;\n" +
" }\n" +
- " @NonNull String test1() {\n" +
- " return Lib1.one;\n" +
+ " @NonNull String test1() {\n" +
+ " return Lib1.one;\n" +
" }\n" +
"}\n",
true, new NullProgressMonitor()).getWorkingCopy(new NullProgressMonitor());
@@ -315,17 +315,17 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
// test project #1:
unit = fragment1.createCompilationUnit("Test1.java",
- "package tests;\n" +
- "import org.eclipse.jdt.annotation.*;\n" +
- "\n" +
- "import libs.Lib1;\n" +
- "\n" +
- "public class Test1 {\n" +
- " @NonNull String test0() {\n" +
- " return Lib1.none;\n" +
+ "package tests;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "import libs.Lib1;\n" +
+ "\n" +
+ "public class Test1 {\n" +
+ " @NonNull String test0() {\n" +
+ " return Lib1.none;\n" +
" }\n" +
- " @NonNull String test1() {\n" +
- " return Lib1.one;\n" +
+ " @NonNull String test1() {\n" +
+ " return Lib1.one;\n" +
" }\n" +
"}\n",
true, new NullProgressMonitor()).getWorkingCopy(new NullProgressMonitor());
@@ -357,7 +357,7 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
"Pb(910) Null type mismatch: required \'@NonNull Test1\' but the provided value is null",
"Pb(910) Null type mismatch: required \'@NonNull Object\' but the provided value is null",
"Pb(452) Potential null pointer access: The variable v may be null at this location"
- },
+ },
new int[]{ 7, 8, 9});
}
@@ -365,37 +365,37 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
myCreateJavaProject("TestLibs");
addLibraryWithExternalAnnotations(this.project, "lib1.jar", "annots", new String[] {
"/UnannotatedLib/libs/Lib1.java",
- "package libs;\n" +
+ "package libs;\n" +
"\n" +
- "public interface Lib1 {\n" +
- " String one = \"1\";\n" +
- " String none = null;\n" +
+ "public interface Lib1 {\n" +
+ " String one = \"1\";\n" +
+ " String none = null;\n" +
"}\n"
}, null);
- createFileInProject("annots/libs", "Lib1.eea",
+ createFileInProject("annots/libs", "Lib1.eea",
"class libs/Lib1\n" +
- "\n" +
- "one\n" +
- " Ljava/lang/String;\n" +
- " L1java/lang/String;\n" +
- "\n" +
- "none\n" +
+ "\n" +
+ "one\n" +
+ " Ljava/lang/String;\n" +
+ " L1java/lang/String;\n" +
+ "\n" +
+ "none\n" +
" Ljava/lang/String;\n" +
" L0java/lang/String;\n" +
"\n");
IPackageFragment fragment = this.project.getPackageFragmentRoots()[0].createPackageFragment("tests", true, null);
- ICompilationUnit unit = fragment.createCompilationUnit("Test1.java",
- "package tests;\n" +
- "import org.eclipse.jdt.annotation.*;\n" +
- "\n" +
- "import libs.Lib1;\n" +
- "\n" +
- "public class Test1 {\n" +
- " @NonNull String test0() {\n" +
- " return Lib1.none;\n" +
+ ICompilationUnit unit = fragment.createCompilationUnit("Test1.java",
+ "package tests;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "import libs.Lib1;\n" +
+ "\n" +
+ "public class Test1 {\n" +
+ " @NonNull String test0() {\n" +
+ " return Lib1.none;\n" +
" }\n" +
- " @NonNull String test1() {\n" +
- " return Lib1.one;\n" +
+ " @NonNull String test1() {\n" +
+ " return Lib1.one;\n" +
" }\n" +
"}\n",
true, new NullProgressMonitor()).getWorkingCopy(new NullProgressMonitor());
@@ -412,25 +412,25 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
myCreateJavaProject("TestLibs");
addLibraryWithExternalAnnotations(this.project, "lib1.jar", "annots", new String[] {
"/UnannotatedLib/libs/Lib1.java",
- "package libs;\n" +
+ "package libs;\n" +
"\n" +
"public interface Lib1 {\n" +
- " public static class Nested {\n" +
- " public static String one = \"1\";\n" +
- " }\n" +
+ " public static class Nested {\n" +
+ " public static String one = \"1\";\n" +
+ " }\n" +
"}\n"
}, null);
// acquire source AST:
IPackageFragment fragment = this.project.getPackageFragmentRoots()[0].createPackageFragment("tests", true, null);
- String test1Content = "package tests;\n" +
- "import org.eclipse.jdt.annotation.*;\n" +
- "\n" +
- "import libs.Lib1;\n" +
- "\n" +
- "public class Test1 {\n" +
- " @NonNull String test0() {\n" +
- " return Lib1.Nested.one;\n" +
+ String test1Content = "package tests;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "import libs.Lib1;\n" +
+ "\n" +
+ "public class Test1 {\n" +
+ " @NonNull String test0() {\n" +
+ " return Lib1.Nested.one;\n" +
" }\n" +
"}\n";
ICompilationUnit cu = fragment.createCompilationUnit("Test1.java", test1Content,
@@ -445,13 +445,13 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
assertProblems(problems, new String[] {
"Pb(912) Null type safety: The expression of type 'String' needs unchecked conversion to conform to '@NonNull String'",
}, new int[] { 8 });
-
+
// find type binding:
int start = test1Content.indexOf("one");
ASTNode name = NodeFinder.perform(unit, start, 0);
assertTrue("should be simple name", name.getNodeType() == ASTNode.SIMPLE_NAME);
IVariableBinding fieldBinding = (IVariableBinding) ((SimpleName)name).resolveBinding();
-
+
// find annotation file (not yet existing):
IFile annotationFile = ExternalAnnotationUtil.getAnnotationFile(this.project, fieldBinding.getDeclaringClass(), null);
assertFalse("file should not exist", annotationFile.exists());
@@ -468,7 +468,7 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
// check that the error is gone:
CompilationUnit reconciled = cu.reconcile(getJLS8(), true, null, new NullProgressMonitor());
- assertNoProblems(reconciled.getProblems());
+ assertNoProblems(reconciled.getProblems());
}
@@ -476,7 +476,7 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
myCreateJavaProject("TestLibs");
addLibraryWithExternalAnnotations(this.project, "lib1.jar", "annots", new String[] {
"/UnannotatedLib/libs/Lib1.java",
- "package libs;\n" +
+ "package libs;\n" +
"\n" +
"public class Lib1<T> {\n" +
" public Lib1<T> one;\n" +
@@ -485,14 +485,14 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
// acquire source AST:
IPackageFragment fragment = this.project.getPackageFragmentRoots()[0].createPackageFragment("tests", true, null);
- String test1Content = "package tests;\n" +
- "import org.eclipse.jdt.annotation.*;\n" +
- "\n" +
- "import libs.Lib1;\n" +
- "\n" +
- "public class Test1 {\n" +
- " @NonNull Lib1<String> test0(Lib1<String> stringLib) {\n" +
- " return stringLib.one;\n" +
+ String test1Content = "package tests;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "import libs.Lib1;\n" +
+ "\n" +
+ "public class Test1 {\n" +
+ " @NonNull Lib1<String> test0(Lib1<String> stringLib) {\n" +
+ " return stringLib.one;\n" +
" }\n" +
"}\n";
ICompilationUnit cu = fragment.createCompilationUnit("Test1.java", test1Content,
@@ -507,13 +507,13 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
assertProblems(problems, new String[] {
"Pb(912) Null type safety: The expression of type 'Lib1<String>' needs unchecked conversion to conform to '@NonNull Lib1<String>'",
}, new int[] { 8 });
-
+
// find type binding:
int start = test1Content.indexOf("one");
ASTNode name = NodeFinder.perform(unit, start, 0);
assertTrue("should be simple name", name.getNodeType() == ASTNode.SIMPLE_NAME);
IVariableBinding fieldBinding = (IVariableBinding) ((SimpleName)name).resolveBinding();
-
+
// find annotation file (not yet existing):
IFile annotationFile = ExternalAnnotationUtil.getAnnotationFile(this.project, fieldBinding.getDeclaringClass(), null);
assertFalse("file should not exist", annotationFile.exists());
@@ -522,9 +522,9 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
// annotate:
String originalSignature = ExternalAnnotationUtil.extractGenericTypeSignature(fieldBinding.getVariableDeclaration().getType());
ExternalAnnotationUtil.annotateMember("libs/Lib1", annotationFile,
- "one",
- originalSignature,
- "L0libs/Lib1<TT;>;",
+ "one",
+ originalSignature,
+ "L0libs/Lib1<TT;>;",
MergeStrategy.OVERWRITE_ANNOTATIONS, null);
assertTrue("file should exist", annotationFile.exists());
@@ -538,8 +538,8 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
public void testAnnotateMethodReturn() throws Exception {
myCreateJavaProject("TestLibs");
- String lib1Content =
- "package libs;\n" +
+ String lib1Content =
+ "package libs;\n" +
"\n" +
"public interface Lib1<T> {\n" +
" public Lib1<T> getLib();\n" +
@@ -552,14 +552,14 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
// type check sources:
IPackageFragment fragment = this.project.getPackageFragmentRoots()[0].createPackageFragment("tests", true, null);
ICompilationUnit cu = fragment.createCompilationUnit("Test1.java",
- "package tests;\n" +
- "import org.eclipse.jdt.annotation.*;\n" +
- "\n" +
- "import libs.Lib1;\n" +
- "\n" +
- "public class Test1 {\n" +
- " @NonNull Lib1<String> test0(Lib1<String> stringLib) {\n" +
- " return stringLib.getLib();\n" +
+ "package tests;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "import libs.Lib1;\n" +
+ "\n" +
+ "public class Test1 {\n" +
+ " @NonNull Lib1<String> test0(Lib1<String> stringLib) {\n" +
+ " return stringLib.getLib();\n" +
" }\n" +
"}\n",
true, new NullProgressMonitor()).getWorkingCopy(new NullProgressMonitor());
@@ -579,14 +579,14 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
parser.setBindingsRecovery(false);
CompilationUnit unit = (CompilationUnit) parser.createAST(null);
libWorkingCopy.discardWorkingCopy();
-
+
// find method binding:
int start = lib1Content.indexOf("getLib");
ASTNode name = NodeFinder.perform(unit, start, 0);
assertTrue("should be simple name", name.getNodeType() == ASTNode.SIMPLE_NAME);
ASTNode method = name.getParent();
IMethodBinding methodBinding = ((MethodDeclaration)method).resolveBinding();
-
+
// find annotation file (not yet existing):
IFile annotationFile = ExternalAnnotationUtil.getAnnotationFile(this.project, methodBinding.getDeclaringClass(), null);
assertFalse("file should not exist", annotationFile.exists());
@@ -595,9 +595,9 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
// annotate:
String originalSignature = ExternalAnnotationUtil.extractGenericSignature(methodBinding);
ExternalAnnotationUtil.annotateMember("libs/Lib1", annotationFile,
- "getLib",
- originalSignature,
- "()L1libs/Lib1<TT;>;",
+ "getLib",
+ originalSignature,
+ "()L1libs/Lib1<TT;>;",
MergeStrategy.OVERWRITE_ANNOTATIONS, null);
assertTrue("file should exist", annotationFile.exists());
@@ -607,7 +607,7 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
}
// ==== error scenarii: ====
-
+
// annotation file is empty
public void testBogusAnnotationFile1() throws Exception {
LogListener listener = new LogListener();
@@ -615,8 +615,8 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
Platform.addLogListener(listener);
myCreateJavaProject("TestLibs");
- String lib1Content =
- "package libs;\n" +
+ String lib1Content =
+ "package libs;\n" +
"\n" +
"public interface Lib1<T> {\n" +
" public Lib1<T> getLib();\n" +
@@ -625,20 +625,20 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
"/UnannotatedLib/libs/Lib1.java",
lib1Content
}, null);
- createFileInProject("annots/libs", "Lib1.eea",
+ createFileInProject("annots/libs", "Lib1.eea",
"");
-
+
// type check sources:
IPackageFragment fragment = this.project.getPackageFragmentRoots()[0].createPackageFragment("tests", true, null);
ICompilationUnit cu = fragment.createCompilationUnit("Test1.java",
- "package tests;\n" +
- "import org.eclipse.jdt.annotation.*;\n" +
- "\n" +
- "import libs.Lib1;\n" +
- "\n" +
- "public class Test1 {\n" +
- " @NonNull Lib1<String> test0(Lib1<String> stringLib) {\n" +
- " return stringLib.getLib();\n" +
+ "package tests;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "import libs.Lib1;\n" +
+ "\n" +
+ "public class Test1 {\n" +
+ " @NonNull Lib1<String> test0(Lib1<String> stringLib) {\n" +
+ " return stringLib.getLib();\n" +
" }\n" +
"}\n",
true, new NullProgressMonitor()).getWorkingCopy(new NullProgressMonitor());
@@ -647,7 +647,7 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
assertProblems(problems, new String[] {
"Pb(912) Null type safety: The expression of type 'Lib1<String>' needs unchecked conversion to conform to '@NonNull Lib1<String>'",
}, new int[] { 8 });
-
+
assertEquals("number of log entries", 1, listener.loggedStatus.size());
final Throwable exception = listener.loggedStatus.get(0).getException();
assertEquals("logged message", "missing class header in annotation file for libs/Lib1", exception.getMessage());
@@ -663,8 +663,8 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
Platform.addLogListener(listener);
myCreateJavaProject("TestLibs");
- String lib1Content =
- "package libs;\n" +
+ String lib1Content =
+ "package libs;\n" +
"\n" +
"public interface Lib1<T> {\n" +
" public Lib1<T> getLib();\n" +
@@ -673,20 +673,20 @@ public class ExternalAnnotations17Test extends ExternalAnnotations18Test {
"/UnannotatedLib/libs/Lib1.java",
lib1Content
}, null);
- createFileInProject("annots/libs", "Lib1.eea",
+ createFileInProject("annots/libs", "Lib1.eea",
"type Lib1\n");
-
+
// type check sources:
IPackageFragment fragment = this.project.getPackageFragmentRoots()[0].createPackageFragment("tests", true, null);
ICompilationUnit cu = fragment.createCompilationUnit("Test1.java",
- "package tests;\n" +
- "import org.eclipse.jdt.annotation.*;\n" +
- "\n" +
- "import libs.Lib1;\n" +
- "\n" +
- "public class Test1 {\n" +
- " @NonNull Lib1<String> test0(Lib1<String> stringLib) {\n" +
- " return stringLib.getLib();\n" +
+ "package tests;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "import libs.Lib1;\n" +
+ "\n" +
+ "public class Test1 {\n" +
+ " @NonNull Lib1<String> test0(Lib1<String> stringLib) {\n" +
+ " return stringLib.getLib();\n" +
" }\n" +
"}\n",
true, new NullProgressMonitor()).getWorkingCopy(new NullProgressMonitor());

Back to the top