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

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

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

   ## 🚨 TestLens detected 1 failed test 🚨
   
   Here is what you can do:
   
   1) Inspect the test failures carefully.
   2) If you are convinced that some of the tests are flaky, you can mute them 
below.
   3) Finally, trigger a rerun by checking the rerun checkbox.
   
   ### Test Summary
   
   #### [Build and test / lts \(17, 
macos-latest\)](https://github.com/apache/groovy/actions/runs/33270345602/job/99147740382?pr=2845)
 > :test
   
   | Test | Runs | Flakiness |
   |---|---|--:|
   | Groovy9270 > testInstanceOfTypeParameter1\(\) | ❌ | 0% 🟢 |
   
   🏷️ Commit: dee5be1a2a06c3a7016f219a4610817a9fcb42f5
   ▶️ Tests:  18976 executed
   🟡 Checks: 5/29 completed
   
   ### Test Failures
   
   <details>
   
   <summary><strong>Groovy9270 > testInstanceOfTypeParameter1()</strong> (:test 
in <a 
href="https://github.com/apache/groovy/actions/runs/33270345602/job/99147740382?pr=2845";>Build
 and test / lts (17, macos-latest)</a>)</summary>
   
   ```
   Assertion failed: 
   
   assert err.message =~ / Cannot perform instanceof check against type 
parameter T/
          |   |       |
          |   |       java.util.regex.Matcher[pattern= Cannot perform 
instanceof check against type parameter T region=0,200 lastmatch=]
          |   'startup failed:\nTestScript15.groovy: 4: Cannot select from a 
type parameter T\n @ line 4, column 40.\n                       if (obj 
instanceof T) {\n                                          ^\n\n1 error\n'
          org.codehaus.groovy.control.MultipleCompilationErrorsException: 
startup failed:
          TestScript15.groovy: 4: Cannot select from a type parameter T
           @ line 4, column 40.
                                 if (obj instanceof T) {
                                                    ^
           
          1 error
   
        at 
org.codehaus.groovy.runtime.InvokerHelper.createAssertError(InvokerHelper.java:401)
        at bugs.Groovy9270.testInstanceOfTypeParameter1(Groovy9270.groovy:77)
   ```
   
   </details>
   
   ### Rerun Controls
   > [!NOTE]
   > Checks are currently running using the configuration below.
   
   Select tests to mute in this pull request:
   
   🔲 Groovy9270 > testInstanceOfTypeParameter1\(\) <!

> Java compatibility: remaining generic type syntax
> -------------------------------------------------
>
>                 Key: GROOVY-12319
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12319
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Daniel Sun
>            Priority: Major
>
> Groovy already accepts most Java generics. Three Java forms still fail — two 
> in the parser, one in {{GenericsVisitor}}. Each has a local workaround. 
> Method type arguments such as {{Helper.<String>identity(x\)}} already work 
> and are not part of this request.
> h3. 1. Diamond {{<>}} on an anonymous class
> Java 9+ (JEP 213) allows:
> {code:java}
> Processor<String> p = new Processor<>() {
>     public String process(String val) { return val; }
> };
> {code}
> Groovy rejects this with {{Cannot use diamond <> with anonymous inner 
> classes}}. Writing  new Processor<String>() \{ ... \}  compiles.
> GROOVY-6730 and GROOVY-7159 were false-positive STC errors when diamond was 
> _not_ used; they did not add this form.
> h3. 2. Qualified parameterized inner types ("rare" types)
> Java allows an inner type to keep the outer's type arguments:
> {code:java}
> class Outer<T> {
>     class Inner<U> {}
> }
> Outer<String>.Inner<Integer> x;
> {code}
> Groovy fails to parse {{Outer<String>.Inner}} ({{Unexpected input}}). A 
> factory that returns {{Inner}} without naming {{Outer<T>.Inner}} is a 
> workaround. The same qualification appears in {{o.new Inner<Integer>(42)}}.
> h3. 3. Explicit type arguments on constructors, {{this()}} and {{super()}}
> Java allows:
> {code:java}
> class Box {
>     <T> Box(T t) {}
> }
> new <String>Box("x");
> {code}
> and, on generic constructors, {{<T>this()}}, {{<T>super()}}, 
> {{recv.<T>super()}}, and {{outer.new <T>Inner(...)}}.
> Groovy fails at {{new <}} with {{Unexpected input: '<'}}. Inference ({{new 
> Box("x")}}) is the workaround.
> Constructor type arguments are already tracked by GROOVY-10501. The 
> {{this()}} / {{super()}} / inner-{{new}} forms are the same JLS production 
> (JLS 15.9) and should be handled together.
> h3. Related
> * GROOVY-10501 — constructor type arguments (open)
> * GROOVY-6730, GROOVY-7159 — diamond + anonymous class, STC false positives 
> (fixed)



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

Reply via email to