palantir / palantir-java-format

A modern, lambda-friendly, 120 character Java formatter.
Apache License 2.0
468 stars 48 forks source link

After upgrading Intellij IDEA Ultimate to version 2023.2.1 an error is thrown by the plugin #919

Open fpaulettich opened 1 year ago

fpaulettich commented 1 year ago

Error is thrown by the plugin palantir-java-format (2.35.0) after upgrading to Intellij IDEA to version 2023.2.1

NazarioJL commented 1 year ago

Error is thrown by the plugin palantir-java-format (2.35.0) after upgrading to Intellij IDEA to version 2023.2.1

Can you provide the error message, or any other information that can help diagnose what is happening?

rkraneis commented 1 year ago

The reason could be, that Palantir is executed with the default Java present on the system. I have no idea why it is handled that way:

   Got unexpected exception during formatting file:///X.java

   java.util.concurrent.ExecutionException: java.lang.RuntimeException: Error running formatter command
    at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
        ...
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.RuntimeException: Error running formatter command
    at com.palantir.javaformat.bootstrap.BootstrappingFormatterService.getFormatReplacements(BootstrappingFormatterService.java:58)
    ...
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
Caused by: java.io.IOException: Command terminated with exit value 1
Command: /home/X/.sdkman/candidates/java/current/bin/java -cp ... com.palantir.javaformat.java.Main --character-ranges 0:8064 --output-replacements --palantir -
Stdout:

Stderr:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/palantir/javaformat/java/Main has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
        ...
    at com.palantir.javaformat.bootstrap.BootstrappingFormatterService.getFormatReplacements(BootstrappingFormatterService.java:56)
    ... 60 more

Unimportant pieces have been redacted. As can be seen, my current Java is 8 atm for legacy reasons, but palantir wants to run on 11.

fpaulettich commented 1 year ago

Really sorry for my lack of update on this issue. Originally wasn´t able to add the logs as above and eventually forgot to add them, and now I don´t have them anymore. I´ll post the details if I get to happen again. Just to give more context, my system is running on Java 17.

fpaulettich commented 1 year ago

I just get the error, this is the log:

An invalid state was detected that occurs if the key's equals or hashCode was modified while it resided in the cache. This violation of the Map  contract can lead to non-deterministic behavior (key: com.intellij.psi.impl.ElementBase$ElementIconRequest@f1f0cb04, key type: ElementIconRequest, node type: PSMS, cache type: SSMS).

  java.lang.IllegalStateException
