aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten <mkersten>2003-08-07 09:16:05 +0000
committermkersten <mkersten>2003-08-07 09:16:05 +0000
commitbe23e3d01d1acde57b8ae25e04d0fc011a71e219 (patch)
tree341c6274bc12289cbdf38b54d0d0031fdd816fac
parent02d3af8df7b3131a7dd64e5e19e19367e275b0bc (diff)
downloadaspectj-be23e3d01d1acde57b8ae25e04d0fc011a71e219.tar.gz
aspectj-be23e3d01d1acde57b8ae25e04d0fc011a71e219.zip
Changed org.aspectj.bridge.IMessage.getISourceLocation to getSourceLocation in order to match method naming conventions.
-rw-r--r--ajde/testsrc/org/aspectj/ajde/CompilerMessagesTest.java23
-rw-r--r--ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java30
-rw-r--r--ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java6
-rw-r--r--bridge/src/org/aspectj/bridge/IMessage.java2
-rw-r--r--bridge/src/org/aspectj/bridge/Message.java4
-rw-r--r--bridge/src/org/aspectj/bridge/MessageUtil.java4
-rw-r--r--bridge/testsrc/org/aspectj/bridge/MessageTest.java2
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java2
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java2
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java2
-rw-r--r--testing/src/org/aspectj/testing/util/BridgeUtil.java10
-rw-r--r--testing/src/org/aspectj/testing/xml/SoftMessage.java6
-rw-r--r--testing/testsrc/org/aspectj/testing/harness/bridge/AjcSpecTest.java2
13 files changed, 49 insertions, 46 deletions
diff --git a/ajde/testsrc/org/aspectj/ajde/CompilerMessagesTest.java b/ajde/testsrc/org/aspectj/ajde/CompilerMessagesTest.java
index 0506eb36d..8208e1515 100644
--- a/ajde/testsrc/org/aspectj/ajde/CompilerMessagesTest.java
+++ b/ajde/testsrc/org/aspectj/ajde/CompilerMessagesTest.java
@@ -15,6 +15,8 @@ package org.aspectj.ajde;
import java.io.IOException;
import java.util.List;
+import org.aspectj.bridge.IMessage;
+
/**
* @author colyer
*
@@ -25,10 +27,6 @@ public class CompilerMessagesTest extends AjdeTestCase {
private final String CONFIG_FILE_PATH = "../examples/declare-warning/all.lst";
- /**
- * Constructor for CompilerMessagesTest.
- * @param name
- */
public CompilerMessagesTest(String name) {
super(name);
}
@@ -44,24 +42,29 @@ public class CompilerMessagesTest extends AjdeTestCase {
assertEquals("Two warning messages should be produced",2,msgs.size());
NullIdeTaskListManager.SourceLineTask task =
(NullIdeTaskListManager.SourceLineTask) msgs.get(0);
- assertEquals( 8, task.location.getLine());
- assertEquals( "Please don't call init methods", task.message);
+ assertEquals( 8, task.getContainedMessage().getSourceLocation().getLine());
+ assertEquals( "Please don't call init methods", task.message.getMessage());
try {
- String fullyQualifiedFile = task.location.getSourceFile().getCanonicalPath();
+ String fullyQualifiedFile = task.getContainedMessage().getSourceLocation().getSourceFile().getCanonicalPath();
// this name has a tester specific prefix, followed by the location of the file.
// we can validate the ending.
fullyQualifiedFile = fullyQualifiedFile.replace('\\','/'); // ignore platform differences in slashes
assertTrue( "Fully-qualified source file location returned",
fullyQualifiedFile.endsWith("testdata/examples/declare-warning/apackage/SomeClass.java"));
} catch (IOException ex) {
- assertTrue( "Unable to convert source file location: " + task.location.getSourceFile(), false);
+ assertTrue( "Unable to convert source file location: " + task.getContainedMessage().getSourceLocation().getSourceFile(), false);
}
}
-
+
public void testDeclareMessageContents() {
List msgs = NullIdeManager.getIdeManager().getCompilationSourceLineTasks();
- assertEquals( "Please don't call setters" , ((NullIdeTaskListManager.SourceLineTask) msgs.get(1)).message);
+ IMessage msg = (IMessage)((NullIdeTaskListManager.SourceLineTask)msgs.get(1)).getContainedMessage();
+ assertEquals( "Please don't call setters" , msg.getMessage());
+
+// assertEquals("extra info", msg.getCorrespondingJoinPoint());
+
+// fail();
}
diff --git a/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java b/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java
index 239c02cff..2b1275bb0 100644
--- a/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java
+++ b/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java
@@ -43,8 +43,8 @@ public class NullIdeTaskListManager implements TaskListManager {
if (!hasWarning && IMessage.WARNING.isSameOrLessThan(message.getKind())) {
hasWarning = true;
}
- System.out.println("> added sourceline task: " + message + ", file: " + message.getISourceLocation().getSourceFile().getAbsolutePath()
- + ": " + message.getISourceLocation().getLine());
+ System.out.println("> added sourceline task: " + message + ", file: " + message.getSourceLocation().getSourceFile().getAbsolutePath()
+ + ": " + message.getSourceLocation().getLine());
}
public void addProjectTask(String message, IMessage.Kind kind) {
@@ -61,8 +61,7 @@ public class NullIdeTaskListManager implements TaskListManager {
public void clearTasks() {
sourceLineTasks = new ArrayList();
hasWarning = false;
-// System.out.println("> cleared tasks");
- }
+ }
/**
* Return the list of source line compiler messages resulting from a compile, so
@@ -75,23 +74,24 @@ public class NullIdeTaskListManager implements TaskListManager {
public static class SourceLineTask {
- public String message;
- public ISourceLocation location;
- public IMessage.Kind kind;
+ IMessage message;
public SourceLineTask(IMessage m) {
- message = m.getMessage();
- location = m.getISourceLocation();
- kind = m.getKind();
+ message = m;
+ }
+
+ public IMessage getContainedMessage() {
+ return message;
}
+
public String toString() {
- String loc = "<no location";
- if (null != location) {
- loc = location.getSourceFile() + ":" + location.getLine();
+ String loc = "<no location>";
+ if (null != message.getSourceLocation()) {
+ loc = message.getSourceLocation().getSourceFile() + ":" + message.getSourceLocation().getLine();
}
- return "SourceLineTask [" + message
+ return "SourceLineTask [" + message.getMessage()
+ ", " + loc
- + ", " + kind
+ + ", " + message.getKind()
+ "]";
}
}
diff --git a/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java b/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java
index 1266b0c4b..0a5b8c1a6 100644
--- a/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java
+++ b/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java
@@ -49,12 +49,12 @@ public class LstBuildConfigManagerTest extends AjdeTestCase {
List messages = NullIdeManager.getIdeManager().getCompilationSourceLineTasks();
NullIdeTaskListManager.SourceLineTask message = (NullIdeTaskListManager.SourceLineTask)messages.get(0);
- assertEquals(message.location.getSourceFile().getAbsolutePath(), openFile("dir-entry.lst").getAbsolutePath());
+ assertEquals(message.getContainedMessage().getSourceLocation().getSourceFile().getAbsolutePath(), openFile("dir-entry.lst").getAbsolutePath());
doSynchronousBuild("bad-injar.lst");
messages = NullIdeManager.getIdeManager().getCompilationSourceLineTasks();
message = (NullIdeTaskListManager.SourceLineTask)messages.get(0);
- assertTrue(message.message.indexOf("invalid") != -1);
+ assertTrue(message.getContainedMessage().getMessage().indexOf("invalid") != -1);
}
public void testErrorMessages() throws IOException {
@@ -63,7 +63,7 @@ public class LstBuildConfigManagerTest extends AjdeTestCase {
List messages = NullIdeManager.getIdeManager().getCompilationSourceLineTasks();
SourceLineTask message = (SourceLineTask)messages.get(0);
- assertEquals("invalid option: aaa.bbb", message.message);
+ assertEquals("invalid option: aaa.bbb", message.getContainedMessage().getMessage());
}
diff --git a/bridge/src/org/aspectj/bridge/IMessage.java b/bridge/src/org/aspectj/bridge/IMessage.java
index 7f7407e0f..fe2a2124d 100644
--- a/bridge/src/org/aspectj/bridge/IMessage.java
+++ b/bridge/src/org/aspectj/bridge/IMessage.java
@@ -73,7 +73,7 @@ public interface IMessage {
Throwable getThrown();
/** @return source location associated with this message, or null if none */
- ISourceLocation getISourceLocation();
+ ISourceLocation getSourceLocation();
public static final class Kind implements Comparable {
public static final Comparator COMPARATOR = new Comparator() {
diff --git a/bridge/src/org/aspectj/bridge/Message.java b/bridge/src/org/aspectj/bridge/Message.java
index 56e2275b7..ada78629a 100644
--- a/bridge/src/org/aspectj/bridge/Message.java
+++ b/bridge/src/org/aspectj/bridge/Message.java
@@ -126,7 +126,7 @@ public class Message implements IMessage { // XXX toString or renderer?
}
/** @return ISourceLocation associated with this message, or null if none */
- final public ISourceLocation getISourceLocation() {
+ final public ISourceLocation getSourceLocation() {
return sourceLocation;
}
@@ -135,7 +135,7 @@ public class Message implements IMessage { // XXX toString or renderer?
}
public static String renderToString(IMessage message) {
- ISourceLocation loc = message.getISourceLocation();
+ ISourceLocation loc = message.getSourceLocation();
String locString = (null == loc ? "" : " at " + loc);
Throwable thrown = message.getThrown();
return message.getKind() + locString + ": " + message.getMessage()
diff --git a/bridge/src/org/aspectj/bridge/MessageUtil.java b/bridge/src/org/aspectj/bridge/MessageUtil.java
index 31f72ed94..9dbb09e44 100644
--- a/bridge/src/org/aspectj/bridge/MessageUtil.java
+++ b/bridge/src/org/aspectj/bridge/MessageUtil.java
@@ -770,7 +770,7 @@ public class MessageUtil {
result.append(" ");
}
- ISourceLocation loc = message.getISourceLocation();
+ ISourceLocation loc = message.getSourceLocation();
if ((null != loc) && (loc != ISourceLocation.EMPTY)) {
result.append("at " + renderSourceLocation(loc));
}
@@ -849,7 +849,7 @@ public class MessageUtil {
String text = message.getMessage();
Throwable thrown = message.getThrown();
- ISourceLocation sl = message.getISourceLocation();
+ ISourceLocation sl = message.getSourceLocation();
IMessage.Kind kind = message.getKind();
StringBuffer result = new StringBuffer();
result.append(kind.toString());
diff --git a/bridge/testsrc/org/aspectj/bridge/MessageTest.java b/bridge/testsrc/org/aspectj/bridge/MessageTest.java
index 8688f44b4..19cbc50ef 100644
--- a/bridge/testsrc/org/aspectj/bridge/MessageTest.java
+++ b/bridge/testsrc/org/aspectj/bridge/MessageTest.java
@@ -223,7 +223,7 @@ public class MessageTest extends TestCase {
assertTrue(""+kind, kind == m.getKind());
assertTrue(""+thrown, equals(thrown, m.getThrown()));
assertTrue(""+sourceLocation,
- equals(sourceLocation, m.getISourceLocation()));
+ equals(sourceLocation, m.getSourceLocation()));
String err = new KindTest().testKindSet(message, kind);
if (null != err) {
assertTrue(err, false);
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java b/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
index 061239ac5..101fef62b 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
@@ -403,7 +403,7 @@ public class Main {
if (toString) {
text = message.toString();
}
- ISourceLocation loc = message.getISourceLocation();
+ ISourceLocation loc = message.getSourceLocation();
String context = null;
if (null != loc) {
File file = loc.getSourceFile();
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java
index 7fa623c0f..d1391b8a5 100644
--- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java
@@ -112,7 +112,7 @@ public abstract class CommandTestCase extends TestCase {
boolean found = false;
for (Iterator iter = errors.iterator(); iter.hasNext(); ) {
IMessage m = (IMessage)iter.next();
- if (m.getISourceLocation() != null && m.getISourceLocation().getLine() == line) {
+ if (m.getSourceLocation() != null && m.getSourceLocation().getLine() == line) {
found = true;
iter.remove();
}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java
index 7a5a306a9..e8cd9ab21 100644
--- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java
@@ -336,7 +336,7 @@ public class IncrementalCase { // XXX NOT bound to junit - bridge tests?
final int expLine = exp[i];
boolean found = false;
for (int j = 0; !found && (j < messages.length); j++) {
- ISourceLocation sl = messages[j].getISourceLocation();
+ ISourceLocation sl = messages[j].getSourceLocation();
found = ((null != sl) && (expLine == sl.getLine()));
if (found) {
info(handler, "found " + label + " for: " + exp[i]);
diff --git a/testing/src/org/aspectj/testing/util/BridgeUtil.java b/testing/src/org/aspectj/testing/util/BridgeUtil.java
index 325656e84..10117c398 100644
--- a/testing/src/org/aspectj/testing/util/BridgeUtil.java
+++ b/testing/src/org/aspectj/testing/util/BridgeUtil.java
@@ -105,7 +105,7 @@ public class BridgeUtil {
+ KIND_DELIM
+ message.getMessage()
+ MESSAGE_DELIM
- + message.getISourceLocation(); // XXX implement
+ + message.getSourceLocation(); // XXX implement
}
@@ -247,8 +247,8 @@ public class BridgeUtil {
if (0 != result) {
return result;
}
- ISourceLocation sl1 = one.getISourceLocation();
- ISourceLocation sl2 = two.getISourceLocation();
+ ISourceLocation sl1 = one.getSourceLocation();
+ ISourceLocation sl2 = two.getSourceLocation();
return WEAK_ISourceLocation.compare(sl1, sl2);
}
};
@@ -267,8 +267,8 @@ public class BridgeUtil {
}
IMessage rhs_m= (IMessage) o1;
IMessage lhs_m = (IMessage) o2;
- ISourceLocation rhs_sl = rhs_m.getISourceLocation();
- ISourceLocation lhs_sl = lhs_m.getISourceLocation();
+ ISourceLocation rhs_sl = rhs_m.getSourceLocation();
+ ISourceLocation lhs_sl = lhs_m.getSourceLocation();
result = MEDIUM_ISourceLocation.compare(lhs_sl, rhs_sl);
if (0 != result) {
return result;
diff --git a/testing/src/org/aspectj/testing/xml/SoftMessage.java b/testing/src/org/aspectj/testing/xml/SoftMessage.java
index d064fa001..c5eb95489 100644
--- a/testing/src/org/aspectj/testing/xml/SoftMessage.java
+++ b/testing/src/org/aspectj/testing/xml/SoftMessage.java
@@ -96,7 +96,7 @@ public class SoftMessage implements IMessage { // XXX mutable dup of Message
if (null != value) {
out.printAttribute("message", value);
}
- ISourceLocation sl = message.getISourceLocation();
+ ISourceLocation sl = message.getSourceLocation();
if (null != sl) {
out.endAttributes();
SoftSourceLocation.writeXml(out, sl);
@@ -204,7 +204,7 @@ public class SoftMessage implements IMessage { // XXX mutable dup of Message
* @return ISourceLocation associated with this message,
* a mock-up if file or line is available, or null if none
*/
- final public ISourceLocation getISourceLocation() {
+ final public ISourceLocation getSourceLocation() {
if ((null == sourceLocation)
&& ((null != file) || (line != Integer.MAX_VALUE))) {
File f = (null == file ? NO_FILE : new File(file));
@@ -270,7 +270,7 @@ public class SoftMessage implements IMessage { // XXX mutable dup of Message
result.append(messageString);
}
- ISourceLocation loc = getISourceLocation();
+ ISourceLocation loc = getSourceLocation();
if ((null != loc) && (loc != ISourceLocation.NO_FILE)) {
result.append(" at " + loc);
}
diff --git a/testing/testsrc/org/aspectj/testing/harness/bridge/AjcSpecTest.java b/testing/testsrc/org/aspectj/testing/harness/bridge/AjcSpecTest.java
index 2c3c46e98..c55b0a894 100644
--- a/testing/testsrc/org/aspectj/testing/harness/bridge/AjcSpecTest.java
+++ b/testing/testsrc/org/aspectj/testing/harness/bridge/AjcSpecTest.java
@@ -299,7 +299,7 @@ public class AjcSpecTest extends TestCase {
assertTrue(lhs.getKind() == rhs.getKind());
same(lhs.getMessage(), rhs.getMessage(), a);
assertEquals(lhs.getThrown(), rhs.getThrown());
- sameSourceLocation(lhs.getISourceLocation(), rhs.getISourceLocation(), a);
+ sameSourceLocation(lhs.getSourceLocation(), rhs.getSourceLocation(), a);
}
public static void sameSourceLocation(ISourceLocation lhs, ISourceLocation rhs, Assert a) {