The value from type.getCanonicalText() is BigDecimal when code is built using IntelliJ version 2024.2.
I believe this is a breaking change for us. Is there any documentation on this change? Is the fully qualified name available through another method, or is there another way to verify that the type is unambiguously java.math.BigDecimal rather than another class with the same simple name, BigDecimal ?
Is it rather possible, that the environment you’re testing has some differences (e.g. wrongly setup JDK)?
Using com.intellij.psi.PsiType#equalsToText with FQN of expected class should work reliably.
Thanks for the reply , there is no difference in the JDK setup between IntelliJ versions 2024.1 and 2024.2.
I tried using com.intellij.psi.PsiType#equalsToText(BIG_DECIMAL), but the condition failed. The value remains BigDecimal instead of java.math.BigDecimal in IntelliJ version 2024.2.
I also tried using Java version 21 for IntelliJ version 2024.2, but the issue persists.
While debugging, I checked the value of ((PsiClassReferenceType) type).getLanguageLevel() in both IntelliJ versions, and it returns JDK_1_8, as shown in the image below. Is there any relevance to this above issue?
Hello! I tried the following unit-test using the latest codebase of IntelliJ IDEA:
import com.intellij.psi.PsiField;
import com.intellij.psi.PsiType;
import com.intellij.psi.impl.source.PsiClassReferenceType;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.testFramework.LightProjectDescriptor;
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
import org.jetbrains.annotations.NotNull;
public final class CanonicalTextTest extends LightJavaCodeInsightFixtureTestCase {
@Override
protected @NotNull LightProjectDescriptor getProjectDescriptor() {
return JAVA_11;
}
public void testBigDecimal() {
myFixture.configureByText("A.java", """
import java.math.BigDecimal;
class A {
BigDecimal <caret>d;
}""");
PsiField field = PsiTreeUtil.getParentOfType(myFixture.getFile().findElementAt(myFixture.getCaretOffset()), PsiField.class);
PsiType type = field.getType();
assertNotNull(PsiUtil.resolveClassInClassTypeOnly(type));
assertEquals(PsiClassReferenceType.class, type.getClass());
assertEquals("java.math.BigDecimal", type.getCanonicalText());
}
}
It finishes successfully, so the canonical text looks generated correctly. It can be unqualified if the reference is unresolved. Probably this is your case? What is the result of PsiUtil.resolveClassInClassTypeOnly(type)?
I am wondering why the same project is working in intelij version 2024.1 and that case the value from PsiUtil.resolveClassInClassTypeOnly(type) is not null.
Hello,
I am getting the first value as null, and the second value as shown in the image below. I am getting the same values when I build using IntelliJ version 2024.1.
Mock JDK 1.7 does not contain the java.math package, so it’s naturally not resolved. I suggest using newer Mock JDK for tests. We have IdeaTestUtil.getMockJdk11 or IdeaTestUtil.getMockJdk21. These two are mocking the whole java.base module, including the java.math package. Instead of calling setupJdkForModule, you can do something like this:
// do this once
Sdk jdk11 = IdeaTestUtil.getMockJdk11();
WriteAction.runAndWait(() -> ProjectJdkTable.getInstance()
.addJdk(jdk11, getTestRootDisposable()));
// do this for every module
ModuleRootModificationUtil.setModuleSdk(module, jdk11);
The behavior of getCanonicalText() could change for unresolved types. This should not affect normal work when JDK is properly configured and you have no erroneous code in the editor.
I tried your code with IntelliJ version 2024.1 and encountered the following failure, but I could see PsiUtil.resolveClassInClassTypeOnly(type) is not null. But the test is failed due to below error.
Leaked SDKs: [java 11 Version:java 11 Path:(/Users/home/.m2/repository/org/jetbrains/mockjdk/mockjdk-base-java/11.0)]. Please remove leaking SDKs by e.g. ProjectJdkTable.getInstance().removeJdk() or by disposing the ProjectJdkImpl. Registration trace for 'java 11' is shown as the cause
java.lang.AssertionError: Leaked SDKs: [java 11 Version:java 11 Path:(/Users/home/.m2/repository/org/jetbrains/mockjdk/mockjdk-base-java/11.0)]. Please remove leaking SDKs by e.g. ProjectJdkTable.getInstance().removeJdk() or by disposing the ProjectJdkImpl. Registration trace for 'java 11' is shown as the cause
I tried the same code with IntelliJ version 2024.2 and encountered the failure that is PsiUtil.resolveClassInClassTypeOnly(type) is null, results in type.getCanonicalText() is simple name leads to unit test failure
When I build with IntelliJ version 2024.2 and call setupJdkForModule(module.getName());, I evaluate the expression ModuleRootManager.getInstance(getTestFixture().getModule()).getSdk(); and get the following SDK:
With IntelliJ version 2024.1, unit tests are passing. Could there be an issue with the internal SDK in IntelliJ 2024.2? (JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk())
Having internal JDK (17 or 21) is quite expected, and BigDecimal should be resolvable in both cases. However, in the previous comments you’ve said that your SDK is mockJDK-1.7, which would not work definitely. Probably some other code changes the JDK after setupJdkForModule? Try to put the breakpoint into com.intellij.openapi.roots.ModuleRootModificationUtil#setModuleSdk and see if you arrive there the second time with mockJDK-1.7.
Sorry, I want to clarify that the value mockJDK-1.7 is evaluated before the method setupJdkForModule(module.getName()). I evaluated the SDK after calling setupJdkForModule(), and in those cases, I got the values mentioned in my last message ( java 17 for intellij 2024.1 and java 21 for intellij 2024.2) . I checked both IntelliJ versions, and there are no scenarios where the value would be mockJDK-1.7 a second time.
I agree with what you said about mockJDK-1.7 not working, I checked this without calling setupJdkForModule().
In this case, with IntelliJ version 2024.1, all the tests passed. However, after building with IntelliJ version 2024.2 and running the same code, the unit tests did not start running; instead, they froze for 10 minutes and then failed with the following error in the logs.
Configuration file for j.u.l.LogManager does not exist: /Users/vaisakht/.gradle/caches/transforms-4/129f3540ae5bceea3b4a84f339c004d5/transformed/ideaIC-2024.2.3-aarch64/test-log.properties
SLF4J: Class path contains multiple SLF4J providers.
SLF4J: Found provider [org.slf4j.nop.NOPServiceProvider@723bd3d0]
SLF4J: Found provider [org.slf4j.jul.JULServiceProvider@4897175]
SLF4J: See https://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual provider is of type [org.slf4j.nop.NOPServiceProvider@723bd3d0]
[ 655] WARN - #c.i.s.ComponentManagerImpl - `preload=TRUE` must be used only for core services (service=org.jetbrains.idea.maven.project.MavenProjectsManagerEx, plugin=org.jetbrains.idea.maven)
[ 656] WARN - #c.i.s.ComponentManagerImpl - `preload=TRUE` must be used only for core services (service=org.jetbrains.idea.maven.navigator.MavenProjectsNavigator, plugin=org.jetbrains.idea.maven)
[ 656] WARN - #c.i.s.ComponentManagerImpl - `preload=TRUE` must be used only for core services (service=org.jetbrains.idea.maven.tasks.MavenShortcutsManager, plugin=org.jetbrains.idea.maven)
[ 1387] WARN - #o.j.i.maven - updateAllMavenProjects started: incremental=true, MavenProjectsManagerEx.addManagedFilesWithProfilesAndUpdate GeneratedAnnotation
[ 1395] WARN - #o.j.i.maven - ImportLogging. pomReadingStarted (1)
[ 1813] WARN - #o.j.i.maven - ImportLogging. pomReadingFinished (1)
[ 2421] WARN - #o.j.i.maven - ImportLogging. importStarted (1)
[ 2424] WARN - #o.j.i.maven - Can't migrate the project to external project files storage: Project.isExternalStorageEnabled=false
[ 2588] WARN - #o.j.i.maven - ImportLogging. importFinished (1): 1, 1
[ 2592] WARN - #o.j.i.maven - ImportLogging. pluginResolutionStarted (1)
[ 2593] WARN - #o.j.i.maven - ImportLogging. pluginResolutionFinished (1)
[ 2595] WARN - #o.j.i.maven - updateAllMavenProjects finished: incremental=true, MavenProjectsManagerEx.addManagedFilesWithProfilesAndUpdate GeneratedAnnotation
[ 602620] WARN - #c.i.t.IndexingTestUtil - "AWT-EventQueue-0 @coroutine#938" prio=0 tid=0x0 nid=0x0 runnable
java.lang.Thread.State: RUNNABLE
at java.management@21.0.4/sun.management.ThreadImpl.dumpThreads0(Native Method)
at java.management@21.0.4/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:518)
at java.management@21.0.4/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:506)
at com.intellij.diagnostic.ThreadDumper.getThreadInfos(ThreadDumper.java:85)
at com.intellij.diagnostic.ThreadDumper.getThreadInfos(ThreadDumper.java:56)
at com.intellij.diagnostic.ThreadDumper.dumpThreadsToString(ThreadDumper.java:40)
at com.intellij.testFramework.IndexingTestUtil.suspendUntilIndexesAreReady(IndexingTestUtil.kt:134)
at com.intellij.testFramework.IndexingTestUtil.access$suspendUntilIndexesAreReady(IndexingTestUtil.kt:21)
at com.intellij.testFramework.IndexingTestUtil$suspendUntilIndexesAreReady$1.invokeSuspend(IndexingTestUtil.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:29)
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:99)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:102)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:277)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:111)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$BuildersKt__BuildersKt(Builders.kt:84)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:52)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at io.openliberty.tools.intellij.lsp4jakarta.it.core.BaseJakartaTest.createMavenModules(BaseJakartaTest.java:87)
at io.openliberty.tools.intellij.lsp4jakarta.it.core.BaseJakartaTest.createMavenModule(BaseJakartaTest.java:105)
at io.openliberty.tools.intellij.lsp4jakarta.it.annotations.PostConstructAnnotationTest.GeneratedAnnotation(PostConstructAnnotationTest.java:43)
at java.base@21.0.4/java.lang.invoke.LambdaForm$DMH/0x0000000800268400.invokeVirtual(LambdaForm$DMH)
at java.base@21.0.4/java.lang.invoke.LambdaForm$MH/0x0000000800198800.invoke(LambdaForm$MH)
at java.base@21.0.4/java.lang.invoke.Invokers$Holder.invokeExact_MT(Invokers$Holder)
at java.base@21.0.4/jdk.internal.reflect.DirectMethodHandleAccessor.invokeImpl(DirectMethodHandleAccessor.java:153)
at java.base@21.0.4/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base@21.0.4/java.lang.reflect.Method.invoke(Method.java:580)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at com.intellij.testFramework.UsefulTestCase$1$$Lambda/0x000000080026ed38.run(Unknown Source)
at com.intellij.testFramework.UsefulTestCase.lambda$wrapTestRunnable$14(UsefulTestCase.java:512)
at com.intellij.testFramework.UsefulTestCase$$Lambda/0x000000080026f850.run(Unknown Source)
at com.intellij.testFramework.UsefulTestCase.runTestRunnable(UsefulTestCase.java:411)
at com.intellij.maven.testFramework.MavenTestCase.runTestRunnable(MavenTestCase.kt:324)
at com.intellij.testFramework.UsefulTestCase.defaultRunBare(UsefulTestCase.java:427)
at com.intellij.testFramework.UsefulTestCase.lambda$runBare$12(UsefulTestCase.java:494)
at com.intellij.testFramework.UsefulTestCase$$Lambda/0x00000008002aea48.run(Unknown Source)
at com.intellij.testFramework.EdtTestUtil.lambda$runInEdtAndWait$3(EdtTestUtil.java:80)
at com.intellij.testFramework.EdtTestUtil$$Lambda/0x00000008002b0220.compute(Unknown Source)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWriteIntentReadAction(AnyThreadWriteThreadingSupport.kt:84)
at com.intellij.testFramework.EdtTestUtil.lambda$runInEdtAndWait$4(EdtTestUtil.java:79)
at com.intellij.testFramework.EdtTestUtil$$Lambda/0x00000008002af730.run(Unknown Source)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:308)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:728)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
at java.base@21.0.4/java.security.AccessController.executePrivileged(AccessController.java:778)
at java.base@21.0.4/java.security.AccessController.doPrivileged(AccessController.java:400)
at java.base@21.0.4/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:750)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:320)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
"BaseDataReader: error stream of /Users/vaisakht/.gradle/caches/transforms-4/129f3540ae5bceea3b4a84f339c0...rs/vaisakht/.gradle/caches/transforms-4/129f3540ae5bceea3b4a84f339c004d5/transformed/ideaIC-2024.2.3-aarch64/lib/util-8.jar org.jetbrains.idea.maven.server.RemoteMavenServer36" prio=0 tid=0x0 nid=0x0 runnable
java.lang.Thread.State: RUNNABLE
(in native)
at java.base@21.0.4/java.io.FileInputStream.readBytes(Native Method)
at java.base@21.0.4/java.io.FileInputStream.read(FileInputStream.java:287)
at java.base@21.0.4/java.io.BufferedInputStream.read1(BufferedInputStream.java:345)
at java.base@21.0.4/java.io.BufferedInputStream.implRead(BufferedInputStream.java:420)
at java.base@21.0.4/java.io.BufferedInputStream.read(BufferedInputStream.java:405)
at java.base@21.0.4/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:350)
at java.base@21.0.4/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:393)
at java.base@21.0.4/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:217)
at java.base@21.0.4/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
at java.base@21.0.4/java.io.InputStreamReader.read(InputStreamReader.java:188)
at java.base@21.0.4/java.io.Reader.read(Reader.java:265)
at com.intellij.util.io.BaseOutputReader.readAvailableBlocking(BaseOutputReader.java:148)
at com.intellij.util.io.BaseDataReader.readAvailable(BaseDataReader.java:72)
at com.intellij.util.io.BaseDataReader.doRun(BaseDataReader.java:153)
at com.intellij.util.io.BaseDataReader$$Lambda/0x0000000800cbe388.run(Unknown Source)
at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:218)
at com.intellij.util.io.BaseDataReader.lambda$start$0(BaseDataReader.java:48)
at com.intellij.util.io.BaseDataReader$$Lambda/0x0000000800cbded0.run(Unknown Source)
at java.base@21.0.4/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base@21.0.4/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
at com.intellij.util.concurrency.CancellationRunnable$run$1.invoke(CancellationRunnable.kt:21)
at com.intellij.util.concurrency.CancellationRunnable$run$1.invoke(CancellationRunnable.kt:21)
at com.intellij.util.concurrency.Propagation$runAsCoroutine$deferred$1.invokeSuspend(propagation.kt:229)
at com.intellij.util.concurrency.Propagation$runAsCoroutine$deferred$1.invoke(propagation.kt)
at com.intellij.util.concurrency.Propagation$runAsCoroutine$deferred$1.invoke(propagation.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:27)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:90)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:123)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.async(Builders.common.kt:87)
at kotlinx.coroutines.BuildersKt.async(Unknown Source)
at com.intellij.util.concurrency.Propagation.runAsCoroutine(propagation.kt:224)
at com.intellij.util.concurrency.CancellationRunnable.run(CancellationRunnable.kt:21)
at java.base@21.0.4/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base@21.0.4/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base@21.0.4/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
at java.base@21.0.4/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
at java.base@21.0.4/java.security.AccessController.executePrivileged(AccessController.java:778)
at java.base@21.0.4/java.security.AccessController.doPrivileged(AccessController.java:400)
at java.base@21.0.4/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
at java.base@21.0.4/java.lang.Thread.runWith(Thread.java:1596)
at java.base@21.0.4/java.lang.Thread.run(Thread.java:1583)
"BaseDataReader: output stream of /Users/vaisakht/.gradle/caches/transforms-4/129f3540ae5bceea3b4a84f339c0...rs/vaisakht/.gradle/caches/transforms-4/129f3540ae5bceea3b4a84f339c004d5/transformed/ideaIC-2024.2.3-aarch64/lib/util-8.jar org.jetbrains.idea.maven.server.RemoteMavenServer36" prio=0 tid=0x0 nid=0x0 runnable
java.lang.Thread.State: RUNNABLE
(in native)
at java.base@21.0.4/java.io.FileInputStream.readBytes(Native Method)
at java.base@21.0.4/java.io.FileInputStream.read(FileInputStream.java:287)
at java.base@21.0.4/java.io.BufferedInputStream.read1(BufferedInputStream.java:345)
at java.base@21.0.4/java.io.BufferedInputStream.implRead(BufferedInputStream.java:420)
at java.base@21.0.4/java.io.BufferedInputStream.read(BufferedInputStream.java:405)
at java.base@21.0.4/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:350)
at java.base@21.0.4/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:393)
at java.base@21.0.4/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:217)
at java.base@21.0.4/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
at java.base@21.0.4/java.io.InputStreamReader.read(InputStreamReader.java:188)
at java.base@21.0.4/java.io.Reader.read(Reader.java:265)
at com.intellij.util.io.BaseOutputReader.readAvailableBlocking(BaseOutputReader.java:148)
at com.intellij.util.io.BaseDataReader.readAvailable(BaseDataReader.java:72)
at com.intellij.util.io.BaseDataReader.doRun(BaseDataReader.java:153)
at com.intellij.util.io.BaseDataReader$$Lambda/0x0000000800cbe388.run(Unknown Source)
at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:218)
at com.intellij.util.io.BaseDataReader.lambda$start$0(BaseDataReader.java:48)
at com.intellij.util.io.BaseDataReader$$Lambda/0x0000000800cbded0.run(Unknown Source)
at java.base@21.0.4/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base@21.0.4/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
at com.intellij.util.concurrency.CancellationRunnable$run$1.invoke(CancellationRunnable.kt:21)
at com.intellij.util.concurrency.CancellationRunnable$run$1.invoke(CancellationRunnable.kt:21)
at com.intellij.util.concurrency.Propagation$runAsCoroutine$deferred$1.invokeSuspend(propagation.kt:229)
at com.intellij.util.concurrency.Propagation$runAsCoroutine$deferred$1.invoke(propagation.kt)
at com.intellij.util.concurrency.Propagation$runAsCoroutine$deferred$1.invoke(propagation.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:27)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:90)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:123)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.async(Builders.common.kt:87)
at kotlinx.coroutines.BuildersKt.async(Unknown Source)
at com.intellij.util.concurrency.Propagation.runAsCoroutine(propagation.kt:224)
at com.intellij.util.concurrency.CancellationRunnable.run(CancellationRunnable.kt:21)
at java.base@21.0.4/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base@21.0.4/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base@21.0.4/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
at java.base@21.0.4/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
at java.base@21.0.4/java.security.AccessController.executePrivileged(AccessController.java:778)
at java.base@21.0.4/java.security.AccessController.doPrivileged(AccessController.java:400)
at java.base@21.0.4/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
at java.base@21.0.4/java.lang.Thread.runWith(Thread.java:1596)
at java.base@21.0.4/java.lang.Thread.run(Thread.java:1583)
"/127.0.0.1:59092 to /127.0.0.1:59091 workers Thread 3" prio=0 tid=0x0 nid=0x0 runnable
java.lang.Thread.State: RUNNABLE
(in native)
at java.base@21.0.4/sun.nio.ch.KQueue.poll(Native Method)
at java.base@21.0.4/sun.nio.ch.KQueueSelectorImpl.doSelect(KQueueSelectorImpl.java:125)
at java.base@21.0.4/sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:130)
at java.base@21.0.4/sun.nio.ch.SelectorImpl.select(SelectorImpl.java:147)
at org.gradle.internal.remote.internal.inet.SocketConnection$SocketInputStream.read(SocketConnection.java:185)
at com.esotericsoftware.kryo.io.Input.fill(Input.java:146)
at com.esotericsoftware.kryo.io.Input.require(Input.java:178)
at com.esotericsoftware.kryo.io.Input.readByte(Input.java:295)
at org.gradle.internal.serialize.kryo.KryoBackedDecoder.readByte(KryoBackedDecoder.java:88)
at org.gradle.internal.remote.internal.hub.InterHubMessageSerializer$MessageReader.read(InterHubMessageSerializer.java:64)
at org.gradle.internal.remote.internal.hub.InterHubMessageSerializer$MessageReader.read(InterHubMessageSerializer.java:52)
at org.gradle.internal.remote.internal.inet.SocketConnection.receive(SocketConnection.java:81)
at org.gradle.internal.remote.internal.hub.MessageHub$ConnectionReceive.run(MessageHub.java:270)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)
at java.base@21.0.4/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base@21.0.4/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base@21.0.4/java.lang.Thread.runWith(Thread.java:1596)
at java.base@21.0.4/java.lang.Thread.run(Thread.java:1583)
"process reaper (pid 49472)" prio=0 tid=0x0 nid=0x0 runnable
java.lang.Thread.State: RUNNABLE
(in native)
at java.base@21.0.4/java.lang.ProcessHandleImpl.waitForProcessExit0(Native Method)
at java.base@21.0.4/java.lang.ProcessHandleImpl$1.run(ProcessHandleImpl.java:163)
at java.base@21.0.4/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base@21.0.4/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base@21.0.4/java.lang.Thread.runWith(Thread.java:1596)
at java.base@21.0.4/java.lang.Thread.run(Thread.java:1583)
at java.base@21.0.4/jdk.internal.misc.InnocuousThread.run(InnocuousThread.java:186)
"Reference Handler" prio=0 tid=0x0 nid=0x0 runnable
java.lang.Thread.State: RUNNABLE
at java.base@21.0.4/java.lang.ref.Reference.waitForReferencePendingList(Native Method)
at java.base@21.0.4/java.lang.ref.Reference.processPendingReferences(Reference.java:246)
at java.base@21.0.4/java.lang.ref.Reference$ReferenceHandler.run(Reference.java:208)
"AppKit Thread" prio=0 tid=0x0 nid=0x0 runnable
java.lang.Thread.State: RUNNABLE
(in native)
"Notification Thread" prio=0 tid=0x0 nid=0x0 runnable
java.lang.Thread.State: RUNNABLE
"Signal Dispatcher" prio=0 tid=0x0 nid=0x0 runnable
java.lang.Thread.State: RUNNABLE
"Test worker" prio=0 tid=0x0 nid=0x0 waiting on condition
java.lang.Thread.State: WAITING
on java.awt.EventQueue$1AWTInvocationLock@20ac6ba0
at java.base@21.0.4/java.lang.Object.wait0(Native Method)
at java.base@21.0.4/java.lang.Object.wait(Object.java:366)
at java.base@21.0.4/java.lang.Object.wait(Object.java:339)
at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1375)
at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1356)
at java.desktop/javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1480)
at com.intellij.testFramework.EdtTestUtil.runInEdtAndWait(EdtTestUtil.java:109)
at com.intellij.testFramework.EdtTestUtil.runInEdtAndWait(EdtTestUtil.java:40)
at com.intellij.testFramework.UsefulTestCase.runBare(UsefulTestCase.java:494)
at com.intellij.maven.testFramework.MavenTestCase.runBare$lambda$6(MavenTestCase.kt:201)
at com.intellij.maven.testFramework.MavenTestCase$$Lambda/0x000000080026f610.run(Unknown Source)
at com.intellij.testFramework.LoggedErrorProcessor.executeWith(LoggedErrorProcessor.java:27)
at com.intellij.maven.testFramework.MavenTestCase.runBare(MavenTestCase.kt:191)
at com.intellij.testFramework.UsefulTestCase$1.evaluate(UsefulTestCase.java:159)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:42)
at org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:80)
at org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:72)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:198)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:169)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:93)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:58)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator$$Lambda/0x0000000800242de8.accept(Unknown Source)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:141)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:57)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:103)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:85)
at org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:119)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:94)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:89)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:62)
at java.base@21.0.4/java.lang.invoke.LambdaForm$DMH/0x0000000800198000.invokeInterface(LambdaForm$DMH)
at java.base@21.0.4/java.lang.invoke.LambdaForm$MH/0x0000000800198800.invoke(LambdaForm$MH)
at java.base@21.0.4/java.lang.invoke.Invokers$Holder.invokeExact_MT(Invokers$Holder)
at java.base@21.0.4/jdk.internal.reflect.DirectMethodHandleAccessor.invokeImpl(DirectMethodHandleAccessor.java:153)
at java.base@21.0.4/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base@21.0.4/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:94)
at jdk.proxy1/jdk.proxy1.$Proxy2.stop(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193)
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)
"/Users/vaisakht/.gradle/caches/transforms-4/129f3540ae5bceea3b4a84f339c0...rs/vaisakht/.gradle/caches/transforms-4/129f3540ae5bceea3b4a84f339c004d5/transformed/ideaIC-2024.2.3-aarch64/lib/util-8.jar org.jetbrains.idea.maven.server.RemoteMavenServer36" prio=0 tid=0x0 nid=0x0 waiting on condition
java.lang.Thread.State: WAITING
on java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@19331918
at java.base@21.0.4/jdk.internal.misc.Unsafe.park(Native Method)
at java.base@21.0.4/java.util.concurrent.locks.LockSupport.park(LockSupport.java:371)
at java.base@21.0.4/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519)
at java.base@21.0.4/java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:4013)
at java.base@21.0.4/java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3961)
at java.base@21.0.4/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707)
at java.base@21.0.4/java.lang.ProcessImpl.waitFor(ProcessImpl.java:425)
at com.intellij.execution.process.ProcessWaitFor.lambda$new$0(ProcessWaitFor.java:28)
at com.intellij.execution.process.ProcessWaitFor$$Lambda/0x0000000800cbbc88.run(Unknown Source)
at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:218)
at com.intellij.execution.process.ProcessWaitFor.lambda$new$1(ProcessWaitFor.java:23)
at com.intellij.execution.process.ProcessWaitFor$$Lambda/0x0000000800cbb7c0.run(Unknown Source)
at java.base@21.0.4/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base@21.0.4/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
at com.intellij.util.concurrency.CancellationRunnable$run$1.invoke(CancellationRunnable.kt:21)
at com.intellij.util.concurrency.CancellationRunnable$run$1.invoke(CancellationRunnable.kt:21)
at com.intellij.util.concurrency.Propagation$runAsCoroutine$deferred$1.invokeSuspend(propagation.kt:229)
at com.intellij.util.concurrency.Propagation$runAsCoroutine$deferred$1.invoke(propagation.kt)
at com.intellij.util.concurrency.Propagation$runAsCoroutine$deferred$1.invoke(propagation.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:27)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:90)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:123)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.async(Builders.common.kt:87)
at kotlinx.coroutines.BuildersKt.async(Unknown Source)
at com.intellij.util.concurrency.Propagation.runAsCoroutine(propagation.kt:224)
at com.intellij.util.concurrency.CancellationRunnable.run(CancellationRunnable.kt:21)
at java.base@21.0.4/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base@21.0.4/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base@21.0.4/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
at java.base@21.0.4/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
at java.base@21.0.4/java.security.AccessController.executePrivileged(AccessController.java:778)
at java.base@21.0.4/java.security.AccessController.doPrivileged(AccessController.java:400)
at java.base@21.0.4/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
at java.base@21.0.4/java.lang.Thread.runWith(Thread.java:1596)
at java.base@21.0.4/java.lang.Thread.run(Thread.java:1583)
"Reader thread for BuildOutputInstantReaderImpl@945,712,345" prio=0 tid=0x0 nid=0x0 waiting on condition
java.lang.Thread.State: TIMED_WAITING
on java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@115be015
This is the reason for changing as below code from what is shown in the screenshot to:
With this change, the unit tests started running, but five tests still failed in IntelliJ version 2024.2, whereas the same code works fine in IntelliJ version 2024.1.
However, I noticed that the importProjects(pomFiles.toArray(VirtualFile[]::new)) method is annotated with @Obsolete. Can I continue using this method for the time being? The importProjectAsync() method is a suspend function, which requires a blocking call, causing the unit tests to get stuck and eventually fail after some time.
protected suspend fun importProjectAsync(file: VirtualFile) {
importProjectsAsync(listOf(file))
}