From 22ef48bec27b73ce9bd6c945265372682ecf4ba0 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 5 Jun 2023 10:45:02 +0200 Subject: [PATCH] Shorten constant names to BUILD and RUN (for consistent spelling) See gh-30511 --- .../main/java/org/springframework/aot/AotDetector.java | 3 ++- .../java/org/springframework/core/NativeDetector.java | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/aot/AotDetector.java b/spring-core/src/main/java/org/springframework/aot/AotDetector.java index a3c1740733a7..4ecac5d35b9d 100644 --- a/spring-core/src/main/java/org/springframework/aot/AotDetector.java +++ b/spring-core/src/main/java/org/springframework/aot/AotDetector.java @@ -39,7 +39,8 @@ public abstract class AotDetector { */ public static final String AOT_ENABLED = "spring.aot.enabled"; - private static final boolean inNativeImage = NativeDetector.inNativeImage(Context.RUNTIME, Context.BUILD_TIME); + private static final boolean inNativeImage = NativeDetector.inNativeImage(Context.RUN, Context.BUILD); + /** * Determine whether AOT optimizations must be considered at runtime. This diff --git a/spring-core/src/main/java/org/springframework/core/NativeDetector.java b/spring-core/src/main/java/org/springframework/core/NativeDetector.java index a588864234a2..46d72b7bdd7e 100644 --- a/spring-core/src/main/java/org/springframework/core/NativeDetector.java +++ b/spring-core/src/main/java/org/springframework/core/NativeDetector.java @@ -32,6 +32,7 @@ public abstract class NativeDetector { private static final boolean inNativeImage = (imageCode != null); + /** * Returns {@code true} if running in a native image context (for example * {@code buildtime}, {@code runtime}, or {@code agent}) expressed by setting the @@ -55,10 +56,10 @@ public static boolean inNativeImage(Context... contexts) { return false; } + /** * Native image context as defined in GraalVM's * ImageInfo. - * * @since 6.0.10 */ public enum Context { @@ -66,12 +67,12 @@ public enum Context { /** * The code is executing in the context of image building. */ - BUILD_TIME("buildtime"), + BUILD("buildtime"), /** * The code is executing at image runtime. */ - RUNTIME("runtime"); + RUN("runtime"); private final String key; @@ -83,7 +84,6 @@ public enum Context { public String toString() { return this.key; } - } }