diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2014-05-30 02:58:29 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2014-05-30 03:00:41 +0200 |
commit | 06371ca2580dc9938e07a9ff0ab86a72ab10fa2f (patch) | |
tree | 44d99b57ce94c70982b7aca9230852441f42ef60 /src/core/lombok | |
parent | 48c93ecc30b8ee8d04336bf73955293d25f9eeda (diff) | |
download | lombok-06371ca2580dc9938e07a9ff0ab86a72ab10fa2f.tar.gz lombok-06371ca2580dc9938e07a9ff0ab86a72ab10fa2f.tar.bz2 lombok-06371ca2580dc9938e07a9ff0ab86a72ab10fa2f.zip |
#682: bugfix work in progress to fix IllegalArgumentException ‘Path must include project and resource name’.
Diffstat (limited to 'src/core/lombok')
-rw-r--r-- | src/core/lombok/eclipse/EclipseAST.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/core/lombok/eclipse/EclipseAST.java b/src/core/lombok/eclipse/EclipseAST.java index 45551d1c..62a01e59 100644 --- a/src/core/lombok/eclipse/EclipseAST.java +++ b/src/core/lombok/eclipse/EclipseAST.java @@ -70,9 +70,20 @@ public class EclipseAST extends AST<EclipseAST, EclipseNode, ASTNode> { private static volatile boolean skipEclipseWorkspaceBasedFileResolver = false; public URI getAbsoluteFileLocation() { + String fileName = getFileName(); + if (!skipEclipseWorkspaceBasedFileResolver) { try { - return EclipseWorkspaceBasedFileResolver.resolve(getFileName()); + /*if (fileName.startsWith("/") && fileName.indexOf('/', 1) > -1) */ + try { + return EclipseWorkspaceBasedFileResolver.resolve(fileName); + } catch (IllegalArgumentException e) { + String msg = e.getMessage(); + if (msg != null && msg.startsWith("Path must include project and resource name")) { + // go with the fallthrough, but log that this happened. + addProblem(new ParseProblem(true, "Path resolution for lombok.config failed. Path: " + fileName + " -- falling back to: " + new File(fileName).getAbsoluteFile(), 0, 1)); + } else throw e; + } } catch (NoClassDefFoundError e) { skipEclipseWorkspaceBasedFileResolver = true; } @@ -80,7 +91,7 @@ public class EclipseAST extends AST<EclipseAST, EclipseNode, ASTNode> { // Our fancy workspace based source file to absolute disk location algorithm only works in a fully fledged eclipse. // This fallback works when using 'ecj', which has a much simpler project/path system. For example, no 'linked' resources. - return new File(getFileName()).getAbsoluteFile().toURI(); + return new File(fileName).getAbsoluteFile().toURI(); } private static class EclipseWorkspaceBasedFileResolver { |