typetools / typetools/checker-framework

Using the annotated JDK 11 as stub files crashes with Android Studio

Open
#3,043 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

 Underlying Exception: org.checkerframework.javacutil.BugInCF: JDK not found; Stack trace: org.checkerframework.framework.stub.StubTypes.prepJdkStubs(StubTypes.java:419)
  org.checkerframework.framework.stub.StubTypes.parseStubFiles(StubTypes.java:145)
  org.checkerframework.framework.type.AnnotatedTypeFactory.parseStubFiles(AnnotatedTypeFactory.java:2942)
  org.checkerframework.framework.type.GenericAnnotatedTypeFactory.postInit(GenericAnnotatedTypeFactory.java:245)
  org.checkerframework.checker.nullness.KeyForAnnotatedTypeFactory.<init>(KeyForAnnotatedTypeFactory.java:76)
  java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
  org.checkerframework.common.basetype.BaseTypeChecker.invokeConstructorFor(BaseTypeChecker.java:294)
  org.checkerframework.common.basetype.BaseTypeVisitor.createTypeFactory(BaseTypeVisitor.java:254)
  org.checkerframework.common.basetype.BaseTypeVisitor.<init>(BaseTypeVisitor.java:219)
  org.checkerframework.common.basetype.BaseTypeVisitor.<init>(BaseTypeVisitor.java:208)
  org.checkerframework.common.basetype.BaseTypeChecker.createSourceVisitor(BaseTypeChecker.java:225)
  org.checkerframework.common.basetype.BaseTypeChecker.createSourceVisitor(BaseTypeChecker.java:86)
  org.checkerframework.framework.source.SourceChecker.initChecker(SourceChecker.java:927)
  org.checkerframework.common.basetype.BaseTypeChecker.initChecker(BaseTypeChecker.java:105)
  org.checkerframework.common.basetype.BaseTypeChecker.initChecker(BaseTypeChecker.java:92)
  org.checkerframework.framework.source.SourceChecker.typeProcessingStart(SourceChecker.java:883)

This was reported to the mailing list. I can reproduce this crash locally.

This can be work around be not using the JDK by adding the following to the build.gradle:

javaCompileOptions.annotationProcessorOptions.arguments.put("nocheckjdk", "")

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 in Android Studio with the annotated JDK 11, then inspect StubTypes.prepJdkStubs at StubTypes.java:419 and its callers in StubTypes.java. Confirm the fix by checking that JDK 11 stubs no longer produce the reported “JDK not found” failure without requiring the nocheckjdk build.gradle workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.