aboutsummaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
Diffstat (limited to 'bridge')
-rw-r--r--bridge/src/main/java/org/aspectj/bridge/context/CompilationAndWeavingContext.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/bridge/src/main/java/org/aspectj/bridge/context/CompilationAndWeavingContext.java b/bridge/src/main/java/org/aspectj/bridge/context/CompilationAndWeavingContext.java
index 451c9cca7..c204c78a1 100644
--- a/bridge/src/main/java/org/aspectj/bridge/context/CompilationAndWeavingContext.java
+++ b/bridge/src/main/java/org/aspectj/bridge/context/CompilationAndWeavingContext.java
@@ -148,6 +148,16 @@ public class CompilationAndWeavingContext {
return sb.toString();
}
+ /**
+ * Returns a string description of what the compiler/weaver is currently doing
+ * @param prependNLIfNotEmpty Prepend a newline character to the message? This can be nice when printing the context
+ * as part of an exception stack trace.
+ */
+ public static String getCurrentContext(boolean prependNLIfNotEmpty) {
+ String context = getCurrentContext();
+ return context.isEmpty() ? context : (prependNLIfNotEmpty ? "\n" : "") + context;
+ }
+
public static ContextToken enteringPhase(int phaseId, Object data) {
Stack<ContextStackEntry> contextStack = getContextStack();
ContextTokenImpl nextToken = nextToken();