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

Error in IntelliJ opening RAML: Boolean cannot be cast to String #97

Open
rmorrise opened this issue Jun 15, 2017 · 5 comments
Open

Error in IntelliJ opening RAML: Boolean cannot be cast to String #97

rmorrise opened this issue Jun 15, 2017 · 5 comments

Comments

@rmorrise
Copy link

rmorrise commented Jun 15, 2017

When I open a RAML file in the IDE with the RAML Plugin for IntelliJ installed, I see an error dialog from the IDE.

IntelliJ IDEA 2017.1.4
Build #IU-171.4694.23, built on June 6, 2017
...
JRE: 1.8.0_112-release-736-b21 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 7 6.1

RAML plugin version: 0.10

The following Details are provided.

java.lang.Boolean cannot be cast to java.lang.String
java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String
	at org.raml.yagi.framework.util.NodeSelector.selectStringValue(NodeSelector.java:99)
	at org.raml.v2.internal.impl.v10.type.ObjectResolvedType.overwriteFacets(ObjectResolvedType.java:132)
	at org.raml.v2.internal.impl.commons.nodes.TypeDeclarationNode.resolveTypeDefinition(TypeDeclarationNode.java:99)
	at org.raml.v2.internal.impl.commons.nodes.TypeDeclarationNode.getResolvedType(TypeDeclarationNode.java:85)
	at org.raml.v2.internal.impl.v10.type.ObjectResolvedType.validateCanOverwriteWith(ObjectResolvedType.java:208)
	at org.raml.v2.internal.impl.commons.nodes.TypeDeclarationNode.validateCanOverwrite(TypeDeclarationNode.java:143)
	at org.raml.v2.internal.impl.commons.phase.TypeValidationPhase.apply(TypeValidationPhase.java:39)
	at org.raml.v2.internal.impl.v10.Raml10Builder.runPhases(Raml10Builder.java:114)
	at org.raml.v2.internal.impl.v10.Raml10Builder.build(Raml10Builder.java:93)
	at org.raml.v2.internal.impl.RamlBuilder.build(RamlBuilder.java:116)
	at org.raml.v2.internal.impl.RamlBuilder.build(RamlBuilder.java:100)
	at org.raml.v2.internal.impl.RamlBuilder.build(RamlBuilder.java:95)
	at org.mule.tooling.lang.raml.annotator.RamlAnnotator.doAnnotate(RamlAnnotator.java:37)
	at org.mule.tooling.lang.raml.annotator.RamlAnnotator.doAnnotate(RamlAnnotator.java:18)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass.d(ExternalToolPass.java:224)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass.access$500(ExternalToolPass.java:48)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:172)
	at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
	at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
	at com.intellij.util.ui.update.MergingUpdateQueue.lambda$flush$1(MergingUpdateQueue.java:277)
	at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:291)
	at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:246)
	at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:223)
	at com.intellij.util.Alarm$Request.runSafely(Alarm.java:418)
	at com.intellij.util.Alarm$Request.access$700(Alarm.java:343)
	at com.intellij.util.Alarm$Request$1.run(Alarm.java:385)
	at com.intellij.util.Alarm$Request.run(Alarm.java:396)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:237)
	at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:212)
	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)
@javaduke
Copy link
Collaborator

Can you please post your RAML file? Or is it happening with any RAML file you are trying to open?

@rmorrise
Copy link
Author

The attached RAML file is sufficient to reproduce the issue. The error popup only seems to appear the first time the editor is opened for that file, after starting up the IDE.

(File renamed with .TXT extension for purposes of passing GitHub upload filter)
test.raml.txt

@javaduke
Copy link
Collaborator

OK, so the problem is that the parser doesn't like the fact that your discriminator value is boolean. I'm not sure yet if this is a bug in parser or is it that discriminator can only be string by design. I'm trying to get some answers from the RAML Parser team.

@rmorrise
Copy link
Author

I don't know if it's any help, but the API Workbench plugin for the Atom text editor seems able to handle this file correctly. Not sure if it's using a different parser?

https://atom.io/packages/api-workbench

@javaduke
Copy link
Collaborator

Looks like a Java parser bug after all: raml-org/raml-java-parser#404
I'll keep this issue open till the new version of the parser released and then I'll update the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants