aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2014-08-16 01:33:51 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2014-08-16 01:33:51 +0200
commit5e6cdb07ef1a89f8047904fd2e00f574bc7ca1bf (patch)
treeec0e4c4e6aff06c0ca8be343250f9401dfc097d3
parent3c4f684143190c1fbab0e69fc754f45a839170ea (diff)
downloadlombok-5e6cdb07ef1a89f8047904fd2e00f574bc7ca1bf.tar.gz
lombok-5e6cdb07ef1a89f8047904fd2e00f574bc7ca1bf.tar.bz2
lombok-5e6cdb07ef1a89f8047904fd2e00f574bc7ca1bf.zip
Some workaround fix-esque work to prevent serious slowdown issues when refactoring.
-rw-r--r--doc/changelog.markdown2
-rw-r--r--src/core/lombok/eclipse/EclipseAST.java20
2 files changed, 20 insertions, 2 deletions
diff --git a/doc/changelog.markdown b/doc/changelog.markdown
index 4f15b426..d6c1b380 100644
--- a/doc/changelog.markdown
+++ b/doc/changelog.markdown
@@ -3,7 +3,7 @@ Lombok Changelog
### v1.14.5 "Edgy Guinea Pig"
-* No changes.
+* WORK-IN-PROGRESS: A bunch of errors in the error log about 'Path must include project and resource name' seem to be related to slowdowns. This fix removes the errors, but does it remove the slowdowns? [Issue #682](https://code.google.com/p/projectlombok/issues/detail?id=682).
### v1.14.4 (July 1st, 2014)
* BUGFIX: GWT produces errors in handlers on line 1 in any source files that use lombok; this has been fixed. [Issue #699](https://code.google.com/p/projectlombok/issues/detail?id=699)
diff --git a/src/core/lombok/eclipse/EclipseAST.java b/src/core/lombok/eclipse/EclipseAST.java
index 58621e7f..5723668b 100644
--- a/src/core/lombok/eclipse/EclipseAST.java
+++ b/src/core/lombok/eclipse/EclipseAST.java
@@ -156,7 +156,25 @@ public class EclipseAST extends AST<EclipseAST, EclipseNode, ASTNode> {
private static class EclipseWorkspaceBasedFileResolver {
public static URI resolve(String path) {
- return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path)).getLocationURI();
+ /* eclipse issue: When creating snippets, for example to calculate 'find callers', refactor scripts, save actions, etc,
+ * eclipse creates a psuedo-file whose path is simply "/SimpleName.java", which cannot be turned back into a real location.
+ * What we really need to do is find out which file is the source of this script job and use its directory instead. For now,
+ * we just go with all defaults; these operations are often not sensitive to proper lomboking or aren't even lomboked at all.
+ *
+ * Reliable way to reproduce this (Kepler, possibly with JDK8 beta support):
+ * * Have a method, called once by some code in another class.
+ * * Refactor it with the 'change method signature' refactor script, and add a parameter and hit 'ok'.
+ */
+ if (path == null || path.indexOf('/', 1) == -1) {
+ return null;
+ }
+ try {
+ return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path)).getLocationURI();
+ } catch (Exception e) {
+ // One of the exceptions that can occur is IllegalStateException (during getWorkspace())
+ // if you try to run this while eclipse is shutting down.
+ return null;
+ }
}
}