commit | 88efd0d10c545c5262de919b563de12f72a71b5e | [log] [tgz] |
---|---|---|
author | Chuck Jazdzewski <chuckj@google.com> | Mon Apr 08 14:51:22 2024 -0700 |
committer | Space Cloud <noreply@jetbrains.space> | Mon Apr 15 16:27:01 2024 +0000 |
tree | 37d4fde74ff96f67a8a1eae50e0ddbe9d5536821 | |
parent | 05c2d57237ee7ea1522df8f6b8b8b42d639cbb91 [diff] |
Fix compiler debugger test for JDK 21 Changed debugger test to be compatible with JDK 21 by using `Class.forName` instead of directly referencing the class which is no allowed in JDK 21. The JDK exmaples use `Class.forName` for other classes. Fixes: 331276193 ( https://issuetracker.google.com/issues/331276193 ) Test: ./gradlew :compose:c:c-h:i-t:desktopTest Change-Id: I98ae6e3ce3ef165975291ed2fb3f73a50b0a78a2 ( https://android-review.googlesource.com/q/I98ae6e3ce3ef165975291ed2fb3f73a50b0a78a2 ) Moved from: https://github.com/androidx/androidx/commit/d68597cd89510935bdb5568cdc5bbdfdb494a253
diff --git a/plugins/compose/compiler-hosted/integration-tests/src/desktopTest/kotlin/androidx/compose/compiler/plugins/kotlin/debug/AbstractDebuggerTest.kt b/plugins/compose/compiler-hosted/integration-tests/src/desktopTest/kotlin/androidx/compose/compiler/plugins/kotlin/debug/AbstractDebuggerTest.kt index b91998b..a0011fe 100644 --- a/plugins/compose/compiler-hosted/integration-tests/src/desktopTest/kotlin/androidx/compose/compiler/plugins/kotlin/debug/AbstractDebuggerTest.kt +++ b/plugins/compose/compiler-hosted/integration-tests/src/desktopTest/kotlin/androidx/compose/compiler/plugins/kotlin/debug/AbstractDebuggerTest.kt
@@ -25,6 +25,7 @@ import com.intellij.util.SystemProperties import com.sun.jdi.AbsentInformationException import com.sun.jdi.VirtualMachine +import com.sun.jdi.connect.AttachingConnector import com.sun.jdi.event.BreakpointEvent import com.sun.jdi.event.ClassPrepareEvent import com.sun.jdi.event.LocatableEvent @@ -38,7 +39,6 @@ import com.sun.jdi.request.MethodEntryRequest import com.sun.jdi.request.MethodExitRequest import com.sun.jdi.request.StepRequest -import com.sun.tools.jdi.SocketAttachingConnector import java.io.File import java.net.URL import java.net.URLClassLoader @@ -109,7 +109,8 @@ private const val DEBUG_ADDRESS = "127.0.0.1" private fun attachDebugger(port: Int): VirtualMachine { - val connector = SocketAttachingConnector() + val c = Class.forName("com.sun.tools.jdi.SocketAttachingConnector") + val connector = c.getDeclaredConstructor().newInstance() as AttachingConnector return connector.attach( connector.defaultArguments().apply { getValue("port").setValue("$port")