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

ClassCastException in DeadStoreCheck #1402

Closed
vilchik-elena opened this issue Sep 13, 2019 · 1 comment · Fixed by #1600
Closed

ClassCastException in DeadStoreCheck #1402

vilchik-elena opened this issue Sep 13, 2019 · 1 comment · Fixed by #1600
Assignees
Labels
type: bug Exceptions and blocking issues during analysis
Milestone

Comments

@vilchik-elena
Copy link
Contributor

let x = -foo();
x = 42;
java.lang.ClassCastException: class org.sonar.javascript.tree.impl.expression.CallExpressionTreeImpl cannot be cast to class org.sonar.plugins.javascript.api.tree.expression.LiteralTree (org.sonar.javascript.tree.impl.expression.CallExpressionTreeImpl and org.sonar.plugins.javascript.api.tree.expression.LiteralTree are in unnamed module of loader 'app')

	at org.sonar.javascript.checks.DeadStoreCheck.isBasicValue(DeadStoreCheck.java:179)
	at org.sonar.javascript.checks.DeadStoreCheck.initializedToBasicValue(DeadStoreCheck.java:167)
	at org.sonar.javascript.checks.DeadStoreCheck.checkUsage(DeadStoreCheck.java:150)
	at org.sonar.javascript.checks.DeadStoreCheck.checkCFG(DeadStoreCheck.java:127)
	at org.sonar.javascript.checks.DeadStoreCheck.checkFunction(DeadStoreCheck.java:102)
	at org.sonar.javascript.checks.DeadStoreCheck.visitFunctionDeclaration(DeadStoreCheck.java:69)
	at org.sonar.javascript.tree.impl.declaration.FunctionDeclarationTreeImpl.accept(FunctionDeclarationTreeImpl.java:145)
	at org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitor.scanChildren(DoubleDispatchVisitor.java:192)
	at org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitor.visitModule(DoubleDispatchVisitor.java:206)
	at org.sonar.javascript.tree.impl.declaration.ModuleTreeImpl.accept(ModuleTreeImpl.java:56)
	at org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitor.scanChildren(DoubleDispatchVisitor.java:192)
	at org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitor.visitScript(DoubleDispatchVisitor.java:202)
	at org.sonar.javascript.tree.impl.declaration.ScriptTreeImpl.accept(ScriptTreeImpl.java:74)
	at org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitor.scan(DoubleDispatchVisitor.java:180)
	at org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitor.scanTree(DoubleDispatchVisitor.java:175)
	at org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitorCheck.scanFile(DoubleDispatchVisitorCheck.java:34)
	at org.sonar.javascript.checks.verifier.JavaScriptCheckVerifier.getActualIssues(JavaScriptCheckVerifier.java:133)
	at org.sonar.javascript.checks.verifier.JavaScriptCheckVerifier.verify(JavaScriptCheckVerifier.java:111)
	at org.sonar.javascript.checks.verifier.JavaScriptCheckVerifier.verify(JavaScriptCheckVerifier.java:104)
	at org.sonar.javascript.checks.DeadStoreCheckTest.test(DeadStoreCheckTest.java:32)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
@saberduck
Copy link
Contributor

this is happing in analysis of ag-grid

ERROR: Unable to analyse file: file:///tmp/cirrus-ci-build/ag-grid/workspace/packages/ag-grid-enterprise/dist/lib/charts/chart/series/barSeries.js
java.lang.ClassCastException: org.sonar.javascript.tree.impl.expression.IdentifierTreeImpl cannot be cast to org.sonar.plugins.javascript.api.tree.expression.LiteralTree
    at org.sonar.javascript.checks.DeadStoreCheck.isBasicValue(DeadStoreCheck.java:179)
    at org.sonar.javascript.checks.DeadStoreCheck.initializedToBasicValue(DeadStoreCheck.java:167)
    at org.sonar.javascript.checks.DeadStoreCheck.checkUsage(DeadStoreCheck.java:150)
    at org.sonar.javascript.checks.DeadStoreCheck.checkCFG(DeadStoreCheck.java:127)
    at org.sonar.javascript.checks.DeadStoreCheck.checkFunction(DeadStoreCheck.java:102)
    at org.sonar.javascript.checks.DeadStoreCheck.visitFunctionExpression(DeadStoreCheck.java:75)
    at org.sonar.javascript.tree.impl.expression.FunctionExpressio

adding to be fixed in 6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Exceptions and blocking issues during analysis
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants