From a24daba66ce4705429b266972319ad15b1db0d70 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Mon, 18 Jul 2011 23:49:26 +0200 Subject: Upgraded the issue 164 reporter to replace what we had. I think we'll roll this out in 0.10.0-RC2. --- src/core/lombok/core/debug/DebugSnapshot.java | 2 +- src/core/lombok/core/debug/DebugSnapshotStore.java | 7 +++++-- src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java | 6 ++---- 3 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src/core') diff --git a/src/core/lombok/core/debug/DebugSnapshot.java b/src/core/lombok/core/debug/DebugSnapshot.java index f12cbcc4..d94798e8 100644 --- a/src/core/lombok/core/debug/DebugSnapshot.java +++ b/src/core/lombok/core/debug/DebugSnapshot.java @@ -43,7 +43,7 @@ public class DebugSnapshot implements Comparable { public String shortToString() { StringBuilder out = new StringBuilder(); out.append(String.format("WHEN: %14d THREAD: %s AST: %s", when, threadName, ownerName())); - if (message != null) out.append(String.format(message, params)); + if (message != null) out.append(" ").append(String.format(message, params)); return out.toString(); } diff --git a/src/core/lombok/core/debug/DebugSnapshotStore.java b/src/core/lombok/core/debug/DebugSnapshotStore.java index fda3ba14..7abfc07c 100644 --- a/src/core/lombok/core/debug/DebugSnapshotStore.java +++ b/src/core/lombok/core/debug/DebugSnapshotStore.java @@ -31,7 +31,7 @@ public class DebugSnapshotStore { } } - public void print(CompilationUnitDeclaration owner, String message, Object... params) { + public String print(CompilationUnitDeclaration owner, String message, Object... params) { List list; synchronized (map) { @@ -54,14 +54,17 @@ public class DebugSnapshotStore { } try { - OutputStream stream = new FileOutputStream(new File(System.getProperty("user.home", "."), String.format("lombok164-%d.err", System.currentTimeMillis()))); + File logFile = new File(System.getProperty("user.home", "."), String.format("lombok164-%d.err", System.currentTimeMillis())); + OutputStream stream = new FileOutputStream(logFile); try { stream.write(out.toString().getBytes("UTF-8")); } finally { stream.close(); } + return logFile.getAbsolutePath(); } catch (Exception e) { System.err.println(out); + return "(can't write log file - emitted to system err)"; } } } diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index 5f6691fd..45d58df3 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -467,10 +467,8 @@ public class EclipseHandlerUtil { if (report) { CompilationUnitDeclaration cud = (CompilationUnitDeclaration) type.top().get(); - DebugSnapshotStore.INSTANCE.print(cud, "Printing: injecting whilst scope is already built."); -// Eclipse.warning("State: " + Issue164Fixer.getState(cud) + " -- We believe you may have just stumbled on lombok issue #164. Please " + -// "report the stack trace associated with this message at:\n" + -// "http://code.google.com/p/projectlombok/issues/detail?id=164. Occurred on class " + new String(parent.name), new Throwable()); + String logFileLocation = DebugSnapshotStore.INSTANCE.print(cud, "Printing: injecting whilst scope is already built."); + Eclipse.warning("We believe you may have stumbled on issue 164. Please upload file " + logFileLocation + " to: http://code.google.com/p/projectlombok/issues/detail?id=164", new Throwable()); } } -- cgit