### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.apt.tests Index: src/org/eclipse/jdt/apt/tests/AptBuilderTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/AptBuilderTests.java,v retrieving revision 1.27 diff -u -r1.27 AptBuilderTests.java --- src/org/eclipse/jdt/apt/tests/AptBuilderTests.java 3 Apr 2008 20:47:18 -0000 1.27 +++ src/org/eclipse/jdt/apt/tests/AptBuilderTests.java 23 Dec 2008 08:08:01 -0000 @@ -704,4 +704,42 @@ expectingNoMarkers(); } + /** + * This test makes sure that changing an annotation on type A causes type B + * to be recompiled, if B references A. See http://bugs.eclipse.org/149768 + */ + + public void testAnnotationDependency() throws Exception + { + IProject project = env.getProject( getProjectName() ); + IPath srcRoot = getSourcePath( getProjectName() ); + + String a1Code = "package p1; " + "\n" + + "import org.eclipse.jdt.apt.tests.annotations.noop.NoOpAnnotation;" + "\n" + + "@NoOpAnnotation(\"A1\")" + "\n" + + "public class A {}"; + String a2Code = "package p1; " + "\n" + + "import org.eclipse.jdt.apt.tests.annotations.noop.NoOpAnnotation;" + "\n" + + "@NoOpAnnotation(\"A2\")" + "\n" + + "public class A {}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( srcRoot, "p1", "A", a1Code ); + env.addClass( srcRoot, "p1", "B", bCode ); + + fullBuild( project.getFullPath() ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( srcRoot, "p1", "A", a2Code ); + incrementalBuild( project.getFullPath() ); + expectingNoProblems(); + + // verify that B was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A", "p1.B" }); + } + }