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

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

testlens-app[bot] commented on PR #3286:
URL: https://github.com/apache/groovy/pull/3286#issuecomment-6756223970

   ## 🚨 TestLens detected 1 failed test 🚨
   
   ### Test Summary
   > [!TIP]
   > Inspect all details with the [TestLens 
CLI](https://testlens.app/docs/features/cli): `testlens pr 3286`
   
   #### [Build and test / lts \(17, 
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/42732835509/job/129554844107?pr=3286)
 > :test
   
   | Test | Runs | Flakiness |
   |---|---|--:|
   | StaticCompileRuntimePackageTest > testSystemProperty\(\) | ❌ | 0% 🟢 |
   
   🏷️ Commit: 2ce6046aa3f835ac76e43cb8b2020c43ace41be2
   ▶️ Tests:  77427 executed
   🟡 Checks: 8/24 completed
   
   ### Test Failures
   
   <details><summary><strong>StaticCompileRuntimePackageTest > 
testSystemProperty()</strong> (:test in <a 
href="https://github.com/apache/groovy/actions/runs/42732835509/job/129554844107?pr=3286";>Build
 and test / lts (17, ubuntu-latest)</a>)</summary>
   
   ```
   Assertion failed: 
   
   assert 
config.optimizationOptions[CompilerConfiguration.RUNTIME_PACKAGE_CHECK] == 
Boolean.FALSE
          |      |                  |                      |                    
  |          |
          |      |                  null                   
'runtimePackageCheck'  false      false
          |      ['indy':true, 'parallelParse':true]
          org.codehaus.groovy.control.CompilerConfiguration@5a4e492c
   
        at 
org.codehaus.groovy.runtime.InvokerHelper.createAssertError(InvokerHelper.java:407)
        at 
org.codehaus.groovy.classgen.asm.sc.StaticCompileRuntimePackageTest.testSystemProperty(StaticCompileRuntimePackageTest.groovy:468)
   ```
   
   </details>
   
   ### Rerun Controls
   > [!NOTE]
   > Checks are currently running using the configuration below.
   
   Select tests to mute in this pull request:
   
   🔲 StaticCompileRuntimePackageTest > testSystemProperty\(\) <!

> STC: e.getClass() is typed Class<?>, so since GROOVY-12714 it is rejected 
> where a Class<? extends T> is expected
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12755
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12755
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 7.0.0-alpha-1, 6.0.1
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> JLS 4.3.2 gives a call {{e.getClass()}} the type {{Class<? extends |T|>}}, 
> where {{|T|}} is the erasure of the static type of {{e}}. Static type 
> checking types it with the declared return type of {{Object#getClass()}}, 
> {{Class<?>}}. Until GROOVY-12714 the wildcard check accepted {{Class<?>}} 
> where a {{Class<? extends T>}} was expected. Since GROOVY-12714 (GROOVY_6_0_X 
> and master) it is rejected:
> {code:groovy}
> @groovy.transform.CompileStatic
> class C {
>     interface Store {}
>     static <T> T with(Class<? extends Store> type, Closure<T> body) { 
> body.call() }
>     static class Adapter { Adapter(Class<? extends Store> type) {} }
>     static Object viaMethod(Store store) { with(store.getClass()) { 1 } }
>     static Object viaProperty(Store store) { with(store.class) { 1 } }
>     static Object viaConstructor(Store store) { new Adapter(store.getClass()) 
> }
>     static Class<? extends Store> viaReturn(Store store) { store.getClass() }
> }
> {code}
> {noformat}
> [Static type checking] - Cannot call <T> C#with(java.lang.Class<? extends 
> C.Store>, groovy.lang.Closure<T>) with arguments [java.lang.Class<?>, 
> groovy.lang.Closure]
> [Static type checking] - Cannot call <T> C#with(java.lang.Class<? extends 
> C.Store>, groovy.lang.Closure<T>) with arguments [java.lang.Class<?>, 
> groovy.lang.Closure]
> [Static type checking] - Cannot call C$Adapter#<init>(java.lang.Class<? 
> extends C.Store>) with arguments [java.lang.Class<?>]
> [Static type checking] - Incompatible generic argument types. Cannot assign 
> java.lang.Class<?> to: java.lang.Class<? extends C.Store>
> {noformat}
> javac accepts the equivalent Java. Grails no longer compiles against 
> GROOVY_6_0_X: it passes {{datastore.getClass()}} to a {{Class<? extends 
> Datastore>}} parameter and {{registrar.getClass()}} to a {{Class<? extends 
> BeanRegistrar>}} one 
> (https://github.com/apache/grails-core/actions/runs/42702095261).
> Typing {{e.getClass()}} and {{e.class}} as {{Class<? extends |T|>}} makes 
> more calls pass an upper-bounded wildcard for a bounded type parameter, such 
> as {{foo(list.class)}} for {{<T extends List<Integer>> foo(Class<T>)}}, which 
> GROOVY-12754 rejected. So this depends on GROOVY-12754.
> The inferred type of {{list.class}} for a raw {{List list}} changes from 
> {{Class<? extends Object>}} to {{Class<? extends List>}}, and the GROOVY-5415 
> error for {{a.bar(this.getClass())}} now names {{Class<? extends ClassB>}}; 
> the two tests that assert those types are updated.
> PR: https://github.com/apache/groovy/pull/3286



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

Reply via email to