eclipse-archived/ceylon-ide-intellij

java.lang.IllegalArgumentException in log

Closed this issue · 11 comments

This error happened after i enteried import keyword. Additional information - project was in brocket state and ceylon problems contained some errors

null
java.lang.IllegalArgumentException
    at com.redhat.ceylon.compiler.java.codegen.CodegenUtil.getJavaNameOfDeclaration(CodegenUtil.java:401)
    at com.redhat.ceylon.ide.common.model.asjava.getJavaQualifiedName_.getJavaQualifiedName(JObjectMirror.ceylon:91)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.scanJavaIndex_$1processor_.findOrCreateDeclaration$priv$(scanJavaIndex.ceylon:150)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.scanJavaIndex_$1processor_.process(scanJavaIndex.ceylon:362)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.scanJavaIndex_$1processor_.process(scanJavaIndex.ceylon)
    at com.intellij.psi.impl.search.AllClassesSearchExecutor.processClassesByNames(AllClassesSearchExecutor.java:84)
    at com.intellij.codeInsight.completion.AllClassesGetter.processJavaClasses(AllClassesGetter.java:162)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.scanJavaIndex_.scanJavaIndex(scanJavaIndex.ceylon:413)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.IdeaModule.getAvailableDeclarations(IdeaModule.ceylon:76)
    at com.redhat.ceylon.model.typechecker.model.Package.getMatchingDeclarations(Package.java:241)
    at com.redhat.ceylon.ide.common.util.SingleSourceUnitPackage.getMatchingDeclarations(SinceSourceUnitPackage.ceylon:107)
    at com.redhat.ceylon.ide.common.completion.completionManager_.getProposals$canonical$(IdeCompletionManager.ceylon:1699)
    at com.redhat.ceylon.ide.common.completion.completionManager_.getProposals(IdeCompletionManager.ceylon:1576)
    at com.redhat.ceylon.ide.common.completion.completionManager_.getContentProposals$canonical$(IdeCompletionManager.ceylon:265)
    at com.redhat.ceylon.ide.common.completion.completionManager_.getContentProposals(IdeCompletionManager.ceylon:113)
    at org.intellij.plugins.ceylon.ide.ceylonCode.completion.IdeaCompletionProvider.addCompletionsInternal$priv$(ideaCompletionManager.ceylon:216)
    at org.intellij.plugins.ceylon.ide.ceylonCode.completion.IdeaCompletionProvider.access$100(ideaCompletionManager.ceylon:70)
    at org.intellij.plugins.ceylon.ide.ceylonCode.completion.IdeaCompletionProvider$1.$call$(ideaCompletionManager.ceylon:179)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.concurrencyManager_.withIndexStrategy$priv$(concurrencyManager.ceylon:207)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.concurrencyManager_.withAlternateResolution(concurrencyManager.ceylon:219)
    at org.intellij.plugins.ceylon.ide.ceylonCode.completion.IdeaCompletionProvider.addCompletions(ideaCompletionManager.ceylon:162)
    at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:36)
    at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:155)
    at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:81)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:132)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:125)
    at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$2.addCompletions(LiveTemplateCompletionContributor.java:90)
    at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:36)
    at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:155)
    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.calculateItems(CompletionProgressIndicator.java:776)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator.access$500(CompletionProgressIndicator.java:90)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator$1CalculateItems.run(CompletionProgressIndicator.java:758)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$null$0(CompletionThreading.java:87)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:848)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$null$1(CompletionThreading.java:84)
    at com.intellij.openapi.progress.impl.CoreProgressManager$3.run(CoreProgressManager.java:170)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:494)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:443)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:155)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$2(CompletionThreading.java:82)
    at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:307)
    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.IllegalArgumentException
    at com.redhat.ceylon.compiler.java.codegen.CodegenUtil.getJavaNameOfDeclaration(CodegenUtil.java:401)
    at com.redhat.ceylon.ide.common.model.asjava.getJavaQualifiedName_.getJavaQualifiedName(JObjectMirror.ceylon:91)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.scanJavaIndex_$1processor_.findOrCreateDeclaration$priv$(scanJavaIndex.ceylon:150)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.scanJavaIndex_$1processor_.process(scanJavaIndex.ceylon:362)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.scanJavaIndex_$1processor_.process(scanJavaIndex.ceylon)
    at com.intellij.psi.impl.search.AllClassesSearchExecutor.processClassesByNames(AllClassesSearchExecutor.java:84)
    at com.intellij.codeInsight.completion.AllClassesGetter.processJavaClasses(AllClassesGetter.java:162)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.scanJavaIndex_.scanJavaIndex(scanJavaIndex.ceylon:413)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.IdeaModule.getAvailableDeclarations(IdeaModule.ceylon:76)
    at com.redhat.ceylon.model.typechecker.model.Package.getMatchingDeclarations(Package.java:241)
    at com.redhat.ceylon.ide.common.util.SingleSourceUnitPackage.getMatchingDeclarations(SinceSourceUnitPackage.ceylon:107)
    at com.redhat.ceylon.ide.common.completion.completionManager_.getProposals$canonical$(IdeCompletionManager.ceylon:1699)
    at com.redhat.ceylon.ide.common.completion.completionManager_.getProposals(IdeCompletionManager.ceylon:1576)
    at com.redhat.ceylon.ide.common.completion.completionManager_.getContentProposals$canonical$(IdeCompletionManager.ceylon:265)
    at com.redhat.ceylon.ide.common.completion.completionManager_.getContentProposals(IdeCompletionManager.ceylon:113)
    at org.intellij.plugins.ceylon.ide.ceylonCode.completion.IdeaCompletionProvider.addCompletionsInternal$priv$(ideaCompletionManager.ceylon:216)
    at org.intellij.plugins.ceylon.ide.ceylonCode.completion.IdeaCompletionProvider.access$100(ideaCompletionManager.ceylon:70)
    at org.intellij.plugins.ceylon.ide.ceylonCode.completion.IdeaCompletionProvider$1.$call$(ideaCompletionManager.ceylon:179)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.concurrencyManager_.withIndexStrategy$priv$(concurrencyManager.ceylon:207)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.concurrencyManager_.withAlternateResolution(concurrencyManager.ceylon:219)
    at org.intellij.plugins.ceylon.ide.ceylonCode.completion.IdeaCompletionProvider.addCompletions(ideaCompletionManager.ceylon:162)
    at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:36)
    at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:155)
    at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:81)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:132)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:125)
    at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$2.addCompletions(LiveTemplateCompletionContributor.java:90)
    at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:36)
    at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:155)
    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.calculateItems(CompletionProgressIndicator.java:776)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator.access$500(CompletionProgressIndicator.java:90)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator$1CalculateItems.run(CompletionProgressIndicator.java:758)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$null$0(CompletionThreading.java:87)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:848)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$null$1(CompletionThreading.java:84)
    at com.intellij.openapi.progress.impl.CoreProgressManager$3.run(CoreProgressManager.java:170)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:494)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:443)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:155)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$2(CompletionThreading.java:82)
    at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:307)
    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.IllegalArgumentException
    at com.redhat.ceylon.compiler.java.codegen.CodegenUtil.getJavaNameOfDeclaration(CodegenUtil.java:401)
    at com.redhat.ceylon.ide.common.model.asjava.getJavaQualifiedName_.getJavaQualifiedName(JObjectMirror.ceylon:91)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.scanJavaIndex_$1processor_.findOrCreateDeclaration$priv$(scanJavaIndex.ceylon:150)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.scanJavaIndex_$1processor_.process(scanJavaIndex.ceylon:362)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.scanJavaIndex_$1processor_.process(scanJavaIndex.ceylon)
    at com.intellij.psi.impl.search.AllClassesSearchExecutor.processClassesByNames(AllClassesSearchExecutor.java:84)
    at com.intellij.codeInsight.completion.AllClassesGetter.processJavaClasses(AllClassesGetter.java:162)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.scanJavaIndex_.scanJavaIndex(scanJavaIndex.ceylon:413)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.IdeaModule.getAvailableDeclarations(IdeaModule.ceylon:76)
    at com.redhat.ceylon.model.typechecker.model.Package.getMatchingDeclarations(Package.java:241)
    at com.redhat.ceylon.ide.common.util.SingleSourceUnitPackage.getMatchingDeclarations(SinceSourceUnitPackage.ceylon:107)
    at com.redhat.ceylon.ide.common.completion.completionManager_.getProposals$canonical$(IdeCompletionManager.ceylon:1699)
    at com.redhat.ceylon.ide.common.completion.completionManager_.getProposals(IdeCompletionManager.ceylon:1576)
    at com.redhat.ceylon.ide.common.completion.completionManager_.getContentProposals$canonical$(IdeCompletionManager.ceylon:265)
    at com.redhat.ceylon.ide.common.completion.completionManager_.getContentProposals(IdeCompletionManager.ceylon:113)
    at org.intellij.plugins.ceylon.ide.ceylonCode.completion.IdeaCompletionProvider.addCompletionsInternal$priv$(ideaCompletionManager.ceylon:216)
    at org.intellij.plugins.ceylon.ide.ceylonCode.completion.IdeaCompletionProvider.access$100(ideaCompletionManager.ceylon:70)
    at org.intellij.plugins.ceylon.ide.ceylonCode.completion.IdeaCompletionProvider$1.$call$(ideaCompletionManager.ceylon:179)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.concurrencyManager_.withIndexStrategy$priv$(concurrencyManager.ceylon:207)
    at org.intellij.plugins.ceylon.ide.ceylonCode.model.concurrencyManager_.withAlternateResolution(concurrencyManager.ceylon:219)
    at org.intellij.plugins.ceylon.ide.ceylonCode.completion.IdeaCompletionProvider.addCompletions(ideaCompletionManager.ceylon:162)
    at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:36)
    at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:155)
    at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:81)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:132)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:125)
    at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$2.addCompletions(LiveTemplateCompletionContributor.java:90)
    at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:36)
    at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:155)
    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.calculateItems(CompletionProgressIndicator.java:776)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator.access$500(CompletionProgressIndicator.java:90)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator$1CalculateItems.run(CompletionProgressIndicator.java:758)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$null$0(CompletionThreading.java:87)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:848)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$null$1(CompletionThreading.java:84)
    at com.intellij.openapi.progress.impl.CoreProgressManager$3.run(CoreProgressManager.java:170)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:494)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:443)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:155)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$2(CompletionThreading.java:82)
    at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:307)
    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)



