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

Quote capitalized exported names in decompilation so they aren't treated as Aliases #703

Closed
OvermindDL1 opened this issue May 25, 2017 · 7 comments
Labels

Comments

@OvermindDL1
Copy link

Version

5.1.0

Exception

org.elixir_lang.beam.psi.impl.ModuleElementImpl$InvalidMirrorException

Message

file://C:/Users/<user>/Projects/my_server/rel/my_server/lib/ldap_ex-0.2.4/ebin/Elixir.LDAPEx.ELDAPv3.beam: stub:[org.elixir_lang.beam.psi.impl.CallDefinitionImpl@389a196c, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@5abe5875, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@67b35ca5, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@7b097a56, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@13b05d22, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@3b65c2d1, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@464ee76c, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@76a5fe39, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@67ede482, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@728bd1e4, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@43cf2d5e, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@1ac24728, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@12037906, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@3e2b8e53, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@4b4f115, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@c470dac, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@5858e6b, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@67bec19e, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@4421a825, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@703ff760, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@59e0c9da, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@48c35149, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@16ab8f4, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@ee1db4e, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@51907d51, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@38b2733, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@57f292ae, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@574918b5, org.eli

Stacktrace:

file://C:/Users/<user>/Projects/my_server/rel/my_server/lib/ldap_ex-0.2.4/ebin/Elixir.LDAPEx.ELDAPv3.beam: stub:[org.elixir_lang.beam.psi.impl.CallDefinitionImpl@389a196c, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@5abe5875, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@67b35ca5, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@7b097a56, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@13b05d22, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@3b65c2d1, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@464ee76c, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@76a5fe39, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@67ede482, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@728bd1e4, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@43cf2d5e, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@1ac24728, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@12037906, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@3e2b8e53, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@4b4f115, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@c470dac, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@5858e6b, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@67bec19e, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@4421a825, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@703ff760, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@59e0c9da, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@48c35149, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@16ab8f4, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@ee1db4e, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@51907d51, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@38b2733, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@57f292ae, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@574918b5, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@5e19df8, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@5f0980c8, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@1c2d1e65, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@3be31e5, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@a397237, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@19a5bc78, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@6d8f471f, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@1fcc6252, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@5ea50356, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@6a572286, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@7df7276c, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@1550472, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@771c08bd, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@248c47ca, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@6084c870, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@495b3686, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@5e1586f0, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@18e128ef, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@5ee0a4cb, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@4e9f5697, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@3c4f7bb2, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@2df89a84, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@76e5b50c, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@427a7ea9, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@52f1fbf, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@6c6a8924, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@377c1c70, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@26e2a300, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@5b4d9284, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@63561360, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@341e1ce6, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@7d753c6, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@3039280a, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@6327e07e, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@279a39d0, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@1aee1786, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@63ee15a9]; mirror:[UNMATCHED_UNQUALIFIED_NO_PARENTHESES_CALL]
org.elixir_lang.beam.psi.impl.ModuleElementImpl$InvalidMirrorException: stub:[org.elixir_lang.beam.psi.impl.CallDefinitionImpl@389a196c, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@5abe5875, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@67b35ca5, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@7b097a56, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@13b05d22, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@3b65c2d1, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@464ee76c, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@76a5fe39, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@67ede482, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@728bd1e4, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@43cf2d5e, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@1ac24728, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@12037906, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@3e2b8e53, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@4b4f115, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@c470dac, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@5858e6b, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@67bec19e, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@4421a825, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@703ff760, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@59e0c9da, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@48c35149, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@16ab8f4, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@ee1db4e, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@51907d51, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@38b2733, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@57f292ae, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@574918b5, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@5e19df8, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@5f0980c8, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@1c2d1e65, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@3be31e5, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@a397237, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@19a5bc78, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@6d8f471f, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@1fcc6252, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@5ea50356, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@6a572286, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@7df7276c, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@1550472, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@771c08bd, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@248c47ca, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@6084c870, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@495b3686, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@5e1586f0, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@18e128ef, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@5ee0a4cb, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@4e9f5697, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@3c4f7bb2, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@2df89a84, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@76e5b50c, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@427a7ea9, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@52f1fbf, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@6c6a8924, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@377c1c70, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@26e2a300, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@5b4d9284, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@63561360, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@341e1ce6, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@7d753c6, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@3039280a, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@6327e07e, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@279a39d0, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@1aee1786, org.elixir_lang.beam.psi.impl.CallDefinitionImpl@63ee15a9]; mirror:[UNMATCHED_UNQUALIFIED_NO_PARENTHESES_CALL]
	at org.elixir_lang.beam.psi.impl.ModuleElementImpl.setMirrors(ModuleElementImpl.java:43)
	at org.elixir_lang.beam.psi.impl.ModuleElementImpl.setMirrors(ModuleElementImpl.java:37)
	at org.elixir_lang.beam.psi.impl.ModuleImpl.setMirror(ModuleImpl.java:76)
	at org.elixir_lang.beam.psi.impl.ModuleElementImpl.setMirror(ModuleElementImpl.java:55)
	at org.elixir_lang.beam.psi.impl.ModuleElementImpl.setMirrors(ModuleElementImpl.java:46)
	at org.elixir_lang.beam.psi.impl.ModuleElementImpl.setMirrors(ModuleElementImpl.java:37)
	at org.elixir_lang.beam.psi.BeamFileImpl.setMirror(BeamFileImpl.java:649)
	at org.elixir_lang.beam.psi.BeamFileImpl$1.run(BeamFileImpl.java:622)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:556)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:501)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:204)
	at org.elixir_lang.beam.psi.BeamFileImpl.getMirror(BeamFileImpl.java:620)
	at org.elixir_lang.beam.psi.impl.ModuleElementImpl.getMirror(ModuleElementImpl.java:125)
	at org.elixir_lang.beam.psi.impl.CallDefinitionImpl.getNavigationElement(CallDefinitionImpl.java:110)
	at org.elixir_lang.psi.scope.module.Variants.addProjectNameElementsTo(Variants.java:316)
	at org.elixir_lang.psi.scope.module.Variants.lookupElementList(Variants.java:51)
	at org.elixir_lang.reference.Module.getVariants(Module.java:184)
	at com.intellij.codeInsight.completion.CompletionData.completeReference(CompletionData.java:273)
	at com.intellij.codeInsight.completion.CompletionVariant.addReferenceCompletions(CompletionVariant.java:137)
	at com.intellij.codeInsight.completion.CompletionData.completeReference(CompletionData.java:81)
	at com.intellij.codeInsight.completion.LegacyCompletionContributor.a(LegacyCompletionContributor.java:71)
	at com.intellij.codeInsight.completion.LegacyCompletionContributor.a(LegacyCompletionContributor.java:125)
	at com.intellij.codeInsight.completion.LegacyCompletionContributor.processReferences(LegacyCompletionContributor.java:108)
	at com.intellij.codeInsight.completion.LegacyCompletionContributor.completeReference(LegacyCompletionContributor.java:69)
	at com.intellij.codeInsight.completion.LegacyCompletionContributor.fillCompletionVariants(LegacyCompletionContributor.java:52)
	at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:81)
	at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:138)
	at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:131)
	at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$2.addCompletions(LiveTemplateCompletionContributor.java:88)
	at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:36)
	at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:151)
	at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:81)
	at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:110)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.a(CompletionProgressIndicator.java:831)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.access$600(CompletionProgressIndicator.java:93)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator$1CalculateItems.run(CompletionProgressIndicator.java:813)
	at com.intellij.codeInsight.completion.AsyncCompletion.a(CompletionThreading.java:108)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:931)
	at com.intellij.codeInsight.completion.AsyncCompletion.b(CompletionThreading.java:105)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:176)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:556)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:501)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:163)
	at com.intellij.codeInsight.completion.AsyncCompletion.a(CompletionThreading.java:103)
	at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:334)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)


