### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.compiler.apt.tests Index: src/org/eclipse/jdt/compiler/apt/tests/CompilerAptTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/CompilerAptTests.java,v retrieving revision 1.4 diff -u -r1.4 CompilerAptTests.java --- src/org/eclipse/jdt/compiler/apt/tests/CompilerAptTests.java 17 Jan 2007 02:36:09 -0000 1.4 +++ src/org/eclipse/jdt/compiler/apt/tests/CompilerAptTests.java 8 Feb 2007 00:26:41 -0000 @@ -62,6 +62,17 @@ "public class TestEchoArgs {\n" + "}\n" ; + private static final String _twoAnnotationsSource = + "package p;\n" + + "import anno.EchoArgs;\n" + + "import anno.GenClass;\n" + + "import gen.XGen;\n" + + "@GenClass(clazz=\"gen.XGen\", method=\"foo\")\n" + + "@EchoArgs\n" + + "public class X {\n" + + "\tXGen _xgen;\n" + + "}\n" ; + // locations to generate files protected static final String _tmpFolder = System.getProperty("java.io.tmpdir") + "eclipse-temp"; @@ -77,6 +88,7 @@ "-XprintRounds" }; + protected JavaCompiler _eclipseCompiler; protected String _tmpSrcFolderName; @@ -181,6 +193,25 @@ internalTestGenerateClass(compiler); } + public void testTwoAnnotations() { + File inputFile = writeSourceFile(_tmpSrcFolderName, "X.java", _twoAnnotationsSource); + + List options = new ArrayList(); + // See corresponding list in ArgsTestProc processor. + // Processor will throw IllegalStateException if it detects a mismatch. + options.add("-Afoo=bar"); + options.add("-Anovalue"); + compileOneClass(_eclipseCompiler, inputFile, options); + + // check that the src and class files were generated + File genSrcFile = new File(_tmpGenFolderName + File.separator + "gen" + File.separator + "XGen.java"); + assertTrue("generated src file does not exist", genSrcFile.exists()); + File classFile = new File(_tmpBinFolderName + File.separator + "p" + File.separator + "X.class"); + assertTrue("ordinary src file was not compiled", classFile.exists()); + File genClassFile = new File(_tmpBinFolderName + File.separator + "gen" + File.separator + "XGen.class"); + assertTrue("generated src file was not compiled", genClassFile.exists()); + } + /* * Clean up the compiler */