Skip to content

Commit 59fef88

Browse files
committed
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 <[email protected]>
1 parent 97d8f73 commit 59fef88

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public static UnresolvedType createTypeFromSignature(String signature) {
152152
return new UnresolvedType(signature, signatureErasure, typeParams);
153153
}
154154
// can't replace above with convertSigToType - leads to stackoverflow
155-
} else if ((firstChar == '?' || firstChar == '*') && signature.length()==1) {
155+
} else if (firstChar == '*' && signature.length()==1) {
156156
return WildcardedUnresolvedType.QUESTIONMARK;
157157
} else if (firstChar == '+') {
158158
// ? extends ...

org.aspectj.matcher/src/main/java/org/aspectj/weaver/UnresolvedType.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ public static UnresolvedType forSignature(String signature) {
418418
return TypeFactory.createTypeFromSignature(signature);
419419
case '-':
420420
return TypeFactory.createTypeFromSignature(signature);
421-
case '?':
421+
case '*':
422422
return TypeFactory.createTypeFromSignature(signature);
423423
case 'T':
424424
return TypeFactory.createTypeFromSignature(signature);
@@ -746,7 +746,7 @@ private static String nameToSignature(String name) {
746746
return "C";
747747
}
748748
if (name.equals("?")) {
749-
return name;
749+
return "*";
750750
}
751751
}
752752
if (len == 0) {

0 commit comments

Comments
 (0)