diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2014-08-16 01:33:51 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2014-08-16 01:33:51 +0200 |
commit | 5e6cdb07ef1a89f8047904fd2e00f574bc7ca1bf (patch) | |
tree | ec0e4c4e6aff06c0ca8be343250f9401dfc097d3 /src/core/lombok | |
parent | 3c4f684143190c1fbab0e69fc754f45a839170ea (diff) | |
download | lombok-5e6cdb07ef1a89f8047904fd2e00f574bc7ca1bf.tar.gz lombok-5e6cdb07ef1a89f8047904fd2e00f574bc7ca1bf.tar.bz2 lombok-5e6cdb07ef1a89f8047904fd2e00f574bc7ca1bf.zip |
Some workaround fix-esque work to prevent serious slowdown issues when refactoring.
Diffstat (limited to 'src/core/lombok')
-rw-r--r-- | src/core/lombok/eclipse/EclipseAST.java | 20 |
1 files changed, 19 insertions, 1 deletions
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; + } } } |