From 9ed75a10abaca8a6c8569ead1b74eaaadc980b07 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 21 Nov 2005 16:33:56 +0000 Subject: [PATCH] test and fix for 115607 (declare @type): patch from helen. --- .../compiler/lookup/EclipseSourceLocation.java | 2 ++ tests/bugs150/pr115607.java | 7 +++++++ .../org/aspectj/systemtest/ajc150/Ajc150Tests.java | 14 +++++++++++++- tests/src/org/aspectj/systemtest/ajc150/ajc150.xml | 9 +++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 tests/bugs150/pr115607.java diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java index 6b395c6e0..2a4329fe5 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java @@ -88,6 +88,8 @@ public class EclipseSourceLocation implements ISourceLocation { } else { column = 0; } + } else if (0 < lineNumber && lineNumber == result.lineSeparatorPositions.length) { + column = 0; } } return column; diff --git a/tests/bugs150/pr115607.java b/tests/bugs150/pr115607.java new file mode 100644 index 000000000..dfbcd28b7 --- /dev/null +++ b/tests/bugs150/pr115607.java @@ -0,0 +1,7 @@ +@interface I {} + +class Simple {} + +public aspect pr115607 { + declare @type: Simple : @I; +} \ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java index 253a9fe72..4a2ff9f6b 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java @@ -77,6 +77,7 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testVarargsITD_pr110906() { runTest("ITD varargs problem");} public void testBadRenderer_pr86903() { runTest("bcelrenderer bad");} + // public void testSelfBoundGenerics_pr117296() { runTest("self bounding generic types");} public void testIncompatibleClassChangeError_pr113630_1() {runTest("IncompatibleClassChangeError - errorscenario");} public void testIncompatibleClassChangeError_pr113630_2() {runTest("IncompatibleClassChangeError - workingscenario");} @@ -731,7 +732,18 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testXlintMessageForImproperAnnotationType_pr115252_Parameter() {runTest("xlint message for improper annotated parameter type");} public void testXlintMessageForImproperAnnotationType_pr115252_Throws() {runTest("xlint message for improper annotated throws pattern");} public void testXlintMessageForImproperAnnotationType_pr115252_MoreThanOne() {runTest("xlint message for more than one improper annotated parameter type");} - + + public void testDeclareAtTypeInStructureModel_pr115607() { + AsmManager.setReporting("c:/debug.txt",true,true,true,true); + runTest("declare at type appears correctly in structure model"); + IHierarchy top = AsmManager.getDefault().getHierarchy(); + IProgramElement pe = top.findElementForLabel(top.getRoot(), + IProgramElement.Kind.DECLARE_ANNOTATION_AT_TYPE,"declare @type: Simple : @I"); + assertNotNull("Couldn't find 'declare @type: Simple : @I' element in the tree",pe); + List l = AsmManager.getDefault().getRelationshipMap().get(pe); + assertNotNull("Should have some relationships but does not",l); + } + // helper methods..... public SyntheticRepository createRepos(File cpentry) { diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index 5239733ca..8c9354fe4 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -52,6 +52,10 @@ + + + + @@ -1123,6 +1127,11 @@ + + + + + -- 2.39.5