Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzymon Ptaszkiewicz2012-03-30 14:54:44 +0000
committerSatyam Kandula2012-03-30 14:54:44 +0000
commit35d0b351847d4e8745a40a3e5edc237f756e10b9 (patch)
treee7626a8933c58b40ae528ae3d2d47676501060db
parentd98b4a95ae2e4cef5a9a6c79cca6f7e95b903d8e (diff)
downloadeclipse.jdt.core-35d0b351847d4e8745a40a3e5edc237f756e10b9.tar.gz
eclipse.jdt.core-35d0b351847d4e8745a40a3e5edc237f756e10b9.tar.xz
eclipse.jdt.core-35d0b351847d4e8745a40a3e5edc237f756e10b9.zip
Fix for 185601: .apt_generated is not restored as a source folder
-rw-r--r--org.eclipse.jdt.apt.core/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/generatedfile/GeneratedSourceFolderManager.java13
-rw-r--r--org.eclipse.jdt.apt.tests/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/AptBuilderTests.java15
4 files changed, 20 insertions, 12 deletions
diff --git a/org.eclipse.jdt.apt.core/META-INF/MANIFEST.MF b/org.eclipse.jdt.apt.core/META-INF/MANIFEST.MF
index e8d8521769..6991409fb6 100644
--- a/org.eclipse.jdt.apt.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.apt.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.apt.core; singleton:=true
-Bundle-Version: 3.3.402.qualifier
+Bundle-Version: 3.3.403.qualifier
Bundle-Localization: plugin
Export-Package: com.sun.mirror.apt,
com.sun.mirror.declaration,
diff --git a/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/generatedfile/GeneratedSourceFolderManager.java b/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/generatedfile/GeneratedSourceFolderManager.java
index 8aba5a768e..4933b24e42 100644
--- a/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/generatedfile/GeneratedSourceFolderManager.java
+++ b/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/generatedfile/GeneratedSourceFolderManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 BEA Systems, Inc.
+ * Copyright (c) 2005, 2012 BEA Systems, Inc. and others
* 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
@@ -7,6 +7,7 @@
*
* Contributors:
* wharley@bea.com - initial API and implementation
+ * IBM Corporation - modified to fix https://bugs.eclipse.org/bugs/show_bug.cgi?id=185601
*******************************************************************************/
package org.eclipse.jdt.apt.core.internal.generatedfile;
@@ -51,6 +52,10 @@ import org.eclipse.jdt.core.JavaModelException;
* the enabled/disabled state or the folder name change. These changes are
* discovered via the preferenceChanged() method.
* <p>
+ * We attempt to update the classpath with an entry for the generated source
+ * folder if APT is enabled and there is no entry for this folder present
+ * on the classpath.
+ * <p>
* GeneratedSourceFolderManager is responsible only for the folder itself, not
* its contents. Contents are managed by @see GeneratedFileManager.
*
@@ -161,7 +166,9 @@ public class GeneratedSourceFolderManager {
/**
* Creates the generated source folder if necessary. This should be called just
* before doing a build.
- * No changes to the classpath will be made.
+ *
+ * Classpath will be updated with an entry for the generated source folder
+ * if it is not already added to the classpath. See bug 185601.
*/
public void ensureFolderExists(){
// If APT is disabled, do nothing.
@@ -182,7 +189,7 @@ public class GeneratedSourceFolderManager {
}
if (createOnDisk(srcFolder)) {
- if (isOnClasspath(srcFolder)) {
+ if (addToClasspath(srcFolder)) {
synchronized (this) {
// Only set _generatedSourceFolder if folder is on disk and on classpath.
_generatedSourceFolder = srcFolder;
diff --git a/org.eclipse.jdt.apt.tests/META-INF/MANIFEST.MF b/org.eclipse.jdt.apt.tests/META-INF/MANIFEST.MF
index 9feb687442..d76a6b492d 100644
--- a/org.eclipse.jdt.apt.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.apt.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.apt.tests; singleton:=true
-Bundle-Version: 3.3.301.qualifier
+Bundle-Version: 3.3.302.qualifier
Bundle-ClassPath: apt.jar,
aptext.jar
Bundle-Activator: org.eclipse.jdt.apt.tests.plugin.AptTestsPlugin
diff --git a/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/AptBuilderTests.java b/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/AptBuilderTests.java
index db553231cd..d580d9bc1e 100644
--- a/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/AptBuilderTests.java
+++ b/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/AptBuilderTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 BEA Systems, Inc.
+ * Copyright (c) 2005, 2012 BEA Systems, Inc. and others
* 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
@@ -7,7 +7,7 @@
*
* Contributors:
* mkaufman@bea.com - initial API and implementation
- *
+ * IBM Corporation - updated test to reflect changes for https://bugs.eclipse.org/bugs/show_bug.cgi?id=185601
*******************************************************************************/
package org.eclipse.jdt.apt.tests;
@@ -22,7 +22,6 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.apt.core.internal.AptPlugin;
import org.eclipse.jdt.apt.core.internal.generatedfile.GeneratedSourceFolderManager;
import org.eclipse.jdt.apt.core.util.AptConfig;
-import org.eclipse.jdt.apt.core.util.AptPreferenceConstants;
import org.eclipse.jdt.apt.tests.annotations.helloworld.HelloWorldAnnotationProcessor;
import org.eclipse.jdt.apt.tests.annotations.messager.MessagerAnnotationProcessor;
import org.eclipse.jdt.core.IClasspathEntry;
@@ -625,6 +624,9 @@ public class AptBuilderTests extends APTTestBase
expectingNoProblems();
}
+ // After fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=185601,
+ // the config marker 'Generated source folder * is not in classpath'
+ // is not easy to simulate. So, this test doesn't really do anything
public void testConfigMarker() throws Exception{
final String projectName = "ConfigMarkerTestProject";
final IJavaProject javaProj = createJavaProject( projectName );
@@ -651,10 +653,9 @@ public class AptBuilderTests extends APTTestBase
javaProj.setRawClasspath(cp, null);
fullBuild( project.getFullPath() );
expectingNoProblems();
- // make sure we post the marker about the incorrect classpath
- expectingMarkers(new String[]{"Generated source folder '" +
- AptPreferenceConstants.DEFAULT_GENERATED_SOURCE_FOLDER_NAME +
- "' is missing from classpath"} );
+ // classpath should be updated with an entry for the source folder
+ // make sure we do not post the marker about the incorrect classpath
+ expectingNoMarkers();
// take out the annotation and no type generation will occur.
code = "package pkg;\n"

Back to the top