Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTill Brychcy2018-10-03 09:33:45 +0000
committerTill Brychcy2018-10-03 10:16:19 +0000
commit8cf83f933796df000fcc1b7d1fb25dcb88784a6b (patch)
tree5c0e8c4d0cd52246f16a4509305146f15e94da6e /org.eclipse.jdt.apt.pluggable.tests
parent857d9084a165437226063f27f3534961278d4049 (diff)
downloadeclipse.jdt.core-8cf83f933796df000fcc1b7d1fb25dcb88784a6b.tar.gz
eclipse.jdt.core-8cf83f933796df000fcc1b7d1fb25dcb88784a6b.tar.xz
eclipse.jdt.core-8cf83f933796df000fcc1b7d1fb25dcb88784a6b.zip
Bug 539663 - [9] in named module, class created by annotation processor
cannot be referenced in class that causes its creation - make test work: annotations.jar needs to be on the module path Change-Id: Ia01d94352d240b997715d7e97b4630af47eaf19d
Diffstat (limited to 'org.eclipse.jdt.apt.pluggable.tests')
-rw-r--r--org.eclipse.jdt.apt.pluggable.tests/annotations.jardesc4
-rw-r--r--org.eclipse.jdt.apt.pluggable.tests/lib/annotations.jarbin4156 -> 4191 bytes
-rw-r--r--org.eclipse.jdt.apt.pluggable.tests/resources/annotations-manifest/MANIFEST.MF2
-rw-r--r--org.eclipse.jdt.apt.pluggable.tests/src/org/eclipse/jdt/apt/pluggable/tests/BuilderTests.java2
-rw-r--r--org.eclipse.jdt.apt.pluggable.tests/src/org/eclipse/jdt/apt/pluggable/tests/TestBase.java21
5 files changed, 20 insertions, 9 deletions
diff --git a/org.eclipse.jdt.apt.pluggable.tests/annotations.jardesc b/org.eclipse.jdt.apt.pluggable.tests/annotations.jardesc
index 00370b5d64..fad57c01d7 100644
--- a/org.eclipse.jdt.apt.pluggable.tests/annotations.jardesc
+++ b/org.eclipse.jdt.apt.pluggable.tests/annotations.jardesc
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jardesc>
<jar path="org.eclipse.jdt.apt.pluggable.tests/lib/annotations.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/org.eclipse.jdt.apt.pluggable.tests/annotations.jardesc" exportErrors="false" exportWarnings="true" includeDirectoryEntries="false" overwrite="true" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/>
- <manifest generateManifest="true" manifestLocation="" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
+ <manifest generateManifest="false" manifestLocation="/org.eclipse.jdt.apt.pluggable.tests/resources/annotations-manifest/MANIFEST.MF" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
<sealing sealJar="false">
<packagesToSeal/>
<packagesToUnSeal/>
diff --git a/org.eclipse.jdt.apt.pluggable.tests/lib/annotations.jar b/org.eclipse.jdt.apt.pluggable.tests/lib/annotations.jar
index 07bd93286a..9b02691223 100644
--- a/org.eclipse.jdt.apt.pluggable.tests/lib/annotations.jar
+++ b/org.eclipse.jdt.apt.pluggable.tests/lib/annotations.jar
Binary files differ
diff --git a/org.eclipse.jdt.apt.pluggable.tests/resources/annotations-manifest/MANIFEST.MF b/org.eclipse.jdt.apt.pluggable.tests/resources/annotations-manifest/MANIFEST.MF
new file mode 100644
index 0000000000..be7ebd6a86
--- /dev/null
+++ b/org.eclipse.jdt.apt.pluggable.tests/resources/annotations-manifest/MANIFEST.MF
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Automatic-Module-Name: annotations
diff --git a/org.eclipse.jdt.apt.pluggable.tests/src/org/eclipse/jdt/apt/pluggable/tests/BuilderTests.java b/org.eclipse.jdt.apt.pluggable.tests/src/org/eclipse/jdt/apt/pluggable/tests/BuilderTests.java
index 703df680d9..8e2824f904 100644
--- a/org.eclipse.jdt.apt.pluggable.tests/src/org/eclipse/jdt/apt/pluggable/tests/BuilderTests.java
+++ b/org.eclipse.jdt.apt.pluggable.tests/src/org/eclipse/jdt/apt/pluggable/tests/BuilderTests.java
@@ -401,7 +401,7 @@ public class BuilderTests extends TestBase
IPath root = projPath.append("src");
IPath packagePath = root.append("test");
try {
- env.addClass(root, null, "module-info", "module example {}");
+ env.addClass(root, null, "module-info", "module example {requires annotations;}");
env.addClass(root, "test", "Foo",
"package test;\n" +
diff --git a/org.eclipse.jdt.apt.pluggable.tests/src/org/eclipse/jdt/apt/pluggable/tests/TestBase.java b/org.eclipse.jdt.apt.pluggable.tests/src/org/eclipse/jdt/apt/pluggable/tests/TestBase.java
index 480926c0eb..25f2020a62 100644
--- a/org.eclipse.jdt.apt.pluggable.tests/src/org/eclipse/jdt/apt/pluggable/tests/TestBase.java
+++ b/org.eclipse.jdt.apt.pluggable.tests/src/org/eclipse/jdt/apt/pluggable/tests/TestBase.java
@@ -29,9 +29,12 @@ import org.eclipse.jdt.apt.core.internal.util.FactoryContainer;
import org.eclipse.jdt.apt.core.internal.util.FactoryContainer.FactoryType;
import org.eclipse.jdt.apt.core.internal.util.FactoryPath;
import org.eclipse.jdt.apt.core.util.AptConfig;
+import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.tests.builder.BuilderTests;
import org.eclipse.jdt.core.tests.util.Util;
+import org.eclipse.jdt.internal.core.ClasspathEntry;
import junit.framework.Test;
@@ -57,7 +60,7 @@ public class TestBase extends BuilderTests
/**
* Extract lib/annotations.jar from the test bundle and add it to the specified project
*/
- private static void addAnnotationJar(IJavaProject jproj) throws Exception {
+ private static void addAnnotationJar(IJavaProject jproj, boolean addToModulePath) throws Exception {
final String resName = "lib/annotations.jar"; // name in bundle
final String libName = resName; // name in destination project
InputStream is = null;
@@ -72,7 +75,13 @@ public class TestBase extends BuilderTests
} else {
libFile.create(is, true, null);
}
- env.addLibrary(projPath, libFile.getFullPath(), null, null);
+ if (addToModulePath) {
+ IClasspathAttribute[] attributes = { JavaCore.newClasspathAttribute(IClasspathAttribute.MODULE, "true") };
+ env.addEntry(projPath, JavaCore.newLibraryEntry(libFile.getFullPath(), null, null,
+ ClasspathEntry.NO_ACCESS_RULES, attributes, false));
+ } else {
+ env.addLibrary(projPath, libFile.getFullPath(), null, null);
+ }
}
/**
@@ -93,7 +102,7 @@ public class TestBase extends BuilderTests
env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$
env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$
final IJavaProject javaProj = env.getJavaProject(projectPath);
- addAnnotationJar(javaProj);
+ addAnnotationJar(javaProj, false);
return javaProj;
}
@@ -119,12 +128,12 @@ public class TestBase extends BuilderTests
javaProj.getProject().getFolder("prebuilt").create(true, true, null);
javaProj.getProject().getFolder("prebuilt").getFolder("p").create(true, true, null);
env.addClassFolder(projectPath, projectPath.append("prebuilt"), true);
- addAnnotationJar(javaProj);
+ addAnnotationJar(javaProj, false);
return javaProj;
}
/**
- * Create a java project with java libraries and test annotations on classpath
+ * Create a java project with java libraries and test annotations on modulepath
* (compiler level is 1.9). Use "src" as source folder and "bin" as output folder. APT
* is not enabled.
*
@@ -141,7 +150,7 @@ public class TestBase extends BuilderTests
env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$
env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$
final IJavaProject javaProj = env.getJavaProject(projectPath);
- addAnnotationJar(javaProj);
+ addAnnotationJar(javaProj, true);
return javaProj;
}

Back to the top