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

Eric Milles edited comment on GROOVY-10594 at 2/4/23 11:51 PM:
---------------------------------------------------------------

Can you retry using the latest Groovy 3 snapshot? The java compiler creates 
public bridge methods in {{StringBuilder}} and {{StringBuffer}} for the public 
methods of {{AbstractStringBuilder}} (the package-private super class). A 
change was rolled back in the type checker so that the bridge methods regain 
preference. I don't know if the meta-object protocol (MOP – the runtime 
selection algorithms) do the same.

Update: demo project still fails with Groovy 3.0.15-SNAPSHOT and Java 17.0.4.1 
for me. Add this to your {{build.gradle}} repositories section:
{code:groovy}
maven { url = 'https://groovy.jfrog.io/artifactory/libs-snapshot-local/' }
{code}


was (Author: emilles):
Can you retry using the latest Groovy 3 snapshot?  The java compiler creates 
public bridge methods in {{StringBuilder}} and {{StringBuffer}} for the public 
methods of {{AbstractStringBuilder}} (the package-private super class).  A 
change was rolled back in the type checker so that the bridge methods regain 
preference.  I don't know if the meta-object protocol (MOP -- the runtime 
selection algorithms) do the same.

> Unable to Call StringBuilder.substring() method (JDK17, Groovy 3)
> -----------------------------------------------------------------
>
>                 Key: GROOVY-10594
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10594
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Gurpreet
>            Assignee: Eric Milles
>            Priority: Major
>         Attachments: demo.zip
>
>
> I am attaching a sample project that will simply print Hello on console. JDK 
> target is set to 11.
> Project can be run using command
> {code:java}
> ./gradlew clean run
> {code}
> When running project with JDK11 it will successfully print Hello to console
> But when running with JDK17, it fails with error
> {code:java}
> groovy.lang.MissingMethodException: No signature of method: 
> java.lang.StringBuilder.substring() is applicable for argument types: 
> (Integer, Integer) values: [0, 5] {code}



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

Reply via email to