]> source.dussan.org Git - aspectj.git/commitdiff
265356: positional info for anno style messages
authoraclement <aclement>
Wed, 8 Apr 2009 17:28:06 +0000 (17:28 +0000)
committeraclement <aclement>
Wed, 8 Apr 2009 17:28:06 +0000 (17:28 +0000)
tests/bugs165/pr265356/Main.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java
tests/src/org/aspectj/systemtest/ajc165/ajc165.xml

diff --git a/tests/bugs165/pr265356/Main.java b/tests/bugs165/pr265356/Main.java
new file mode 100644 (file)
index 0000000..62a795d
--- /dev/null
@@ -0,0 +1,16 @@
+import org.aspectj.lang.annotation.*;
+
+import java.util.Date;
+
+@Aspect
+public class Main {
+  @Pointcut("execution(java.util.Date foo())") 
+  public void pc() {}
+
+  @Before("pc()")
+  public void log() {}
+
+  @Before("execution(List goo())")
+  public void log2() {} 
+}
+
index d85a29889e43312b3b5ed798a03f13ba68832db7..44dd8c9ac3833557e3f58f660fc4302e5aea41b8 100644 (file)
 package org.aspectj.systemtest.ajc165;
 
 import java.io.File;
+import java.util.List;
 
 import junit.framework.Test;
 
 import org.aspectj.testing.XMLBasedAjcTestCase;
+import org.aspectj.weaver.LintMessage;
 
 public class Ajc165Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
 
+       public void testAnnotationStyle_pr265356() {
+               runTest("annotation style message positions");
+               List ms = ajc.getLastCompilationResult().getWarningMessages();
+               boolean checked = true;
+               // Look for the message relating to 'List' and check the offsets
+               for (int i = 0; i < ms.size(); i++) {
+                       LintMessage m = (LintMessage) ms.get(i);
+                       if (m.toString().indexOf("List") != -1) {
+                               assertEquals(237, m.getSourceStart());
+                               assertEquals(240, m.getSourceEnd());
+                               checked = true;
+                       }
+               }
+               assertTrue("Failed to check the message", checked);
+       }
+
        public void testAroundCall_pr271169() {
                runTest("around call npe");
        }
index d0f866e19f718d1eb3da4bbc4d9fac70422d1731..aa237128889a731346fc70c4e503711b89f39a7a 100644 (file)
@@ -2,6 +2,14 @@
 
 <suite>
 
+   <ajc-test dir="bugs165/pr265356" title="annotation style message positions">
+     <compile files="Main.java" options="-1.5">
+       <message kind="warning" line="11"/>
+       <message kind="warning" line="13"/>
+       <message kind="warning" line="14"/>
+     </compile>
+   </ajc-test>
+
    <ajc-test dir="bugs165/pr271169" title="around call npe">
      <compile files="HypChecksums.java" options="-1.5"/>
    </ajc-test>