aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2023-06-26 08:11:38 +0200
committerAlexander Kriegisch <Alexander@Kriegisch.name>2023-06-26 13:48:27 +0700
commitdb76c175037c10ce21fc8f7fe681162e31082445 (patch)
treec722587c4fb6bc229c28e744dea918dc6f003e3d
parent00998fd4b23ad0d3e0cd292127297e0fb249c36f (diff)
downloadaspectj-db76c175037c10ce21fc8f7fe681162e31082445.tar.gz
aspectj-db76c175037c10ce21fc8f7fe681162e31082445.zip
Add method ArrayReferenceType.equals to fix failing tests
This also fixes a bug. Previously, ResolvedType.equals was used for equality check, and in there is a '==' comparison, which does not work for two different ArrayReferenceType instances, even if the component type is the same. Relates to #246. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/ArrayReferenceType.java8
-rw-r--r--tests/bugs1920/github_246/ITDAspect.aj10
-rw-r--r--tests/src/test/resources/org/aspectj/systemtest/ajc1920/ajc1920.xml4
3 files changed, 21 insertions, 1 deletions
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ArrayReferenceType.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ArrayReferenceType.java
index 23aaa2e5e..76d947e76 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ArrayReferenceType.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ArrayReferenceType.java
@@ -208,4 +208,12 @@ public class ArrayReferenceType extends ReferenceType {
return false;
}
}
+
+ @Override
+ public boolean equals(Object other) {
+ if (other instanceof ArrayReferenceType)
+ return componentType.equals(((ArrayReferenceType) other).componentType);
+ return super.equals(other);
+ }
+
}
diff --git a/tests/bugs1920/github_246/ITDAspect.aj b/tests/bugs1920/github_246/ITDAspect.aj
index fffef1651..7e4f30e3f 100644
--- a/tests/bugs1920/github_246/ITDAspect.aj
+++ b/tests/bugs1920/github_246/ITDAspect.aj
@@ -10,4 +10,14 @@ public aspect ITDAspect {
public int App.foo(int parameter) {
return parameter + 3;
}
+
+ public void App.foo(String... parameters) { }
+
+ @Second
+ public int App.foo(int... parameters) {
+ int sum = 0;
+ for (int parameter : parameters)
+ sum += parameter;
+ return sum;
+ }
}
diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1920/ajc1920.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1920/ajc1920.xml
index 2026df491..9f072c86d 100644
--- a/tests/src/test/resources/org/aspectj/systemtest/ajc1920/ajc1920.xml
+++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1920/ajc1920.xml
@@ -181,8 +181,10 @@
<compile files="First.java Second.java App.java ITDAspect.aj" options="-8"/>
<run class="App">
<stdout>
- <line text="[@First(), @Second()] public void App.foo(java.lang.Object)"/>
+ <line text="[@Second()] public int App.foo(int[])"/>
<line text="[@First()] public void App.foo(java.lang.String)"/>
+ <line text="[] public void App.foo(java.lang.String[])"/>
+ <line text="[@First(), @Second()] public void App.foo(java.lang.Object)"/>
<line text="[@Second()] public int App.foo(int)"/>
</stdout>
</run>