Mercurial > hg > truffle
comparison graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionsLoader.java @ 21762:1025d6dc645a
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sat, 06 Jun 2015 15:13:09 +0200 |
parents | 55058b8000ea |
children |
comparison
equal
deleted
inserted
replaced
21761:0dfd3ea90d33 | 21762:1025d6dc645a |
---|---|
22 */ | 22 */ |
23 package com.oracle.jvmci.options; | 23 package com.oracle.jvmci.options; |
24 | 24 |
25 import java.util.*; | 25 import java.util.*; |
26 | 26 |
27 import com.oracle.jvmci.service.*; | |
28 | |
29 /** | 27 /** |
30 * Helper class used to load option descriptors. Only to be used in the slow-path. | 28 * Helper class used to load option descriptors. Only to be used in the slow-path. |
31 */ | 29 */ |
32 public class OptionsLoader { | 30 public class OptionsLoader { |
33 public static final SortedMap<String, OptionDescriptor> options = new TreeMap<>(); | 31 public static final SortedMap<String, OptionDescriptor> options = new TreeMap<>(); |
34 | 32 |
35 /** | 33 /** |
36 * Initializes {@link #options} from {@link Options} services. | 34 * Initializes {@link #options} from {@link Options} services. |
37 */ | 35 */ |
38 static { | 36 static { |
39 for (Options opts : Services.load(Options.class)) { | 37 for (Options opts : ServiceLoader.load(Options.class, OptionsLoader.class.getClassLoader())) { |
40 for (OptionDescriptor desc : opts) { | 38 for (OptionDescriptor desc : opts) { |
41 String name = desc.getName(); | 39 String name = desc.getName(); |
42 OptionDescriptor existing = options.put(name, desc); | 40 OptionDescriptor existing = options.put(name, desc); |
43 assert existing == null : "Option named \"" + name + "\" has multiple definitions: " + existing.getLocation() + " and " + desc.getLocation(); | 41 assert existing == null : "Option named \"" + name + "\" has multiple definitions: " + existing.getLocation() + " and " + desc.getLocation(); |
44 } | 42 } |