Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Garms2006-01-16 21:51:19 +0000
committerJesse Garms2006-01-16 21:51:19 +0000
commite9814fbeb88b750bd00343334953a4cfd459bb8e (patch)
tree2e37b4bb6961ce5357dcef67f8e875be3465b91a
parente02cb92dc0a45c958dd566310eced8be5b78d04f (diff)
downloadeclipse.jdt.core-e9814fbeb88b750bd00343334953a4cfd459bb8e.tar.gz
eclipse.jdt.core-e9814fbeb88b750bd00343334953a4cfd459bb8e.tar.xz
eclipse.jdt.core-e9814fbeb88b750bd00343334953a4cfd459bb8e.zip
Bug fixes:
1. Don't throw a CoreException when a case-rename changes on a binary or text file that is generated by APT. 2. Fix relative/absolute path errors in APTConfig when the project is not under the workspace root.
-rw-r--r--org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/env/BinaryFileOutputStream.java10
-rw-r--r--org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/util/AptConfig.java40
2 files changed, 38 insertions, 12 deletions
diff --git a/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/env/BinaryFileOutputStream.java b/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/env/BinaryFileOutputStream.java
index 3377f386b5..1c4f80eb82 100644
--- a/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/env/BinaryFileOutputStream.java
+++ b/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/env/BinaryFileOutputStream.java
@@ -105,8 +105,14 @@ public class BinaryFileOutputStream extends ByteArrayOutputStream {
}
}
catch (CoreException ce) {
- AptPlugin.log(ce, "Could not create generated file"); //$NON-NLS-1$
- throw new IOException(ce.getMessage());
+ if (_file.exists()) {
+ // Do nothing. This is a case-insensitive file system mismatch,
+ // and the underlying platform has saved the contents already.
+ }
+ else {
+ AptPlugin.log(ce, "Could not create generated file"); //$NON-NLS-1$
+ throw new IOException(ce.getMessage());
+ }
}
}
diff --git a/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/util/AptConfig.java b/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/util/AptConfig.java
index 50183853c3..bc46d20bf7 100644
--- a/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/util/AptConfig.java
+++ b/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/util/AptConfig.java
@@ -17,6 +17,8 @@ import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -133,7 +135,7 @@ public class AptConfig {
return options;
}
- IPath workspaceRootPath = jproj.getProject().getWorkspace().getRoot().getLocation();
+ IWorkspaceRoot root = jproj.getProject().getWorkspace().getRoot();
// Add sourcepath and classpath variables
try {
@@ -151,35 +153,53 @@ public class AptConfig {
else {
classpathSB.append(File.pathSeparatorChar);
}
- classpathSB.append(entry.getPath().makeAbsolute().toOSString());
+ IPath cpPath = entry.getPath();
+
+ IResource res = root.findMember(cpPath);
+
+ // If res is null, the path is absolute (it's an external jar)
+ if (res == null) {
+ classpathSB.append(cpPath.toOSString());
+ }
+ else {
+ // It's relative
+ classpathSB.append(res.getLocation().toOSString());
+ }
}
else if (kind == IClasspathEntry.CPE_SOURCE) {
if (firstSP) {
firstSP = false;
}
else {
- sourcepathSB.append(File.separatorChar);
+ sourcepathSB.append(File.pathSeparatorChar);
}
- // Sourcepath is a bit odd -- it's workspace-relative
- IPath sourcepath = entry.getPath();
- sourcepathSB.append(workspaceRootPath.append(sourcepath).toOSString());
+
+ sourcepathSB.append(root.findMember(entry.getPath()).getLocation().toOSString());
}
}
// if you add options here, also add them in isAutomaticProcessorOption(),
// and document them in docs/reference/automatic_processor_options.html.
// Classpath and sourcepath
- options.put("-classpath",classpathSB.toString()); //$NON-NLS-1$
+ options.put("-classpath",classpathSB.toString()); //$NON-NLS-1$
options.put("-sourcepath", sourcepathSB.toString()); //$NON-NLS-1$
// Get absolute path for generated source dir
IFolder genSrcDir = jproj.getProject().getFolder(getGenSrcDir(jproj));
- options.put("-s", genSrcDir.getRawLocation().toOSString()); //$NON-NLS-1$
+ String genSrcDirString = genSrcDir.getRawLocation().toOSString();
+ options.put("-s", genSrcDirString); //$NON-NLS-1$
// Absolute path for bin dir as well
IPath binPath = jproj.getOutputLocation();
- IPath binDir = workspaceRootPath.append(binPath);
- options.put("-d", binDir.toOSString()); //$NON-NLS-1$
+ IResource binPathResource = root.findMember(binPath);
+ String binDirString;
+ if (binPathResource != null) {
+ binDirString = root.findMember(binPath).getLocation().toOSString();
+ }
+ else {
+ binDirString = binPath.toOSString();
+ }
+ options.put("-d", binDirString); //$NON-NLS-1$
String target = jproj.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true);
options.put("-target", target); //$NON-NLS-1$

Back to the top