diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2023-01-17 14:49:54 +0100 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2024-04-12 14:19:06 +0200 |
commit | 59fef88ca15bf9b90758067dee2e3b1e321645f2 (patch) | |
tree | 9d825e751127ad5a996a7c771d02b6c5f7779b40 /org.aspectj.matcher | |
parent | 97d8f7339e18af21927065509e549cb2e3cad393 (diff) | |
download | aspectj-59fef88ca15bf9b90758067dee2e3b1e321645f2.tar.gz aspectj-59fef88ca15bf9b90758067dee2e3b1e321645f2.zip |
UnresolvedType: fix JVM signature conversion
Fixes #211. Previously, '?' was not converted to '*' in
UnresolvedType.nameToSignature, but kept as-is. That is why - falsely -
it was necessary to handle the '?' case in UnresolvedType.forSignature
at all, reading this kind of bogus signature and creating a type for it
in TypeFactory.createTypeFromSignature. This, ironically, led to correct
JVM generic type signatures containing '*' not being handled at all.
The conversion should now work correctly both ways.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r-- | org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java | 2 | ||||
-rw-r--r-- | org.aspectj.matcher/src/main/java/org/aspectj/weaver/UnresolvedType.java | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java index 3d4c0d46d..c5326b80e 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java @@ -152,7 +152,7 @@ public class TypeFactory { return new UnresolvedType(signature, signatureErasure, typeParams); } // can't replace above with convertSigToType - leads to stackoverflow - } else if ((firstChar == '?' || firstChar == '*') && signature.length()==1) { + } else if (firstChar == '*' && signature.length()==1) { return WildcardedUnresolvedType.QUESTIONMARK; } else if (firstChar == '+') { // ? extends ... diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/UnresolvedType.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/UnresolvedType.java index d0611868f..37780023c 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/UnresolvedType.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/UnresolvedType.java @@ -418,7 +418,7 @@ public class UnresolvedType implements Traceable, TypeVariableDeclaringElement { return TypeFactory.createTypeFromSignature(signature); case '-': return TypeFactory.createTypeFromSignature(signature); - case '?': + case '*': return TypeFactory.createTypeFromSignature(signature); case 'T': return TypeFactory.createTypeFromSignature(signature); @@ -746,7 +746,7 @@ public class UnresolvedType implements Traceable, TypeVariableDeclaringElement { return "C"; } if (name.equals("?")) { - return name; + return "*"; } } if (len == 0) { |