[
https://issues.apache.org/jira/browse/GROOVY-10652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles reassigned GROOVY-10652:
------------------------------------
Assignee: Eric Milles
> Code that worked in Groovy 3 throws exception in Groovy 4.0.1
> -------------------------------------------------------------
>
> Key: GROOVY-10652
> URL: https://issues.apache.org/jira/browse/GROOVY-10652
> Project: Groovy
> Issue Type: Bug
> Reporter: Tommy Svensson
> Assignee: Eric Milles
> Priority: Major
>
> The following code is an example of this fail:
> {code:groovy}
> @NotNull Line removeBegNumberDot() {
> Line line = this
> if (this.origLine.trim() =~ /^[0-9]+\..*/){ final int ix =
> this.origLine.indexOf(".")
> // As of Groovy 4 this no longer works!
> line = newLine(this.origLine[(ix+1)..-1]) // <--
> }
> line
> }
> {code}
> This method is part of class Line!
> Results in the following stack trace:
> {code}
> java.lang.NoSuchMethodError: 'void groovy.lang.IntRange.<init>(boolean,
> boolean, int, int)'
> at se.natusoft.doc.markdown.io.Line.removeBegNumberDot(Line.groovy:160)
> at ...
> {code}
> In Groovy 3 this both compiles and executes without problem, but with Groovy
> 4.0.1 it does compile, but gets above exception when executed. It looks like
> there is functionality missing the the Groovy 4.0.1 runtime library for
> {{groovy.lang.IntRange}}. But it is the Groovy 4.0.1 compiler that has
> produced the code that uses {{IntRange}}, so it can possibly produce the
> wrong code.
> For now I have to rewrite this method doing it the Java way rather than the
> Groovy way.
> Again, the code does compile, but the compiler produces code that can't be
> executed.
> It is being built for JDK 11 byte code. Don't believe that matters though.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)