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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2493?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 67.1268%. Comparing base 
([`526aa23`](https://app.codecov.io/gh/apache/groovy/commit/526aa239b6a0c758aadeeee9d69e559a6427892a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`a1be2cb`](https://app.codecov.io/gh/apache/groovy/commit/a1be2cb0eb3eadba49a87bace768089c09182c50?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 1 commits behind head on master.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/2493/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/2493?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #2493        +/-   ##
   ==================================================
   - Coverage     67.1304%   67.1268%   -0.0036%     
   + Complexity      31619      31617         -2     
   ==================================================
     Files            1451       1451                
     Lines          122560     122562         +2     
     Branches        22007      22008         +1     
   ==================================================
   - Hits            82275      82272         -3     
   - Misses          33206      33208         +2     
   - Partials         7079       7082         +3     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2493?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...orm/sc/transformers/ListExpressionTransformer.java](https://app.codecov.io/gh/apache/groovy/pull/2493?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2Fsc%2Ftransformers%2FListExpressionTransformer.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9zYy90cmFuc2Zvcm1lcnMvTGlzdEV4cHJlc3Npb25UcmFuc2Zvcm1lci5qYXZh)
 | `97.8723% <100.0000%> (+0.0946%)` | :arrow_up: |
   
   ... and [6 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/2493/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>




> VerifyError in @CompileStatic constructor with default-valued list parameter
> ----------------------------------------------------------------------------
>
>                 Key: GROOVY-11967
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11967
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Paul King
>            Priority: Major
>
> h3. Summary
> A {{@CompileStatic}} class with a constructor that has a default-valued 
> list-literal parameter triggers {{VerifyError}} when the synthesised 
> lower-arity bridge constructor is loaded.
> h3. Repro
> {code:java}
> @CompileStatic
> class Foo {
>     Foo(Class<?> a, MessageSource b, List<Class> targetTypes = [Object]) {
>     }
> }
> new Foo(String, ms) // boom
> {code}
> h3. Symptom
> {noformat}
> java.lang.VerifyError: Bad type on operand stack
>   Location: Foo.<init>(Ljava/lang/Class;LMessageSource;)V @20: invokevirtual
>   Reason:   Type 'java/lang/Object' (current frame, stack[4]) is not 
> assignable to 'java/util/ArrayList'
> {noformat}
> h3. Root cause
> Introduced by GROOVY-8699 (commit {{7b18440c4f}}, master only). That change 
> replaced the {{ScriptBytecodeAdapter.createList(Object[])}} call (returns 
> {{List}}) with direct {{new ArrayList\(n) + .add(...)}} bytecode, generated 
> by {{ListExpressionTransformer$NewListExpression.visit()}}.
> In indy mode the constructor call lowers to {{invokedynamic 
> init:(Class;I)Object}} -- the JVM stack value is typed as {{Object}}, so the 
> subsequent {{INVOKEVIRTUAL java/util/ArrayList.add(Object)Z}} fails 
> verification because its receiver is not an {{ArrayList}}. The {{CHECKCAST}} 
> to {{List}} added later by the transformer happens after the {{add}} call, 
> too late.
> h3. Scope
> Not specific to {{List<Class>}} -- any default {{[...]}} literal in a 
> {{@CompileStatic}} constructor is affected ({{List<String>}}, 
> {{List<Integer>}}, {{List<List<String>>}}, etc.). Map defaults go through a 
> different transformer and are not affected.
> h3. Fix
> Insert {{CHECKCAST java/util/ArrayList}} immediately after the constructor 
> call in {{ListExpressionTransformer$NewListExpression.visit()}}, before the 
> loop that emits the per-element {{DUP / add / pop}}.
> h3. Affects
> Master only. Groovy 5.0.x and earlier are fine (used the 
> {{createList(Object[])}} helper).



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

Reply via email to