JetBrains / js-graphql-intellij-plugin

GraphQL language support for WebStorm, IntelliJ IDEA and other IDEs based on the IntelliJ Platform.
https://jimkyndemeyer.github.io/js-graphql-intellij-plugin/
MIT License
880 stars 97 forks source link

Exception: java.lang.IllegalArgumentException: Argument for @NotNull parameter 'locations' of com/intellij/lang/jsgraphql/ide/introspection/GraphQLIntrospectionResultToSchema.createDirectiveLocations must not be null #569

Open BoD opened 2 years ago

BoD commented 2 years ago

Description

Stacktrace

Please paste the full stacktrace from the IDEA error popup.

java.lang.IllegalArgumentException: Argument for @NotNull parameter 'locations' of com/intellij/lang/jsgraphql/ide/introspection/GraphQLIntrospectionResultToSchema.createDirectiveLocations must not be null
    at com.intellij.lang.jsgraphql.ide.introspection.GraphQLIntrospectionResultToSchema.$$$reportNull$$$0(GraphQLIntrospectionResultToSchema.java)
    at com.intellij.lang.jsgraphql.ide.introspection.GraphQLIntrospectionResultToSchema.createDirectiveLocations(GraphQLIntrospectionResultToSchema.java)
    at com.intellij.lang.jsgraphql.ide.introspection.GraphQLIntrospectionResultToSchema.createDirectiveDefinition(GraphQLIntrospectionResultToSchema.java:337)
    at com.intellij.lang.jsgraphql.ide.introspection.GraphQLIntrospectionResultToSchema.createSchemaDefinition(GraphQLIntrospectionResultToSchema.java:89)
    at com.intellij.lang.jsgraphql.ide.introspection.GraphQLIntrospectionService.printIntrospectionAsGraphQL(GraphQLIntrospectionService.java:328)
    at com.intellij.lang.jsgraphql.ide.introspection.GraphQLIntrospectionService.printIntrospectionAsGraphQL(GraphQLIntrospectionService.java:305)
    at com.intellij.lang.jsgraphql.ide.introspection.GraphQLIntrospectionFilesManager.lambda$getOrCreateIntrospectionSDL$0(GraphQLIntrospectionFilesManager.java:32)
    at com.intellij.psi.util.CachedValuesManager$1.compute(CachedValuesManager.java:158)
    at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:39)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:227)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:42)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:227)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:114)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:44)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:68)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:228)
    at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:28)
    at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:72)
    at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:155)
    at com.intellij.lang.jsgraphql.ide.introspection.GraphQLIntrospectionFilesManager.getOrCreateIntrospectionSDL(GraphQLIntrospectionFilesManager.java:27)
    at com.intellij.lang.jsgraphql.ide.search.GraphQLPsiSearchHelper$4.visitElement(GraphQLPsiSearchHelper.java:271)
    at com.intellij.psi.impl.PsiElementBase.accept(PsiElementBase.java:273)
    at com.intellij.json.psi.impl.JsonLiteralImpl.accept(JsonLiteralImpl.java:26)
    at com.intellij.json.psi.impl.JsonStringLiteralImpl.accept(JsonStringLiteralImpl.java:28)
    at com.intellij.psi.impl.PsiElementBase.acceptChildren(PsiElementBase.java:69)
    at com.intellij.psi.PsiRecursiveElementVisitor.visitElement(PsiRecursiveElementVisitor.java:41)
    at com.intellij.lang.jsgraphql.ide.search.GraphQLPsiSearchHelper$4.visitElement(GraphQLPsiSearchHelper.java:282)
    at com.intellij.psi.impl.PsiElementBase.accept(PsiElementBase.java:273)
    at com.intellij.json.psi.impl.JsonPropertyImpl.accept(JsonPropertyImpl.java:27)
    at com.intellij.psi.impl.PsiElementBase.acceptChildren(PsiElementBase.java:69)
    at com.intellij.psi.PsiRecursiveElementVisitor.visitElement(PsiRecursiveElementVisitor.java:41)
    at com.intellij.lang.jsgraphql.ide.search.GraphQLPsiSearchHelper$4.visitElement(GraphQLPsiSearchHelper.java:282)
    at com.intellij.psi.impl.PsiElementBase.accept(PsiElementBase.java:273)
    at com.intellij.json.psi.impl.JsonValueImpl.accept(JsonValueImpl.java:26)
    at com.intellij.json.psi.impl.JsonContainerImpl.accept(JsonContainerImpl.java:27)
    at com.intellij.json.psi.impl.JsonObjectImpl.accept(JsonObjectImpl.java:27)
    at com.intellij.psi.impl.source.tree.SharedImplUtil.acceptChildren(SharedImplUtil.java:185)
    at com.intellij.psi.impl.source.PsiFileImpl.acceptChildren(PsiFileImpl.java:754)
    at com.intellij.psi.PsiRecursiveElementVisitor.visitElement(PsiRecursiveElementVisitor.java:41)
    at com.intellij.lang.jsgraphql.ide.search.GraphQLPsiSearchHelper$4.visitElement(GraphQLPsiSearchHelper.java:282)
    at com.intellij.psi.PsiElementVisitor.visitFile(PsiElementVisitor.java:35)
    at com.intellij.psi.PsiRecursiveElementVisitor.visitFile(PsiRecursiveElementVisitor.java:60)
    at com.intellij.extapi.psi.PsiFileBase.accept(PsiFileBase.java:60)
    at com.intellij.lang.jsgraphql.ide.search.GraphQLPsiSearchHelper.lambda$processElementsWithWordUsingIdentifierIndex$3(GraphQLPsiSearchHelper.java:286)
    at com.intellij.util.indexing.FileBasedIndexEx.processVirtualFiles(FileBasedIndexEx.java:522)
    at com.intellij.util.indexing.FileBasedIndexEx.processFilesContainingAllKeys(FileBasedIndexEx.java:362)
    at com.intellij.util.indexing.FileBasedIndexEx.getFilesWithKey(FileBasedIndexEx.java:433)
    at com.intellij.lang.jsgraphql.ide.search.GraphQLPsiSearch...

Version and Environment Details

Operation system: macOS 12.0.1 IDE version: IC-213.5744.223 Plugin version: 3.1.0

vepanimas commented 2 years ago

Hi! It shouldn't happen anymore in the released 3.1.2 version, but still it's interesting to find what exactly caused this. Do you have any GraphQL schemas in JSON format in your project?

BoD commented 2 years ago

Hi! To be honest it's a weird project (I'm working on the Apollo Android library)which has tons of schemas, including json ones, all over the place for test cases. Not a regular use case for your plugin.