Skip to content

Commit

Permalink
Fix an invalid signature (#33984)
Browse files Browse the repository at this point in the history
This code is creating a field with the same type as a method return
type. The return type is erased, but calling `getGenericSignature()`
turns the erased type back into a generic type. For methods with type
parameters, this results in signatures that are invalid for field
declarations, for example
`<T:Ljava/lang/Object;>Ljava/lang/Object;Ljava/io/Serializable;`. Future
versions of bytebuddy reject the invalid signature.

See also raphw/byte-buddy#1771
  • Loading branch information
cushon authored Feb 13, 2025
1 parent ca01010 commit e651aed
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ public StackManipulation.Size apply(MethodVisitor mv, Context context) {
mv.visitLocalVariable(
"res",
returnType.getDescriptor(),
returnType.getGenericSignature(),
null,
wrapStart,
wrapEnd,
returnVarIndex);
Expand Down

0 comments on commit e651aed

Please sign in to comment.