paulk-asert commented on code in PR #2645:
URL: https://github.com/apache/groovy/pull/2645#discussion_r3669779134


##########
src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java:
##########
@@ -424,6 +434,20 @@ public void setLogClassgenStackTraceMaxDepth(int 
logClassgenStackTraceMaxDepth)
      */
     private Set<String> scriptExtensions = new LinkedHashSet<>();
 
+    /**
+     * Consumer vetoes for {@link groovy.transform.stc.ClassTag @ClassTag} 
preemption under static
+     * compilation (GROOVY-12115). Preemption is declared by the API author
+     * ({@code @ClassTag(preempt=true)}) and contained to the declaring class; 
this set lets the
+     * consuming build veto it anyway. Entries use the same selector forms as
+     * {@code groovy.extension.disable}: a bare method name ({@code 
withDefault}) vetoes all
+     * overloads of that name, a signature form ({@code 
withDefault(Map,Class,Closure)}, simple or
+     * fully-qualified type names) vetoes the exact overload, and {@code *} 
vetoes all preemption.
+     * Additive injection (supplying an otherwise-mandatory token, such as for 
{@code asChecked})
+     * is never gated by this set. Seeded from the {@code 
groovy.classtag.preemption.disable}
+     * system property; empty (the default) honours declared intent. Never 
null.
+     */
+    private Set<String> classTagPreemptionDisabled = 
splitRespectingParens(getSystemPropertySafe("groovy.classtag.preemption.disable"));

Review Comment:
   The chain is:
   
   - GROOVY-11807 = the bug: lenient withDefault auto-grows a wrong-typed key 
into a Map<Number,?> (or Map<String,Integer>), corrupting keySet() — a latent 
violation of the map's own declared generics. Fixed in 6.0.0-alpha-2 by the 
checked overload.
   - The checked withDefault(Map, Class, Class, Closure) = the fix, opt-in by 
passing the tokens.
   - GROOVY-12115 @ClassTag(preempt=true) = makes that fix reach existing 
static callers automatically, without them editing source.
   - classTagPreemptionDisabled = a migration escape hatch to defer the fix, 
not a general "override the author" lever.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to