From e0fc5d834b0782548b52c3d0651b332b30c3fad6 Mon Sep 17 00:00:00 2001 From: Adam J Ryan Date: Sun, 22 Mar 2020 22:55:47 +0000 Subject: [PATCH] Add ability to fine tune transpiler class substitutions. --- .../main/resources/META-INF/teavm.properties | 4 +- .../parsing/ClasspathResourceMapper.java | 257 +++++++++--------- .../parsing/substitution/ClassExclusions.java | 83 ++++++ .../parsing/substitution/ClassMappings.java | 103 +++++++ .../substitution/OrderedProperties.java | 59 ++++ .../parsing/substitution/PrefixMapping.java | 74 +++++ .../ClasspathResourceMapperTest.java | 106 ++++++++ .../SubSubPackageClassSubstitute.java | 22 ++ .../RootPackageClass1.java | 22 ++ .../ExcludedPackageClass1.java | 22 ++ .../ExcludedSubPackageClass.java | 22 ++ .../IncludedSubPackageClass.java | 22 ++ .../ExcludedPackageClass2.java | 22 ++ .../NotExcludedSubPackageClass.java | 22 ++ .../subpackage/ExcludedClass.java | 22 ++ .../subpackage/SubPackageClass1.java | 22 ++ .../RootPackageClass2.java | 22 ++ .../subpackage/SubPackageClass2.java | 22 ++ .../PrefixedRootPackageClass3.java | 22 ++ .../subpackage/PrefixedSubPackageClass3.java | 22 ++ .../PrefixedRootPackageClass4.java | 22 ++ .../subpackage/PrefixedSubPackageClass4.java | 22 ++ .../substitution/java/RootPackageClass1.java | 22 ++ .../substitution/java/RootPackageClass2.java | 22 ++ .../substitution/java/RootPackageClass3.java | 22 ++ .../substitution/java/RootPackageClass4.java | 22 ++ .../ExcludedPackageClass1.java | 22 ++ .../ExcludedSubPackageClass.java | 22 ++ .../IncludedSubPackageClass.java | 22 ++ .../ExcludedPackageClass2.java | 22 ++ .../NotExcludedSubPackageClass.java | 22 ++ .../java/subpackage/ExcludedClass.java | 22 ++ .../java/subpackage/SubPackageClass1.java | 22 ++ .../java/subpackage/SubPackageClass2.java | 22 ++ .../java/subpackage/SubPackageClass3.java | 22 ++ .../java/subpackage/SubPackageClass4.java | 22 ++ .../subsubpackage/SubSubPackageClass1.java | 22 ++ tests/src/test/js/.gitignore | 3 +- .../test/resources/META-INF/teavm.properties | 26 ++ 39 files changed, 1247 insertions(+), 128 deletions(-) create mode 100644 core/src/main/java/org/teavm/parsing/substitution/ClassExclusions.java create mode 100644 core/src/main/java/org/teavm/parsing/substitution/ClassMappings.java create mode 100644 core/src/main/java/org/teavm/parsing/substitution/OrderedProperties.java create mode 100644 core/src/main/java/org/teavm/parsing/substitution/PrefixMapping.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/ClasspathResourceMapperTest.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/classlib/SubSubPackageClassSubstitute.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/RootPackageClass1.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedhierarchy/ExcludedPackageClass1.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedhierarchy/excludedsubpackage/ExcludedSubPackageClass.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedhierarchy/excludedsubpackage/IncludedSubPackageClass.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedpackage/ExcludedPackageClass2.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedpackage/excludedsubpackage/NotExcludedSubPackageClass.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/subpackage/ExcludedClass.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/subpackage/SubPackageClass1.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/classlib/packagesubstitution/RootPackageClass2.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/classlib/packagesubstitution/subpackage/SubPackageClass2.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/classlib/prefixed/packagehierarchysubstitution/PrefixedRootPackageClass3.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/classlib/prefixed/packagehierarchysubstitution/subpackage/PrefixedSubPackageClass3.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/classlib/prefixed/packagesubstitution/PrefixedRootPackageClass4.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/classlib/prefixed/packagesubstitution/subpackage/PrefixedSubPackageClass4.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/java/RootPackageClass1.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/java/RootPackageClass2.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/java/RootPackageClass3.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/java/RootPackageClass4.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/java/excludedhierarchy/ExcludedPackageClass1.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/java/excludedhierarchy/excludedsubpackage/ExcludedSubPackageClass.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/java/excludedhierarchy/excludedsubpackage/IncludedSubPackageClass.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/java/excludedpackage/ExcludedPackageClass2.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/java/excludedpackage/excludedsubpackage/NotExcludedSubPackageClass.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/ExcludedClass.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/SubPackageClass1.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/SubPackageClass2.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/SubPackageClass3.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/SubPackageClass4.java create mode 100644 tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/subsubpackage/SubSubPackageClass1.java create mode 100644 tests/src/test/resources/META-INF/teavm.properties diff --git a/classlib/src/main/resources/META-INF/teavm.properties b/classlib/src/main/resources/META-INF/teavm.properties index 4d80f6d1e..dbf34ff21 100644 --- a/classlib/src/main/resources/META-INF/teavm.properties +++ b/classlib/src/main/resources/META-INF/teavm.properties @@ -11,5 +11,5 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -packagePrefix.java=org.teavm.classlib -classPrefix.java=T \ No newline at end of file +stripPrefixFromPackageHierarchyClasses|org.teavm.classlib.java=T +mapPackageHierarchy|org.teavm.classlib.java=java \ No newline at end of file diff --git a/core/src/main/java/org/teavm/parsing/ClasspathResourceMapper.java b/core/src/main/java/org/teavm/parsing/ClasspathResourceMapper.java index 82387ce5f..7ce742a8a 100644 --- a/core/src/main/java/org/teavm/parsing/ClasspathResourceMapper.java +++ b/core/src/main/java/org/teavm/parsing/ClasspathResourceMapper.java @@ -20,53 +20,69 @@ import java.io.IOException; import java.io.InputStream; import java.net.URISyntaxException; import java.net.URL; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.ServiceLoader; import java.util.function.Function; import org.teavm.common.CachedFunction; import org.teavm.model.ClassHolder; import org.teavm.model.FieldHolder; import org.teavm.model.MethodHolder; import org.teavm.model.ReferenceCache; +import org.teavm.parsing.substitution.ClassExclusions; +import org.teavm.parsing.substitution.ClassMappings; +import org.teavm.parsing.substitution.OrderedProperties; +import org.teavm.parsing.substitution.PrefixMapping; import org.teavm.vm.spi.ElementFilter; public class ClasspathResourceMapper implements Function, ClassDateProvider { - private static final String PACKAGE_PREFIX = "packagePrefix."; - private static final String CLASS_PREFIX = "classPrefix."; + private static final String STRIP_PREFIX_FROM_PREFIX = "stripPrefixFrom"; + private static final String STRIP_PREFIX_FROM_PACKAGE_HIERARCHY_PREFIX = + STRIP_PREFIX_FROM_PREFIX + "PackageHierarchyClasses"; + private static final String STRIP_PREFIX_FROM_PACKAGE_PREFIX = STRIP_PREFIX_FROM_PREFIX + "PackageClasses"; + private static final String MAP_PREFIX = "map"; + private static final String MAP_PACKAGE_HIERARCHY_PREFIX = MAP_PREFIX + "PackageHierarchy"; + private static final String MAP_PACKAGE_PREFIX = MAP_PREFIX + "Package"; + private static final String MAP_CLASS_PREFIX = MAP_PREFIX + "Class"; + private static final String INCLUDE_PREFIX = "include"; + private static final String INCLUDE_PACKAGE_HIERARCHY_PREFIX = INCLUDE_PREFIX + "PackageHierarchy"; + private static final String INCLUDE_PACKAGE_PREFIX = INCLUDE_PREFIX + "Package"; + private static final String INCLUDE_CLASS_PREFIX = INCLUDE_PREFIX + "Class"; + private static final Date VOID_DATE = new Date(0); private Function innerMapper; - private List transformations = new ArrayList<>(); private ClassRefsRenamer renamer; private ClassLoader classLoader; - private Map modificationDates = new HashMap<>(); - private ReferenceCache referenceCache; + private Map modificationDates = new HashMap<>(); private List elementFilters = new ArrayList<>(); - - private static class Transformation { - String packageName; - String packagePrefix = ""; - String fullPrefix = ""; - String classPrefix = ""; - } + private ClassMappings classMappings = new ClassMappings(); + private PrefixMapping prefixMapping = new PrefixMapping(); + private ClassMappings packageMappings = new ClassMappings(); + private ClassExclusions classExclusions = new ClassExclusions(); + private ClassMappings reverseClassMappings = new ClassMappings(); + private ClassMappings reversePackageMappings = new ClassMappings(); public ClasspathResourceMapper(ClassLoader classLoader, ReferenceCache referenceCache, Function provider) { this.innerMapper = provider; - this.referenceCache = referenceCache; try { Enumeration resources = classLoader.getResources("META-INF/teavm.properties"); - Map transformationMap = new HashMap<>(); while (resources.hasMoreElements()) { URL resource = resources.nextElement(); - Properties properties = new Properties(); + Properties properties = new OrderedProperties(); try (InputStream input = resource.openStream()) { properties.load(input); } - loadProperties(properties, transformationMap); + loadProperties(properties); } - transformations.addAll(transformationMap.values()); } catch (IOException e) { throw new RuntimeException("Error reading resources", e); } - renamer = new ClassRefsRenamer(referenceCache, new CachedFunction<>(classNameMapper)); + renamer = new ClassRefsRenamer(referenceCache, new CachedFunction<>(this::toUnmappedClassName)); for (ElementFilter elementFilter : ServiceLoader.load(ElementFilter.class)) { elementFilters.add(elementFilter); @@ -78,61 +94,57 @@ public class ClasspathResourceMapper implements Function, C public ClasspathResourceMapper(Properties properties, ReferenceCache referenceCache, Function innerMapper) { this.innerMapper = innerMapper; - this.referenceCache = referenceCache; - Map transformationMap = new HashMap<>(); - loadProperties(properties, transformationMap); - transformations.addAll(transformationMap.values()); - renamer = new ClassRefsRenamer(referenceCache, new CachedFunction<>(classNameMapper)); - } - - private void loadProperties(Properties properties, Map cache) { - for (String propertyName : properties.stringPropertyNames()) { - if (propertyName.startsWith(PACKAGE_PREFIX)) { - String packageName = propertyName.substring(PACKAGE_PREFIX.length()); - Transformation transformation = getTransformation(cache, packageName); - transformation.packagePrefix = properties.getProperty(propertyName) + "."; - transformation.fullPrefix = transformation.packagePrefix + transformation.packageName; - } else if (propertyName.startsWith(CLASS_PREFIX)) { - String packageName = propertyName.substring(CLASS_PREFIX.length()); - Transformation transformation = getTransformation(cache, packageName); - transformation.classPrefix = properties.getProperty(propertyName); - } - } - } - - private Transformation getTransformation(Map cache, String packageName) { - Transformation transformation = cache.get(packageName); - if (transformation == null) { - transformation = new Transformation(); - transformation.packageName = packageName + "."; - transformation.fullPrefix = packageName + "."; - cache.put(packageName, transformation); - } - return transformation; + loadProperties(properties); + renamer = new ClassRefsRenamer(referenceCache, new CachedFunction<>(this::toUnmappedClassName)); } @Override public ClassHolder apply(String name) { - for (ElementFilter filter : elementFilters) { - if (!filter.acceptClass(name)) { - return null; + ClassHolder cls = null; + for (String mappedClassName : classMappings.apply(name)) { + if (classExclusions.apply(mappedClassName)) { + continue; + } + ClassHolder classHolder = innerMapper.apply(mappedClassName); + if (classHolder == null) { + continue; + } + cls = renamer.rename(classHolder); + break; + } + if (cls == null) { + for (String mappedClassName : packageMappings.apply(name)) { + mappedClassName = prefixMapping.apply(mappedClassName); + if (classExclusions.apply(mappedClassName)) { + continue; + } + ClassHolder classHolder = innerMapper.apply(mappedClassName); + if (classHolder == null) { + continue; + } + cls = renamer.rename(classHolder); + break; } } - - ClassHolder cls = find(name); - - if (cls != null) { - for (MethodHolder method : cls.getMethods().toArray(new MethodHolder[0])) { - for (ElementFilter filter : elementFilters) { + if (cls == null) { + cls = innerMapper.apply(name); + } + if (cls != null && !elementFilters.isEmpty()) { + for (ElementFilter filter : elementFilters) { + if (!filter.acceptClass(name)) { + return null; + } + } + MethodHolder[] methodHolders = cls.getMethods().toArray(new MethodHolder[0]); + FieldHolder[] fieldHolders = cls.getFields().toArray(new FieldHolder[0]); + for (ElementFilter filter : elementFilters) { + for (MethodHolder method : methodHolders) { if (!filter.acceptMethod(method.getReference())) { cls.removeMethod(method); break; } } - } - - for (FieldHolder field : cls.getFields().toArray(new FieldHolder[0])) { - for (ElementFilter filter : elementFilters) { + for (FieldHolder field : fieldHolders) { if (!filter.acceptField(field.getReference())) { cls.removeField(field); break; @@ -140,77 +152,31 @@ public class ClasspathResourceMapper implements Function, C } } } - return cls; } - private ClassHolder find(String name) { - for (Transformation transformation : transformations) { - if (name.startsWith(transformation.packageName)) { - int index = name.lastIndexOf('.'); - String className = name.substring(index + 1); - String packageName = index > 0 ? name.substring(0, index) : ""; - ClassHolder classHolder = innerMapper.apply(transformation.packagePrefix + packageName - + "." + transformation.classPrefix + className); - if (classHolder != null) { - classHolder = renamer.rename(classHolder); - } - return classHolder; - } - } - return innerMapper.apply(name); - } - - private String renameClass(String name) { - for (Transformation transformation : transformations) { - if (name.startsWith(transformation.fullPrefix)) { - int index = name.lastIndexOf('.'); - String className = name.substring(index + 1); - String packageName = name.substring(0, index); - if (className.startsWith(transformation.classPrefix)) { - String newName = packageName.substring(transformation.packagePrefix.length()) + "." - + className.substring(transformation.classPrefix.length()); - return referenceCache.getCached(newName); - } - } - } - return name; - } - - private Function classNameMapper = this::renameClass; - @Override public Date getModificationDate(String className) { - ModificationDate mdate = modificationDates.get(className); + Date mdate = modificationDates.get(className); if (mdate == null) { - mdate = new ModificationDate(); + mdate = getOriginalModificationDate(toUnmappedClassName(className)); modificationDates.put(className, mdate); - mdate.date = calculateModificationDate(className); } - return mdate.date; + return mdate == VOID_DATE ? null : mdate; } - private Date calculateModificationDate(String className) { - int dotIndex = className.lastIndexOf('.'); - String packageName; - String simpleName; - if (dotIndex > 0) { - packageName = className.substring(0, dotIndex + 1); - simpleName = className.substring(dotIndex + 1); - } else { - packageName = ""; - simpleName = className; + private String toUnmappedClassName(String name) { + if (classExclusions.apply(name)) { + return name; } - for (Transformation transformation : transformations) { - if (packageName.startsWith(transformation.packageName)) { - String fullName = transformation.packagePrefix + packageName + transformation.classPrefix + simpleName; - Date date = getOriginalModificationDate(fullName); - if (date != null) { - return date; - } - } + name = prefixMapping.revert(name); + for (String originalClassName : reverseClassMappings.apply(name)) { + return originalClassName; } - return getOriginalModificationDate(className); + for (String originalClassName : reversePackageMappings.apply(name)) { + return originalClassName; + } + return name; } private Date getOriginalModificationDate(String className) { @@ -239,7 +205,48 @@ public class ClasspathResourceMapper implements Function, C } } - static class ModificationDate { - Date date; + private void loadProperties(Properties properties) { + for (String propertyName : properties.stringPropertyNames()) { + final String[] instruction = propertyName.split("\\|", 2); + switch (instruction[0]) { + case STRIP_PREFIX_FROM_PACKAGE_HIERARCHY_PREFIX: + prefixMapping.setPackageHierarchyClassPrefixRule(instruction[1].split("\\."), + properties.getProperty(propertyName)); + continue; + case STRIP_PREFIX_FROM_PACKAGE_PREFIX: + prefixMapping.setPackageClassPrefixRule(instruction[1].split("\\."), + properties.getProperty(propertyName)); + continue; + case MAP_PACKAGE_HIERARCHY_PREFIX: + packageMappings.addPackageHierarchyMappingRule(properties.getProperty(propertyName).split("\\."), + instruction[1]); + reversePackageMappings.addPackageHierarchyMappingRule(instruction[1].split("\\."), + properties.getProperty(propertyName)); + continue; + case MAP_PACKAGE_PREFIX: + packageMappings + .addPackageMappingRule(properties.getProperty(propertyName).split("\\."), instruction[1]); + reversePackageMappings + .addPackageMappingRule(instruction[1].split("\\."), properties.getProperty(propertyName)); + continue; + case MAP_CLASS_PREFIX: + classMappings + .addClassMappingRule(properties.getProperty(propertyName).split("\\."), instruction[1]); + reverseClassMappings + .addClassMappingRule(instruction[1].split("\\."), properties.getProperty(propertyName)); + continue; + case INCLUDE_PACKAGE_HIERARCHY_PREFIX: + classExclusions.setPackageHierarchyExclusion(instruction[1].split("\\."), + !Boolean.parseBoolean(properties.getProperty(propertyName))); + continue; + case INCLUDE_PACKAGE_PREFIX: + classExclusions.setPackageExclusion(instruction[1].split("\\."), + !Boolean.parseBoolean(properties.getProperty(propertyName))); + continue; + case INCLUDE_CLASS_PREFIX: + classExclusions.setClassExclusion(instruction[1].split("\\."), + !Boolean.parseBoolean(properties.getProperty(propertyName))); + } + } } -} +} \ No newline at end of file diff --git a/core/src/main/java/org/teavm/parsing/substitution/ClassExclusions.java b/core/src/main/java/org/teavm/parsing/substitution/ClassExclusions.java new file mode 100644 index 000000000..d5ae8bbb4 --- /dev/null +++ b/core/src/main/java/org/teavm/parsing/substitution/ClassExclusions.java @@ -0,0 +1,83 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; + +public class ClassExclusions implements Function { + private final Map classExclusions = new HashMap<>(); + private Boolean isExcluded; + private Boolean isSubpackagesExcluded; + private final Map subExclusions = new HashMap<>(); + + @Override + public Boolean apply(String className) { + return isExcluded(className.split("\\.")) == Boolean.TRUE; + } + + public void setPackageHierarchyExclusion(String[] packageNameSegments, boolean isExcluded) { + if (packageNameSegments == null || packageNameSegments.length < 1) { + isSubpackagesExcluded = isExcluded; + return; + } + subExclusions.computeIfAbsent(packageNameSegments[0], packageName -> new ClassExclusions()) + .setPackageHierarchyExclusion( + Arrays.copyOfRange(packageNameSegments, 1, packageNameSegments.length), isExcluded); + } + + public void setPackageExclusion(String[] packageNameSegments, boolean isExcluded) { + if (packageNameSegments == null || packageNameSegments.length < 1) { + this.isExcluded = isExcluded; + return; + } + subExclusions.computeIfAbsent(packageNameSegments[0], packageName -> new ClassExclusions()) + .setPackageExclusion(Arrays.copyOfRange(packageNameSegments, 1, packageNameSegments.length), + isExcluded); + } + + public void setClassExclusion(String[] classNameSegments, boolean isExcluded) { + if (classNameSegments == null || classNameSegments.length < 1) { + return; + } + if (classNameSegments.length == 1) { + classExclusions.put(classNameSegments[0], isExcluded); + } else { + subExclusions.computeIfAbsent(classNameSegments[0], packageName -> new ClassExclusions()) + .setClassExclusion(Arrays.copyOfRange(classNameSegments, 1, classNameSegments.length), + isExcluded); + } + } + + private Boolean isExcluded(String[] classNameSegments) { + if (classNameSegments == null || classNameSegments.length < 1) { + return isExcluded; + } + if (classNameSegments.length == 1) { + final Boolean isClassExcluded = classExclusions.get(classNameSegments[0]); + return isClassExcluded != null ? isClassExcluded : isExcluded != null ? isExcluded : isSubpackagesExcluded; + } + ClassExclusions subPackageExclusions = subExclusions.get(classNameSegments[0]); + if (subPackageExclusions != null) { + Boolean isExcluded = subPackageExclusions + .isExcluded(Arrays.copyOfRange(classNameSegments, 1, classNameSegments.length)); + return isExcluded != null ? isExcluded : isSubpackagesExcluded; + } + return isSubpackagesExcluded; + } +} diff --git a/core/src/main/java/org/teavm/parsing/substitution/ClassMappings.java b/core/src/main/java/org/teavm/parsing/substitution/ClassMappings.java new file mode 100644 index 000000000..2048c409e --- /dev/null +++ b/core/src/main/java/org/teavm/parsing/substitution/ClassMappings.java @@ -0,0 +1,103 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.function.Function; + +public class ClassMappings implements Function> { + private final Map> mappedClassNames = new LinkedHashMap<>(); + private final List mappedPackageNames = new LinkedList<>(); + private final List mappedPackageHierarchyNames = new LinkedList<>(); + private final Map subMappings = new HashMap<>(); + + @Override + public List apply(String className) { + List mappings = new LinkedList<>(); + getMappingsInto(className.split("\\."), mappings); + return mappings; + } + + public void addPackageHierarchyMappingRule(String[] packageNameSegments, String mappedPackageName) { + if (packageNameSegments == null || packageNameSegments.length < 1) { + mappedPackageHierarchyNames.add(mappedPackageName); + } else { + subMappings.computeIfAbsent(packageNameSegments[0], packageName -> new ClassMappings()) + .addPackageHierarchyMappingRule( + Arrays.copyOfRange(packageNameSegments, 1, packageNameSegments.length), + mappedPackageName); + } + } + + public void addPackageMappingRule(String[] packageNameSegments, String mappedPackageName) { + if (packageNameSegments == null || packageNameSegments.length < 1) { + mappedPackageNames.add(mappedPackageName); + } else { + subMappings.computeIfAbsent(packageNameSegments[0], packageName -> new ClassMappings()) + .addPackageMappingRule(Arrays.copyOfRange(packageNameSegments, 1, packageNameSegments.length), + mappedPackageName); + } + } + + public void addClassMappingRule(String[] classNameSegments, String mappedClassName) { + if (classNameSegments == null || classNameSegments.length < 1) { + return; + } + if (classNameSegments.length == 1) { + mappedClassNames.computeIfAbsent(classNameSegments[0], simpleClassName -> new LinkedList<>()) + .add(mappedClassName); + return; + } + subMappings.computeIfAbsent(classNameSegments[0], packageName -> new ClassMappings()) + .addClassMappingRule(Arrays.copyOfRange(classNameSegments, 1, classNameSegments.length), + mappedClassName); + } + + private void getMappingsInto(String[] classNameSegments, List mappings) { + if (classNameSegments == null || classNameSegments.length < 1) { + return; + } + if (classNameSegments.length == 1) { + final List classNameMappings = mappedClassNames.get(classNameSegments[0]); + if (classNameMappings != null) { + mappings.addAll(classNameMappings); + } + if (!mappedPackageNames.isEmpty()) { + String mappingSuffix = "." + classNameSegments[0]; + for (String packageName : mappedPackageNames) { + mappings.add(packageName + mappingSuffix); + } + } + } else { + ClassMappings classMappings = subMappings.get(classNameSegments[0]); + if (classMappings != null) { + classMappings + .getMappingsInto(Arrays.copyOfRange(classNameSegments, 1, classNameSegments.length), mappings); + } + } + if (!mappedPackageHierarchyNames.isEmpty()) { + String mappingSuffix = "." + String.join(".", classNameSegments); + for (String packageName : mappedPackageHierarchyNames) { + mappings.add(packageName + mappingSuffix); + } + } + } +} diff --git a/core/src/main/java/org/teavm/parsing/substitution/OrderedProperties.java b/core/src/main/java/org/teavm/parsing/substitution/OrderedProperties.java new file mode 100644 index 000000000..3c31f0502 --- /dev/null +++ b/core/src/main/java/org/teavm/parsing/substitution/OrderedProperties.java @@ -0,0 +1,59 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution; + +import java.util.Enumeration; +import java.util.LinkedHashSet; +import java.util.Properties; +import java.util.Set; +import java.util.Vector; + +public class OrderedProperties extends Properties { + private Vector keys; + + public OrderedProperties() { + keys = new Vector<>(); + } + + @Override + public Object put(Object key, Object value) { + keys.remove(key); + keys.add(key); + return super.put(key, value); + } + + @Override + public Enumeration propertyNames() { + return keys.elements(); + } + + @Override + public Set stringPropertyNames() { + Set stringPropertyNames = new LinkedHashSet<>(keys.size()); + for (Object key : keys) { + if (key instanceof String) { + stringPropertyNames.add((String) key); + } + } + return stringPropertyNames; + } + + @Override + public Object remove(Object key) { + keys.remove(key); + return super.remove(key); + } +} diff --git a/core/src/main/java/org/teavm/parsing/substitution/PrefixMapping.java b/core/src/main/java/org/teavm/parsing/substitution/PrefixMapping.java new file mode 100644 index 000000000..fe768858b --- /dev/null +++ b/core/src/main/java/org/teavm/parsing/substitution/PrefixMapping.java @@ -0,0 +1,74 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; + +public class PrefixMapping implements Function { + private String packageClassPrefix; + private String packageHierarchyClassPrefix; + private final Map subMappings = new HashMap<>(); + + @Override + public String apply(String className) { + final String prefix = getPrefix(className.split("\\.")); + return prefix != null ? new StringBuilder(className).insert(className.lastIndexOf(".") + 1, prefix) + .toString() : className; + } + + public String revert(String className) { + final String prefix = getPrefix(className.split("\\.")); + return prefix != null ? new StringBuilder(className) + .delete(className.lastIndexOf(".") + 1, className.lastIndexOf(".") + 1 + prefix.length()).toString() + : className; + } + + public void setPackageHierarchyClassPrefixRule(String[] packageNameSegments, String classPrefix) { + if (packageNameSegments == null || packageNameSegments.length < 1) { + packageHierarchyClassPrefix = classPrefix; + } else { + subMappings.computeIfAbsent(packageNameSegments[0], s -> new PrefixMapping()) + .setPackageHierarchyClassPrefixRule( + Arrays.copyOfRange(packageNameSegments, 1, packageNameSegments.length), classPrefix); + } + } + + public void setPackageClassPrefixRule(String[] packageNameSegments, String classPrefix) { + if (packageNameSegments == null || packageNameSegments.length < 1) { + packageClassPrefix = classPrefix; + } else { + subMappings.computeIfAbsent(packageNameSegments[0], s -> new PrefixMapping()) + .setPackageClassPrefixRule( + Arrays.copyOfRange(packageNameSegments, 1, packageNameSegments.length), classPrefix); + } + } + + private String getPrefix(String[] classNameSegments) { + if (classNameSegments == null || classNameSegments.length <= 1) { + return packageClassPrefix != null ? packageClassPrefix : packageHierarchyClassPrefix; + } + final PrefixMapping prefixMapping = subMappings.get(classNameSegments[0]); + if (prefixMapping != null) { + final String prefix = + prefixMapping.getPrefix(Arrays.copyOfRange(classNameSegments, 1, classNameSegments.length)); + return prefix != null ? prefix : packageHierarchyClassPrefix; + } + return packageHierarchyClassPrefix; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/ClasspathResourceMapperTest.java b/tests/src/test/java/org/teavm/parsing/substitution/ClasspathResourceMapperTest.java new file mode 100644 index 000000000..e1f8fb77e --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/ClasspathResourceMapperTest.java @@ -0,0 +1,106 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.teavm.junit.SkipJVM; +import org.teavm.junit.TeaVMTestRunner; +import org.teavm.junit.WholeClassCompilation; +import org.teavm.parsing.substitution.java.RootPackageClass1; +import org.teavm.parsing.substitution.java.RootPackageClass2; +import org.teavm.parsing.substitution.java.RootPackageClass3; +import org.teavm.parsing.substitution.java.RootPackageClass4; +import org.teavm.parsing.substitution.java.excludedhierarchy.ExcludedPackageClass1; +import org.teavm.parsing.substitution.java.excludedhierarchy.excludedsubpackage.ExcludedSubPackageClass; +import org.teavm.parsing.substitution.java.excludedhierarchy.excludedsubpackage.IncludedSubPackageClass; +import org.teavm.parsing.substitution.java.excludedpackage.ExcludedPackageClass2; +import org.teavm.parsing.substitution.java.excludedpackage.excludedsubpackage.NotExcludedSubPackageClass; +import org.teavm.parsing.substitution.java.subpackage.ExcludedClass; +import org.teavm.parsing.substitution.java.subpackage.SubPackageClass1; +import org.teavm.parsing.substitution.java.subpackage.SubPackageClass2; +import org.teavm.parsing.substitution.java.subpackage.SubPackageClass3; +import org.teavm.parsing.substitution.java.subpackage.SubPackageClass4; +import org.teavm.parsing.substitution.java.subpackage.subsubpackage.SubSubPackageClass1; + +@RunWith(TeaVMTestRunner.class) +@WholeClassCompilation +@SkipJVM +public class ClasspathResourceMapperTest { + @Test + public void classesInPackageHierarchyMappingAreSubstituted() { + assertEquals("RootPackageClass1Substitute", new RootPackageClass1().getIdentifier()); + assertEquals("SubPackageClass1Substitute", new SubPackageClass1().getIdentifier()); + } + + @Test + public void classesInPackageMappingAreSubstituted() { + assertEquals("RootPackageClass2Substitute", new RootPackageClass2().getIdentifier()); + } + + @Test + public void classesOutsidePackageMappingAreNotSubstituted() { + assertEquals("SubPackageClass2", new SubPackageClass2().getIdentifier()); + } + + @Test + public void specificClassMappingsAreSubstituted() { + assertEquals("SubSubPackageClassSubstitute", new SubSubPackageClass1().getIdentifier()); + } + + @Test + public void prefixedClassesInPackageHierarchyMappingAreSubstituted() { + assertEquals("RootPackageClass3Substitute", new RootPackageClass3().getIdentifier()); + assertEquals("SubPackageClass3Substitute", new SubPackageClass3().getIdentifier()); + } + + @Test + public void prefixedClassesInPackageMappingAreSubstituted() { + assertEquals("RootPackageClass4Substitute", new RootPackageClass4().getIdentifier()); + } + + @Test + public void prefixedClassesOutsidePackageMappingAreNotSubstituted() { + assertEquals("SubPackageClass4", new SubPackageClass4().getIdentifier()); + } + + @Test + public void excludedClassesInPackageHierarchyMappingAreNotSubstituted() { + assertEquals("ExcludedPackageClass1", new ExcludedPackageClass1().getIdentifier()); + assertEquals("ExcludedSubPackageClass", new ExcludedSubPackageClass().getIdentifier()); + } + + @Test + public void excludedClassesInPackageMappingAreNotSubstituted() { + assertEquals("ExcludedPackageClass2", new ExcludedPackageClass2().getIdentifier()); + } + + @Test + public void classesOutsidePackageMappingExclusionAreSubstituted() { + assertEquals("NotExcludedSubPackageClassSubstitute", new NotExcludedSubPackageClass().getIdentifier()); + } + + @Test + public void individualIncludedClassesInPackageHierarchyMappingExclusionAreSubstituted() { + assertEquals("IncludedSubPackageClassSubstitute", new IncludedSubPackageClass().getIdentifier()); + } + + @Test + public void individualExcludedClassesInPackageHierarchyMappingAreNotSubstituted() { + assertEquals("ExcludedClass", new ExcludedClass().getIdentifier()); + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/classlib/SubSubPackageClassSubstitute.java b/tests/src/test/java/org/teavm/parsing/substitution/classlib/SubSubPackageClassSubstitute.java new file mode 100644 index 000000000..e19237962 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/classlib/SubSubPackageClassSubstitute.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.classlib; + +public class SubSubPackageClassSubstitute { + public String getIdentifier() { + return "SubSubPackageClassSubstitute"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/RootPackageClass1.java b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/RootPackageClass1.java new file mode 100644 index 000000000..74666f67b --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/RootPackageClass1.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.classlib.packagehierarchysubstitution; + +public class RootPackageClass1 { + public String getIdentifier() { + return "RootPackageClass1Substitute"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedhierarchy/ExcludedPackageClass1.java b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedhierarchy/ExcludedPackageClass1.java new file mode 100644 index 000000000..5f7483bb1 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedhierarchy/ExcludedPackageClass1.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.classlib.packagehierarchysubstitution.excludedhierarchy; + +public class ExcludedPackageClass1 { + public String getIdentifier() { + return "ExcludedPackageClass1Substitute"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedhierarchy/excludedsubpackage/ExcludedSubPackageClass.java b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedhierarchy/excludedsubpackage/ExcludedSubPackageClass.java new file mode 100644 index 000000000..cbeabc745 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedhierarchy/excludedsubpackage/ExcludedSubPackageClass.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.classlib.packagehierarchysubstitution.excludedhierarchy.excludedsubpackage; + +public class ExcludedSubPackageClass { + public String getIdentifier() { + return "ExcludedSubPackageClassSubstitute"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedhierarchy/excludedsubpackage/IncludedSubPackageClass.java b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedhierarchy/excludedsubpackage/IncludedSubPackageClass.java new file mode 100644 index 000000000..8e3e95956 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedhierarchy/excludedsubpackage/IncludedSubPackageClass.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.classlib.packagehierarchysubstitution.excludedhierarchy.excludedsubpackage; + +public class IncludedSubPackageClass { + public String getIdentifier() { + return "IncludedSubPackageClassSubstitute"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedpackage/ExcludedPackageClass2.java b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedpackage/ExcludedPackageClass2.java new file mode 100644 index 000000000..be05ce30e --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedpackage/ExcludedPackageClass2.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.classlib.packagehierarchysubstitution.excludedpackage; + +public class ExcludedPackageClass2 { + public String getIdentifier() { + return "ExcludedPackageClass2Substitute"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedpackage/excludedsubpackage/NotExcludedSubPackageClass.java b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedpackage/excludedsubpackage/NotExcludedSubPackageClass.java new file mode 100644 index 000000000..c066a45df --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/excludedpackage/excludedsubpackage/NotExcludedSubPackageClass.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.classlib.packagehierarchysubstitution.excludedpackage.excludedsubpackage; + +public class NotExcludedSubPackageClass { + public String getIdentifier() { + return "NotExcludedSubPackageClassSubstitute"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/subpackage/ExcludedClass.java b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/subpackage/ExcludedClass.java new file mode 100644 index 000000000..18d035831 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/subpackage/ExcludedClass.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.classlib.packagehierarchysubstitution.subpackage; + +public class ExcludedClass { + public String getIdentifier() { + return "ExcludedClassSubstitute"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/subpackage/SubPackageClass1.java b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/subpackage/SubPackageClass1.java new file mode 100644 index 000000000..d602ab5d1 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagehierarchysubstitution/subpackage/SubPackageClass1.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.classlib.packagehierarchysubstitution.subpackage; + +public class SubPackageClass1 { + public String getIdentifier() { + return "SubPackageClass1Substitute"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagesubstitution/RootPackageClass2.java b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagesubstitution/RootPackageClass2.java new file mode 100644 index 000000000..7d17f8558 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagesubstitution/RootPackageClass2.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.classlib.packagesubstitution; + +public class RootPackageClass2 { + public String getIdentifier() { + return "RootPackageClass2Substitute"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagesubstitution/subpackage/SubPackageClass2.java b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagesubstitution/subpackage/SubPackageClass2.java new file mode 100644 index 000000000..c538a092a --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/classlib/packagesubstitution/subpackage/SubPackageClass2.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.classlib.packagesubstitution.subpackage; + +public class SubPackageClass2 { + public String getIdentifier() { + return "SubPackageClass2Substitute"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/classlib/prefixed/packagehierarchysubstitution/PrefixedRootPackageClass3.java b/tests/src/test/java/org/teavm/parsing/substitution/classlib/prefixed/packagehierarchysubstitution/PrefixedRootPackageClass3.java new file mode 100644 index 000000000..ae4b12740 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/classlib/prefixed/packagehierarchysubstitution/PrefixedRootPackageClass3.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.classlib.prefixed.packagehierarchysubstitution; + +public class PrefixedRootPackageClass3 { + public String getIdentifier() { + return "RootPackageClass3Substitute"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/classlib/prefixed/packagehierarchysubstitution/subpackage/PrefixedSubPackageClass3.java b/tests/src/test/java/org/teavm/parsing/substitution/classlib/prefixed/packagehierarchysubstitution/subpackage/PrefixedSubPackageClass3.java new file mode 100644 index 000000000..9978a1286 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/classlib/prefixed/packagehierarchysubstitution/subpackage/PrefixedSubPackageClass3.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.classlib.prefixed.packagehierarchysubstitution.subpackage; + +public class PrefixedSubPackageClass3 { + public String getIdentifier() { + return "SubPackageClass3Substitute"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/classlib/prefixed/packagesubstitution/PrefixedRootPackageClass4.java b/tests/src/test/java/org/teavm/parsing/substitution/classlib/prefixed/packagesubstitution/PrefixedRootPackageClass4.java new file mode 100644 index 000000000..7f30bc898 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/classlib/prefixed/packagesubstitution/PrefixedRootPackageClass4.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.classlib.prefixed.packagesubstitution; + +public class PrefixedRootPackageClass4 { + public String getIdentifier() { + return "RootPackageClass4Substitute"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/classlib/prefixed/packagesubstitution/subpackage/PrefixedSubPackageClass4.java b/tests/src/test/java/org/teavm/parsing/substitution/classlib/prefixed/packagesubstitution/subpackage/PrefixedSubPackageClass4.java new file mode 100644 index 000000000..378466a72 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/classlib/prefixed/packagesubstitution/subpackage/PrefixedSubPackageClass4.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.classlib.prefixed.packagesubstitution.subpackage; + +public class PrefixedSubPackageClass4 { + public String getIdentifier() { + return "SubPackageClass4Substitute"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/java/RootPackageClass1.java b/tests/src/test/java/org/teavm/parsing/substitution/java/RootPackageClass1.java new file mode 100644 index 000000000..6c2019b3b --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/java/RootPackageClass1.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.java; + +public class RootPackageClass1 { + public String getIdentifier() { + return "RootPackageClass1"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/java/RootPackageClass2.java b/tests/src/test/java/org/teavm/parsing/substitution/java/RootPackageClass2.java new file mode 100644 index 000000000..6d163569b --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/java/RootPackageClass2.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.java; + +public class RootPackageClass2 { + public String getIdentifier() { + return "RootPackageClass2"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/java/RootPackageClass3.java b/tests/src/test/java/org/teavm/parsing/substitution/java/RootPackageClass3.java new file mode 100644 index 000000000..eaf876f58 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/java/RootPackageClass3.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.java; + +public class RootPackageClass3 { + public String getIdentifier() { + return "RootPackageClass3"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/java/RootPackageClass4.java b/tests/src/test/java/org/teavm/parsing/substitution/java/RootPackageClass4.java new file mode 100644 index 000000000..def3af5a2 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/java/RootPackageClass4.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.java; + +public class RootPackageClass4 { + public String getIdentifier() { + return "RootPackageClass4"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/java/excludedhierarchy/ExcludedPackageClass1.java b/tests/src/test/java/org/teavm/parsing/substitution/java/excludedhierarchy/ExcludedPackageClass1.java new file mode 100644 index 000000000..0a0f7e692 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/java/excludedhierarchy/ExcludedPackageClass1.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.java.excludedhierarchy; + +public class ExcludedPackageClass1 { + public String getIdentifier() { + return "ExcludedPackageClass1"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/java/excludedhierarchy/excludedsubpackage/ExcludedSubPackageClass.java b/tests/src/test/java/org/teavm/parsing/substitution/java/excludedhierarchy/excludedsubpackage/ExcludedSubPackageClass.java new file mode 100644 index 000000000..71500230b --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/java/excludedhierarchy/excludedsubpackage/ExcludedSubPackageClass.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.java.excludedhierarchy.excludedsubpackage; + +public class ExcludedSubPackageClass { + public String getIdentifier() { + return "ExcludedSubPackageClass"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/java/excludedhierarchy/excludedsubpackage/IncludedSubPackageClass.java b/tests/src/test/java/org/teavm/parsing/substitution/java/excludedhierarchy/excludedsubpackage/IncludedSubPackageClass.java new file mode 100644 index 000000000..1aa7e4569 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/java/excludedhierarchy/excludedsubpackage/IncludedSubPackageClass.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.java.excludedhierarchy.excludedsubpackage; + +public class IncludedSubPackageClass { + public String getIdentifier() { + return "IncludedSubPackageClass"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/java/excludedpackage/ExcludedPackageClass2.java b/tests/src/test/java/org/teavm/parsing/substitution/java/excludedpackage/ExcludedPackageClass2.java new file mode 100644 index 000000000..24cdbccd8 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/java/excludedpackage/ExcludedPackageClass2.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.java.excludedpackage; + +public class ExcludedPackageClass2 { + public String getIdentifier() { + return "ExcludedPackageClass2"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/java/excludedpackage/excludedsubpackage/NotExcludedSubPackageClass.java b/tests/src/test/java/org/teavm/parsing/substitution/java/excludedpackage/excludedsubpackage/NotExcludedSubPackageClass.java new file mode 100644 index 000000000..4a1075480 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/java/excludedpackage/excludedsubpackage/NotExcludedSubPackageClass.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.java.excludedpackage.excludedsubpackage; + +public class NotExcludedSubPackageClass { + public String getIdentifier() { + return "NotExcludedSubPackageClass"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/ExcludedClass.java b/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/ExcludedClass.java new file mode 100644 index 000000000..f0291b3c6 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/ExcludedClass.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.java.subpackage; + +public class ExcludedClass { + public String getIdentifier() { + return "ExcludedClass"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/SubPackageClass1.java b/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/SubPackageClass1.java new file mode 100644 index 000000000..a45e2a170 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/SubPackageClass1.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.java.subpackage; + +public class SubPackageClass1 { + public String getIdentifier() { + return "SubPackageClass1"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/SubPackageClass2.java b/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/SubPackageClass2.java new file mode 100644 index 000000000..4a674dc4e --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/SubPackageClass2.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.java.subpackage; + +public class SubPackageClass2 { + public String getIdentifier() { + return "SubPackageClass2"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/SubPackageClass3.java b/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/SubPackageClass3.java new file mode 100644 index 000000000..63f300c5d --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/SubPackageClass3.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.java.subpackage; + +public class SubPackageClass3 { + public String getIdentifier() { + return "SubPackageClass3"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/SubPackageClass4.java b/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/SubPackageClass4.java new file mode 100644 index 000000000..0d60e3bd7 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/SubPackageClass4.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.java.subpackage; + +public class SubPackageClass4 { + public String getIdentifier() { + return "SubPackageClass4"; + } +} diff --git a/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/subsubpackage/SubSubPackageClass1.java b/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/subsubpackage/SubSubPackageClass1.java new file mode 100644 index 000000000..a8f33b3e5 --- /dev/null +++ b/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/subsubpackage/SubSubPackageClass1.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 adam. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.parsing.substitution.java.subpackage.subsubpackage; + +public class SubSubPackageClass1 { + public String getIdentifier() { + return "SubSubPackageClass"; + } +} diff --git a/tests/src/test/js/.gitignore b/tests/src/test/js/.gitignore index 7e66d4e0e..c2df3edee 100644 --- a/tests/src/test/js/.gitignore +++ b/tests/src/test/js/.gitignore @@ -1,3 +1,4 @@ /node_modules/ /bin/ -/tmp/ \ No newline at end of file +/tmp/ +package-lock.json \ No newline at end of file diff --git a/tests/src/test/resources/META-INF/teavm.properties b/tests/src/test/resources/META-INF/teavm.properties new file mode 100644 index 000000000..b306963fc --- /dev/null +++ b/tests/src/test/resources/META-INF/teavm.properties @@ -0,0 +1,26 @@ +# +# Copyright 2020 adam. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +mapPackageHierarchy|org.teavm.parsing.substitution.classlib.packagehierarchysubstitution=org.teavm.parsing.substitution.java +mapPackage|org.teavm.parsing.substitution.classlib.packagesubstitution=org.teavm.parsing.substitution.java +mapClass|org.teavm.parsing.substitution.classlib.SubSubPackageClassSubstitute=org.teavm.parsing.substitution.java.subpackage.subsubpackage.SubSubPackageClass1 +mapPackageHierarchy|org.teavm.parsing.substitution.classlib.prefixed.packagehierarchysubstitution=org.teavm.parsing.substitution.java +stripPrefixFromPackageHierarchyClasses|org.teavm.parsing.substitution.classlib.prefixed.packagehierarchysubstitution=Prefixed +mapPackage|org.teavm.parsing.substitution.classlib.prefixed.packagesubstitution=org.teavm.parsing.substitution.java +stripPrefixFromPackageClasses|org.teavm.parsing.substitution.classlib.prefixed.packagesubstitution=Prefixed +includePackageHierarchy|org.teavm.parsing.substitution.classlib.packagehierarchysubstitution.excludedhierarchy=false +includePackage|org.teavm.parsing.substitution.classlib.packagehierarchysubstitution.excludedpackage=false +includeClass|org.teavm.parsing.substitution.classlib.packagehierarchysubstitution.excludedhierarchy.excludedsubpackage.IncludedSubPackageClass=true +includeClass|org.teavm.parsing.substitution.classlib.packagehierarchysubstitution.subpackage.ExcludedClass=false \ No newline at end of file