Commit 6cc3de7e authored by Emmanuel Bourg's avatar Emmanuel Bourg
Browse files

Fixed the build failure with Java 11 (Closes: #909259)

parent 69805dea
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
procyon (0.5.32-5) UNRELEASED; urgency=medium

  * Team upload.
  * Fixed the build failure with Java 11 (Closes: #909259)

 -- Emmanuel Bourg <ebourg@apache.org>  Mon, 25 Feb 2019 11:30:44 +0100

procyon (0.5.32-4) unstable; urgency=medium

  * Team upload.
+23 −0
Original line number Diff line number Diff line
Description: Fixes the compatibility with Java 11
Author: Emmanuel Bourg <ebourg@apache.org>
Bug: https://bitbucket.org/mstrobel/procyon/issues/331
--- a/Procyon.Reflection/src/main/java/com/strobel/reflection/emit/TypeBuilder.java
+++ b/Procyon.Reflection/src/main/java/com/strobel/reflection/emit/TypeBuilder.java
@@ -1231,12 +1231,15 @@
 
             _hasBeenCreated = true;
 
-            _generatedClass = (Class<T>) getUnsafeInstance().defineClass(
+            ClassLoader classloader = ClassLoader.getSystemClassLoader();
+            java.lang.reflect.Method defineClass = classloader.getClass().getDeclaredMethod("defineClass", String.class, byte[].class, int.class, int.class, ProtectionDomain.class);
+            defineClass.setAccessible(true);
+
+            _generatedClass = (Class<T>) defineClass.invoke(classloader,
                 fullName,
                 classBytes,
                 0,
                 classBytes.length,
-                ClassLoader.getSystemClassLoader(),
                 _protectionDomain
             );
 
+1 −0
Original line number Diff line number Diff line
@@ -2,3 +2,4 @@
02-cli-program-name.patch
03-java9-compatibility.patch
04-jcommander-compatibility.patch
05-java11-compatibility.patch