diff --git a/classlib/src/main/java/org/teavm/classlib/java/util/TProperties.java b/classlib/src/main/java/org/teavm/classlib/java/util/TProperties.java index c80950b57..a8f37d9fa 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/util/TProperties.java +++ b/classlib/src/main/java/org/teavm/classlib/java/util/TProperties.java @@ -331,7 +331,7 @@ public class TProperties extends THashtable { return selected.keys(); } - private void selectProperties(THashtable selected) { + private void selectProperties(TMap selected) { if (defaults != null) { defaults.selectProperties(selected); } @@ -398,4 +398,24 @@ public class TProperties extends THashtable { } writer.write("\n"); } + + public TSet stringPropertyNames() { + TSet selected = new THashSet<>(); + selectPropertyNames(selected); + return selected; + } + + private void selectPropertyNames(TSet selected) { + if (defaults != null) { + defaults.selectPropertyNames(selected); + } + + TEnumeration e = keys(); + while (e.hasMoreElements()) { + Object key = e.nextElement(); + if (key instanceof String) { + selected.add((String) key); + } + } + } } diff --git a/core/src/main/java/org/teavm/parsing/ClasspathResourceMapper.java b/core/src/main/java/org/teavm/parsing/ClasspathResourceMapper.java index 42513dfeb..3b5955a30 100644 --- a/core/src/main/java/org/teavm/parsing/ClasspathResourceMapper.java +++ b/core/src/main/java/org/teavm/parsing/ClasspathResourceMapper.java @@ -67,6 +67,7 @@ public class ClasspathResourceMapper implements Mapper, Cla Map transformationMap = new HashMap<>(); loadProperties(properties, transformationMap); transformations.addAll(transformationMap.values()); + renamer = new ClassRefsRenamer(new CachedMapper<>(classNameMapper)); } private void loadProperties(Properties properties, Map cache) { @@ -165,6 +166,9 @@ public class ClasspathResourceMapper implements Mapper, Cla } private Date getOriginalModificationDate(String className) { + if (classLoader == null) { + return null; + } URL url = classLoader.getResource(className.replace('.', '/') + ".class"); if (url == null) { return null;