You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/11/16 19:55:00 UTC

[jira] [Created] (GROOVY-11225) shouldFail return type

Eric Milles created GROOVY-11225:
------------------------------------

             Summary: shouldFail return type
                 Key: GROOVY-11225
                 URL: https://issues.apache.org/jira/browse/GROOVY-11225
             Project: Groovy
          Issue Type: Improvement
          Components: groovy-test
            Reporter: Eric Milles


The declaration of {{GroovyAssert}} shouldFail and shouldFailWithCause could be improved to return the given type.  For example:
{code:java}
    public static Throwable shouldFail(Class clazz, Closure code) {
      // ...
    }
{code}

could be written as:
{code:java}
    public static <T extends Throwable> T shouldFail(Class<T> type, Closure code) {
    }
{code}

This should not change the erasure type of the method, so it should not require a bridge method to maintain binary compatibility.



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