[
https://issues.apache.org/jira/browse/GROOVY-12313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18129905#comment-18129905
]
ASF GitHub Bot commented on GROOVY-12313:
-----------------------------------------
codecov-commenter commented on PR #3002:
URL: https://github.com/apache/groovy/pull/3002#issuecomment-6329155590
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3002?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 72.4322%. Comparing base
([`8778bce`](https://app.codecov.io/gh/apache/groovy/commit/8778bce1a0da05b5bffe27f02819262c849f9d56?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
to head
([`d9bd0c1`](https://app.codecov.io/gh/apache/groovy/commit/d9bd0c1752079a87bd0ba7c3222c09d44d11fb48?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/groovy/pull/3002?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #3002 +/- ##
==================================================
+ Coverage 72.4290% 72.4322% +0.0032%
- Complexity 40622 40626 +4
==================================================
Files 1643 1643
Lines 142686 142688 +2
Branches 26799 26800 +1
==================================================
+ Hits 103346 103352 +6
+ Misses 29830 29829 -1
+ Partials 9510 9507 -3
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/3002?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Coverage Δ | |
|---|---|---|
|
[...roovy/transform/stc/StaticTypeCheckingVisitor.java](https://app.codecov.io/gh/apache/groovy/pull/3002?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2Fstc%2FStaticTypeCheckingVisitor.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9zdGMvU3RhdGljVHlwZUNoZWNraW5nVmlzaXRvci5qYXZh)
| `87.2052% <100.0000%> (+0.0060%)` | :arrow_up: |
... and [12 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/3002/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>
> STC: instanceof-inferred type leaks to else-branch when the same
> VariableExpression node is reused
> --------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12313
> URL: https://issues.apache.org/jira/browse/GROOVY-12313
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 5.0.3, 4.0.31
> Reporter: Björn Kautler
> Priority: Major
>
> With this in groovyconsole.dev
> {code:java}
> @groovy.transform.CompileStatic
> class Foo extends Specification {
> def foo() {
> expect:
> true
> where:
> [a, b] << [['a', 'b']]
> }
> }
> {code}
> you get
> {code:java}
> Cannot cast object '[a, b]' with class 'java.util.ArrayList' to class
> 'java.util.Map' due to: groovy.lang.GroovyRuntimeException: Could not find
> matching constructor for: java.util.Map(String, String){code}
> The AST transformed code after class generation phase for this is
> {code:java}
> @org.spockframework.runtime.model.DataProcessorMetadata(dataVariables =
> ['a', 'b'])
> public java.lang.Object $spock_feature_0_0proc(java.lang.Object
> $spock_p0) {
> java.lang.Object a = ((java.lang.Object) $spock_p0 instanceof
> java.util.Map ? $spock_p0.getAt('a') : $spock_p0.getAt(0))
> java.lang.Object b = ((java.lang.Object) $spock_p0 instanceof
> java.util.Map ? $spock_p0.getAt('b') : $spock_p0.getAt(1))
> return new java.lang.Object[]{ a , b }
> } {code}
> where {{$spock_p0}} is given as {{{}['a', 'b']{}}}.
> Without static compilation this works fine and runs the expected iterations.
> With static compilation and indy switched off, the generated and then
> decompiled bytecode is this:
> {code:java}
> @DataProcessorMetadata(
> dataVariables = {"a", "b"}
> )
> public Object $spock_feature_0_0proc(Object $spock_p0) {
> Object a = $spock_p0 instanceof Map ?
> DefaultGroovyMethods.getAt((Map)ScriptBytecodeAdapter.castToType($spock_p0,
> Map.class), "a") :
> DefaultGroovyMethods.getAt((Map)ScriptBytecodeAdapter.castToType($spock_p0,
> Map.class), 0);
> Object b = $spock_p0 instanceof Map ?
> DefaultGroovyMethods.getAt((Map)ScriptBytecodeAdapter.castToType($spock_p0,
> Map.class), "b") :
> DefaultGroovyMethods.getAt((Map)ScriptBytecodeAdapter.castToType($spock_p0,
> Map.class), 1);
> return new Object[]{a, b};
> } {code}
> So with static compilation the inferred {{Map}} type somehow leaks into the
> else-branch of the ternary expression and causes this class-cast exception.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)