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 {
34
34
35
35
private static Pattern [] patterns = {
36
36
Pattern .compile (Pattern .quote ("org.springframework.core.NativeDetector#imageCode" )),
37
+ Pattern .compile (Pattern .quote ("org.springframework.cglib.core.AbstractClassGenerator#imageCode" )),
37
38
Pattern .compile (Pattern .quote ("org.springframework." ) + ".*#.*Present" ),
38
39
Pattern .compile (Pattern .quote ("org.springframework." ) + ".*#.*PRESENT" ),
39
40
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 {
43
43
private static final boolean DEFAULT_USE_CACHE =
44
44
Boolean .parseBoolean (System .getProperty ("cglib.useCache" , "true" ));
45
45
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
+
46
49
47
50
private GeneratorStrategy strategy = DefaultGeneratorStrategy .INSTANCE ;
48
51
@@ -359,6 +362,12 @@ protected Class generate(ClassLoaderData data) {
359
362
// ignore
360
363
}
361
364
}
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
362
371
byte [] b = strategy .generate (this );
363
372
String className = ClassNameReader .getClassName (new ClassReader (b ));
364
373
ProtectionDomain protectionDomain = getProtectionDomain ();
You can’t perform that action at this time.
0 commit comments