java.lang.IllegalStateException: @NotNull method org/elixir_lang/beam/psi/impl/CallDefinitionImpl.getNavigationElement must not return null
	at org.elixir_lang.beam.psi.impl.CallDefinitionImpl.getNavigationElement(CallDefinitionImpl.java:110)
	at org.elixir_lang.psi.scope.module.Variants.addProjectNameElementsTo(Variants.java:316)
	at org.elixir_lang.psi.scope.module.Variants.lookupElementList(Variants.java:51)
	at org.elixir_lang.reference.Module.getVariants(Module.java:184)
	at com.intellij.codeInsight.completion.CompletionData.completeReference(CompletionData.java:273)
	at com.intellij.codeInsight.completion.CompletionVariant.addReferenceCompletions(CompletionVariant.java:137)
	at com.intellij.codeInsight.completion.CompletionData.completeReference(CompletionData.java:81)
	at com.intellij.codeInsight.completion.LegacyCompletionContributor.a(LegacyCompletionContributor.java:71)
	at com.intellij.codeInsight.completion.LegacyCompletionContributor.a(LegacyCompletionContributor.java:125)
	at com.intellij.codeInsight.completion.LegacyCompletionContributor.processReferences(LegacyCompletionContributor.java:108)
	at com.intellij.codeInsight.completion.LegacyCompletionContributor.completeReference(LegacyCompletionContributor.java:69)
	at com.intellij.codeInsight.completion.LegacyCompletionContributor.fillCompletionVariants(LegacyCompletionContributor.java:52)
	at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:81)
	at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:138)
	at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:131)
	at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$2.addCompletions(LiveTemplateCompletionContributor.java:88)
	at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:36)
	at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:151)
	at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:81)
	at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:110)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.a(CompletionProgressIndicator.java:831)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.access$600(CompletionProgressIndicator.java:93)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator$1CalculateItems.run(CompletionProgressIndicator.java:813)
	at com.intellij.codeInsight.completion.AsyncCompletion.a(CompletionThreading.java:108)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:931)
	at com.intellij.codeInsight.completion.AsyncCompletion.b(CompletionThreading.java:105)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:176)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:556)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:501)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:163)
	at com.intellij.codeInsight.completion.AsyncCompletion.a(CompletionThreading.java:103)
	at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:334)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
