Add ability to fine tune transpiler class substitutions.

This commit is contained in:
Adam J Ryan 2020-03-22 22:55:47 +00:00 committed by Alexey Andreev
parent 3254dce53b
commit e0fc5d834b
39 changed files with 1247 additions and 128 deletions

View File

@ -11,5 +11,5 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
packagePrefix.java=org.teavm.classlib stripPrefixFromPackageHierarchyClasses|org.teavm.classlib.java=T
classPrefix.java=T mapPackageHierarchy|org.teavm.classlib.java=java

View File

@ -20,53 +20,69 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; 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 java.util.function.Function;
import org.teavm.common.CachedFunction; import org.teavm.common.CachedFunction;
import org.teavm.model.ClassHolder; import org.teavm.model.ClassHolder;
import org.teavm.model.FieldHolder; import org.teavm.model.FieldHolder;
import org.teavm.model.MethodHolder; import org.teavm.model.MethodHolder;
import org.teavm.model.ReferenceCache; 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; import org.teavm.vm.spi.ElementFilter;
public class ClasspathResourceMapper implements Function<String, ClassHolder>, ClassDateProvider { public class ClasspathResourceMapper implements Function<String, ClassHolder>, ClassDateProvider {
private static final String PACKAGE_PREFIX = "packagePrefix."; private static final String STRIP_PREFIX_FROM_PREFIX = "stripPrefixFrom";
private static final String CLASS_PREFIX = "classPrefix."; 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<String, ClassHolder> innerMapper; private Function<String, ClassHolder> innerMapper;
private List<Transformation> transformations = new ArrayList<>();
private ClassRefsRenamer renamer; private ClassRefsRenamer renamer;
private ClassLoader classLoader; private ClassLoader classLoader;
private Map<String, ModificationDate> modificationDates = new HashMap<>(); private Map<String, Date> modificationDates = new HashMap<>();
private ReferenceCache referenceCache;
private List<ElementFilter> elementFilters = new ArrayList<>(); private List<ElementFilter> elementFilters = new ArrayList<>();
private ClassMappings classMappings = new ClassMappings();
private static class Transformation { private PrefixMapping prefixMapping = new PrefixMapping();
String packageName; private ClassMappings packageMappings = new ClassMappings();
String packagePrefix = ""; private ClassExclusions classExclusions = new ClassExclusions();
String fullPrefix = ""; private ClassMappings reverseClassMappings = new ClassMappings();
String classPrefix = ""; private ClassMappings reversePackageMappings = new ClassMappings();
}
public ClasspathResourceMapper(ClassLoader classLoader, ReferenceCache referenceCache, public ClasspathResourceMapper(ClassLoader classLoader, ReferenceCache referenceCache,
Function<String, ClassHolder> provider) { Function<String, ClassHolder> provider) {
this.innerMapper = provider; this.innerMapper = provider;
this.referenceCache = referenceCache;
try { try {
Enumeration<URL> resources = classLoader.getResources("META-INF/teavm.properties"); Enumeration<URL> resources = classLoader.getResources("META-INF/teavm.properties");
Map<String, Transformation> transformationMap = new HashMap<>();
while (resources.hasMoreElements()) { while (resources.hasMoreElements()) {
URL resource = resources.nextElement(); URL resource = resources.nextElement();
Properties properties = new Properties(); Properties properties = new OrderedProperties();
try (InputStream input = resource.openStream()) { try (InputStream input = resource.openStream()) {
properties.load(input); properties.load(input);
} }
loadProperties(properties, transformationMap); loadProperties(properties);
} }
transformations.addAll(transformationMap.values());
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException("Error reading resources", 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)) { for (ElementFilter elementFilter : ServiceLoader.load(ElementFilter.class)) {
elementFilters.add(elementFilter); elementFilters.add(elementFilter);
@ -78,61 +94,57 @@ public class ClasspathResourceMapper implements Function<String, ClassHolder>, C
public ClasspathResourceMapper(Properties properties, ReferenceCache referenceCache, public ClasspathResourceMapper(Properties properties, ReferenceCache referenceCache,
Function<String, ClassHolder> innerMapper) { Function<String, ClassHolder> innerMapper) {
this.innerMapper = innerMapper; this.innerMapper = innerMapper;
this.referenceCache = referenceCache; loadProperties(properties);
Map<String, Transformation> transformationMap = new HashMap<>(); renamer = new ClassRefsRenamer(referenceCache, new CachedFunction<>(this::toUnmappedClassName));
loadProperties(properties, transformationMap);
transformations.addAll(transformationMap.values());
renamer = new ClassRefsRenamer(referenceCache, new CachedFunction<>(classNameMapper));
}
private void loadProperties(Properties properties, Map<String, Transformation> 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<String, Transformation> 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;
} }
@Override @Override
public ClassHolder apply(String name) { public ClassHolder apply(String name) {
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;
}
}
if (cls == null) {
cls = innerMapper.apply(name);
}
if (cls != null && !elementFilters.isEmpty()) {
for (ElementFilter filter : elementFilters) { for (ElementFilter filter : elementFilters) {
if (!filter.acceptClass(name)) { if (!filter.acceptClass(name)) {
return null; return null;
} }
} }
MethodHolder[] methodHolders = cls.getMethods().toArray(new MethodHolder[0]);
ClassHolder cls = find(name); FieldHolder[] fieldHolders = cls.getFields().toArray(new FieldHolder[0]);
if (cls != null) {
for (MethodHolder method : cls.getMethods().toArray(new MethodHolder[0])) {
for (ElementFilter filter : elementFilters) { for (ElementFilter filter : elementFilters) {
for (MethodHolder method : methodHolders) {
if (!filter.acceptMethod(method.getReference())) { if (!filter.acceptMethod(method.getReference())) {
cls.removeMethod(method); cls.removeMethod(method);
break; break;
} }
} }
} for (FieldHolder field : fieldHolders) {
for (FieldHolder field : cls.getFields().toArray(new FieldHolder[0])) {
for (ElementFilter filter : elementFilters) {
if (!filter.acceptField(field.getReference())) { if (!filter.acceptField(field.getReference())) {
cls.removeField(field); cls.removeField(field);
break; break;
@ -140,77 +152,31 @@ public class ClasspathResourceMapper implements Function<String, ClassHolder>, C
} }
} }
} }
return cls; 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<String, String> classNameMapper = this::renameClass;
@Override @Override
public Date getModificationDate(String className) { public Date getModificationDate(String className) {
ModificationDate mdate = modificationDates.get(className); Date mdate = modificationDates.get(className);
if (mdate == null) { if (mdate == null) {
mdate = new ModificationDate(); mdate = getOriginalModificationDate(toUnmappedClassName(className));
modificationDates.put(className, mdate); modificationDates.put(className, mdate);
mdate.date = calculateModificationDate(className);
} }
return mdate.date; return mdate == VOID_DATE ? null : mdate;
} }
private Date calculateModificationDate(String className) { private String toUnmappedClassName(String name) {
int dotIndex = className.lastIndexOf('.'); if (classExclusions.apply(name)) {
String packageName; return name;
String simpleName;
if (dotIndex > 0) {
packageName = className.substring(0, dotIndex + 1);
simpleName = className.substring(dotIndex + 1);
} else {
packageName = "";
simpleName = className;
} }
for (Transformation transformation : transformations) { name = prefixMapping.revert(name);
if (packageName.startsWith(transformation.packageName)) { for (String originalClassName : reverseClassMappings.apply(name)) {
String fullName = transformation.packagePrefix + packageName + transformation.classPrefix + simpleName; return originalClassName;
Date date = getOriginalModificationDate(fullName);
if (date != null) {
return date;
} }
for (String originalClassName : reversePackageMappings.apply(name)) {
return originalClassName;
} }
} return name;
return getOriginalModificationDate(className);
} }
private Date getOriginalModificationDate(String className) { private Date getOriginalModificationDate(String className) {
@ -239,7 +205,48 @@ public class ClasspathResourceMapper implements Function<String, ClassHolder>, C
} }
} }
static class ModificationDate { private void loadProperties(Properties properties) {
Date date; 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)));
}
}
} }
} }

View File

@ -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<String, Boolean> {
private final Map<String, Boolean> classExclusions = new HashMap<>();
private Boolean isExcluded;
private Boolean isSubpackagesExcluded;
private final Map<String, ClassExclusions> 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;
}
}

View File

@ -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<String, List<String>> {
private final Map<String, List<String>> mappedClassNames = new LinkedHashMap<>();
private final List<String> mappedPackageNames = new LinkedList<>();
private final List<String> mappedPackageHierarchyNames = new LinkedList<>();
private final Map<String, ClassMappings> subMappings = new HashMap<>();
@Override
public List<String> apply(String className) {
List<String> 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<String> mappings) {
if (classNameSegments == null || classNameSegments.length < 1) {
return;
}
if (classNameSegments.length == 1) {
final List<String> 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);
}
}
}
}

View File

@ -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<Object> 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<String> stringPropertyNames() {
Set<String> 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);
}
}

View File

@ -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<String, String> {
private String packageClassPrefix;
private String packageHierarchyClassPrefix;
private final Map<String, PrefixMapping> 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;
}
}

View File

@ -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());
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -1,3 +1,4 @@
/node_modules/ /node_modules/
/bin/ /bin/
/tmp/ /tmp/
package-lock.json

View File

@ -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