Georgii Ustinov created GROOVY-11972:
----------------------------------------
Summary: Groovy 2.5 doesn't support Java 25
Key: GROOVY-11972
URL: https://issues.apache.org/jira/browse/GROOVY-11972
Project: Groovy
Issue Type: Bug
Reporter: Georgii Ustinov
*Steps to reproduce:*
1. Consider the following single file project:
```
import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import groovy.transform.TupleConstructor
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.util.function.Function
import java.util.function.Predicate
import java.util.stream.Collectors
import java.util.stream.Stream
@ToString(includeNames = true)
@EqualsAndHashCode
@TupleConstructor
class Order {
String id
BigDecimal amount
LocalDateTime createdAt
List<String> tags = []
}
class OrderRepository implements Iterable<Order> {
String report(Predicate<Order> filter, Function<Order, String> formatter) {
storage.values().stream()
.filter(filter)
.map(formatter)
.collect(Collectors.joining(System.lineSeparator()))
}
@Override
Iterator<Order> iterator() \{ storage.values().iterator() }
String render() {
def fmt = DateTimeFormatter.ISO_LOCAL_DATE_TIME
def sb = new StringBuilder()
sb << "Repository (${size()} orders)\n"
each { Order o ->
sb << " • ${o.id}: ${o.amount} @ ${o.createdAt.format(fmt)} ${o.tags}\n"
}
sb << describe()
sb.toString()
}
}
static void main(args) {
def repo = demo()
println repo.render()
def closure = \{ Order o -> "${o.id} -> ${o.amount}" }
println repo.report(\{ it.amount > 20 } as Predicate, closure as Function)
Stream.of(1, 2, 3).map \{ it * 2 }.forEach \{ println it }
}
```
2. try to compile it with java 25 installed and groovy 2.5.23.
*Expected behaviour:*
compilation is succeeded
{*}Actual behaviour:{*}{*}{*}
```
Caught: BUG! exception in phase 'semantic analysis' in source unit
'/$USER/RunFolders/IdeaProjects/Groovy25Java25/src/Main.groovy' Unsupported
class file major version 69
BUG! exception in phase 'semantic analysis' in source unit
'/$USER/RunFolders/IdeaProjects/Groovy25Java25/src/Main.groovy' Unsupported
class file major version 69
at
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
Caused by: java.lang.IllegalArgumentException: Unsupported class file major
version 69
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:199)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:180)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:166)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:287)
... 1 more
```
I am supporting groovy inside IntelliJ IDEA. Currently, we are migrating our
codebase to Java 25. Is it possible to bump the asm version like you did for
groovy 3.0.25 and release new artifact?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)