Skip to content

Commit

Permalink
Shorten constant names to BUILD and RUN (for consistent spelling)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller authored and mdeinum committed Jun 29, 2023
1 parent 3066b54 commit fc94f88
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -55,23 +56,23 @@ public static boolean inNativeImage(Context... contexts) {
return false;
}


/**
* Native image context as defined in GraalVM's
* <a href="https://github.com/oracle/graal/blob/master/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/ImageInfo.java">ImageInfo</a>.
*
* @since 6.0.10
*/
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;

Expand All @@ -83,7 +84,6 @@ public enum Context {
public String toString() {
return this.key;
}

}

}

0 comments on commit fc94f88

Please sign in to comment.