Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Instrumentation breaks test suites that use inheritance #30

Open
delsner opened this issue Jun 19, 2022 · 2 comments
Open

[Bug] Instrumentation breaks test suites that use inheritance #30

delsner opened this issue Jun 19, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@delsner
Copy link
Contributor

delsner commented Jun 19, 2022

When instrumenting with sys.trace,test.trace, the test instrumentation breaks test cases that inherit from an (abstract) super test class:

[ERROR] [Byte Buddy] ERROR some.TestSuiteImpl [jdk.internal.loader.ClassLoaders$AppClassLoader@2f333739, unnamed module @535779e4, Thread[main,5,main], loaded=false]
[ERROR] net.bytebuddy.shaded.pool.TypePool$Resolution$NoSuchTypeException: Cannot resolve type description for some.AbstractTestSuite
@delsner
Copy link
Contributor Author

delsner commented Jun 19, 2022

This could also be related to the way the test suite is initialized (e.g., through DI).

@delsner delsner added the bug Something isn't working label Jun 19, 2022
@delsner
Copy link
Contributor Author

delsner commented Jun 20, 2022

Maybe this is related to this post.

If you substitute your hasSuperType(named(...)) matcher with just named(...), it might work without errors as this is where the error seems to happen. Byte Buddy needs to resolve all classes in a class hierarchy for being able to apply this matcher what seems to be impossible in your case.

[ERROR] 	at net.bytebuddy.shaded.pool.TypePool$Resolution$Illegal.resolve(TypePool.java:167)
[ERROR] 	at net.bytebuddy.shaded.pool.TypePool$Default$WithLazyResolution$LazyTypeDescription.delegate(TypePool.java:1088)
[ERROR] 	at net.bytebuddy.shaded.description.type.TypeDescription$AbstractBase$OfSimpleType$WithDelegation.getSuperClass(TypeDescription.java:8351)
[ERROR] 	at net.bytebuddy.shaded.description.type.TypeDescription$Generic$OfNonGenericType.getSuperClass(TypeDescription.java:3602)
[ERROR] 	at net.bytebuddy.shaded.description.type.TypeDefinition$SuperClassIterator.next(TypeDefinition.java:391)
[ERROR] 	at net.bytebuddy.shaded.description.type.TypeDefinition$SuperClassIterator.next(TypeDefinition.java:357)
[ERROR] 	at net.bytebuddy.shaded.matcher.HasSuperTypeMatcher.doMatch(HasSuperTypeMatcher.java:54)
[ERROR] 	at net.bytebuddy.shaded.matcher.HasSuperTypeMatcher.doMatch(HasSuperTypeMatcher.java:32)
[ERROR] 	at net.bytebuddy.shaded.matcher.ElementMatcher$Junction$ForNonNullValues.matches(ElementMatcher.java:249)
[ERROR] 	at net.bytebuddy.shaded.matcher.ElementMatcher$Junction$Disjunction.matches(ElementMatcher.java:214)
[ERROR] 	at net.bytebuddy.shaded.agent.builder.AgentBuilder$RawMatcher$ForElementMatchers.matches(AgentBuilder.java:1833)
[ERROR] 	at net.bytebuddy.shaded.agent.builder.AgentBuilder$Default$ExecutingTransformer.doTransform(AgentBuilder.java:11870)

@delsner delsner changed the title [Bugfix] Instrumentation breaks test suites that use inheritance [Bug] Instrumentation breaks test suites that use inheritance Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant