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

Tests fail with cannot access class sun.awt.AWTAutoShutdown #1360

Closed
Undin opened this issue Apr 3, 2023 · 9 comments
Closed

Tests fail with cannot access class sun.awt.AWTAutoShutdown #1360

Undin opened this issue Apr 3, 2023 · 9 comments
Assignees
Labels
Milestone

Comments

@Undin
Copy link
Contributor

Undin commented Apr 3, 2023

Describe the bug

When I try to use gradle-intellij-plugin 1.13.3/1.13.4-SNAPSHOT, tests start failing with the following exception

Stacktrace
class com.intellij.testFramework.UITestUtil (in unnamed module @0x61001b64) cannot access class sun.awt.AWTAutoShutdown (in module java.desktop) because module java.desktop does not export sun.awt to unnamed module @0x61001b64
java.lang.IllegalAccessError: class com.intellij.testFramework.UITestUtil (in unnamed module @0x61001b64) cannot access class sun.awt.AWTAutoShutdown (in module java.desktop) because module java.desktop does not export sun.awt to unnamed module @0x61001b64
	at com.intellij.testFramework.UITestUtil.replaceIdeEventQueueSafely(UITestUtil.java:73)
	at com.intellij.testFramework.UsefulTestCase.runBare(UsefulTestCase.java:484)
	at com.intellij.testFramework.UsefulTestCase.runBare(UsefulTestCase.java:477)
	at junit.framework.TestResult$1.protect(TestResult.java:122)
	at junit.framework.TestResult.runProtected(TestResult.java:142)
	at junit.framework.TestResult.run(TestResult.java:125)
	at junit.framework.TestCase.run(TestCase.java:130)
	at junit.framework.TestSuite.runTest(TestSuite.java:241)
	at junit.framework.TestSuite.run(TestSuite.java:236)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:108)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:57)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:39)
	at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:52)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	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:94)
	at jdk.proxy1/jdk.proxy1.$Proxy2.processTestClass(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)

Everything works fine with 1.13.1

To Reproduce

Try to run any test (for example, org.rust.lang.core.completion.RsAttributeCompletionTest#test derive on struct) using this commit

Expected behavior
Tests pass without cannot access class errors

Environment:

  • OS: macOS x64 12.5.1
  • Gradle IntelliJ Plugin Version: 1.13.3/1.13.4-SNAPSHOT
  • Gradle Version:7.6
@Undin Undin added the bug label Apr 3, 2023
hsz added a commit that referenced this issue Jun 15, 2023
Move jvmArgs calculation inside Test doFirst block to fix the issue with incorrect JVM args for running tests (#1360). This ensures the correct values are used when executing tests.
@hsz hsz added this to the 1.14.2 milestone Jun 15, 2023
@hsz
Copy link
Member

hsz commented Jun 15, 2023

Thanks, fixed!

@hsz hsz closed this as completed Jun 15, 2023
@hsz hsz self-assigned this Jun 15, 2023
@kirillk
Copy link

kirillk commented Jun 24, 2023

@hsz When this fix is going to be released? I can't run my tests.

@hsz
Copy link
Member

hsz commented Jun 24, 2023

Next week, but as for now you cash use the snapshot release.

@kirillk
Copy link

kirillk commented Jun 24, 2023

@hsz what's the repo, this? https://www.jetbrains.com/intellij-repository/snapshots
I don't see anything like 1.14.2-SNAPSHOT

@hsz
Copy link
Member

hsz commented Jun 24, 2023

Please see docs: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#snapshot-release

@kirillk
Copy link

kirillk commented Jun 24, 2023

@hsz Are you sure it's in the snapshot release now? I tried to use the snapshot, refreshed all deps, it apparently got the snapshot but tests fails exactly with the same error like in the original report.

@hsz
Copy link
Member

hsz commented Jun 24, 2023

Yes, the snapshot release makes the failing tests green.
@Undin could you please confirm?

@kirillk
Copy link

kirillk commented Jun 24, 2023

@hsz With snapshot I have therunIde task failing with debug. Rolling back to 1.14.1 fixes it. So the snapshot is no use for me.

Error occurred during initialization of VM
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
agent library failed to init: jdwp

Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.

Execution failed for task ':vcs-hub-intellij-plugin:runIde'.
> Process 'command '/Users/kkalishev/.gradle/caches/modules-2/files-2.1/com.jetbrains/jbre/jbr_jcef-17.0.7-osx-aarch64-b829.16/extracted/jbr_jcef-17.0.7-osx-aarch64-b829.16/Contents/Home/bin/java'' finished with non-zero exit value 1```

@hsz
Copy link
Member

hsz commented Jun 26, 2023

@kirillk Could you please try the 1.14.2-SNAPSHOT once again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants