8210731: PropertiesParser does not produce reproducible output
Reviewed-by: mchung, jjg, erikj
This commit is contained in:
parent
acb7acc64f
commit
99eee041ba
@ -30,7 +30,7 @@ import propertiesparser.gen.ClassGenerator;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.util.HashMap;
|
import java.util.TreeMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/** Translates a .properties file into a .java file containing an enum-like Java class
|
/** Translates a .properties file into a .java file containing an enum-like Java class
|
||||||
@ -96,12 +96,13 @@ public class PropertiesParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, String> parseOptions(String args[]) {
|
private Map<String, String> parseOptions(String args[]) {
|
||||||
Map<String, String> optionsMap = new HashMap<>(args.length);
|
/* Use TreeMap to guarantee stable forEach iteration */
|
||||||
|
Map<String, String> optionsMap = new TreeMap<>();
|
||||||
for ( int i = 0; i < args.length ; i++ ) {
|
for ( int i = 0; i < args.length ; i++ ) {
|
||||||
if ( "-compile".equals(args[i]) && i+2 < args.length ) {
|
if ( "-compile".equals(args[i]) && i+2 < args.length ) {
|
||||||
optionsMap.put(args[++i], args[++i]);
|
optionsMap.put(args[++i], args[++i]);
|
||||||
} else {
|
} else {
|
||||||
return new HashMap<>();
|
return new TreeMap<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return optionsMap;
|
return optionsMap;
|
||||||
|
Loading…
Reference in New Issue
Block a user