checker-framework icon indicating copy to clipboard operation
checker-framework copied to clipboard

Crash: AsSuperVisitor Declared_Primitive: type is not a boxed primitive

Open iamsanjaymalakar opened this issue 1 year ago • 2 comments

The Checker Framework crashes while running Whole Program Inference (WPI) in the NJR benchmark. The error occurs during the analysis of a specific Java file, resulting in the exception: AsSuperVisitor Declared_Primitive: type is not a boxed primitive.

Crash Details: Checker Framework Version: 3.48-SNAPSHOT4 JDK Version: 11 Commit ID: d15b6bed510135305724f361a4799a5cbf3f8122

Stacktrace:

error: AsSuperVisitor Declared_Primitive: type is not a boxed primitive.
  ; The Checker Framework crashed.  Please report the crash.  Version: Checker Framework 3.48.-SNAPSHOT4. 
  Compilation unit: /home/smala009/RLF/cf-rlc/june2020_dataset_NJR/urle381b6cba7_IkarosKappler_ikrs_http_tgz-pJ8-ikrs_json_rpc_JSONRPCHandlerJ8/src/ikrs/httpd/AbstractPreparedResponse.java
  Last visited tree at line 491 column 16:
  	return total_length;
  Exception: java.lang.Throwable; java.lang.Throwable
  	at org.checkerframework.javacutil.BugInCF.<init>(BugInCF.java:26)
  	at org.checkerframework.framework.type.AsSuperVisitor.visitDeclared_Primitive(AsSuperVisitor.java:362)
  	at org.checkerframework.framework.type.AsSuperVisitor.visitDeclared_Primitive(AsSuperVisitor.java:30)
  	at org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:333)
  	at org.checkerframework.framework.type.visitor.AbstractAtmComboVisitor.visit(AbstractAtmComboVisitor.java:34)
  	at org.checkerframework.framework.type.AsSuperVisitor.visit(AsSuperVisitor.java:107)
  	at org.checkerframework.framework.type.AsSuperVisitor.asSuper(AsSuperVisitor.java:88)
  	at org.checkerframework.framework.util.AnnotatedTypes.asSuper(AnnotatedTypes.java:118)
  	at org.checkerframework.common.wholeprograminference.WholeProgramInferenceImplementation.updateAtmWithLub(WholeProgramInferenceImplementation.java:1067)
  	at org.checkerframework.framework.type.AnnotatedTypeFactory.makeConditionConsistentWithOtherMethod(AnnotatedTypeFactory.java:5661)
  	at org.checkerframework.framework.type.AnnotatedTypeFactory.wpiPrepareMethodForWriting(AnnotatedTypeFactory.java:5608)
  	at org.checkerframework.common.wholeprograminference.WholeProgramInferenceJavaParserStorage.wpiPrepareMethodForWriting(WholeProgramInferenceJavaParserStorage.java:1008)
  	at org.checkerframework.common.wholeprograminference.WholeProgramInferenceJavaParserStorage.wpiPrepareClassForWriting(WholeProgramInferenceJavaParserStorage.java:959)
  	at org.checkerframework.common.wholeprograminference.WholeProgramInferenceJavaParserStorage.wpiPrepareCompilationUnitForWriting(WholeProgramInferenceJavaParserStorage.java:929)
  	at org.checkerframework.common.wholeprograminference.WholeProgramInferenceJavaParserStorage.writeResultsToFile(WholeProgramInferenceJavaParserStorage.java:1028)
  	at org.checkerframework.common.wholeprograminference.WholeProgramInferenceImplementation.writeResultsToFile(WholeProgramInferenceImplementation.java:1147)
  	at org.checkerframework.framework.type.AnnotatedTypeFactory.postProcessClassTree(AnnotatedTypeFactory.java:1461)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:559)
  	at org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:189)
  	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:88)
  	at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1347)
  	at org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:1268)
  	at org.checkerframework.javacutil.AbstractTypeProcessor$AttributionTaskListener.finished(AbstractTypeProcessor.java:188)
  	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:1417)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1374)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1515)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1431)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
  	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)
  	at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)

Reproducer: reproducer.zip

chmod +x wpi.sh && ./wpi.sh urle381b6cba7_IkarosKappler_ikrs_http_tgz-pJ8-ikrs_json_rpc_JSONRPCHandlerJ8

iamsanjaymalakar avatar Dec 12 '24 20:12 iamsanjaymalakar

The error I get (under Java 11 or Java 17) is:

urle381b6cba7_IkarosKappler_ikrs_http_tgz-pJ8-ikrs_json_rpc_JSONRPCHandlerJ8/src/ikrs/httpd/response/successful/OK.java:617: error: package javax.xml.bind does not exist
		byte[] authBytes  = javax.xml.bind.DatatypeConverter.parseBase64Binary(base64);
		                                  ^

Under Java 8, I get:

Unrecognized option: --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED

mernst avatar Dec 12 '24 23:12 mernst

Under Java 8, the Unrecognized option error you are encountering is expected, as it was introduced in Java 9. This was required to run the Checker Framework using the OpenJDK javac compiler (https://checkerframework.org/manual/#javac-jdk11).

The javax.xml.bind package does not exist because it was removed after JDK 8. However, you should already have the exception related to this issue. Let me try reproducing it on a different machine.

iamsanjaymalakar avatar Dec 14 '24 01:12 iamsanjaymalakar