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

Crash in AbstractAtmComboVisitor visitArray_Typevar .. defaultAction #3612

Closed
vlsi opened this issue Aug 31, 2020 · 4 comments
Closed

Crash in AbstractAtmComboVisitor visitArray_Typevar .. defaultAction #3612

vlsi opened this issue Aug 31, 2020 · 4 comments
Labels

Comments

@vlsi
Copy link
Contributor

vlsi commented Aug 31, 2020

checkerframework 3.6.0
org.checkerframework gradle plugin 0.5.9
CI failure: https://github.com/apache/calcite/runs/1051080062?check_suite_focus=true#step:4:15495

The sequence to reproduce could be as follows:

git clone --branch checkerframework https://github.com/vlsi/calcite.git calcite_checkerframework
cd calcite_checkerframework
./gradlew -PenableCheckerframework :core:classes

Code in question

https://github.com/apache/calcite/blob/39e3acd6ae8cd271d4d0b19c07be473dcff3bd6c/core/src/main/java/org/apache/calcite/runtime/ResultSetEnumerable.java#L110

I'm not sure I have a small reproducer yet. The checker prints extremely long message before it crashes:

[@org.checkerframework.checker.initialization.qual.UnknownInitialization, @org.checkerframework.checker.nullness.qual.Nullable], Pair(@Initialized @NonNull List<@Initialized @NonNull RelNode>, @Initialized @NonNull List<@Initialized @NonNull RelNode>)=[@org.checkerframework.checker.initialization.qual.UnknownInitialization, @org.checkerframework.checker.nullness.qual.Nullable], Pair(@Initialized @NonNull Iterator<@Initialized @NonNull Entry<K extends @Initialized @Nullable Object, V extends @Initialized @Nullable Object>>, @Initialized @NonNull Iterator<@Initialized @NonNull Entry<K extends @Initialized @Nullable Object, V extends @Initialized @Nullable Object>>)=[@org.checkerframework.checker.initialization.qual.UnknownInitialization, 

Stacktrace:

; The Checker Framework crashed.  Please report the crash.
  Compilation unit: /home/runner/work/calcite/calcite/core/src/main/java/org/apache/calcite/runtime/ResultSetEnumerable.java
  Last visited tree at line 110 column 15:
                return list.toArray();
  Exception: java.lang.Throwable; java.lang.Throwable
  	at org.checkerframework.javacutil.BugInCF.<init>(BugInCF.java:14)
  	at org.checkerframework.framework.type.visitor.AbstractAtmComboVisitor.defaultAction(AbstractAtmComboVisitor.java:52)
  	at org.checkerframework.framework.type.visitor.AbstractAtmComboVisitor.visitArray_Typevar(AbstractAtmComboVisitor.java:105)
  	at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:298)
  	at org.checkerframework.framework.type.DefaultTypeHierarchy.isSubtype(DefaultTypeHierarchy.java:185)
  	at org.checkerframework.framework.type.DefaultTypeHierarchy.isSubtype(DefaultTypeHierarchy.java:161)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.commonAssignmentCheck(BaseTypeVisitor.java:2529)
  	at org.checkerframework.checker.nullness.NullnessVisitor.commonAssignmentCheck(NullnessVisitor.java:229)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.commonAssignmentCheck(BaseTypeVisitor.java:2423)
  	at org.checkerframework.checker.nullness.NullnessVisitor.commonAssignmentCheck(NullnessVisitor.java:211)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.visitReturn(BaseTypeVisitor.java:1807)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.visitReturn(BaseTypeVisitor.java:167)
  	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1554)
  	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
  	at org.checkerframework.framework.source.SourceVisitor.scan(SourceVisitor.java:88)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:290)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:167)
  	at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90)
  	at jdk.compiler/com.sun.source.util.TreeScanner.visitTry(TreeScanner.java:374)
  	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCTry.accept(JCTree.java:1328)
  	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
  	at org.checkerframework.framework.source.SourceVisitor.scan(SourceVisitor.java:88)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:290)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:167)
  	at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:105)
  	at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:248)
  	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1032)
  	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
  	at org.checkerframework.framework.source.SourceVisitor.scan(SourceVisitor.java:88)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:290)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:167)
  	at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90)
  	at jdk.compiler/com.sun.source.util.TreeScanner.visitLambdaExpression(TreeScanner.java:559)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.visitLambdaExpression(BaseTypeVisitor.java:1761)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.visitLambdaExpression(BaseTypeVisitor.java:167)
  	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1815)
  	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
  	at org.checkerframework.framework.source.SourceVisitor.scan(SourceVisitor.java:88)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:290)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:167)
  	at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90)
  	at jdk.compiler/com.sun.source.util.TreeScanner.visitTypeCast(TreeScanner.java:639)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.visitTypeCast(BaseTypeVisitor.java:2169)
  	at org.checkerframework.checker.initialization.InitializationVisitor.visitTypeCast(InitializationVisitor.java:271)
  	at org.checkerframework.checker.nullness.NullnessVisitor.visitTypeCast(NullnessVisitor.java:464)
  	at org.checkerframework.checker.nullness.NullnessVisitor.visitTypeCast(NullnessVisitor.java:59)
  	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCTypeCast.accept(JCTree.java:2032)
  	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
  	at org.checkerframework.framework.source.SourceVisitor.scan(SourceVisitor.java:88)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:290)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:167)
  	at jdk.compiler/com.sun.source.util.TreeScanner.visitReturn(TreeScanner.java:469)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.visitReturn(BaseTypeVisitor.java:1809)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.visitReturn(BaseTypeVisitor.java:167)
  	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1554)
  	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
  	at org.checkerframework.framework.source.SourceVisitor.scan(SourceVisitor.java:88)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:290)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:167)
  	at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:105)
  	at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:248)
  	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1032)
  	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
  	at org.checkerframework.framework.source.SourceVisitor.scan(SourceVisitor.java:88)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:290)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:167)
  	at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90)
  	at jdk.compiler/com.sun.source.util.TreeScanner.visitIf(TreeScanner.java:420)
  	at org.checkerframework.checker.nullness.NullnessVisitor.visitIf(NullnessVisitor.java:389)
  	at org.checkerframework.checker.nullness.NullnessVisitor.visitIf(NullnessVisitor.java:59)
  	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIf.accept(JCTree.java:1433)
  	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
  	at org.checkerframework.framework.source.SourceVisitor.scan(SourceVisitor.java:88)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:290)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:167)
  	at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90)
  	at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:105)
  	at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:248)
  	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1032)
  	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
  	at org.checkerframework.framework.source.SourceVisitor.scan(SourceVisitor.java:88)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:290)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:167)
  	at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90)
  	at jdk.compiler/com.sun.source.util.TreeScanner.visitLambdaExpression(TreeScanner.java:559)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.visitLambdaExpression(BaseTypeVisitor.java:1761)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.visitLambdaExpression(BaseTypeVisitor.java:167)
  	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1815)
  	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
  	at org.checkerframework.framework.source.SourceVisitor.scan(SourceVisitor.java:88)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:290)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:167)
  	at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90)
  	at jdk.compiler/com.sun.source.util.TreeScanner.visitVariable(TreeScanner.java:223)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.visitVariable(BaseTypeVisitor.java:1156)
  	at org.checkerframework.checker.initialization.InitializationVisitor.visitVariable(InitializationVisitor.java:169)
  	at org.checkerframework.checker.initialization.InitializationVisitor.visitVariable(InitializationVisitor.java:51)
  	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:974)
  	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
  	at org.checkerframework.framework.source.SourceVisitor.scan(SourceVisitor.java:88)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:290)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:167)
  	at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90)
  	at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:105)
  	at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:113)
  	at jdk.compiler/com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:187)
  	at org.checkerframework.framework.source.SourceVisitor.visitClass(SourceVisitor.java:94)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.processClassTree(BaseTypeVisitor.java:375)
  	at org.checkerframework.checker.initialization.InitializationVisitor.processClassTree(InitializationVisitor.java:296)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:328)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:167)
  	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:808)
  	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:56)
  	at org.checkerframework.framework.source.SourceVisitor.visit(SourceVisitor.java:82)
  	at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:911)
  	at org.checkerframework.common.basetype.BaseTypeChecker.typeProcess(BaseTypeChecker.java:512)
  	at org.checkerframework.javacutil.AbstractTypeProcessor$AttributionTaskListener.finished(AbstractTypeProcessor.java:190)
  	at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:828)
  	at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1418)
