From 57185cc81eae0ea98b057589abd3e4c45535e3c0 Mon Sep 17 00:00:00 2001 From: scott Date: Sat, 14 Dec 2024 00:16:01 -0500 Subject: [PATCH] https://github.com/manifold-systems/manifold/issues/645 - revise fix for https://github.com/manifold-systems/manifold/issues/627, use reflection to enable compiling manifold itself with jdk 11+ only for building Xxx_11.java11+ source files --- .../internal/javac/ManifoldJavaFileManager.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/manifold-core-parent/manifold/src/main/java/manifold/internal/javac/ManifoldJavaFileManager.java b/manifold-core-parent/manifold/src/main/java/manifold/internal/javac/ManifoldJavaFileManager.java index 6fbc0e1ec..7ca0c7c8a 100644 --- a/manifold-core-parent/manifold/src/main/java/manifold/internal/javac/ManifoldJavaFileManager.java +++ b/manifold-core-parent/manifold/src/main/java/manifold/internal/javac/ManifoldJavaFileManager.java @@ -288,8 +288,17 @@ private void hackToFixJava8Issue( TypeName tn ) { if( JreUtil.isJava8() && tn.name.equals( "java.util.Map" ) ) { - // ensure top-level Map class loads before inner class Entry, see https://github.com/manifold-systems/manifold/issues/627 - Annotate.instance( _ctx ).normal( () -> ClassReader.instance( _ctx ).loadClass( Names.instance( _ctx ).fromString( tn.name ) ) ); + try + { + // ensure top-level Map class loads before inner class Entry, see https://github.com/manifold-systems/manifold/issues/627 + // (using reflection to compile here to enable compiling with jdk 11+ only for building Xxx_11.java11+ source files) + Annotate.instance( _ctx ).normal( + () -> ReflectUtil.method( ClassReader.instance( _ctx ), "loadClass", Name.class ) + .invoke( Names.instance( _ctx ).fromString( tn.name ) ) ); + } + catch( Throwable ignore ) + { + } } }