File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
spring-core/src/main/java/org/springframework Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ class PreComputeFieldFeature implements Feature {
3434
3535 private static Pattern [] patterns = {
3636 Pattern .compile (Pattern .quote ("org.springframework.core.NativeDetector#imageCode" )),
37+ Pattern .compile (Pattern .quote ("org.springframework.cglib.core.AbstractClassGenerator#imageCode" )),
3738 Pattern .compile (Pattern .quote ("org.springframework." ) + ".*#.*Present" ),
3839 Pattern .compile (Pattern .quote ("org.springframework." ) + ".*#.*PRESENT" ),
3940 Pattern .compile (Pattern .quote ("reactor." ) + ".*#.*Available" ),
Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ abstract public class AbstractClassGenerator<T> implements ClassGenerator {
4343 private static final boolean DEFAULT_USE_CACHE =
4444 Boolean .parseBoolean (System .getProperty ("cglib.useCache" , "true" ));
4545
46+ // See https://github.com/oracle/graal/blob/master/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/ImageInfo.java
47+ private static final boolean imageCode = (System .getProperty ("org.graalvm.nativeimage.imagecode" ) != null );
48+
4649
4750 private GeneratorStrategy strategy = DefaultGeneratorStrategy .INSTANCE ;
4851
@@ -359,6 +362,12 @@ protected Class generate(ClassLoaderData data) {
359362 // ignore
360363 }
361364 }
365+ // SPRING PATCH BEGIN
366+ if (imageCode ) {
367+ throw new UnsupportedOperationException ("CGLIB runtime enhancement not supported on native image. " +
368+ "Make sure to include a pre-generated class on the classpath instead: " + getClassName ());
369+ }
370+ // SPRING PATCH END
362371 byte [] b = strategy .generate (this );
363372 String className = ClassNameReader .getClassName (new ClassReader (b ));
364373 ProtectionDomain protectionDomain = getProtectionDomain ();
You can’t perform that action at this time.
0 commit comments