intellij-erlang
intellij-erlang copied to clipboard
Java errors during Erlang compilation
Very often when I compile Erlang in IDEA I get different Java errors as a result, the latest I received was:
Error:Erlang '<module_name>': java.lang.IllegalArgumentException: Equal objects must have equal hashcodes. During rehashing, Trove discovered that the following two objects claim to be equal (as in java.lang.Object.equals() or TObjectHashingStrategy.equals()) but their hashCodes (or those calculated by your TObjectHashingStrategy) are not equal.This violates the general contract of java.lang.Object.hashCode(). See bullet point two in that method's documentation. object #1 =Rebar (class org.jetbrains.jps.model.ex.JpsElementChildRoleBase), hashCode=1860295362; object #2 =Rebar (class org.jetbrains.jps.model.ex.JpsElementChildRoleBase), hashCode=1860295362
Where <module_name>
is an arbitrary module name.
This particular error happened when I was trying to 'Rebuild Project'.
I usually need to close/open my project to fix this.
I just got one more error, this time when I was doing 'Make Module':
Error:prepare files target: java.lang.NullPointerException
Thank you @istocniks, I'll take a look at it.
Could you share logs, please?
I'm happy to share anything you need :) Which logs are you interested in?
Both IDE logs and build-logs would be great. You can find them via Help -> Show Logs in ***
Here they are http://cl.ly/1z3c382m2A1E
Thank you for information about build. I'm going to fix problem with NullPointerException tomorrow.
@istocniks
The NPE will no longer occur - but, please, check your build logs for a string "Unexpected dirty file detected." - it would be interesting to know why it happened in the first place.
As to the IAE, it was a nasty concurrency bug, which is now fixed.
Thank you once again for you help!
Will do, thanks
A dumb follow up question, how should I build the new plugin version? It's all gradle now and I never used it before. I tried to do gradle build
and install build/libs/Erlang-0.5.SNAPSHOT.jar
but IDEA started to throw java.lang.NoClassDefFoundError: org/intellij/erlang/jps/model/ErlangIncludeSourceRootType
after that
You already have it built =)
Use build/distribution/Erlang-0.5.SNAPSHOT.zip
to install it.
Worked like a charm, thanks! :)
I really like the gradle build, too =) Kudos to @zolotov and @ignatov
Found some dirty files today:
2015-10-16 13:53:04,119 [ 0] INFO - etbrains.jps.cmdline.BuildMain - Build process started. Classpath: /Applications/IntelliJ IDEA 14.app/Contents/lib/jps-launcher.jar:/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar:/Applications/IntelliJ IDEA 14.app/Contents/lib/optimizedFileManager.jar:/Applications/IntelliJ IDEA 14.app/Contents/lib/ecj-4.4.jar
2015-10-16 13:53:04,356 [ 237] INFO - etbrains.jps.cmdline.BuildMain - Connection to IDE established in 216 ms
2015-10-16 13:53:04,478 [ 359] INFO - jps.cmdline.JpsModelLoaderImpl - Loading model: project path = /Users/istocniks/src, global options path = /Users/istocniks/Library/Preferences/IntelliJIdea14/options
2015-10-16 13:53:04,843 [ 724] INFO - jps.cmdline.JpsModelLoaderImpl - Model loaded in 365 ms
2015-10-16 13:53:04,843 [ 724] INFO - jps.cmdline.JpsModelLoaderImpl - Project has 12 modules, 0 libraries
2015-10-16 13:53:04,920 [ 801] INFO - ellij.util.io.PagedFileStorage - lower=100; upper=200; buffer=10; max=703856640
2015-10-16 13:53:05,076 [ 957] INFO - lij.openapi.util.io.FileUtilRt - Was not able to detect NIO API
2015-10-16 13:53:05,083 [ 964] INFO - .incremental.IncProjectBuilder - Building project; isRebuild:false; isMake:true parallel compilation:true
2015-10-16 13:53:05,089 [ 970] INFO - r.api.ClassFilesIndicesBuilder - class files data index disabled
2015-10-16 13:53:05,303 [ 1184] INFO - lang.jps.builder.ErlangBuilder - Computing dirty files
2015-10-16 13:53:05,337 [ 1218] WARN - lang.jps.builder.ErlangBuilder - Unexpected dirty file detected. Please, report to https://github.com/ignatov/intellij-erlang/issues/685. Path: /Users/istocniks/src/proj1/src/module1.erl
2015-10-16 13:53:05,337 [ 1218] WARN - lang.jps.builder.ErlangBuilder - Unexpected dirty file detected. Please, report to https://github.com/ignatov/intellij-erlang/issues/685. Path: /Users/istocniks/src/proj2/src/module2.erl
2015-10-16 13:53:05,337 [ 1218] WARN - lang.jps.builder.ErlangBuilder - Unexpected dirty file detected. Please, report to https://github.com/ignatov/intellij-erlang/issues/685. Path: /Users/istocniks/src/proj2/src/module3.erl
2015-10-16 13:53:05,337 [ 1218] WARN - lang.jps.builder.ErlangBuilder - Unexpected dirty file detected. Please, report to https://github.com/ignatov/intellij-erlang/issues/685. Path: /Users/istocniks/src/proj2/src/module4.erl
2015-10-16 13:53:05,535 [ 1416] INFO - lang.jps.builder.ErlangBuilder - Build module Erlang 'proj3'
2015-10-16 13:53:05,538 [ 1419] INFO - lang.jps.builder.ErlangBuilder - Compile source code for module "proj3".
2015-10-16 13:53:06,146 [ 2027] INFO - lang.jps.builder.ErlangBuilder - Compile tests for module "proj3".
2015-10-16 13:53:06,638 [ 2519] INFO - lang.jps.builder.ErlangBuilder - Build module Erlang 'proj4'
2015-10-16 13:53:06,638 [ 2519] INFO - lang.jps.builder.ErlangBuilder - Compile source code for module "proj4".
2015-10-16 13:53:08,209 [ 4090] INFO - lang.jps.builder.ErlangBuilder - Compile tests for module "proj4".
2015-10-16 13:53:09,693 [ 5574] INFO - rains.jps.cmdline.BuildSession - Build duration: 'erlc' builder took 4106 ms, 8 sources processed
2015-10-16 13:53:10,366 [ 0] INFO - etbrains.jps.cmdline.BuildMain - Build process started. Classpath: /Applications/IntelliJ IDEA 14.app/Contents/lib/jps-launcher.jar:/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar:/Applications/IntelliJ IDEA 14.app/Contents/lib/optimizedFileManager.jar:/Applications/IntelliJ IDEA 14.app/Contents/lib/ecj-4.4.jar
2015-10-16 13:53:10,538 [ 172] INFO - etbrains.jps.cmdline.BuildMain - Connection to IDE established in 153 ms
2015-10-16 13:53:10,632 [ 266] INFO - jps.cmdline.JpsModelLoaderImpl - Loading model: project path = /Users/istocniks/src, global options path = /Users/istocniks/Library/Preferences/IntelliJIdea14/options
2015-10-16 13:53:11,056 [ 690] INFO - jps.cmdline.JpsModelLoaderImpl - Model loaded in 424 ms
2015-10-16 13:53:11,056 [ 690] INFO - jps.cmdline.JpsModelLoaderImpl - Project has 12 modules, 0 libraries
2015-10-16 13:53:11,199 [ 833] INFO - ellij.util.io.PagedFileStorage - lower=100; upper=200; buffer=10; max=703856640
2015-10-16 13:53:11,383 [ 1017] INFO - etbrains.jps.cmdline.BuildMain - Pre-loaded process ready in 1017 ms
I changed some paths for privacy, this happened when I tried to Make Module
proj1
which depends on proj3 and proj4
Good, we'll now figure out what's going wrong, if anything,
Could you, please explain how these directories map to you IntelliJ project and module roots?
/Users/istocniks/src
here is a project root, each proj
is an IntelliJ module
proj1
depends on proj3
and proj4
,
proj4
depends on proj3
proj2
depends on proj3
Any updates on this? It seems like now when this error silently occurs resulting beams become corrupted, I cannot reload them and need to re-build the whole project to fix this. At least before a saw the error and new beforehand that I need to re-build stuff differently.
So I've setup a project as you described, changed files in module proj2
and proj1
, and ran Make Module
proj1
.
This gave me the following log entries:
2015-10-22 14:10:31,281 [ 90598] WARN - lang.jps.builder.ErlangBuilder - Unexpected dirty file detected. Please, report to https://github.com/ignatov/intellij-erlang/issues/685. Path: /home/user/IdeaProjects/erl685/proj2/src/module2.erl
2015-10-22 14:10:31,281 [ 90598] WARN - lang.jps.builder.ErlangBuilder - Unexpected dirty file detected. Please, report to https://github.com/ignatov/intellij-erlang/issues/685. Path: /home/user/IdeaProjects/erl685/proj2/src/module4.erl
2015-10-22 14:10:31,281 [ 90598] WARN - lang.jps.builder.ErlangBuilder - Unexpected dirty file detected. Please, report to https://github.com/ignatov/intellij-erlang/issues/685. Path: /home/user/IdeaProjects/erl685/proj2/src/module3.erl
Which does make sense - we're not building proj2
because neither proj1
nor any of it's dependencies depend on it. Or do you expect changed modules from proj2
to be built as well?
In your case a file from proj1
is reported as unexpected, which confuses me - it's in the module you claim you're building. Could you try to make a sample project which can be used to reproduce the issue?
Yes, the module I'm building get's corrupted, and if I'm not mistaken, it's not just a project it's a file I changed that is reported dirty. Again don't remember for sure but it's possible that this file was just added to the project.
Well, that may be a clue. What do you mean by 'just added'? Was it added from IntelliJ, or was it some external change?
Added in IntelliJ as an Erlang module
Then it could only be reported as unexpected, if you've added it after Make
was started. It's probably something else...
No it's wasn't the case
I've recently pushed a change which affects dirty files set computation before the actual build takes place. Try it out, and let me know if the issue persists.
Gradle build fails on test phase with errors like:
java.lang.RuntimeException: java.lang.ClassNotFoundException: org.intellij.erlang.editor.ErlangEnterInCommentsHandler
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.loadImplementationClass(ExtensionComponentAdapter.java:160)
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.getComponentImplementation(ExtensionComponentAdapter.java:66)
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.getComponentInstance(ExtensionComponentAdapter.java:73)
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.getExtension(ExtensionComponentAdapter.java:119)
at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processAdapters(ExtensionPointImpl.java:249)
at com.intellij.openapi.extensions.impl.ExtensionPointImpl.getExtensions(ExtensionPointImpl.java:194)
at com.intellij.openapi.extensions.Extensions.getExtensions(Extensions.java:100)
at com.intellij.openapi.extensions.Extensions.getExtensions(Extensions.java:87)
at com.intellij.codeInsight.editorActions.EnterHandler.executeWriteActionInner(EnterHandler.java:126)
at com.intellij.codeInsight.editorActions.EnterHandler.access$000(EnterHandler.java:54)
at com.intellij.codeInsight.editorActions.EnterHandler$1.run(EnterHandler.java:76)
at com.intellij.psi.impl.source.PostprocessReformattingAspect$3.compute(PostprocessReformattingAspect.java:115)
at com.intellij.psi.impl.source.PostprocessReformattingAspect.disablePostprocessFormattingInside(PostprocessReformattingAspect.java:124)
at com.intellij.psi.impl.source.PostprocessReformattingAspect.disablePostprocessFormattingInside(PostprocessReformattingAspect.java:112)
at com.intellij.codeInsight.editorActions.EnterHandler.executeWriteAction(EnterHandler.java:73)
at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler$1.run(EditorWriteActionHandler.java:56)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1002)
at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler.doExecute(EditorWriteActionHandler.java:49)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:222)
at com.intellij.codeInsight.template.impl.editorActions.EnterHandler.executeWriteAction(EnterHandler.java:49)
at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler$1.run(EditorWriteActionHandler.java:56)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1002)
at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler.doExecute(EditorWriteActionHandler.java:49)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler$3$1.perform(EditorActionHandler.java:206)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doIfEnabled(EditorActionHandler.java:109)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.access$000(EditorActionHandler.java:38)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler$3.perform(EditorActionHandler.java:203)
at com.intellij.openapi.editor.impl.CaretModelImpl$3.run(CaretModelImpl.java:342)
at com.intellij.openapi.editor.impl.CaretModelImpl.doWithCaretMerging(CaretModelImpl.java:422)
at com.intellij.openapi.editor.impl.CaretModelImpl.runForEachCaret(CaretModelImpl.java:333)
at com.intellij.openapi.editor.impl.CaretModelImpl.runForEachCaret(CaretModelImpl.java:324)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:200)
at com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.java:98)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:117)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:109)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:83)
at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl$17.compute(CodeInsightTestFixtureImpl.java:1017)
at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl$17.compute(CodeInsightTestFixtureImpl.java:1006)
at com.intellij.openapi.command.WriteCommandAction$5.run(WriteCommandAction.java:190)
at com.intellij.openapi.application.RunResult.run(RunResult.java:35)
at com.intellij.openapi.command.WriteCommandAction$2$1.run(WriteCommandAction.java:114)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1002)
at com.intellij.openapi.command.WriteCommandAction$2.run(WriteCommandAction.java:111)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:117)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:108)
at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:80)
at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:192)
at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl._performEditorAction(CodeInsightTestFixtureImpl.java:1006)
at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.performEditorAction(CodeInsightTestFixtureImpl.java:996)
at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl$16.run(CodeInsightTestFixtureImpl.java:946)
at com.intellij.util.ui.UIUtil.invokeAndWaitIfNeeded(UIUtil.java:2342)
at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.type(CodeInsightTestFixtureImpl.java:930)
at org.intellij.erlang.typing.ErlangEnterHandlerTest.doTest(ErlangEnterHandlerTest.java:65)
at org.intellij.erlang.typing.ErlangEnterHandlerTest.testUnmatchedCurlyBrace(ErlangEnterHandlerTest.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at junit.framework.TestCase.runTest(TestCase.java:176)
at com.intellij.testFramework.UsefulTestCase.access$001(UsefulTestCase.java:81)
at com.intellij.testFramework.UsefulTestCase$2.run(UsefulTestCase.java:319)
at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$2.invoke(EdtTestUtil.kt:29)
at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$2.invoke(EdtTestUtil.kt:23)
at com.intellij.testFramework.EdtTestUtil$Companion.runInEdtAndWait(EdtTestUtil.kt:37)
at com.intellij.testFramework.EdtTestUtil$Companion.runInEdtAndWait(EdtTestUtil.kt:29)
at com.intellij.testFramework.EdtTestUtil.runInEdtAndWait(EdtTestUtil.kt)
at com.intellij.testFramework.UsefulTestCase.invokeTestRunnable(UsefulTestCase.java:351)
at com.intellij.testFramework.UsefulTestCase.runTest(UsefulTestCase.java:335)
at com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase.access$001(LightPlatformCodeInsightFixtureTestCase.java:41)
at com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase.doRunTests(LightPlatformCodeInsightFixtureTestCase.java:129)
at com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase$1.run(LightPlatformCodeInsightFixtureTestCase.java:117)
at com.intellij.openapi.application.RunResult.run(RunResult.java:35)
at com.intellij.openapi.command.WriteCommandAction$2$1.run(WriteCommandAction.java:114)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1002)
at com.intellij.openapi.command.WriteCommandAction$2.run(WriteCommandAction.java:111)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:108)
at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:80)
at com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase.runTest(LightPlatformCodeInsightFixtureTestCase.java:119)
at com.intellij.testFramework.UsefulTestCase.defaultRunBare(UsefulTestCase.java:362)
at com.intellij.testFramework.UsefulTestCase$3.run(UsefulTestCase.java:419)
at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:25)
at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:23)
at com.intellij.testFramework.EdtTestUtilKt$sam$Runnable$a15fd9f8.run(EdtTestUtil.kt)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:302)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:861)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:649)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:380)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Caused by: java.lang.ClassNotFoundException: org.intellij.erlang.editor.ErlangEnterInCommentsHandler
at com.intellij.util.lang.UrlClassLoader.findClass(UrlClassLoader.java:203)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.loadImplementationClass(ExtensionComponentAdapter.java:157)
... 102 more
Try running clean
task, or use the latest build from https://github.com/ignatov/intellij-erlang/releases
clean
helped, thanks, but now I have a different problem:
The master branch has been switched to IntelliJ 15. A plugin compatible with IntelliJ 14 can be built from the 141
branch, but it doesn't have these changes yet.
Can you update to IJ15, or should I cherry-pick those changes instead?
Isn't it possible to keep the plugin backwards compatible with 14? Not everyone will upgrade to 15, I definitely don't want to do this before it's released
It's not possible, as there were some API changes between IJ 14 and IJ 15. So we'll have to back-port the changes to make it possible.
BTW, IJ15 was released today =)
Didn't know that it's released, will try it out, thanks :)