typetools / typetools/checker-framework

Java compiler crash when using non-existent inner class

Open
#3,579 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.1k
Forks
440
Avg merge
1d 12h
Merged PRs (30d)
134

Description

I get a compiler crash when running javac -processor TaintingChecker Outer.java.

import org.checkerframework.checker.tainting.qual.*;

public class Outer {
    public void f(@Untainted Outer. @Untainted Inner param) {
    }
}
An exception has occurred in the compiler (11.0.8). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.AssertionError
	at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
	at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
	at jdk.compiler/com.sun.tools.javac.code.TypeMetadata$Annotations.combine(TypeMetadata.java:194)
	at jdk.compiler/com.sun.tools.javac.code.TypeMetadata$Annotations.combine(TypeMetadata.java:174)
	at jdk.compiler/com.sun.tools.javac.code.TypeMetadata.combine(TypeMetadata.java:90)
	at jdk.compiler/com.sun.tools.javac.code.Type.annotatedType(Type.java:389)
	at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions$1.visitErrorType(TypeAnnotations.java:683)
	at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions$1.visitErrorType(TypeAnnotations.java:610)
	at jdk.compiler/com.sun.tools.javac.code.Type$ErrorType.accept(Type.java:2357)
	at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.typeWithAnnotations(TypeAnnotations.java:692)
	at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.typeWithAnnotations(TypeAnnotations.java:526)
	at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.separateAnnotationsKinds(TypeAnnotations.java:353)
	at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitMethodDef(TypeAnnotations.java:1171)
	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:866)
	at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
	at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
	at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
	at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitClassDef(TypeAnnotations.java:1122)
	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:774)
	at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
	at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:283)
	at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations.lambda$organizeTypeAnnotationsSignatures$0(TypeAnnotations.java:123)
	at jdk.compiler/com.sun.tools.javac.comp.Annotate.flush(Annotate.java:197)
	at jdk.compiler/com.sun.tools.javac.comp.Annotate.unblockAnnotations(Annotate.java:144)
	at jdk.compiler/com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:157)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterDone(JavaCompiler.java:1741)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1068)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:937)
	at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:311)
	at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170)
	at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)

This crash doesn't occur with regular javac when passing -cp $CHECKERFRAMEWORK/checker/dist/checker-qual.jar. It also doesn't occur when I remove -processor TaintingChecker. This might indicate the framework is side-effecting the javac constructs somehow. Also, the crash doesn't happen when the class Inner actually exists.

Output of javac -processor TaintingChecker Outer.java -version -verbose -AprintAllQualifiers:
javac_output.txt

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the crash with the supplied Outer.java example using javac -processor TaintingChecker, then compare it with regular javac and with Inner defined. Start from the TypeAnnotations and ErrorType frames in the javac stack trace; done means the non-existent inner-class case no longer crashes the compiler while the relevant compilation behavior remains covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.