summaryrefslogtreecommitdiffstats
path: root/util/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 /util/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 'util/src')
-rw-r--r--util/src/org/aspectj/util/FileUtil.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/util/src/org/aspectj/util/FileUtil.java b/util/src/org/aspectj/util/FileUtil.java
index 35405ce59..490a79921 100644
--- a/util/src/org/aspectj/util/FileUtil.java
+++ b/util/src/org/aspectj/util/FileUtil.java
@@ -305,7 +305,22 @@ public class FileUtil {
}
return path;
}
-
+
+ /**
+ * Render as best path, canonical or absolute.
+ * @param file the File to get the path for (not null)
+ * @return String of the best-available path
+ * @throws IllegalArgumentException if file is null
+ */
+ public static String getBestPath(File file) {
+ LangUtil.throwIaxIfNull(file, "file");
+ try {
+ return file.getCanonicalPath();
+ } catch (IOException e) {
+ return file.getAbsolutePath();
+ }
+ }
+
/** @return array same length as input, with String absolute paths */
public static String[] getAbsolutePaths(File[] files) {
if ((null == files) || (0 == files.length)) {