### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.apt.pluggable.tests Index: src/org/eclipse/jdt/apt/pluggable/tests/FilerTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.apt.pluggable.tests/src/org/eclipse/jdt/apt/pluggable/tests/FilerTests.java,v retrieving revision 1.5 diff -u -r1.5 FilerTests.java --- src/org/eclipse/jdt/apt/pluggable/tests/FilerTests.java 7 Sep 2007 02:28:21 -0000 1.5 +++ src/org/eclipse/jdt/apt/pluggable/tests/FilerTests.java 14 Sep 2007 17:46:24 -0000 @@ -78,4 +78,41 @@ expectingNoFile( proj, ".apt_generated/summary.txt" ); } + /** + * Test generation of a source file that is referenced by the parent, using the GenClass6 annotation + * @see javax.annotation.processing.Filer#createSourceFile(CharSequence, javax.lang.model.element.Element...) + */ + public void testCreateSourceFileWithGenReference() throws Throwable + { + // Temporary workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=201931 + // Bail out on Linux + String osName = System.getProperty("os.name"); + if (null == osName || !osName.contains("Windows")) { + return; + } + + IJavaProject jproj = createJavaProject(_projectName); + IProject proj = jproj.getProject(); + IdeTestUtils.copyResources(proj, "targets/filer02a", "src/targets/filer"); + AptConfig.setEnabled(jproj, true); + fullBuild(); + expectingNoProblems(); + + // Check whether generated sources were generated and compiled + expectingFile(proj, ".apt_generated/gen6/Generated02.java"); + final String[] expectedClasses = { "targets.filer.Parent02", "gen6.Generated02" }; + expectingUniqueCompiledClasses(expectedClasses); + + // Modify target file to change name of generated file and incrementally rebuild; + // generated file should be deleted. + IdeTestUtils.copyResources(proj, "targets/filer02b", "src/targets/filer"); + incrementalBuild(); +// expectingNoProblems(); +// +// final String[] expectedClasses2 = { "targets.filer.Parent02", "targets.filer.XxxGenerated02" }; +// expectingUniqueCompiledClasses(expectedClasses2); +// +// expectingNoFile(proj, ".apt_generated/gen6/Generated02.java"); + } + } Index: resources/targets/filer02a/Parent02.java =================================================================== RCS file: resources/targets/filer02a/Parent02.java diff -N resources/targets/filer02a/Parent02.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/targets/filer02a/Parent02.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2007 BEA Systems, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * wharley@bea.com - initial API and implementation + *******************************************************************************/ + +package targets.filer; + +import org.eclipse.jdt.apt.pluggable.tests.annotations.GenClass6; + +/** + * Processing this class should result in creation of a source file, + * thereby allowing this class to compile + */ +@GenClass6(name="Generated02", pkg="gen6") +public class Parent02 { + gen6.Generated02 _gen; +} + + + Index: resources/targets/filer02b/Parent02.java =================================================================== RCS file: resources/targets/filer02b/Parent02.java diff -N resources/targets/filer02b/Parent02.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/targets/filer02b/Parent02.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2007 BEA Systems, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * wharley@bea.com - initial API and implementation + *******************************************************************************/ + +package targets.filer; + +import org.eclipse.jdt.apt.pluggable.tests.annotations.GenClass6; + +/** + * Processing this class should result in removal of the previously + * generated type and creation of a new one, resulting in a compilation error. + */ +@GenClass6(name="XxxGenerated02", pkg="gen6") +public class Parent02 { + gen6.Generated02 _gen; +} +