...
@vlsi vlsi changed the title Crash in AbstractAtmComboVisitor.defaultAction Crash in AbstractAtmComboVisitor visitArray_Typevar .. defaultAction Aug 31, 2020
@vlsi
Copy link
Contributor Author

vlsi commented Sep 1, 2020

Just for the reference, the error goes away after relevant annotations are added

-  private static final Function1<ResultSet, Function0<Object>> AUTO_ROW_BUILDER_FACTORY =
+  private static final Function1<ResultSet, Function0<@Nullable Object>> AUTO_ROW_BUILDER_FACTORY =
       resultSet -> {
         final ResultSetMetaData metaData;
@@ -93,7 +96,7 @@
         } else {
           //noinspection unchecked
-          return (Function0) () -> {
+          return (Function0<@Nullable Object>) () -> {
             try {
-              final List<Object> list = new ArrayList<>();
+              final List<@Nullable Object> list = new ArrayList<>();
               for (int i = 0; i < columnCount; i++) {
                 if (metaData.getColumnType(i + 1) == Types.TIMESTAMP) {

@uschindler
Copy link

uschindler commented Sep 2, 2020

This also causes issues with ASM (used by forbiddenapis), see policeman-tools/forbidden-apis#173

Javac creates a bad class file when you use type annotations inside a try...catch, that causes many third party tools to fail.

@smillst smillst added the crash label Oct 19, 2020
@smillst
Copy link
Member

smillst commented Oct 19, 2020

The code is with the body of a lambda, so it might be related to #979.

@smillst
Copy link
Member

smillst commented May 24, 2024

I can't reproduce this crash. It was like fixed when #979 was merged.

@smillst smillst closed this as completed May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants