From 162cda91a384d790cd17373c9b411dddf55b5a17 Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 8 Apr 2009 17:28:06 +0000 Subject: [PATCH] 265356: positional info for anno style messages --- tests/bugs165/pr265356/Main.java | 16 ++++++++++++++++ .../aspectj/systemtest/ajc165/Ajc165Tests.java | 18 ++++++++++++++++++ .../org/aspectj/systemtest/ajc165/ajc165.xml | 8 ++++++++ 3 files changed, 42 insertions(+) create mode 100644 tests/bugs165/pr265356/Main.java diff --git a/tests/bugs165/pr265356/Main.java b/tests/bugs165/pr265356/Main.java new file mode 100644 index 000000000..62a795d65 --- /dev/null +++ b/tests/bugs165/pr265356/Main.java @@ -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() {} +} + diff --git a/tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java b/tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java index d85a29889..44dd8c9ac 100644 --- a/tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java @@ -11,13 +11,31 @@ 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"); } diff --git a/tests/src/org/aspectj/systemtest/ajc165/ajc165.xml b/tests/src/org/aspectj/systemtest/ajc165/ajc165.xml index d0f866e19..aa2371288 100644 --- a/tests/src/org/aspectj/systemtest/ajc165/ajc165.xml +++ b/tests/src/org/aspectj/systemtest/ajc165/ajc165.xml @@ -2,6 +2,14 @@ + + + + + + + + -- 2.39.5