Skip to content

Commit 2bb5fbc

Browse files
kindlichclaude
andcommitted
Use the upper bound for out-wildcards in internal names and descriptors
JavaTypeInternalNameVisitor mapped every `out X` wildcard to java/lang/Object, so values typed `out Parent` were checkcast to Object and calling Parent's methods on them failed bytecode verification. JavaTypeDescriptorVisitor recursed into itself instead of the bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent ca73b27 commit 2bb5fbc

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaTypeDescriptorVisitor.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public String visitWildcardIn(WildcardInTypeID type) {
159159

160160
@Override
161161
public String visitWildcardOut(WildcardOutTypeID type) {
162-
return type.accept(this);
162+
return type.upperBound.accept(this);
163163
}
164164

165165
@Override

‎JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaTypeInternalNameVisitor.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public String visitWildcardIn(WildcardInTypeID type) {
143143

144144
@Override
145145
public String visitWildcardOut(WildcardOutTypeID type) {
146-
return "java/lang/Object";
146+
return type.upperBound.accept(this);
147147
}
148148

149149
@Override

0 commit comments

Comments
 (0)