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

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

codecov-commenter commented on PR #3016:
URL: https://github.com/apache/groovy/pull/3016#issuecomment-6373862006

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3016?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :x: Patch coverage is `50.00000%` with `1 line` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 72.4400%. Comparing base 
([`fa53afa`](https://app.codecov.io/gh/apache/groovy/commit/fa53afab4ff811b7ed93560300cd626d0374842e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`a77a92c`](https://app.codecov.io/gh/apache/groovy/commit/a77a92ca82049a0d98ea1948b9cf1841ad589ed2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 9 commits behind head on master.
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3016?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...ransform/InheritConstructorsASTTransformation.java](https://app.codecov.io/gh/apache/groovy/pull/3016?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2FInheritConstructorsASTTransformation.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9Jbmhlcml0Q29uc3RydWN0b3JzQVNUVHJhbnNmb3JtYXRpb24uamF2YQ==)
 | 50.0000% | [0 Missing and 1 partial :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3016?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/3016/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/groovy/pull/3016?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3016        +/-   ##
   ==================================================
   - Coverage     72.4452%   72.4400%   -0.0052%     
     Complexity      40687      40687                
   ==================================================
     Files            1644       1644                
     Lines          142897     142899         +2     
     Branches        26877      26878         +1     
   ==================================================
   - Hits           103522     103516         -6     
   - Misses          29820      29823         +3     
   - Partials         9555       9560         +5     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3016?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...ransform/InheritConstructorsASTTransformation.java](https://app.codecov.io/gh/apache/groovy/pull/3016?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2FInheritConstructorsASTTransformation.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9Jbmhlcml0Q29uc3RydWN0b3JzQVNUVHJhbnNmb3JtYXRpb24uamF2YQ==)
 | `86.9565% <50.0000%> (-1.6798%)` | :arrow_down: |
   
   ... and [7 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3016/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test 
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, 
report on failures, and find test suite problems.
   - :package: [JS Bundle 
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save 
yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>




> Script subclasses cannot have constructors with arguments
> ---------------------------------------------------------
>
>                 Key: GROOVY-11154
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11154
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 4.0.7
>            Reporter: Jonny Carter
>            Priority: Major
>
> Prior to the fix for GROOVY-9857, subclasses of {{Script}} could have 
> constructor arguments and still be used (with a little help from 
> {{InheritConstructors}} and {{DefaultGroovyMethods#newInstance}}).
> For example, the following script executes find in Groovy 3.x, but fails 
> after Groovy 4.0.7:
> {code}
> import groovy.transform.InheritConstructors
> import org.codehaus.groovy.ast.AnnotationNode
> import org.codehaus.groovy.ast.ClassNode
> import org.codehaus.groovy.classgen.GeneratorContext
> import org.codehaus.groovy.control.CompilationFailedException
> import org.codehaus.groovy.control.CompilePhase
> import org.codehaus.groovy.control.CompilerConfiguration
> import org.codehaus.groovy.control.SourceUnit
> import org.codehaus.groovy.control.customizers.CompilationCustomizer
> import org.codehaus.groovy.runtime.DefaultGroovyMethods
> abstract class NamedScript extends Script {
>     NamedScript(String name) {
>     }
> }
> def compilerConfig = new CompilerConfiguration()
> compilerConfig.setScriptBaseClass(NamedScript.class.getName())
> compilerConfig.addCompilationCustomizers(new 
> CompilationCustomizer(CompilePhase.CONVERSION) {
>     @Override
>     void call(SourceUnit source, GeneratorContext context, ClassNode 
> classNode) throws CompilationFailedException {
>         classNode.addAnnotation(new AnnotationNode(new 
> ClassNode(InheritConstructors.class)))
>     }
> })
> def classLoader = new GroovyClassLoader(new GroovyClassLoader(), 
> compilerConfig)
> def parsedClass = classLoader.parseClass('println "Foo"')
> DefaultGroovyMethods.newInstance(parsedClass, "dummy").run()
> {code}
> The error returned is:
> {noformat}
> Implicit super constructor NamedScript() is undefined for generated 
> constructor. Must define an explicit constructor.
> {noformat}
> Ratpack relies on this behavior for its custom text template renderer.
> See how script objects are instantiated in the 
> [ScriptEngine#create|https://github.com/ratpack/ratpack/blob/503060ab2351a49f6e96416d588607ff7ef63028/ratpack-groovy/src/main/java/ratpack/groovy/script/internal/ScriptEngine.java#L51]
>  method.
> I talked this out in the Groovy community Slack with [~blackdrag] (see 
> [thread|https://groovy-community.slack.com/archives/C2NEFCM55/p1691783910137829]),
>  who suggested that we should skip the check for constructors for Script 
> subclasses as a bugfix in Groovy 4, with a potentially breaking change in 
> Groovy 5 to make constructor generation for Script subclasses happen in the 
> same place as any other class.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to