diff options
author | Jay Arthanareeswaran | 2017-08-21 05:56:53 +0000 |
---|---|---|
committer | Jay Arthanareeswaran | 2017-08-21 05:56:53 +0000 |
commit | b58a99ae02f9ab0613f19a76f3a21dd9b2cec757 (patch) | |
tree | 46fe09d5ef2b2b1673fec6f6e396b816c7d140fc /org.eclipse.jdt.compiler.apt.tests | |
parent | 24f6023f7a0a5b6ee0d714e72ddaef4926cca2f5 (diff) | |
download | eclipse.jdt.core-b58a99ae02f9ab0613f19a76f3a21dd9b2cec757.tar.gz eclipse.jdt.core-b58a99ae02f9ab0613f19a76f3a21dd9b2cec757.tar.xz eclipse.jdt.core-b58a99ae02f9ab0613f19a76f3a21dd9b2cec757.zip |
non-primary types
Fix cases where individual source files are supplied via command line
and -source argument is not supplied.
Change-Id: I858b6110cbb18c2151e5183f44b0487f808c7cde
Signed-off-by: Jay Arthanareeswaran <jarthana@in.ibm.com>
Diffstat (limited to 'org.eclipse.jdt.compiler.apt.tests')
2 files changed, 41 insertions, 4 deletions
diff --git a/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/BatchTestUtils.java b/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/BatchTestUtils.java index 98eba965c8..1a033af730 100644 --- a/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/BatchTestUtils.java +++ b/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/BatchTestUtils.java @@ -46,8 +46,8 @@ public class BatchTestUtils { // relative to plugin directory private static final String PROCESSOR_JAR_NAME = "lib/apttestprocessors.jar"; private static final String JLS8_PROCESSOR_JAR_NAME = "lib/apttestprocessors8.jar"; - private static String _processorJarPath; - private static String _jls8ProcessorJarPath; + public static String _processorJarPath; + public static String _jls8ProcessorJarPath; // locations to copy and generate files private static String _tmpFolder; @@ -58,7 +58,7 @@ public class BatchTestUtils { private static File _tmpSrcDir; private static String _tmpBinFolderName; private static File _tmpBinDir; - private static String _tmpGenFolderName; + public static String _tmpGenFolderName; private static File _tmpGenDir; /** diff --git a/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/Java8ElementsTests.java b/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/Java8ElementsTests.java index 4aa1dc0be0..bee51c6d80 100644 --- a/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/Java8ElementsTests.java +++ b/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/Java8ElementsTests.java @@ -301,10 +301,47 @@ public class Java8ElementsTests extends TestCase { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); internalTest(compiler, JAVA8_ANNOTATION_PROC, "testPackageAnnotations", null, "filer8"); } - public void testBug520540() throws Exception { + public void testBug520540a() throws Exception { JavaCompiler compiler = BatchTestUtils.getEclipseCompiler(); internalTest(compiler, JAVA8_ANNOTATION_PROC, "testBug520540", null, "bug520540"); } + public void testBug520540aJavac() throws Exception { + JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + internalTest(compiler, JAVA8_ANNOTATION_PROC, "testBug520540", null, "bug520540"); + } + public void testBug520540b() throws Exception { + JavaCompiler compiler = BatchTestUtils.getEclipseCompiler(); + File targetFolder = TestUtils.concatPath(BatchTestUtils.getSrcFolderName(), "targets", "bug520540"); + BatchTestUtils.copyResources("targets/bug520540", targetFolder); + List<String> options = new ArrayList<String>(); + options.add("-cp"); + options.add(BatchTestUtils._tmpGenFolderName + File.pathSeparatorChar + BatchTestUtils._jls8ProcessorJarPath); + options.add("-processor"); + options.add(JAVA8_ANNOTATION_PROC); + options.add("-A" + JAVA8_ANNOTATION_PROC); + options.add("-AtestBug520540"); + options.add("-1.8"); + boolean success = BatchTestUtils.compileTreeWithErrors(compiler, options, targetFolder, null, true, false); + assertEquals(true, success); + assertEquals("succeeded", System.getProperty(JAVA8_ANNOTATION_PROC)); + } + public void testBug520540bJavac() throws Exception { + JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + File targetFolder = TestUtils.concatPath(BatchTestUtils.getSrcFolderName(), "targets", "bug520540"); + BatchTestUtils.copyResources("targets/bug520540", targetFolder); + List<String> options = new ArrayList<String>(); + options.add("-cp"); + options.add(BatchTestUtils._tmpGenFolderName + File.pathSeparatorChar + BatchTestUtils._jls8ProcessorJarPath); + options.add("-processorpath"); + options.add(" "); + options.add("-processor"); + options.add(JAVA8_ANNOTATION_PROC); + options.add("-A" + JAVA8_ANNOTATION_PROC); + options.add("-AtestBug520540"); + boolean success = BatchTestUtils.compileTreeWithErrors(compiler, options, targetFolder, null, true, false); + assertEquals(true, success); + assertEquals("succeeded", System.getProperty(JAVA8_ANNOTATION_PROC)); + } private void internalTest(JavaCompiler compiler, String processor, String testMethod) throws IOException { internalTest(compiler, processor, testMethod, null); } |