[ 
https://issues.apache.org/jira/browse/GROOVY-12391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18113332#comment-18113332
 ] 

ASF GitHub Bot commented on GROOVY-12391:
-----------------------------------------

Copilot commented on code in PR #2913:
URL: https://github.com/apache/groovy/pull/2913#discussion_r3968797986


##########
build-logic/src/main/groovy/org/apache/groovy/gradle/RepackageJarTask.groovy:
##########
@@ -223,10 +233,11 @@ abstract class RepackageJarTask extends ShadowJar {
             // rewritten to groovyjarjaropenbeans the lookup no-ops. 
Type/descriptor
             // remapping is unaffected (skipStringConstants only gates LDC 
strings).
             // See GROOVY-12199 / Bucket 4a.
-            if (shouldSkipStringConstants(prefix)) {
-                relocate(prefix, destination) { it.skipStringConstants = true }
-            } else {
-                relocate(prefix, destination)
+            List<String> untouched = relocationExcludes[pattern] ?: []
+            boolean skipStrings = shouldSkipStringConstants(prefix)
+            relocate(prefix, destination) { relocator ->
+                if (skipStrings) relocator.skipStringConstants = true
+                untouched.each { relocator.exclude(it) }
             }

Review Comment:
   `relocator.exclude(it)` is receiving entries like `java.beans.Transient` 
(per the new API doc). To avoid silent “exclusion didn’t apply” scenarios, it 
would help to (a) normalize/document the expected format explicitly (dot-name 
vs internal-name vs glob patterns), and/or (b) validate/transform the provided 
names into whatever the relocator actually matches against (e.g., 
`java/beans/Transient` or class resource path). Without this, a format mismatch 
would negate the purpose of GROOVY-12391 while still appearing configured 
correctly.





> grooid jar: java.beans.Transient is rewritten to a class openbeans never had
> ----------------------------------------------------------------------------
>
>                 Key: GROOVY-12391
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12391
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>
> Involves: the jarjar rule maps all of java.beans.**, so the Verifier's 
> reference to java.beans.Transient becomes groovyjarjaropenbeans.Transient, 
> which does not exist, and the grooid jar cannot compile anything. Fix is 
> either excluding Transient from the mapping or adding that one annotation 
> class to the repackaged set.
> Impact on normal usage: none for the regular jars. It affects only grooid 
> consumers, and it means the published grooid artifact has been unusable as a 
> compiler since the reference was introduced, so it is also evidence nobody is 
> using it.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to