at com.github.benmanes.caffeine.cache.BoundedLocalCache.logIfAlive(BoundedLocalCache.java:302)
at com.github.benmanes.caffeine.cache.BoundedLocalCache.removeNode(BoundedLocalCache.java:2140)
at com.github.benmanes.caffeine.cache.BoundedLocalCache.clear(BoundedLocalCache.java:2069)
at com.github.benmanes.caffeine.cache.LocalManualCache.invalidateAll(LocalManualCache.java:146)
at com.intellij.ui.IconDeferrerImpl.clearCache(IconDeferrerImpl.kt:66)
at com.intellij.util.messages.impl.MessageBusImplKt.invokeMethod(MessageBusImpl.kt:696)
at com.intellij.util.messages.impl.MessageBusImplKt.invokeListener(MessageBusImpl.kt:659)
at com.intellij.util.messages.impl.MessageBusImplKt.executeOrAddToQueue(MessageBusImpl.kt:491)
at com.intellij.util.messages.impl.ToParentMessagePublisher.publish$intellij_platform_core(MessageBusImpl.kt:530)
at com.intellij.util.messages.impl.MessagePublisher.invoke(MessageBusImpl.kt:448)
at jdk.proxy2/jdk.proxy2.$Proxy79.modificationCountChanged(Unknown Source)
at com.intellij.psi.impl.PsiModificationTrackerImpl.fireEvent(PsiModificationTrackerImpl.java:82)
at com.intellij.psi.impl.PsiModificationTrackerImpl.incCountersInner(PsiModificationTrackerImpl.java:87)
at com.intellij.psi.impl.PsiModificationTrackerImpl.treeChanged(PsiModificationTrackerImpl.java:97)
at com.intellij.psi.impl.PsiManagerImpl.fireEvent(PsiManagerImpl.java:339)
at com.intellij.psi.impl.PsiManagerImpl.beforeChildrenChange(PsiManagerImpl.java:232)
at com.intellij.pom.core.impl.PomModelImpl.sendBeforeChildrenChangeEvent(PomModelImpl.java:346)
at com.intellij.pom.core.impl.PomModelImpl.startTransaction(PomModelImpl.java:279)
at com.intellij.pom.core.impl.PomModelImpl.lambda$runTransaction$2(PomModelImpl.java:96)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeNonCancelableSection$3(CoreProgressManager.java:222)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:628)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$computeInNonCancelableSection$4(CoreProgressManager.java:230)
at com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:60)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:230)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:221)
at com.intellij.pom.core.impl.PomModelImpl.runTransaction(PomModelImpl.java:93)
at com.intellij.psi.impl.DiffLog.lambda$doActualPsiChange$0(DiffLog.java:242)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.lambda$performActionWithFormatterDisabled$4(CodeStyleManagerImpl.java:428)
at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.disablePostprocessFormattingInside(PostprocessReformattingAspectImpl.java:129)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.performActionWithFormatterDisabled(CodeStyleManagerImpl.java:456)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.performActionWithFormatterDisabled(CodeStyleManagerImpl.java:427)
at com.palantir.javaformat.intellij.CodeStyleManagerDecorator.performActionWithFormatterDisabled(CodeStyleManagerDecorator.java:181)
at jdk.internal.reflect.GeneratedMethodAccessor855.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at krasa.formatter.plugin.ProxyCodeStyleManagerDelegator.PLEASE_REPORT_BUGS_TO_JETBRAINS_IF_IT_FAILS_HERE____ORIGINAL_INTELLIJ_FORMATTER_WAS_USED(ProxyCodeStyleManagerDelegator.java:60)
at krasa.formatter.plugin.ProxyCodeStyleManagerDelegator.invoke(ProxyCodeStyleManagerDelegator.java:28)
at net.sf.cglib.empty.Object$$EnhancerByCGLIB$$a6c18dd5.performActionWithFormatterDisabled(<generated>)
at com.intellij.psi.impl.DiffLog.doActualPsiChange(DiffLog.java:230)
at com.intellij.psi.impl.DocumentCommitThread.lambda$doCommit$5(DocumentCommitThread.java:302)
at com.intellij.psi.impl.PsiDocumentManagerBase.commitToExistingPsi(PsiDocumentManagerBase.java:425)
at com.intellij.psi.impl.PsiDocumentManagerBase.lambda$finishCommitInWriteAction$5(PsiDocumentManagerBase.java:399)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$computeInNonCancelableSection$4(CoreProgressManager.java:230)
at com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:64)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:230)
at com.intellij.psi.impl.PsiDocumentManagerBase.lambda$finishCommitInWriteAction$6(PsiDocumentManagerBase.java:394)
at com.intellij.psi.impl.PsiDocumentManagerBase.executeInsideCommit(PsiDocumentManagerBase.java:510)
at com.intellij.psi.impl.PsiDocumentManagerBase.finishCommitInWriteAction(PsiDocumentManagerBase.java:392)
at com.intellij.psi.impl.PsiDocumentManagerImpl.finishCommitInWriteAction(PsiDocumentManagerImpl.java:136)
at com.intellij.psi.impl.PsiDocumentManagerBase$2.run(PsiDocumentManagerBase.java:359)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:992)
at com.intellij.psi.impl.PsiDocumentManagerBase.finishCommit(PsiDocumentManagerBase.java:356)
at com.intellij.psi.impl.DocumentCommitThread.lambda$commitUnderProgress$2(DocumentCommitThread.java:140)
at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$safeTransferToEdt$7(NonBlockingReadActionImpl.java:708)
at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:208)
at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21)
at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:190)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861)
at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:478)
at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:79)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:121)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:41)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:685)
at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$10(IdeEventQueue.kt:589)
at com.intellij.openapi.application.impl.ApplicationImpl.runWithoutImplicitRead(ApplicationImpl.java:1485)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:589)
at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:67)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:369)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:368)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:368)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:363)
at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:992)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:992)
at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:363)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:405)
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)