eclipse-jdtls/eclipse-jdt-core-incubator

`typecode ERROR` building files with instanceof

Closed this issue · 1 comments

Most instanceof referencing a non-existing variable crash during Build. Eg

package test;

public class Test {
	void doIt() {
		boolean b = lol instanceof String;
	}
}

crashes with

java.lang.AssertionError: typecode ERROR
	at jdk.compiler/com.sun.tools.javac.jvm.Code.typecode(Code.java:263)
	at jdk.compiler/com.sun.tools.javac.jvm.Items$Item.coerce(Items.java:271)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:861)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitTypeTest(Gen.java:2320)
	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCInstanceOf.accept(JCTree.java:2277)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:859)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitVarDef(Gen.java:1063)
	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:1063)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:588)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:623)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:609)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStats(Gen.java:660)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.internalVisitBlock(Gen.java:1121)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1085)
	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1133)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:588)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:623)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:949)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:912)
	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:957)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:588)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2494)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:770)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1700)
	at org.eclipse.jdt.internal.javac.JavacCompiler$2.generate(JavacCompiler.java:156)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1668)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:977)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:897)
	at org.eclipse.jdt.internal.javac.JavacCompiler.compile(JavacCompiler.java:184)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:441)
	at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.compile(IncrementalImageBuilder.java:387)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:372)
	at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.incrementalBuildLoop(IncrementalImageBuilder.java:207)
	at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.build(IncrementalImageBuilder.java:164)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildDeltas(JavaBuilder.java:332)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:249)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1077)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:296)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:352)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:441)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:444)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:555)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:503)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:585)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:207)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:300)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Should be fixed with #985