dodie / scott

Never debug a test again: Detailed failure reports and hassle free assertions for Java tests - Power Asserts for Java
https://advancedweb.hu/junit-and-cucumber-test-reports-based-on-source-code-and-behavior/
MIT License
137 stars 17 forks source link

java.lang.TypeNotPresentException when instrumenting class that refers classes that are not on the classpath #79

Closed dodie closed 5 years ago

dodie commented 5 years ago

When instrumenting a class programmatically (see section "Transform the classes after compilation" in Manual setup) that refers to type that is not on the build-time class path, the following exception occurs:

caused by: java.lang.TypeNotPresentException: Type ... not present
   ...
   hu.advancedweb.scott.instrumentation.transformation.StateTrackingMethodVisitor.visitMaxs(StateTrackingMethodVisitor.java:229)
dodie commented 5 years ago

Possible solution : https://discuss.gradle.org/t/module-dependencies-for-a-specific-task/10589/2 Another approach: https://stackoverflow.com/questions/24899385/gradle-how-to-add-a-custom-task-after-compilation-but-before-packaging-files-in

Also, if possible try to make the code robust to tolerate such cases.