mirror of https://github.com/sbt/sbt.git
This PR adds a scripted test to prevent regression of issue #6175, where `MethodHandle.invokeExact` failed to compile on JDK 15+ when using `-release 11`. Changes: - Added `sbt-app/src/sbt-test/java/method-handle-release/` scripted test - Test uses Scala 2.13.16 with `-release:11` to reproduce the original issue scenario - Verifies that polymorphic signature methods compile correctly under cross-version targeting
This commit is contained in:
parent
d2cd284e5e
commit
642be58d44
|
|
@ -0,0 +1,2 @@
|
|||
ThisBuild / scalaVersion := "2.13.16"
|
||||
scalacOptions += "-release:11"
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
import java.lang.invoke.{ MethodHandle, MethodHandles }
|
||||
|
||||
object Main {
|
||||
case class TestClass(number: Int)
|
||||
def testMethod(): TestClass = {
|
||||
TestClass(10)
|
||||
}
|
||||
|
||||
def wrappedMethod(handle: MethodHandle): TestClass = {
|
||||
handle.invokeExact()
|
||||
}
|
||||
|
||||
def main(args: Array[String]): Unit = {
|
||||
val method = classOf[Main.type].getDeclaredMethod("testMethod")
|
||||
method.setAccessible(true)
|
||||
val handle = MethodHandles.lookup.unreflect(method)
|
||||
println(wrappedMethod(handle))
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# https://github.com/sbt/sbt/issues/6175
|
||||
# MethodHandle.invokeExact fails to compile on JDK 15+ when targeting Java 11
|
||||
> compile
|
||||
Loading…
Reference in New Issue