From af94341c57903d4ccf572076e09c1a7053401d3f Mon Sep 17 00:00:00 2001 From: Aosen Xiong Date: Wed, 14 Aug 2024 22:49:42 -0400 Subject: [PATCH] No bytecode storage flag first --- docs/CHANGELOG.md | 2 ++ .../org/checkerframework/framework/source/SourceChecker.java | 4 ++++ .../checkerframework/framework/type/AnnotatedTypeFactory.java | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f599801da15..c4caa9b72c2 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -3,6 +3,8 @@ Version 3.42.0-eisop5 (July ?, 2024) **User-visible changes:** +The new command-line argument '-AnoBytecodeStorage' allows the option to not store defaulted annotations in bytecode. + Removed support for the `-Anocheckjdk` option, which was deprecated in version 3.1.1. Use `-ApermitMissingJdk` instead. diff --git a/framework/src/main/java/org/checkerframework/framework/source/SourceChecker.java b/framework/src/main/java/org/checkerframework/framework/source/SourceChecker.java index 2a414ac2883..ba8b010357c 100644 --- a/framework/src/main/java/org/checkerframework/framework/source/SourceChecker.java +++ b/framework/src/main/java/org/checkerframework/framework/source/SourceChecker.java @@ -187,6 +187,10 @@ // org.checkerframework.framework.source.SourceChecker.useConservativeDefault "useConservativeDefaultsForUncheckedCode", + // Whether to store defaulted annotations in bytecode. + // org.checkerframework.framework.type.AnnotatedTypeFactory.postProcessClassTree + "noBytecodeStorage", + // Whether to assume sound concurrent semantics or // simplified sequential semantics // org.checkerframework.framework.flow.CFAbstractTransfer.sequentialSemantics diff --git a/framework/src/main/java/org/checkerframework/framework/type/AnnotatedTypeFactory.java b/framework/src/main/java/org/checkerframework/framework/type/AnnotatedTypeFactory.java index 228df9f8942..75fe6f78432 100644 --- a/framework/src/main/java/org/checkerframework/framework/type/AnnotatedTypeFactory.java +++ b/framework/src/main/java/org/checkerframework/framework/type/AnnotatedTypeFactory.java @@ -1528,6 +1528,10 @@ public void preProcessClassTree(ClassTree classTree) {} * to override this method if storing defaulted types is not desirable. */ public void postProcessClassTree(ClassTree tree) { + if (!checker.hasOption("noBytecodeStorage")) { + TypesIntoElements.store(processingEnv, this, tree); + DeclarationsIntoElements.store(processingEnv, this, tree); + } TypesIntoElements.store(processingEnv, this, tree); DeclarationsIntoElements.store(processingEnv, this, tree);