GROOVY-12236: Allow @ASTTest to be disabled via a groovy.asttest.enab… - #2769
Open
paulk-asert wants to merge 1 commit into
Open
GROOVY-12236: Allow @ASTTest to be disabled via a groovy.asttest.enab…#2769paulk-asert wants to merge 1 commit into
paulk-asert wants to merge 1 commit into
Conversation
…le system property The @asttest closure is evaluated during compilation, so merely compiling source which carries the annotation executes that code, whether or not the compiled result is subsequently run. Embedders which compile source they do not control have no way to turn this off. Add a groovy.asttest.enable system property, defaulting to true, which makes the annotation a no-op when set to false. This mirrors groovy.grape.enable for @grab. The check is in visit(), so the closure is never scheduled onto a compilation phase rather than being scheduled and skipped. The property is read per-visit rather than into a static final field so that it can be exercised without relying on JVM startup state. Being a system property it is process-wide, exactly as groovy.grape.enable is: a JVM cannot enable @asttest for one compilation and disable it for another.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2769 +/- ##
==================================================
- Coverage 69.9869% 69.9818% -0.0051%
+ Complexity 35529 35527 -2
==================================================
Files 1557 1557
Lines 131686 131687 +1
Branches 24174 24174
==================================================
- Hits 92163 92157 -6
- Misses 31189 31193 +4
- Partials 8334 8337 +3
🚀 New features to boost your workflow:
|
✅ All tests passed ✅🏷️ Commit: 18109b3 Learn more about TestLens at testlens.app. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…le system property
The @asttest closure is evaluated during compilation, so merely compiling source which carries the annotation executes that code, whether or not the compiled result is subsequently run. Embedders which compile source they do not control have no way to turn this off.
Add a groovy.asttest.enable system property, defaulting to true, which makes the annotation a no-op when set to false. This mirrors groovy.grape.enable for @grab. The check is in visit(), so the closure is never scheduled onto a compilation phase rather than being scheduled and skipped.
The property is read per-visit rather than into a static final field so that it can be exercised without relying on JVM startup state. Being a system property it is process-wide, exactly as groovy.grape.enable is: a JVM cannot enable @asttest for one compilation and disable it for another.