diff options
Diffstat (limited to 'bridge/src')
-rw-r--r-- | bridge/src/org/aspectj/bridge/ISourceLocation.java | 3 | ||||
-rw-r--r-- | bridge/src/org/aspectj/bridge/SourceLocation.java | 18 |
2 files changed, 19 insertions, 2 deletions
diff --git a/bridge/src/org/aspectj/bridge/ISourceLocation.java b/bridge/src/org/aspectj/bridge/ISourceLocation.java index 8dc343f5e..f43a2f54c 100644 --- a/bridge/src/org/aspectj/bridge/ISourceLocation.java +++ b/bridge/src/org/aspectj/bridge/ISourceLocation.java @@ -56,4 +56,7 @@ public interface ISourceLocation { /** @return getLine()..MAX_LINE */ int getEndLine(); + /** @return String application-specific context for source */ + String getContext(); + } diff --git a/bridge/src/org/aspectj/bridge/SourceLocation.java b/bridge/src/org/aspectj/bridge/SourceLocation.java index d388aba36..882d8af1b 100644 --- a/bridge/src/org/aspectj/bridge/SourceLocation.java +++ b/bridge/src/org/aspectj/bridge/SourceLocation.java @@ -55,6 +55,7 @@ public class SourceLocation implements ISourceLocation, java.io.Serializable { private final int startLine; private final int column; private final int endLine; + private final String context; private boolean noColumn; /** @@ -77,6 +78,10 @@ public class SourceLocation implements ISourceLocation, java.io.Serializable { * @param column int character position of starting location - positive number */ public SourceLocation(File file, int line, int endLine, int column) { + this(file, line, endLine, column, (String) null); + } + + public SourceLocation(File file, int line, int endLine, int column, String context) { if (column == NO_COLUMN) { column = 0; noColumn = true; @@ -92,6 +97,7 @@ public class SourceLocation implements ISourceLocation, java.io.Serializable { this.startLine = line; this.column = column; this.endLine = endLine; + this.context = context; } public File getSourceFile() { @@ -113,10 +119,18 @@ public class SourceLocation implements ISourceLocation, java.io.Serializable { return endLine; } - /** @return String {file:}line{:column} */ + /** @return null String or application-specific context */ + public String getContext() { + return context; + } + + /** @return String {context\n}{file:}line{:column} */ public String toString() { StringBuffer sb = new StringBuffer(); - + if (null != context) { + sb.append(context); + sb.append(LangUtil.EOL); + } if (sourceFile != ISourceLocation.NO_FILE) { sb.append(sourceFile.getPath()); sb.append(":"); |