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 38
38
*/
39
39
public class DefaultParameterNameDiscoverer extends PrioritizedParameterNameDiscoverer {
40
40
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
-
45
41
public DefaultParameterNameDiscoverer () {
46
- if (!inImageCode ) {
42
+ if (!GraalDetector . inImageCode () ) {
47
43
if (KotlinDetector .isKotlinReflectPresent ()) {
48
44
addDiscoverer (new KotlinReflectionParameterNameDiscoverer ());
49
45
}
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) {
108
108
// No serializable type wrapping necessary (e.g. for java.lang.Class)
109
109
return providedType ;
110
110
}
111
- if (!Serializable .class .isAssignableFrom (Class .class )) {
111
+ if (GraalDetector . inImageCode () || !Serializable .class .isAssignableFrom (Class .class )) {
112
112
// Let's skip any wrapping attempts if types are generally not serializable in
113
113
// the current runtime environment (even java.lang.Class itself, e.g. on Graal)
114
114
return providedType ;
You can’t perform that action at this time.
0 commit comments