@@ -242,22 +242,19 @@ private static String verifyJVMCIVersion(Class<?> hotspotCompilationSupport) {
242
242
* using reflection. If the method is unavailable, a fallback version of 23.1.1 is returned.
243
243
*/
244
244
public static Version getCompilerVersion (TruffleCompilationSupport compilationSupport ) {
245
- /*
246
- * The TruffleCompilationSupport is present in both the maven artifact
247
- * org.graalvm.truffle/truffle-compiler and the JDK org.graalvm.truffle.compiler module. The
248
- * JDK version of TruffleCompilationSupport may be outdated and lack the getCompilerVersion
249
- * method. To address this, we use reflection.
250
- */
251
- String compilerVersionString = null ;
245
+ Version version = null ;
252
246
try {
253
- Method getCompilerVersion = compilationSupport .getClass ().getMethod ("getCompilerVersion" );
254
- compilerVersionString = (String ) getCompilerVersion .invoke (compilationSupport );
255
- } catch (NoSuchMethodException noMethod ) {
256
- // pass with compilerVersionString set to null
257
- } catch (ReflectiveOperationException e ) {
258
- throw new InternalError (e );
247
+ version = Version .parse (compilationSupport .getCompilerVersion ());
248
+ } catch (NoSuchMethodError noMethod ) {
249
+ /*
250
+ * The TruffleCompilationSupport is present in both the maven artifact
251
+ * org.graalvm.truffle/truffle-compiler and the JDK org.graalvm.truffle.compiler module.
252
+ * The JDK version of TruffleCompilationSupport may be outdated and lack the
253
+ * getCompilerVersion method. To address this, we use reflection.
254
+ */
255
+ version = Version .create (23 , 1 , 1 );
259
256
}
260
- return compilerVersionString != null ? Version . parse ( compilerVersionString ) : Version . create ( 23 , 1 , 1 ) ;
257
+ return version ;
261
258
}
262
259
263
260
private static Version stripUpdateVersion (Version version ) {
0 commit comments