diff --git a/core/src/main/java/org/teavm/cache/MemoryCachedClassReaderSource.java b/core/src/main/java/org/teavm/cache/MemoryCachedClassReaderSource.java index d5ac06d3c..21d21bb82 100644 --- a/core/src/main/java/org/teavm/cache/MemoryCachedClassReaderSource.java +++ b/core/src/main/java/org/teavm/cache/MemoryCachedClassReaderSource.java @@ -24,7 +24,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; -import org.teavm.common.Mapper; +import java.util.function.Function; import org.teavm.model.ClassHolder; import org.teavm.model.ClassReader; import org.teavm.model.ClassReaderSource; @@ -33,7 +33,7 @@ import org.teavm.model.ReferenceCache; public class MemoryCachedClassReaderSource implements ClassReaderSource, CacheStatus { private Map cache = new HashMap<>(); - private Mapper mapper; + private Function provider; private ClassIO classIO; private final Set freshClasses = new HashSet<>(); @@ -42,8 +42,8 @@ public class MemoryCachedClassReaderSource implements ClassReaderSource, CacheSt classIO = new ClassIO(referenceCache, symbolTable, fileTable, varTable); } - public void setMapper(Mapper mapper) { - this.mapper = mapper; + public void setProvider(Function provider) { + this.provider = provider; } @Override @@ -59,7 +59,7 @@ public class MemoryCachedClassReaderSource implements ClassReaderSource, CacheSt @Override public ClassReader get(String name) { Entry entry = cache.computeIfAbsent(name, className -> { - ClassHolder cls = mapper.map(name); + ClassHolder cls = provider.apply(name); Entry en = new Entry(); if (cls != null) { ByteArrayOutputStream output = new ByteArrayOutputStream(); diff --git a/core/src/main/java/org/teavm/common/CachedMapper.java b/core/src/main/java/org/teavm/common/CachedFunction.java similarity index 76% rename from core/src/main/java/org/teavm/common/CachedMapper.java rename to core/src/main/java/org/teavm/common/CachedFunction.java index 634d8022a..a649f662b 100644 --- a/core/src/main/java/org/teavm/common/CachedMapper.java +++ b/core/src/main/java/org/teavm/common/CachedFunction.java @@ -15,10 +15,16 @@ */ package org.teavm.common; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.function.Function; -public class CachedMapper implements Mapper { - private Mapper innerMapper; +public class CachedFunction implements Function { + private Function innerFunction; private Map> cache = new LinkedHashMap<>(); private List> keyListeners = new ArrayList<>(); @@ -27,8 +33,8 @@ public class CachedMapper implements Mapper { boolean computed; } - public CachedMapper(Mapper innerMapper) { - this.innerMapper = innerMapper; + public CachedFunction(Function innerFunction) { + this.innerFunction = innerFunction; } public R getKnown(T preimage) { @@ -37,15 +43,15 @@ public class CachedMapper implements Mapper { } @Override - public R map(T preimage) { - Wrapper wrapper = cache.get(preimage); + public R apply(T t) { + Wrapper wrapper = cache.get(t); if (wrapper == null) { wrapper = new Wrapper<>(); - cache.put(preimage, wrapper); - wrapper.value = innerMapper.map(preimage); + cache.put(t, wrapper); + wrapper.value = innerFunction.apply(t); wrapper.computed = true; for (KeyListener listener : keyListeners) { - listener.keyAdded(preimage); + listener.keyAdded(t); } } if (!wrapper.computed) { diff --git a/core/src/main/java/org/teavm/common/Mapper.java b/core/src/main/java/org/teavm/common/Mapper.java deleted file mode 100644 index e4d54c1af..000000000 --- a/core/src/main/java/org/teavm/common/Mapper.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2013 Alexey Andreev. - * - * 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.common; - -/** - * - * @author Alexey Andreev - * @param which type this mapper takes. - * @param which type this mapper produces. - */ -public interface Mapper { - R map(T preimage); -} diff --git a/core/src/main/java/org/teavm/dependency/DependencyAnalyzer.java b/core/src/main/java/org/teavm/dependency/DependencyAnalyzer.java index b126a8cfd..7f42614ab 100644 --- a/core/src/main/java/org/teavm/dependency/DependencyAnalyzer.java +++ b/core/src/main/java/org/teavm/dependency/DependencyAnalyzer.java @@ -32,12 +32,12 @@ import java.util.Map; import java.util.Optional; import java.util.Queue; import java.util.Set; +import java.util.function.Function; import org.objectweb.asm.tree.ClassNode; import org.teavm.cache.IncrementalDependencyProvider; import org.teavm.cache.IncrementalDependencyRegistration; import org.teavm.callgraph.CallGraph; -import org.teavm.common.CachedMapper; -import org.teavm.common.Mapper; +import org.teavm.common.CachedFunction; import org.teavm.common.ServiceRepository; import org.teavm.diagnostics.Diagnostics; import org.teavm.interop.PlatformMarker; @@ -84,12 +84,12 @@ public abstract class DependencyAnalyzer implements DependencyInfo { private DependencyClassSource classSource; private ClassLoader classLoader; private Map>> methodReaderCache = new HashMap<>(1000, 0.5f); - private Mapper fieldReaderCache; + private Function fieldReaderCache; private Map> methodCache = new HashMap<>(); private Set reachedMethods = new LinkedHashSet<>(); private Set readonlyReachedMethods = Collections.unmodifiableSet(reachedMethods); - private CachedMapper fieldCache; - private CachedMapper classCache; + private CachedFunction fieldCache; + private CachedFunction classCache; private List listeners = new ArrayList<>(); private ServiceRepository services; private Deque pendingTransitions = new ArrayDeque<>(); @@ -121,11 +121,11 @@ public abstract class DependencyAnalyzer implements DependencyInfo { classHierarchy = new ClassHierarchy(this.classSource); this.classLoader = classLoader; this.services = services; - fieldReaderCache = new CachedMapper<>(preimage -> this.classSource.resolveMutable(preimage)); - fieldCache = new CachedMapper<>(preimage -> { - FieldReader field = fieldReaderCache.map(preimage); + fieldReaderCache = new CachedFunction<>(preimage -> this.classSource.resolveMutable(preimage)); + fieldCache = new CachedFunction<>(preimage -> { + FieldReader field = fieldReaderCache.apply(preimage); if (field != null && !field.getReference().equals(preimage)) { - return fieldCache.map(field.getReference()); + return fieldCache.apply(field.getReference()); } FieldDependency node = createFieldNode(preimage, field); if (field != null && field.getInitialValue() instanceof String) { @@ -134,7 +134,7 @@ public abstract class DependencyAnalyzer implements DependencyInfo { return node; }); - classCache = new CachedMapper<>(this::createClassDependency); + classCache = new CachedFunction<>(this::createClassDependency); agent = new DependencyAgent(this); } @@ -399,7 +399,7 @@ public abstract class DependencyAnalyzer implements DependencyInfo { if (completing && getClass(className) == null) { throw new IllegalStateException("Can't link class during completion phase"); } - ClassDependency dep = classCache.map(className); + ClassDependency dep = classCache.apply(className); if (!dep.activated) { dep.activated = true; if (!dep.isMissing()) { @@ -524,7 +524,7 @@ public abstract class DependencyAnalyzer implements DependencyInfo { } public FieldDependency linkField(FieldReference fieldRef) { - FieldDependency dep = fieldCache.map(fieldRef); + FieldDependency dep = fieldCache.apply(fieldRef); if (!dep.activated) { dep.activated = true; if (!dep.isMissing()) { diff --git a/core/src/main/java/org/teavm/model/PreOptimizingClassHolderSource.java b/core/src/main/java/org/teavm/model/PreOptimizingClassHolderSource.java index 75e7dc583..0cbca685c 100644 --- a/core/src/main/java/org/teavm/model/PreOptimizingClassHolderSource.java +++ b/core/src/main/java/org/teavm/model/PreOptimizingClassHolderSource.java @@ -17,7 +17,7 @@ package org.teavm.model; import java.util.LinkedHashMap; import java.util.Map; -import org.teavm.common.Mapper; +import java.util.function.Function; import org.teavm.model.optimization.GlobalValueNumbering; import org.teavm.model.optimization.UnusedVariableElimination; @@ -43,8 +43,8 @@ public class PreOptimizingClassHolderSource implements ClassHolderSource { return cls; } - public static ClassHolder optimize(Mapper innerSource, String name) { - ClassHolder cls = innerSource.map(name); + public static ClassHolder optimize(Function innerSource, String name) { + ClassHolder cls = innerSource.apply(name); if (cls == null) { return cls; } diff --git a/core/src/main/java/org/teavm/parsing/ClassRefsRenamer.java b/core/src/main/java/org/teavm/parsing/ClassRefsRenamer.java index 599941099..b08ec7325 100644 --- a/core/src/main/java/org/teavm/parsing/ClassRefsRenamer.java +++ b/core/src/main/java/org/teavm/parsing/ClassRefsRenamer.java @@ -17,7 +17,7 @@ package org.teavm.parsing; import java.util.Arrays; import java.util.Map; -import org.teavm.common.Mapper; +import java.util.function.Function; import org.teavm.interop.Remove; import org.teavm.interop.Rename; import org.teavm.interop.Superclass; @@ -52,15 +52,15 @@ import org.teavm.model.instructions.PutFieldInstruction; public class ClassRefsRenamer extends AbstractInstructionVisitor { private ReferenceCache referenceCache; - private Mapper classNameMapper; + private Function classNameMapper; - public ClassRefsRenamer(ReferenceCache referenceCache, Mapper classNameMapper) { + public ClassRefsRenamer(ReferenceCache referenceCache, Function classNameMapper) { this.referenceCache = referenceCache; this.classNameMapper = classNameMapper; } public ClassHolder rename(ClassHolder cls) { - ClassHolder renamedCls = new ClassHolder(classNameMapper.map(cls.getName())); + ClassHolder renamedCls = new ClassHolder(classNameMapper.apply(cls.getName())); renamedCls.getModifiers().addAll(cls.getModifiers()); renamedCls.setLevel(cls.getLevel()); String parent = cls.getParent(); @@ -71,7 +71,7 @@ public class ClassRefsRenamer extends AbstractInstructionVisitor { parent = null; } } - renamedCls.setParent(parent != null ? classNameMapper.map(parent) : null); + renamedCls.setParent(parent != null ? classNameMapper.apply(parent) : null); if (renamedCls.getName().equals(renamedCls.getParent())) { renamedCls.setParent(null); } @@ -85,11 +85,11 @@ public class ClassRefsRenamer extends AbstractInstructionVisitor { renamedCls.addField(rename(field)); } if (cls.getOwnerName() != null) { - renamedCls.setOwnerName(classNameMapper.map(cls.getOwnerName())); + renamedCls.setOwnerName(classNameMapper.apply(cls.getOwnerName())); } rename(cls.getAnnotations(), renamedCls.getAnnotations()); for (String iface : cls.getInterfaces()) { - String mappedIfaceName = classNameMapper.map(iface); + String mappedIfaceName = classNameMapper.apply(iface); if (!mappedIfaceName.equals(renamedCls.getName())) { renamedCls.getInterfaces().add(mappedIfaceName); } @@ -133,7 +133,7 @@ public class ClassRefsRenamer extends AbstractInstructionVisitor { return referenceCache.getCached(ValueType.arrayOf(rename(itemType))); } else if (type instanceof ValueType.Object) { String className = ((ValueType.Object) type).getClassName(); - return referenceCache.getCached(ValueType.object(classNameMapper.map(className))); + return referenceCache.getCached(ValueType.object(classNameMapper.apply(className))); } else { return type; } @@ -159,31 +159,31 @@ public class ClassRefsRenamer extends AbstractInstructionVisitor { private MethodHandle rename(MethodHandle handle) { switch (handle.getKind()) { case GET_FIELD: - return MethodHandle.fieldGetter(classNameMapper.map(handle.getClassName()), handle.getName(), + return MethodHandle.fieldGetter(classNameMapper.apply(handle.getClassName()), handle.getName(), rename(handle.getValueType())); case GET_STATIC_FIELD: - return MethodHandle.staticFieldGetter(classNameMapper.map(handle.getClassName()), handle.getName(), + return MethodHandle.staticFieldGetter(classNameMapper.apply(handle.getClassName()), handle.getName(), rename(handle.getValueType())); case PUT_FIELD: - return MethodHandle.fieldSetter(classNameMapper.map(handle.getClassName()), handle.getName(), + return MethodHandle.fieldSetter(classNameMapper.apply(handle.getClassName()), handle.getName(), rename(handle.getValueType())); case PUT_STATIC_FIELD: - return MethodHandle.staticFieldSetter(classNameMapper.map(handle.getClassName()), handle.getName(), + return MethodHandle.staticFieldSetter(classNameMapper.apply(handle.getClassName()), handle.getName(), rename(handle.getValueType())); case INVOKE_VIRTUAL: - return MethodHandle.virtualCaller(classNameMapper.map(handle.getClassName()), handle.getName(), + return MethodHandle.virtualCaller(classNameMapper.apply(handle.getClassName()), handle.getName(), rename(handle.signature())); case INVOKE_STATIC: - return MethodHandle.staticCaller(classNameMapper.map(handle.getClassName()), handle.getName(), + return MethodHandle.staticCaller(classNameMapper.apply(handle.getClassName()), handle.getName(), rename(handle.signature())); case INVOKE_SPECIAL: - return MethodHandle.specialCaller(classNameMapper.map(handle.getClassName()), handle.getName(), + return MethodHandle.specialCaller(classNameMapper.apply(handle.getClassName()), handle.getName(), rename(handle.signature())); case INVOKE_CONSTRUCTOR: - return MethodHandle.constructorCaller(classNameMapper.map(handle.getClassName()), handle.getName(), + return MethodHandle.constructorCaller(classNameMapper.apply(handle.getClassName()), handle.getName(), rename(handle.signature())); case INVOKE_INTERFACE: - return MethodHandle.interfaceCaller(classNameMapper.map(handle.getClassName()), handle.getName(), + return MethodHandle.interfaceCaller(classNameMapper.apply(handle.getClassName()), handle.getName(), rename(handle.signature())); default: break; @@ -201,7 +201,7 @@ public class ClassRefsRenamer extends AbstractInstructionVisitor { } private AnnotationHolder rename(AnnotationHolder annot) { - AnnotationHolder renamedAnnot = new AnnotationHolder(classNameMapper.map(annot.getType())); + AnnotationHolder renamedAnnot = new AnnotationHolder(classNameMapper.apply(annot.getType())); for (Map.Entry entry : annot.getValues().entrySet()) { renamedAnnot.getValues().put(entry.getKey(), entry.getValue()); } @@ -216,7 +216,7 @@ public class ClassRefsRenamer extends AbstractInstructionVisitor { } for (TryCatchBlock tryCatch : basicBlock.getTryCatchBlocks()) { if (tryCatch.getExceptionType() != null) { - tryCatch.setExceptionType(classNameMapper.map(tryCatch.getExceptionType())); + tryCatch.setExceptionType(classNameMapper.apply(tryCatch.getExceptionType())); } } } @@ -239,7 +239,7 @@ public class ClassRefsRenamer extends AbstractInstructionVisitor { @Override public void visit(ConstructInstruction insn) { - insn.setType(classNameMapper.map(insn.getType())); + insn.setType(classNameMapper.apply(insn.getType())); } @Override @@ -249,20 +249,20 @@ public class ClassRefsRenamer extends AbstractInstructionVisitor { @Override public void visit(GetFieldInstruction insn) { - String className = classNameMapper.map(insn.getField().getClassName()); + String className = classNameMapper.apply(insn.getField().getClassName()); insn.setField(referenceCache.getCached(new FieldReference(className, insn.getField().getFieldName()))); } @Override public void visit(PutFieldInstruction insn) { - String className = classNameMapper.map(insn.getField().getClassName()); + String className = classNameMapper.apply(insn.getField().getClassName()); if (className != insn.getField().getClassName()) { insn.setField(referenceCache.getCached(new FieldReference(className, insn.getField().getFieldName()))); } } @Override public void visit(InvokeInstruction insn) { - String className = classNameMapper.map(insn.getMethod().getClassName()); + String className = classNameMapper.apply(insn.getMethod().getClassName()); ValueType[] signature = insn.getMethod().getSignature(); boolean changed = true; for (int i = 0; i < signature.length; ++i) { @@ -298,6 +298,6 @@ public class ClassRefsRenamer extends AbstractInstructionVisitor { @Override public void visit(InitClassInstruction insn) { - insn.setClassName(classNameMapper.map(insn.getClassName())); + insn.setClassName(classNameMapper.apply(insn.getClassName())); } } diff --git a/core/src/main/java/org/teavm/parsing/ClasspathResourceMapper.java b/core/src/main/java/org/teavm/parsing/ClasspathResourceMapper.java index 7d3c8f349..b871f1582 100644 --- a/core/src/main/java/org/teavm/parsing/ClasspathResourceMapper.java +++ b/core/src/main/java/org/teavm/parsing/ClasspathResourceMapper.java @@ -21,15 +21,15 @@ import java.io.InputStream; import java.net.URISyntaxException; import java.net.URL; import java.util.*; -import org.teavm.common.CachedMapper; -import org.teavm.common.Mapper; +import java.util.function.Function; +import org.teavm.common.CachedFunction; import org.teavm.model.ClassHolder; import org.teavm.model.ReferenceCache; -public class ClasspathResourceMapper implements Mapper, ClassDateProvider { +public class ClasspathResourceMapper implements Function, ClassDateProvider { private static final String PACKAGE_PREFIX = "packagePrefix."; private static final String CLASS_PREFIX = "classPrefix."; - private Mapper innerMapper; + private Function innerMapper; private List transformations = new ArrayList<>(); private ClassRefsRenamer renamer; private ClassLoader classLoader; @@ -44,8 +44,8 @@ public class ClasspathResourceMapper implements Mapper, Cla } public ClasspathResourceMapper(ClassLoader classLoader, ReferenceCache referenceCache, - Mapper innerMapper) { - this.innerMapper = innerMapper; + Function provider) { + this.innerMapper = provider; this.referenceCache = referenceCache; try { Enumeration resources = classLoader.getResources("META-INF/teavm.properties"); @@ -62,18 +62,18 @@ public class ClasspathResourceMapper implements Mapper, Cla } catch (IOException e) { throw new RuntimeException("Error reading resources", e); } - renamer = new ClassRefsRenamer(referenceCache, new CachedMapper<>(classNameMapper)); + renamer = new ClassRefsRenamer(referenceCache, new CachedFunction<>(classNameMapper)); this.classLoader = classLoader; } public ClasspathResourceMapper(Properties properties, ReferenceCache referenceCache, - Mapper innerMapper) { + Function innerMapper) { this.innerMapper = innerMapper; this.referenceCache = referenceCache; Map transformationMap = new HashMap<>(); loadProperties(properties, transformationMap); transformations.addAll(transformationMap.values()); - renamer = new ClassRefsRenamer(referenceCache, new CachedMapper<>(classNameMapper)); + renamer = new ClassRefsRenamer(referenceCache, new CachedFunction<>(classNameMapper)); } private void loadProperties(Properties properties, Map cache) { @@ -103,13 +103,13 @@ public class ClasspathResourceMapper implements Mapper, Cla } @Override - public ClassHolder map(String name) { + public ClassHolder apply(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.map(transformation.packagePrefix + packageName + ClassHolder classHolder = innerMapper.apply(transformation.packagePrefix + packageName + "." + transformation.classPrefix + className); if (classHolder != null) { classHolder = renamer.rename(classHolder); @@ -117,7 +117,7 @@ public class ClasspathResourceMapper implements Mapper, Cla return classHolder; } } - return innerMapper.map(name); + return innerMapper.apply(name); } private String renameClass(String name) { @@ -136,7 +136,7 @@ public class ClasspathResourceMapper implements Mapper, Cla return name; } - private Mapper classNameMapper = this::renameClass; + private Function classNameMapper = this::renameClass; @Override public Date getModificationDate(String className) { diff --git a/core/src/main/java/org/teavm/parsing/resource/MapperClassHolderSource.java b/core/src/main/java/org/teavm/parsing/resource/MapperClassHolderSource.java index d45c1d5a0..b4fab2e58 100644 --- a/core/src/main/java/org/teavm/parsing/resource/MapperClassHolderSource.java +++ b/core/src/main/java/org/teavm/parsing/resource/MapperClassHolderSource.java @@ -15,20 +15,20 @@ */ package org.teavm.parsing.resource; -import org.teavm.common.CachedMapper; -import org.teavm.common.Mapper; +import java.util.function.Function; +import org.teavm.common.CachedFunction; import org.teavm.model.ClassHolder; import org.teavm.model.ClassHolderSource; public class MapperClassHolderSource implements ClassHolderSource { - private Mapper mapper; + private Function mapper; - public MapperClassHolderSource(Mapper mapper) { - this.mapper = new CachedMapper<>(mapper); + public MapperClassHolderSource(Function mapper) { + this.mapper = new CachedFunction<>(mapper); } @Override public ClassHolder get(String name) { - return mapper.map(name); + return mapper.apply(name); } } diff --git a/core/src/main/java/org/teavm/parsing/resource/ResourceClassHolderMapper.java b/core/src/main/java/org/teavm/parsing/resource/ResourceClassHolderMapper.java index 5de59f691..c6a74c7dc 100644 --- a/core/src/main/java/org/teavm/parsing/resource/ResourceClassHolderMapper.java +++ b/core/src/main/java/org/teavm/parsing/resource/ResourceClassHolderMapper.java @@ -17,14 +17,14 @@ package org.teavm.parsing.resource; import java.io.IOException; import java.io.InputStream; +import java.util.function.Function; import org.objectweb.asm.ClassReader; import org.objectweb.asm.tree.ClassNode; -import org.teavm.common.Mapper; import org.teavm.model.ClassHolder; import org.teavm.model.ReferenceCache; import org.teavm.parsing.Parser; -public class ResourceClassHolderMapper implements Mapper { +public class ResourceClassHolderMapper implements Function { private Parser parser; private ResourceReader resourceReader; @@ -34,7 +34,7 @@ public class ResourceClassHolderMapper implements Mapper { } @Override - public ClassHolder map(String name) { + public ClassHolder apply(String name) { ClassNode clsNode = new ClassNode(); String resourceName = name.replace('.', '/') + ".class"; if (!resourceReader.hasResource(resourceName)) { diff --git a/tools/devserver/src/main/java/org/teavm/devserver/CodeServlet.java b/tools/devserver/src/main/java/org/teavm/devserver/CodeServlet.java index 7d4a57047..c428703d3 100644 --- a/tools/devserver/src/main/java/org/teavm/devserver/CodeServlet.java +++ b/tools/devserver/src/main/java/org/teavm/devserver/CodeServlet.java @@ -42,6 +42,7 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.function.Function; import java.util.function.Supplier; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; @@ -71,7 +72,6 @@ import org.teavm.cache.InMemoryMethodNodeCache; import org.teavm.cache.InMemoryProgramCache; import org.teavm.cache.InMemorySymbolTable; import org.teavm.cache.MemoryCachedClassReaderSource; -import org.teavm.common.Mapper; import org.teavm.debugging.information.DebugInformation; import org.teavm.debugging.information.DebugInformationBuilder; import org.teavm.dependency.FastDependencyAnalyzer; @@ -745,9 +745,9 @@ public class CodeServlet extends HttpServlet { ClassLoader classLoader = initClassLoader(); ClasspathResourceReader reader = new ClasspathResourceReader(classLoader); ResourceClassHolderMapper rawMapper = new ResourceClassHolderMapper(reader, referenceCache); - Mapper classPathMapper = new ClasspathResourceMapper(classLoader, referenceCache, + Function classPathMapper = new ClasspathResourceMapper(classLoader, referenceCache, rawMapper); - classSource.setMapper(name -> PreOptimizingClassHolderSource.optimize(classPathMapper, name)); + classSource.setProvider(name -> PreOptimizingClassHolderSource.optimize(classPathMapper, name)); long startTime = System.currentTimeMillis(); JavaScriptTarget jsTarget = new JavaScriptTarget();