byte-buddy icon indicating copy to clipboard operation
byte-buddy copied to clipboard

BUG: instrumentation error

Open YongwuHe opened this issue 2 years ago • 3 comments

@raphw

lombok.NonNull

@Override
public Collection<?> fuzzyQueryCity(@NonNull String name) {
}

@Override
public Map<Long, CityBasicData> batchSearchCity(@NonNull List<Long> IdList, @NonNull String language) {
}

When I try to modify this method (batchSearchCity), the following exception is thrown. What is the reason?


 ERROR TransformListener - onError: loaded: false from classLoader ParallelWebappClassLoader
  context: ROOT
  delegate: false
----------> Parent Classloader:
, throwable: java.lang.IllegalStateException: Illegal type annotations on parameter java.lang.String arg0 for public java.util.Collection fuzzyQueryCity(java.lang.String)

YongwuHe avatar Feb 02 '24 10:02 YongwuHe

I assume this is a Lombock issue. The exception states what the issue is. You can ignore this if you only want to decorate classes (apply Advice) by setting DECORATE as a type strategy.

raphw avatar Feb 02 '24 15:02 raphw

@raphw My question is why this type of method cannot be decorated.

YongwuHe avatar Feb 04 '24 02:02 YongwuHe

Byte Buddy resolves the type to a type description. Doing so it discovers that fuzzyQueryCity(java.lang.String) has a type annotation on its first parameter that is not legally defined to be added on a parameter.

raphw avatar Feb 04 '24 07:02 raphw