@@ -42,12 +42,12 @@ public final class VersionInfo {
4242 private static final String UNKNOWN = "<unknown>" ;
4343 private static final String FORMAT = " %20s: %s" ;
4444
45- private enum CompilationInfo {
46- // the ordering is important
45+ private enum SoftwareInfo {
46+ // the ordering is the output ordering
4747 NAME , VERSION , URL , REVISION ;
4848
49- static CompilationInfo parse (String key ) {
50- for (CompilationInfo info : CompilationInfo .values ()) {
49+ static SoftwareInfo parse (String key ) {
50+ for (SoftwareInfo info : SoftwareInfo .values ()) {
5151 if (info .name ().toLowerCase ().equals (key )) {
5252 return info ;
5353 }
@@ -57,16 +57,17 @@ static CompilationInfo parse(String key) {
5757 }
5858
5959 private enum RuntimeInfo {
60- // the ordering is important
60+ // the ordering is the output ordering
6161 JAVA , USER ;
6262
6363 static final InfoMap <RuntimeInfo > MAP ;
6464
6565 static {
66- final EnumMap <RuntimeInfo , String > runtimeInfos = new EnumMap <>(RuntimeInfo .class );
67- runtimeInfos .put (JAVA , System .getProperty ("java.vm.name" ) + " " + System .getProperty ("java.version" ));
68- runtimeInfos .put (USER , System .getProperty ("user.name" ));
69- MAP = new InfoMap <>(runtimeInfos );
66+ final EnumMap <RuntimeInfo , String > map = new EnumMap <>(RuntimeInfo .class );
67+ final Properties properties = System .getProperties ();
68+ map .put (JAVA , properties .getProperty ("java.vm.name" ) + " " + properties .getProperty ("java.runtime.version" ));
69+ map .put (USER , properties .getProperty ("user.name" ));
70+ MAP = new InfoMap <>(map );
7071 }
7172 }
7273
@@ -103,36 +104,36 @@ public static VersionInfo load(Class<?> clazz) {
103104
104105 private final Class <?> clazz ;
105106 private final InfoMap <RuntimeInfo > runtimeInfos = RuntimeInfo .MAP ;
106- private final InfoMap <CompilationInfo > compilationInfos ;
107+ private final InfoMap <SoftwareInfo > softwareInfos ;
107108 private final Map <String , String > otherInfos ;
108109
109110 private VersionInfo (Class <?> clazz , Properties properties ) {
110111 this .clazz = Objects .requireNonNull (clazz , "clazz == null" );
111112
112- final EnumMap <CompilationInfo , String > compilations = new EnumMap <>(CompilationInfo .class );
113+ final EnumMap <SoftwareInfo , String > softwareInfoMap = new EnumMap <>(SoftwareInfo .class );
113114 final Map <String , String > others = new LinkedHashMap <>(); // preserve insertion order
114115 for (Map .Entry <Object , Object > e : properties .entrySet ()) {
115116 final String key = e .getKey ().toString ();
116117 final String value = e .getValue ().toString ();
117- final CompilationInfo k = CompilationInfo .parse (key );
118+ final SoftwareInfo k = SoftwareInfo .parse (key );
118119 if (k != null ) {
119- compilations .put (k , value );
120+ softwareInfoMap .put (k , value );
120121 } else {
121122 others .put (key , value );
122123 }
123124 }
124125
125- this .compilationInfos = new InfoMap <>(compilations );
126+ this .softwareInfos = new InfoMap <>(softwareInfoMap );
126127 this .otherInfos = Collections .unmodifiableMap (others );
127128 }
128129
129130 public void printStartupMessages (Object name , Consumer <String > log ) {
130131 Objects .requireNonNull (name , "name == null" );
131132 log .accept (String .format ("Starting %s -- %s %s" ,
132- compilationInfos .getOrDefault (CompilationInfo .NAME ), clazz .getSimpleName (), name ));
133- final CompilationInfo [] compilationInfoValues = CompilationInfo .values ();
134- for (int i = 1 ; i < compilationInfoValues .length ; i ++) {
135- log .accept (compilationInfos .format (compilationInfoValues [i ]));
133+ softwareInfos .getOrDefault (SoftwareInfo .NAME ), clazz .getSimpleName (), name ));
134+ final SoftwareInfo [] softwareInfoValues = SoftwareInfo .values ();
135+ for (int i = 1 ; i < softwareInfoValues .length ; i ++) {
136+ log .accept (softwareInfos .format (softwareInfoValues [i ]));
136137 }
137138 for (RuntimeInfo runtimeInfo : RuntimeInfo .values ()) {
138139 log .accept (runtimeInfos .format (runtimeInfo ));
0 commit comments