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 2022/02/25 23:30:00 UTC

[jira] [Assigned] (GROOVY-10513) Incorrect bytecode generated for default interface methods with array parameter

     [ https://issues.apache.org/jira/browse/GROOVY-10513?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles reassigned GROOVY-10513:
------------------------------------

    Assignee: Eric Milles

> Incorrect bytecode generated for default interface methods with array parameter
> -------------------------------------------------------------------------------
>
>                 Key: GROOVY-10513
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10513
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 4.0.0
>            Reporter: Renato Athaydes
>            Assignee: Eric Milles
>            Priority: Major
>
> Given the following interface:
>  
> {code:java}
>  package tests
> interface MyTrait {
>     default String loadKeyStoreFrom(String url, Object... passwordChars) {
>         ''
>     }
> }{code}
>  
> Compile this to a jar file (this matters as the bug does not happen when compiled at the same time).
>  
> Now, run this test:
>  
> {code:java}
>  package tests
> import org.junit.jupiter.api.Test
> class ExampleTest implements MyTrait {
>     @Test
>     def 'my test'() {
>         assert loadKeyStoreFrom('', ''.chars) == ''
>     }
> }
> {code}
>  
> I get the following error:
>  
> {code:java}
> ▶ groovy -cp build/libs/groovy-tests-1.0-SNAPSHOT.jar src/test/groovy/tests/ExampleTest.groovy
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> /experiments/groovy-tests/src/test/groovy/tests/ExampleTest.groovy: -1: The method 'java.lang.String loadKeyStoreFrom(java.lang.String, [Ljava.lang.Object;)' has an incorrect modifier transient.
>  @ line -1, column -1.
> 1 error
>  {code}
>  
> This used to work in Groovy {*}3.0.9{*}. It also works, as mentioned, if you compile the interface and the test at the same time.
> Please notice that this error also happens when using {*}traits{*}, which is how I came across the problem.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)