File tree Expand file tree Collapse file tree 3 files changed +41
-6
lines changed
spring-core/src/main/java/org/springframework/core Expand file tree Collapse file tree 3 files changed +41
-6
lines changed Original file line number Diff line number Diff line change 3838 */
3939public class DefaultParameterNameDiscoverer extends PrioritizedParameterNameDiscoverer {
4040
41- // See https://github.com/oracle/graal/blob/master/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/ImageInfo.java
42- private static final boolean inImageCode = (System .getProperty ("org.graalvm.nativeimage.imagecode" ) != null );
43-
44-
4541 public DefaultParameterNameDiscoverer () {
46- if (!inImageCode ) {
42+ if (!GraalDetector . inImageCode () ) {
4743 if (KotlinDetector .isKotlinReflectPresent ()) {
4844 addDiscoverer (new KotlinReflectionParameterNameDiscoverer ());
4945 }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2002-2018 the original author or authors.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
17+ package org .springframework .core ;
18+
19+ /**
20+ * A common delegate for detecting a GraalVM native image environment.
21+ *
22+ * @author Juergen Hoeller
23+ * @author Sebastien Deleuze
24+ * @since 5.1
25+ */
26+ abstract class GraalDetector {
27+
28+ // See https://github.com/oracle/graal/blob/master/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/ImageInfo.java
29+ private static final boolean imageCode = (System .getProperty ("org.graalvm.nativeimage.imagecode" ) != null );
30+
31+
32+ /**
33+ * Return whether this runtime environment lives within a native image.
34+ */
35+ public static boolean inImageCode () {
36+ return imageCode ;
37+ }
38+
39+ }
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ static Type forTypeProvider(TypeProvider provider) {
108108 // No serializable type wrapping necessary (e.g. for java.lang.Class)
109109 return providedType ;
110110 }
111- if (!Serializable .class .isAssignableFrom (Class .class )) {
111+ if (GraalDetector . inImageCode () || !Serializable .class .isAssignableFrom (Class .class )) {
112112 // Let's skip any wrapping attempts if types are generally not serializable in
113113 // the current runtime environment (even java.lang.Class itself, e.g. on Graal)
114114 return providedType ;
You can’t perform that action at this time.
0 commit comments