Additionally - reproduced if I try to write code like:

shared ObjectArray<T> toObjectArray<T>({T*} ceylonIterable) given T satisfies Object {
    [T*] ceylonSeq = ceylonIterable.sequence();
    ObjectArray<T> res = ObjectArray<T>(ceylonSeq.size);
    variable value index = 0;
    for (T elem in res) {
        res[index++] = elem;
    }
    return res;
}

And trying to do something with error near creating ObjectArray(ceylonSeq.size)

@MikhailMalyutin it looks like you're using an older version of the plugin here? Are you really using 1.3.1-2?

@gavinking on the branch, CodegenUtil.getJavaNameOfDeclaration is called from JObjectMirror.ceylon:91, so it could 1.3.0-2.

https://github.com/ceylon/ceylon-ide-common/blob/1.3.0-x-preparation/source/com/redhat/ceylon/ide/common/model/asjava/JObjectMirror.ceylon

@bjansen Ah, OK, sorry.

I use ceylon IDE version 1.3.00201609301555. This is latest plugin which is available by default

I see, there was a conflict between jetbrains repository and ceylon plugin repository. Now i use only plugin.jetbrains.com

I don't even see how that can happen:

    public static String getJavaNameOfDeclaration(Declaration decl) {
        Scope s = decl.getScope();
        while (!(s instanceof Package)) {
            if (!(s instanceof TypeDeclaration)) {
                throw new IllegalArgumentException();
            }
            s = s.getContainer();
        }
...

Every accepted import belongs either to a package, or a class/interface (a TypeDeclaration). I'm not aware of any importable declaration that would be contained in something that is not a TypeDeclaration. @gavinking wdyt?

I'm not aware of any importable declaration that would be contained in something that is not a TypeDeclaration

Users sometimes type things that are not legal Ceylon.

Right, but in that case it won't be accepted by the typechecker, so it won't appear in sourceUnit.imports?

Oh, there's also the possibility that theImport.declaration.scope == null, I guess