mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-23 00:24:11 -08:00
Speed up compilation when locales are not used
This commit is contained in:
parent
b94d711732
commit
54e0c43fb2
|
@ -100,6 +100,7 @@
|
||||||
<argument>java.lang.reflect</argument>
|
<argument>java.lang.reflect</argument>
|
||||||
<argument>java.io</argument>
|
<argument>java.io</argument>
|
||||||
<argument>java.net</argument>
|
<argument>java.net</argument>
|
||||||
|
<argument>java.text</argument>
|
||||||
<argument>java.util</argument>
|
<argument>java.util</argument>
|
||||||
<argument>java.util.logging</argument>
|
<argument>java.util.logging</argument>
|
||||||
<argument>java.util.concurrent</argument>
|
<argument>java.util.concurrent</argument>
|
||||||
|
|
|
@ -38,10 +38,21 @@ public class CLDRReader {
|
||||||
private Set<String> availableLocales = new LinkedHashSet<>();
|
private Set<String> availableLocales = new LinkedHashSet<>();
|
||||||
private Set<String> availableLanguages = new LinkedHashSet<>();
|
private Set<String> availableLanguages = new LinkedHashSet<>();
|
||||||
private Set<String> availableCountries = new LinkedHashSet<>();
|
private Set<String> availableCountries = new LinkedHashSet<>();
|
||||||
|
private boolean initialized;
|
||||||
|
private Properties properties;
|
||||||
|
private ClassLoader classLoader;
|
||||||
|
|
||||||
public CLDRReader(Properties properties, ClassLoader classLoader) {
|
public CLDRReader(Properties properties, ClassLoader classLoader) {
|
||||||
findAvailableLocales(properties);
|
this.properties = properties;
|
||||||
readCLDR(classLoader);
|
this.classLoader = classLoader;
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized void ensureInitialized() {
|
||||||
|
if (!initialized) {
|
||||||
|
initialized = true;
|
||||||
|
findAvailableLocales(properties);
|
||||||
|
readCLDR(classLoader);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void findAvailableLocales(Properties properties) {
|
private void findAvailableLocales(Properties properties) {
|
||||||
|
@ -278,30 +289,37 @@ public class CLDRReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, CLDRLocale> getKnownLocales() {
|
public Map<String, CLDRLocale> getKnownLocales() {
|
||||||
|
ensureInitialized();
|
||||||
return Collections.unmodifiableMap(knownLocales);
|
return Collections.unmodifiableMap(knownLocales);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getAvailableLocales() {
|
public Set<String> getAvailableLocales() {
|
||||||
|
ensureInitialized();
|
||||||
return Collections.unmodifiableSet(availableLocales);
|
return Collections.unmodifiableSet(availableLocales);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getAvailableLanguages() {
|
public Set<String> getAvailableLanguages() {
|
||||||
|
ensureInitialized();
|
||||||
return Collections.unmodifiableSet(availableLanguages);
|
return Collections.unmodifiableSet(availableLanguages);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getAvailableCountries() {
|
public Set<String> getAvailableCountries() {
|
||||||
|
ensureInitialized();
|
||||||
return Collections.unmodifiableSet(availableCountries);
|
return Collections.unmodifiableSet(availableCountries);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Integer> getMinDaysMap() {
|
public Map<String, Integer> getMinDaysMap() {
|
||||||
|
ensureInitialized();
|
||||||
return Collections.unmodifiableMap(minDaysMap);
|
return Collections.unmodifiableMap(minDaysMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Integer> getFirstDayMap() {
|
public Map<String, Integer> getFirstDayMap() {
|
||||||
|
ensureInitialized();
|
||||||
return Collections.unmodifiableMap(firstDayMap);
|
return Collections.unmodifiableMap(firstDayMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getLikelySubtags() {
|
public Map<String, String> getLikelySubtags() {
|
||||||
|
ensureInitialized();
|
||||||
return Collections.unmodifiableMap(likelySubtags);
|
return Collections.unmodifiableMap(likelySubtags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user