You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a test using a simple launcher interceptor, test passes if it is executed with the IDE Junit configuration but fails with the IDE Gradle configuration or ./gradlew test command-line execution. I'm not sure if this issue falls on Junit or Gradle BT. Please, let me know if I should close this issue and create a new one with Gradle.
The text was updated successfully, but these errors were encountered:
cdsap
changed the title
Test using LauncherInterceptor fails when is executed with Gradle
Test using LauncherInterceptor fails when executed with Gradle
Mar 25, 2024
That's caused by Gradle callingselectClass(Class) after loading the class with the default class loader early to perform some checks.
If Gradle would call selectClass(String), it would work. Switching those checks to read the bytecode instead of using reflection would avoid initializing the class potentially multiple times. However, using ASM for that should be avoided since newer JDK require upgrading. The Class-File API would avoid that in the future. I'll leave the decision whether to open an issue in the Gradle repo up to you.
As a workaround, you can replace the ClassLoader in the constructor of CustomLauncherInterceptor rather than in intercept().
In a test using a simple launcher interceptor, test passes if it is executed with the IDE Junit configuration but fails with the IDE Gradle configuration or
./gradlew test
command-line execution. I'm not sure if this issue falls on Junit or Gradle BT. Please, let me know if I should close this issue and create a new one with Gradle.Having the following LauncherInterceptor:
where the
ExampleClassLoader
is:the expected results for the test:
is passing when executing from the IDE and gradle command:
However, the result with Gradle execution is:
(interceptors has been enabled in the platform properties and CustomLauncherInterceptor registered in the services file)
Steps to reproduce
CustomClassLoaderTest
with Junit Configuration in the IDE. Test passes.CustomClassLoaderTest
with Gradle configuration or command-line gradle command. Test fails.Context
Deliverables
The text was updated successfully, but these errors were encountered: