summaryrefslogtreecommitdiffstats
path: root/bridge/src
diff options
context:
space:
mode:
authorwisberg <wisberg>2003-03-04 09:52:21 +0000
committerwisberg <wisberg>2003-03-04 09:52:21 +0000
commitbb9ee8de60674b1bb5bbdaa9e61a7adc92aa8287 (patch)
tree9032c4361bb3ae3d56fbe27b0ff57234df3923c4 /bridge/src
parent55f3ff47ea2fd979cd2d61790f85cbba5ba7dc40 (diff)
downloadaspectj-bb9ee8de60674b1bb5bbdaa9e61a7adc92aa8287.tar.gz
aspectj-bb9ee8de60674b1bb5bbdaa9e61a7adc92aa8287.zip
partial fix for bug 31724 emits file:line numbers for declare warning/error.
This adds an optional "context" String to IMessage. The IMessage creator should create a context String (or use an implementation that lazily creates one). The IMessage client can render their messages without context embedded in the message field. Emitting source context from the weaver will be harder. Using file and start/end line will probably work, since tool clients can map to any available source file paths. (BcelSourceContext and BcelShadow can be updated with end from range.)
Diffstat (limited to 'bridge/src')
-rw-r--r--bridge/src/org/aspectj/bridge/ISourceLocation.java3
-rw-r--r--bridge/src/org/aspectj/bridge/SourceLocation.java18
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(":");