Skip to content

Commit c99c593

Browse files
committed
override getDeclaredAnnotations
1 parent 8c244fd commit c99c593

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

apm-sniffer/bytebuddy-patch/src/main/java/net/bytebuddy/agent/builder/SWDescriptionStrategy.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@ public Generic getSuperClass() {
333333
return null;
334334
}
335335
this.superClass = new ForLoadedSuperClassWrapper(
336-
null,
337-
new SWTypeDescriptionWrapper(delegateSuperClass.asErasure(), this.nameTrait, null, delegateSuperClass.asErasure().getName())
336+
new SWTypeDescriptionWrapper(delegateSuperClass.asErasure(), this.nameTrait, null, delegateSuperClass.asErasure().getName()),
337+
delegateSuperClass
338338
);
339339
}
340340
return this.superClass;
@@ -368,15 +368,12 @@ public int getModifiers() {
368368

369369
static class ForLoadedSuperClassWrapper extends TypeDescription.Generic.LazyProjection.ForLoadedSuperClass {
370370
private final TypeDescription delegation;
371+
private final TypeDescription.Generic superGeneric;
371372

372-
/**
373-
* Creates a new lazy projection of a type's super class.
374-
*
375-
* @param type The type of which the super class is represented.
376-
*/
377-
protected ForLoadedSuperClassWrapper(Class<?> type, TypeDescription delegation) {
378-
super(type);
373+
protected ForLoadedSuperClassWrapper(TypeDescription delegation, TypeDescription.Generic superGeneric) {
374+
super(null); // HACK: a trick here since type is not used anywhere in the wrapper
379375
this.delegation = delegation;
376+
this.superGeneric = superGeneric;
380377
}
381378

382379
@Override
@@ -388,6 +385,11 @@ protected TypeDescription.Generic resolve() {
388385
public TypeDescription asErasure() {
389386
return this.delegation;
390387
}
388+
389+
@Override
390+
public AnnotationList getDeclaredAnnotations() {
391+
return superGeneric.getDeclaredAnnotations();
392+
}
391393
}
392394

393395
static class TypeCache {

0 commit comments

Comments
 (0)