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

asMemberOf called on unexpected type #635

Closed
cushon opened this issue Nov 26, 2023 · 1 comment · Fixed by #636
Closed

asMemberOf called on unexpected type #635

cushon opened this issue Nov 26, 2023 · 1 comment · Fixed by #636

Comments

@cushon
Copy link

cushon commented Nov 26, 2023

import org.checkerframework.checker.nullness.qual.Nullable;

abstract class T {

  private @Nullable Runnable r;

  private void f() {
    r = null;
    r =
        new Runnable() {
          @Override
          public void run() {
            if (r != this) {
              return;
            }
            f();
          }
        };
  }
}
$ ./checker-framework-3.40.0-eisop2/checker/bin/javac -processor nullness T.java |& head -n 30
error: asMemberOf called on unexpected type.
  t: @FBCBottom NullType
  ; The Checker Framework crashed.  Please report the crash.  Version: Checker Framework 3.40.0-eisop2.
  Checker: class org.checkerframework.checker.initialization.InitializationFieldAccessSubchecker
  Visitor: class org.checkerframework.checker.initialization.InitializationFieldAccessVisitor
  Compilation unit: T.java
  Last visited tree at line 3 column 1:
  abstract class T {
  Exception: java.lang.Throwable; java.lang.Throwable
        at org.checkerframework.javacutil.BugInCF.<init>(BugInCF.java:34)
        at org.checkerframework.framework.util.AnnotatedTypes.asMemberOfImpl(AnnotatedTypes.java:438)
        at org.checkerframework.framework.util.AnnotatedTypes.asMemberOf(AnnotatedTypes.java:360)
        at org.checkerframework.framework.util.AnnotatedTypes.asMemberOf(AnnotatedTypes.java:324)
        at org.checkerframework.checker.initialization.InitializationStore.isDeclaredInitialized(InitializationStore.java:182)
        at org.checkerframework.checker.initialization.InitializationStore.newFieldValueAfterMethodCall(InitializationStore.java:142)
        at org.checkerframework.checker.initialization.InitializationStore.newFieldValueAfterMethodCall(InitializationStore.java:31)
        at org.checkerframework.framework.flow.CFAbstractStore.updateFieldValuesForMethodCall(CFAbstractStore.java:386)
        at org.checkerframework.framework.flow.CFAbstractStore.updateForMethodCall(CFAbstractStore.java:267)
        at org.checkerframework.framework.flow.CFAbstractTransfer.visitMethodInvocation(CFAbstractTransfer.java:998)
        at org.checkerframework.checker.initialization.InitializationTransfer.visitMethodInvocation(InitializationTransfer.java:145)
        at org.checkerframework.checker.initialization.InitializationTransfer.visitMethodInvocation(InitializationTransfer.java:45)
        at org.checkerframework.dataflow.cfg.node.MethodInvocationNode.accept(MethodInvocationNode.java:124)
        at org.checkerframework.dataflow.analysis.AbstractAnalysis.callTransferFunction(AbstractAnalysis.java:356)
        at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.callTransferFunction(ForwardAnalysisImpl.java:393)
        at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.performAnalysisBlock(ForwardAnalysisImpl.java:157)
        at org.checkerframework.dataflow.analysis.ForwardAnalysisImpl.performAnalysis(ForwardAnalysisImpl.java:110)
        at org.checkerframework.framework.flow.CFAbstractAnalysis.performAnalysis(CFAbstractAnalysis.java:150)
        at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.analyze(GenericAnnotatedTypeFactory.java:1623)
        at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.performFlowAnalysis(GenericAnnotatedTypeFactory.java:1513)
        at org.checkerframework.checker.initialization.InitializationFieldAccessAnnotatedTypeFactory.performFlowAnalysis(InitializationFieldAccessAnnotatedTypeFactory.java:32)
@wmdietl
Copy link
Member

wmdietl commented Nov 27, 2023

Thanks for the report!

#636 fixes the exception and #637 looks some more at the underlying problem.

This fix will go into the December release. Let me know if this is a blocker and I can make a release tomorrow.

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

Successfully merging a pull request may close this issue.

2 participants