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

Remove IntelliJ JUnit 4 compatibility layer #146

Open
AB-xdev opened this issue Sep 19, 2024 · 4 comments
Open

Remove IntelliJ JUnit 4 compatibility layer #146

AB-xdev opened this issue Sep 19, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@AB-xdev
Copy link
Member

AB-xdev commented Sep 19, 2024

While performing xdev-software/intellij-plugin-template#47 we encountered:
https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-faq.html#junit5-test-framework-refers-to-junit4
https://youtrack.jetbrains.com/issue/IJPL-159134

This is currently worked around by a compatibility layer that was chosen in favor of importing the JUnit4 library as this usually leads to incorrect imports.

https://youtrack.jetbrains.com/issue/IJPL-159134 was fixed in IDEA 2024.3+ (unreleased as of Sept 2024).
Once the minimal plugin version is >= 2024.3 this can be rechecked and eventually removed.

@AB-xdev AB-xdev added the bug Something isn't working label Sep 19, 2024
@AB-xdev AB-xdev changed the title Remove IntelliJ JUnit4 compatibility layer Remove IntelliJ JUnit 4 compatibility layer Sep 19, 2024
@AB-xdev AB-xdev changed the title Remove IntelliJ JUnit 4 compatibility layer Remove IntelliJ JUnit 4 compatibility layer [2024.3+] Sep 19, 2024
@AB-xdev AB-xdev self-assigned this Oct 11, 2024
@AB-xdev
Copy link
Member Author

AB-xdev commented Oct 11, 2024

Nothing was changed inside IntelliJ classes in 2024.3 EAP, however the issue was closed as "Fixed".
Problem is still present.

Let's wait some time maybe the change is still stuck somewhere...

@AB-xdev AB-xdev changed the title Remove IntelliJ JUnit 4 compatibility layer [2024.3+] Remove IntelliJ JUnit 4 compatibility layer Oct 11, 2024
@AB-xdev
Copy link
Member Author

AB-xdev commented Oct 11, 2024

Apparently this was the "fix".
I see no code that fixes anything in there...

JUnit5TestSessionListener still references a JUnit4 TestCase (UsefulTestCase).

@AB-xdev AB-xdev removed their assignment Oct 11, 2024
@AB-xdev
Copy link
Member Author

AB-xdev commented Dec 9, 2024

This was maybe fixed with https://github.com/JetBrains/intellij-platform-gradle-plugin/releases/tag/2.2.0

  • Make IntelliJ Platform dependencies available to testImplementation by default to avoid mutating tests classpath
  • For running testing, use test sandbox instead of compiled classes from build/classes directory

@AB-xdev
Copy link
Member Author

AB-xdev commented Dec 9, 2024

This was maybe fixed with https://github.com/JetBrains/intellij-platform-gradle-plugin/releases/tag/2.2.0

  • Make IntelliJ Platform dependencies available to testImplementation by default to avoid mutating tests classpath
  • For running testing, use test sandbox instead of compiled classes from build/classes directory
Nope, still not working
org.gradle.api.internal.tasks.testing.TestSuiteExecutionException: Could not start Gradle Test Executor 1.
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.startProcessing(SuiteTestClassProcessor.java:45)
	at java.base@21.0.5/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base@21.0.5/java.lang.reflect.Method.invoke(Method.java:580)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:92)
	at jdk.proxy1/jdk.proxy1.$Proxy4.startProcessing(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$1.run(TestWorker.java:168)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:132)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:103)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:63)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:121)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
Caused by: java.util.ServiceConfigurationError: org.junit.platform.launcher.LauncherSessionListener: Provider com.intellij.tests.JUnit5TestSessionListener could not be instantiated
	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:586)
	at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:813)
	at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:729)
	at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1403)
	at java.base/java.lang.Iterable.forEach(Iterable.java:74)
	at org.junit.platform.launcher.core.LauncherFactory.createLauncherSessionListener(LauncherFactory.java:169)
	at org.junit.platform.launcher.core.LauncherFactory.lambda$openSession$0(LauncherFactory.java:101)
	at org.junit.platform.launcher.core.DefaultLauncherSession.<init>(DefaultLauncherSession.java:52)
	at org.junit.platform.launcher.core.LauncherFactory.openSession(LauncherFactory.java:100)
	at org.junit.platform.launcher.core.LauncherFactory.openSession(LauncherFactory.java:82)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$BackwardsCompatibleLauncherSession.open(JUnitPlatformTestClassProcessor.java:323)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.createTestExecutor(JUnitPlatformTestClassProcessor.java:86)
	at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.startProcessing(AbstractJUnitTestClassProcessor.java:44)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.startProcessing(SuiteTestClassProcessor.java:43)
	... 16 more
Caused by: java.lang.NoClassDefFoundError: junit/framework/TestCase
...

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