typetools / typetools/checker-framework

NPE in MustCallConsistencyAnalyzer

Open
#7,217 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

To reproduce:

git clone git@github.com:typetools/guava.git guava-fork-typetools
cd guava-fork-typetools/guava/
mvn -B compile -P checkerframework-local -Dcheckerframework.checkers=org.checkerframework.checker.resourceleak.ResourceLeakChecker

The full output is attached.

guava-resourceleak-output.txt

The stack trace is:

[WARNING]   ; The Checker Framework crashed.  Please report the crash.  Version: Checker Framework 3.49.6-SNAPSHOT, branch master, 2025-08-20, commit 7394319. 
  Compilation unit: /home/mernst/tmp/guava-fork-typetools/guava/src/com/google/common/collect/EnumMultiset.java
  Last visited tree at line 54 column 1:
  @AnnotatedFor({"nullness"})
  Exception: java.lang.NullPointerException: Cannot invoke "org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedTypeVariable.getUnderlyingType()" because "typeVar" is null; java.lang.NullPointerException: Cannot invoke "org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedTypeVariable.getUnderlyingType()" because "typeVar" is null
  	at org.checkerframework.framework.flow.CFAbstractValue$ValueLub.combineAnnotationWithTypeVar(CFAbstractValue.java:594)
  	at org.checkerframework.framework.flow.CFAbstractValue$AnnotationSetCombiner.combineSets(CFAbstractValue.java:782)
  	at org.checkerframework.framework.flow.CFAbstractValue.upperBound(CFAbstractValue.java:527)
  	at org.checkerframework.common.accumulation.AccumulationValue.upperBound(AccumulationValue.java:84)
  	at org.checkerframework.common.accumulation.AccumulationValue.upperBound(AccumulationValue.java:34)
  	at org.checkerframework.framework.flow.CFAbstractValue.upperBound(CFAbstractValue.java:507)
  	at org.checkerframework.framework.flow.CFAbstractValue.leastUpperBound(CFAbstractValue.java:441)
  	at org.checkerframework.framework.flow.CFAbstractStore.upperBoundOfValues(CFAbstractStore.java:1262)
  	at org.checkerframework.framework.flow.CFAbstractStore.upperBound(CFAbstractStore.java:1189)
  	at org.checkerframework.framework.flow.CFAbstractStore.leastUpperBound(CFAbstractStore.java:1171)
  	at org.checkerframework.framework.flow.CFAbstractStore.leastUpperBound(CFAbstractStore.java:66)
  	at org.checkerframework.dataflow.analysis.TransferInput.getRegularStore(TransferInput.java:190)
  	at org.checkerframework.checker.resourceleak.MustCallConsistencyAnalyzer.propagateObligationsToSuccessorBlock(MustCallConsistencyAnalyzer.java:1998)
  	at org.checkerframework.checker.resourceleak.MustCallConsistencyAnalyzer.propagateObligationsToSuccessorBlocks(MustCallConsistencyAnalyzer.java:1949)
  	at org.checkerframework.checker.resourceleak.MustCallConsistencyAnalyzer.analyze(MustCallConsistencyAnalyzer.java:600)
  	at org.checkerframework.checker.rlccalledmethods.RLCCalledMethodsAnnotatedTypeFactory.postAnalyze(RLCCalledMethodsAnnotatedTypeFactory.java:149)
  	at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.analyze(GenericAnnotatedTypeFactory.java:1649)
  	at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.performFlowAnalysis(GenericAnnotatedTypeFactory.java:1481)
  	at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.checkAndPerformFlowAnalysis(GenericAnnotatedTypeFactory.java:1990)
  	at org.checkerframework.framework.type.GenericAnnotatedTypeFactory.preProcessClassTree(GenericAnnotatedTypeFactory.java:432)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:579)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:189)
  	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:860)
  	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:60)
  	at org.checkerframework.framework.source.SourceVisitor.visit(SourceVisitor.java:88)
  	at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1349)
  	at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1270)
  	at org.checkerframework.javacutil.AbstractTypeProcessor$AttributionTaskListener.finished(AbstractTypeProcessor.java:188)
  	at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:854)
  	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:1397)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1344)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:933)
  	at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:317)
  	at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176)
  	at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64)
  	at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50)

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 provided Maven command, then inspect MustCallConsistencyAnalyzer.java around lines 1949-1998 and CFAbstractValue.java around lines 594 and 782, where the stack trace points. Use the attached output and EnumMultiset.java as the failing case. Done means the ResourceLeakChecker compiles Guava without this NullPointerException.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.