@OvermindDL1
Copy link
Author

Keeps happening a few times a day, seems to randomly pop up without me doing any input at the time.

@KronicDeth
Copy link
Owner

Decompilation happens automatically in the background as references are being resolved, so the background stub index update would keep triggering it as it's not able to decompile and index the file, so OpenAPI is marking the file as unindexed.

@KronicDeth KronicDeth changed the title [auto-generated] org.elixir_lang.beam.psi.impl.ModuleElementImpl.setMirrors( Decompilation error in LDAPEx.ELDAPv3 May 25, 2017
@OvermindDL1
Copy link
Author

Decompilation happens automatically in the background as references are being resolved, so the background stub index update would keep triggering it as it's not able to decompile and index the file, so OpenAPI is marking the file as unindexed.

LDAPEx is one of my libraries (with some erlang code in it as well due to elixir limitations in ASN1 generation). What about it is not decompileable for you? Anything I can help with?

@KronicDeth
Copy link
Owner

So, it's not so much that it can't be decompiled, but that the way the indexing of decompiled modules works is there is two sides, there's the binary representation and a thing OpenAPI calls mirrors, which is the text you as a user can view when you open a .beam file now. That generated text is actually parsed by the same parser that would parse you write in an .ex file. That parsing generates normal PSIElements and those elements are scanned for call definition clauses. The nodes for call definition clauses (so PSIElements for the def, defp, defmacro, and defmacrop) are gathered and then they'll set as the mirrors for the binary nodes. If there is a mismatch in the number, then you get the error you're seeing. This usually means that the text I'm producing isn't valid Elixir syntax. There are bunch of edge cases already where the name of a function/macro needs to be a symbol in a unquote, like defmacro unquote(:%), so you probably have some name I didn't encounter for the standard library tests.

It turns out that spotting the problem with the decompilation is pretty easy: you take the decompiled text shown when you open the .beam file (Cmd+A, Cmd+C) and you paste it in a Scratch File (Cmd+Shift+N, Select Elixir, Cmd+V) and then the normal parser errors will occur and point out where the error in the generate text is. I assume because JetBrains expects the decompiler to produce valid code, the error highlights don't show up on the .beam file text itself.

@OvermindDL1
Copy link
Author

OvermindDL1 commented May 25, 2017

This usually means that the text I'm producing isn't valid Elixir syntax.

If it is generating Elixir syntax from the BEAM, they it definitely will choke on that. ^.^
The Elixir AST can represent far more code than the Elixir Syntax can. Any chance you could just keep it in the AST form in that case?

But here is what it infers from the beam file (nice that you can open those):

# Source code recreated from a .beam file by IntelliJ Elixir
defmodule LDAPEx.ELDAPv3 do

  # Macros

  defmacro AddRequest() do
    # body not decompiled
  end

  defmacro AddRequest(p0) do
    # body not decompiled
  end

  defmacro AddRequest(p0, p1) do
    # body not decompiled
  end

  defmacro AttributeValueAssertion() do
    # body not decompiled
  end

  defmacro AttributeValueAssertion(p0) do
    # body not decompiled
  end

  defmacro AttributeValueAssertion(p0, p1) do
    # body not decompiled
  end

  defmacro BindRequest() do
    # body not decompiled
  end

  defmacro BindRequest(p0) do
    # body not decompiled
  end

  defmacro BindRequest(p0, p1) do
    # body not decompiled
  end

  defmacro BindResponse() do
    # body not decompiled
  end

  defmacro BindResponse(p0) do
    # body not decompiled
  end

  defmacro BindResponse(p0, p1) do
    # body not decompiled
  end

  defmacro CompareRequest() do
    # body not decompiled
  end

  defmacro CompareRequest(p0) do
    # body not decompiled
  end

  defmacro CompareRequest(p0, p1) do
    # body not decompiled
  end

  defmacro Control() do
    # body not decompiled
  end

  defmacro Control(p0) do
    # body not decompiled
  end

  defmacro Control(p0, p1) do
    # body not decompiled
  end

  defmacro ExtendedRequest() do
    # body not decompiled
  end

  defmacro ExtendedRequest(p0) do
    # body not decompiled
  end

  defmacro ExtendedRequest(p0, p1) do
    # body not decompiled
  end

  defmacro ExtendedResponse() do
    # body not decompiled
  end

  defmacro ExtendedResponse(p0) do
    # body not decompiled
  end

  defmacro ExtendedResponse(p0, p1) do
    # body not decompiled
  end

  defmacro IntermediateResponse() do
    # body not decompiled
  end

  defmacro IntermediateResponse(p0) do
    # body not decompiled
  end

  defmacro IntermediateResponse(p0, p1) do
    # body not decompiled
  end

  defmacro LDAPMessage() do
    # body not decompiled
  end

  defmacro LDAPMessage(p0) do
    # body not decompiled
  end

  defmacro LDAPMessage(p0, p1) do
    # body not decompiled
  end

  defmacro LDAPResult() do
    # body not decompiled
  end

  defmacro LDAPResult(p0) do
    # body not decompiled
  end

  defmacro LDAPResult(p0, p1) do
    # body not decompiled
  end

  defmacro MatchingRuleAssertion() do
    # body not decompiled
  end

  defmacro MatchingRuleAssertion(p0) do
    # body not decompiled
  end

  defmacro MatchingRuleAssertion(p0, p1) do
    # body not decompiled
  end

  defmacro ModifyDNRequest() do
    # body not decompiled
  end

  defmacro ModifyDNRequest(p0) do
    # body not decompiled
  end

  defmacro ModifyDNRequest(p0, p1) do
    # body not decompiled
  end

  defmacro ModifyRequest() do
    # body not decompiled
  end

  defmacro ModifyRequest(p0) do
    # body not decompiled
  end

  defmacro ModifyRequest(p0, p1) do
    # body not decompiled
  end

  defmacro ModifyRequest_changes_SEQOF() do
    # body not decompiled
  end

  defmacro ModifyRequest_changes_SEQOF(p0) do
    # body not decompiled
  end

  defmacro ModifyRequest_changes_SEQOF(p0, p1) do
    # body not decompiled
  end

  defmacro PartialAttribute() do
    # body not decompiled
  end

  defmacro PartialAttribute(p0) do
    # body not decompiled
  end

  defmacro PartialAttribute(p0, p1) do
    # body not decompiled
  end

  defmacro SaslCredentials() do
    # body not decompiled
  end

  defmacro SaslCredentials(p0) do
    # body not decompiled
  end

  defmacro SaslCredentials(p0, p1) do
    # body not decompiled
  end

  defmacro SearchRequest() do
    # body not decompiled
  end

  defmacro SearchRequest(p0) do
    # body not decompiled
  end

  defmacro SearchRequest(p0, p1) do
    # body not decompiled
  end

  defmacro SearchResultEntry() do
    # body not decompiled
  end

  defmacro SearchResultEntry(p0) do
    # body not decompiled
  end

  defmacro SearchResultEntry(p0, p1) do
    # body not decompiled
  end

  defmacro SubstringFilter() do
    # body not decompiled
  end

  defmacro SubstringFilter(p0) do
    # body not decompiled
  end

  defmacro SubstringFilter(p0, p1) do
    # body not decompiled
  end

  # Functions

  def __info__(p0) do
    # body not decompiled
  end

  def decode(p0, p1) do
    # body not decompiled
  end

  def encode(p0, p1) do
    # body not decompiled
  end

  def module_info() do
    # body not decompiled
  end

  def module_info(p0) do
    # body not decompiled
  end
end

I'm seeing two immediate problems:

  1. The new elixir file dialog box forces me to choose a name with an upper-case initial letter. Module names in Elixir are atoms, something like Blah is the atom :"Elixir.Blah", you can also use :blah as a module name, or :"blah.hfdJ$#$$" and that is still an entirely valid module name.

  2. The decompiled code is choking on the function definitions that start with a capital letter. Same thing, function definitions on the beam are also an atom, thus def blah, do: nil create the function with the name :blah, and consequently you can have functions with any name, including something like :"fdsbha8793q5#$*&$(#" is entirely valid (although unrepresentable in the Elixir 'Syntax', it is fully representable and works with the Elixir 'AST'). So it is, first of all, representing the first function as defmacro AddRequest() do, which is wrong, it should be represented as defmacro :AddRequest() do, though not being correct Elixir 'Syntax', does represent the Elixir AST properly (since the function name is the atom :AddRequest', not :"Elixir.AddRequest"` as it is currently printing as).

The Elixir syntax functions can reverse an Elixir AST in to Elixir Syntax, but it is not always valid syntax even though it is a valid program.

For note, those lines of codes are caused by: https://github.com/OvermindDL1/ldap_ex/blob/master/lib/ldap_ex/ELDAPv3.ex#L13-L15

  for rec <- extract_all(from: "lib/asn1/ELDAPv3a.hrl") do
    defrecord elem(rec, 0), elem(rec, 1)
  end

It is the auto-generated Erlang ASN1 LDAP definition file, not something that I can change as it is generated from the standard spec.

Hope that information helps. :-)

I assume because JetBrains expects the decompiler to produce valid code

For note, Elixir cannot represent all valid BEAM code, Elixir is a limited language compared to Erlang (though its macros are awesome hence why I use it), perhaps it would be best to try to decompile a BEAM file to elixir, and if that fails to reverse properly then decompile it to Erlang instead, or perhaps to CoreErlang as it can fully represent everything perfectly?

@KronicDeth
Copy link
Owner

I'm not reading the AST to generate the names, I'm reading the Atom and Export chunks and then applying some heuristics to produce parsable names and code, in your case I need to quote(:<capitalized_name>) if I find a capitalized name.

@KronicDeth KronicDeth changed the title Decompilation error in LDAPEx.ELDAPv3 Quote capitalized exported names in decompilation so they aren't treated as Aliases May 25, 2017
@KronicDeth
Copy link
Owner

It turns out that this same issues was the root cause of #683: The CORBA modules in the OTP also use capitalized names for some functions, so the fix for #683, #751, also fixed this, but I'm going to add your example as a test case.

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

2 participants