Remove outdated methodAliases build parameter

Replace classAliases with classesToPreserve
This commit is contained in:
Alexey Andreev 2018-01-09 23:33:17 +03:00
parent ac236f1ff8
commit 85c686c72a
15 changed files with 86 additions and 273 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ target
.factorypath
.checkstyle
.cache-main
.metadata
# IntelliJ IDEA
*.iml

View File

@ -284,16 +284,13 @@ public class JavaScriptTarget implements TeaVMTarget, TeaVMJavaScriptHost {
renderer.render(clsNodes);
renderer.renderStringPool();
renderer.renderStringConstants();
for (Map.Entry<String, TeaVMEntryPoint> entry : controller.getEntryPoints().entrySet()) {
for (Map.Entry<? extends String, ? extends TeaVMEntryPoint> entry
: controller.getEntryPoints().entrySet()) {
sourceWriter.append("var ").append(entry.getKey()).ws().append("=").ws();
MethodReference ref = entry.getValue().getReference();
sourceWriter.append(naming.getFullNameFor(ref));
sourceWriter.append(";").newLine();
}
for (Map.Entry<String, String> entry : controller.getExportedClasses().entrySet()) {
sourceWriter.append("var ").append(entry.getKey()).ws().append("=").ws()
.appendClass(entry.getValue()).append(";").newLine();
}
for (RendererListener listener : rendererListeners) {
listener.complete();
}

View File

@ -22,10 +22,12 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.ServiceLoader;
import java.util.Set;
import java.util.stream.Collectors;
import org.teavm.cache.NoCache;
import org.teavm.common.ServiceRepository;
@ -109,8 +111,8 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
private final ClassLoader classLoader;
private final Map<String, TeaVMEntryPoint> entryPoints = new HashMap<>();
private final Map<String, TeaVMEntryPoint> readonlyEntryPoints = Collections.unmodifiableMap(entryPoints);
private final Map<String, String> exportedClasses = new HashMap<>();
private final Map<String, String> readonlyExportedClasses = Collections.unmodifiableMap(exportedClasses);
private final Set<String> preservedClasses = new HashSet<>();
private final Set<String> readonlyPreservedClasses = Collections.unmodifiableSet(preservedClasses);
private final Map<Class<?>, Object> services = new HashMap<>();
private final Properties properties = new Properties();
private ProgramCache programCache;
@ -288,15 +290,11 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
return entryPoint;
}
public void exportType(String name, String className) {
if (exportedClasses.containsKey(name)) {
throw new IllegalArgumentException("Class with public name `" + name + "' already defined for class "
+ className);
}
public void preserveType(String className) {
dependencyAnalyzer.defer(() -> {
dependencyAnalyzer.linkClass(className, null).initClass(null);
});
exportedClasses.put(name, className);
preservedClasses.add(className);
}
/**
@ -675,8 +673,8 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
}
@Override
public Map<String, String> getExportedClasses() {
return readonlyExportedClasses;
public Set<String> getPreservedClasses() {
return readonlyPreservedClasses;
}
@Override

View File

@ -38,7 +38,7 @@ import org.teavm.model.MethodReference;
* Let's see how you achieve it:</p>
*
* <pre>{@code
*vm.exportType("JavaHashMap", "java.util.HashMap");
*vm.preserveType("JavaHashMap", "java.util.HashMap");
*vm.entryPoint("initJavaHashMap", new MethodReference("java.util.HashMap",
* "<init>", ValueType.VOID));
*vm.entryPoint("putValueIntoJavaMap", new MethodReference(

View File

@ -17,6 +17,7 @@ package org.teavm.vm;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.teavm.common.ServiceRepository;
import org.teavm.dependency.DependencyInfo;
import org.teavm.diagnostics.Diagnostics;
@ -41,7 +42,7 @@ public interface TeaVMTargetController {
boolean isFriendlyToDebugger();
Map<String, TeaVMEntryPoint> getEntryPoints();
Map<? extends String, ? extends TeaVMEntryPoint> getEntryPoints();
Map<String, String> getExportedClasses();
Set<? extends String> getPreservedClasses();
}

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2014 Alexey Andreev.
@ -12,10 +13,7 @@
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.teavm</groupId>

View File

@ -1,37 +0,0 @@
/*
* Copyright 2014 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.tooling;
public class ClassAlias {
private String className;
private String alias;
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
}

View File

@ -1,64 +0,0 @@
/*
* Copyright 2014 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.tooling;
public class MethodAlias {
private String alias;
private String className;
private String methodName;
private String descriptor;
private String[] types;
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
public String getMethodName() {
return methodName;
}
public void setMethodName(String methodName) {
this.methodName = methodName;
}
public String getDescriptor() {
return descriptor;
}
public void setDescriptor(String descriptor) {
this.descriptor = descriptor;
}
public String[] getTypes() {
return types;
}
public void setTypes(String[] types) {
this.types = types;
}
}

View File

@ -61,7 +61,6 @@ import org.teavm.vm.BuildTarget;
import org.teavm.vm.DirectoryBuildTarget;
import org.teavm.vm.TeaVM;
import org.teavm.vm.TeaVMBuilder;
import org.teavm.vm.TeaVMEntryPoint;
import org.teavm.vm.TeaVMOptimizationLevel;
import org.teavm.vm.TeaVMProgressListener;
import org.teavm.vm.TeaVMTarget;
@ -81,8 +80,7 @@ public class TeaVMTool implements BaseTeaVMTool {
private boolean incremental;
private File cacheDirectory = new File("./teavm-cache");
private List<ClassHolderTransformer> transformers = new ArrayList<>();
private List<ClassAlias> classAliases = new ArrayList<>();
private List<MethodAlias> methodAliases = new ArrayList<>();
private List<String> classesToPreserve = new ArrayList<>();
private TeaVMToolLog log = new EmptyTeaVMToolLog();
private ClassLoader classLoader = TeaVMTool.class.getClassLoader();
private DiskCachedClassHolderSource cachedClassSource;
@ -197,12 +195,8 @@ public class TeaVMTool implements BaseTeaVMTool {
return transformers;
}
public List<ClassAlias> getClassAliases() {
return classAliases;
}
public List<MethodAlias> getMethodAliases() {
return methodAliases;
public List<String> getClassesToPreserve() {
return classesToPreserve;
}
public TeaVMToolLog getLog() {
@ -392,26 +386,8 @@ public class TeaVMTool implements BaseTeaVMTool {
.withArrayValue(1, "java.lang.String")
.async();
}
for (ClassAlias alias : classAliases) {
vm.exportType(alias.getAlias(), alias.getClassName());
}
for (MethodAlias methodAlias : methodAliases) {
MethodReference ref = new MethodReference(methodAlias.getClassName(), methodAlias.getMethodName(),
MethodDescriptor.parseSignature(methodAlias.getDescriptor()));
TeaVMEntryPoint entryPoint = vm.entryPoint(methodAlias.getAlias(), ref).async();
if (methodAlias.getTypes() != null) {
for (int i = 0; i < methodAlias.getTypes().length; ++i) {
String types = methodAlias.getTypes()[i];
if (types != null) {
for (String type : types.split(" +")) {
type = type.trim();
if (!type.isEmpty()) {
entryPoint.withValue(i, type);
}
}
}
}
}
for (String className : classesToPreserve) {
vm.preserveType(className);
}
targetDirectory.mkdirs();

View File

@ -144,23 +144,21 @@ public class TeaVMProjectConfigurator extends AbstractProjectConfigurator {
profile.setTransformers(transformers != null ? transformers : new String[0]);
monitor.worked(10);
profile.setClassAliases(readClassAliases(execution));
profile.setClassesToPreserve(readClassesToPreserve(execution));
monitor.worked(10);
monitor.done();
}
private Map<String, String> readClassAliases(MojoExecution execution) {
Map<String, String> aliases = new HashMap<>();
Xpp3Dom aliasesElem = execution.getConfiguration().getChild("classAliases");
if (aliasesElem != null) {
for (Xpp3Dom item : aliasesElem.getChildren()) {
String className = item.getChild("className").getValue();
String alias = item.getChild("alias").getValue();
aliases.put(className, alias);
private Set<? extends String> readClassesToPreserve(MojoExecution execution) {
Set<String> classes = new HashSet<>();
Xpp3Dom classesElem = execution.getConfiguration().getChild("classesToPreserve");
if (classesElem != null) {
for (Xpp3Dom item : classesElem.getChildren()) {
classes.add(item.getValue());
}
}
return aliases;
return classes;
}
private String getProjectBuildDirectory() throws CoreException {

View File

@ -16,6 +16,8 @@
package org.teavm.eclipse;
import java.util.*;
import java.util.stream.Collectors;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.CoreException;
@ -163,7 +165,7 @@ public class PreferencesBasedTeaVMProjectSettings implements TeaVMProjectSetting
private boolean sourceFilesCopied;
private Properties properties = new Properties();
private String[] transformers = new String[0];
private Map<String, String> classAliases = new HashMap<>();
private Set<String> classesToPreserve = new HashSet<>();
private String externalToolId = "";
@Override
@ -306,13 +308,14 @@ public class PreferencesBasedTeaVMProjectSettings implements TeaVMProjectSetting
}
@Override
public Map<String, String> getClassAliases() {
return new HashMap<>(classAliases);
public Set<? extends String> getClassesToPreserve() {
return classesToPreserve;
}
@Override
public void setClassAliases(Map<String, String> classAliases) {
this.classAliases = new HashMap<>(classAliases);
public void setClassesToPreserve(Set<? extends String> classesToPreserve) {
this.classesToPreserve.clear();
this.classesToPreserve.addAll(classesToPreserve);
}
@Override
@ -357,11 +360,7 @@ public class PreferencesBasedTeaVMProjectSettings implements TeaVMProjectSetting
Preferences transformersPrefs = preferences.node(TRANSFORMERS);
transformersPrefs.sync();
transformers = transformersPrefs.keys();
Preferences classesPrefs = preferences.node(CLASSES);
classesPrefs.sync();
for (String key : classesPrefs.keys()) {
classAliases.put(key, classesPrefs.get(key, "_"));
}
classesToPreserve.addAll(Arrays.asList(preferences.get(CLASSES, "").split(" ")));
externalToolId = preferences.get(EXTERNAL_TOOL_ID, "");
}
@ -390,12 +389,7 @@ public class PreferencesBasedTeaVMProjectSettings implements TeaVMProjectSetting
transformersPrefs.put(transformer, "");
}
transformersPrefs.flush();
Preferences classesPrefs = preferences.node(CLASSES);
classesPrefs.clear();
for (String key : classAliases.keySet()) {
classesPrefs.put(key, classAliases.get(key));
}
classesPrefs.flush();
preferences.put(CLASSES, classesToPreserve.stream().collect(Collectors.joining(" ")));
preferences.put(EXTERNAL_TOOL_ID, externalToolId);
preferences.flush();
}

View File

@ -15,8 +15,8 @@
*/
package org.teavm.eclipse;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
public interface TeaVMProfile {
String getName();
@ -75,9 +75,9 @@ public interface TeaVMProfile {
void setTransformers(String[] transformers);
Map<String, String> getClassAliases();
Set<? extends String> getClassesToPreserve();
void setClassAliases(Map<String, String> classAliases);
void setClassesToPreserve(Set<? extends String> classesToPreserve);
String getExternalToolId();

View File

@ -70,7 +70,6 @@ import org.teavm.model.FieldReference;
import org.teavm.model.MethodReference;
import org.teavm.model.TextLocation;
import org.teavm.model.ValueType;
import org.teavm.tooling.ClassAlias;
import org.teavm.tooling.RuntimeCopyOperation;
import org.teavm.tooling.TeaVMTool;
import org.teavm.tooling.TeaVMToolException;
@ -163,12 +162,7 @@ public class TeaVMProjectBuilder extends IncrementalProjectBuilder {
for (ClassHolderTransformer transformer : instantiateTransformers(profile, classLoader)) {
tool.getTransformers().add(transformer);
}
for (Map.Entry<String, String> entry : profile.getClassAliases().entrySet()) {
ClassAlias classAlias = new ClassAlias();
classAlias.setClassName(entry.getKey());
classAlias.setAlias(entry.getValue());
tool.getClassAliases().add(classAlias);
}
tool.getClassesToPreserve().addAll(profile.getClassesToPreserve());
for (SourceFileProvider provider : sourceProviders) {
tool.addSourceFileProvider(provider);
}

View File

@ -15,8 +15,12 @@
*/
package org.teavm.eclipse.ui;
import java.util.*;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import org.eclipse.core.databinding.observable.list.WritableList;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@ -30,14 +34,32 @@ import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.*;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
@ -70,10 +92,9 @@ public class TeaVMProfileDialog extends Dialog {
private Button addPropertyButton;
private Button deletePropertyButton;
private WritableList propertyList = new WritableList();
private TableViewer classAliasesTableViewer;
private org.eclipse.swt.widgets.List classAliasesTableViewer;
private Button addClassAliasButton;
private Button removeClassAliasButton;
private WritableList classAliases = new WritableList();
private org.eclipse.swt.widgets.List transformersList;
private Button addTransformerButton;
private Button removeTransformerButton;
@ -290,46 +311,8 @@ public class TeaVMProfileDialog extends Dialog {
private void createClassesGroup(Composite parent) {
Group group = createGroup(parent, "Class aliases", 2, true);
classAliasesTableViewer = new TableViewer(group, SWT.BORDER | SWT.V_SCROLL);
classAliasesTableViewer.getTable().setLinesVisible(true);
classAliasesTableViewer.getTable().setHeaderVisible(true);
classAliasesTableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 3));
classAliasesTableViewer.setContentProvider(new ObservableListContentProvider());
classAliasesTableViewer.setInput(classAliases);
TableViewerColumn classNameColumn = new TableViewerColumn(classAliasesTableViewer, SWT.LEFT);
classNameColumn.getColumn().setWidth(200);
classNameColumn.getColumn().setText("Class");
classNameColumn.setLabelProvider(new ColumnLabelProvider() {
@Override public String getText(Object element) {
ClassAliasRow item = (ClassAliasRow)element;
return item.className;
}
});
TableViewerColumn valueColumn = new TableViewerColumn(classAliasesTableViewer, SWT.LEFT);
valueColumn.getColumn().setWidth(200);
valueColumn.getColumn().setText("Alias");
valueColumn.setLabelProvider(new ColumnLabelProvider() {
@Override public String getText(Object element) {
ClassAliasRow item = (ClassAliasRow)element;
return item.alias;
}
});
valueColumn.setEditingSupport(new EditingSupport(valueColumn.getViewer()) {
private TextCellEditor editor = new TextCellEditor(classAliasesTableViewer.getTable());
@Override protected Object getValue(Object element) {
ClassAliasRow item = (ClassAliasRow)element;
return item.alias;
}
@Override protected void setValue(Object element, Object value) {
ClassAliasRow item = (ClassAliasRow)element;
item.alias = (String)value;
getViewer().update(element, null);
}
@Override protected boolean canEdit(Object element) { return true; }
@Override protected CellEditor getCellEditor(Object element) { return editor; }
});
classAliasesTableViewer = new org.eclipse.swt.widgets.List(group, SWT.BORDER | SWT.SINGLE);
classAliasesTableViewer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 3));
addClassAliasButton = new Button(group, SWT.PUSH);
addClassAliasButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
@ -346,11 +329,6 @@ public class TeaVMProfileDialog extends Dialog {
});
}
static class ClassAliasRow {
String className;
String alias;
}
private void createTransformersGroup(Composite parent) {
Group group = createGroup(parent, "TeaVM bytecode transformers", 2, true);
transformersList = new org.eclipse.swt.widgets.List(group, SWT.SINGLE | SWT.BORDER);
@ -603,31 +581,22 @@ public class TeaVMProfileDialog extends Dialog {
Object[] result = selectionDialog.getResult();
if (result.length > 0) {
IType type = (IType)result[0];
for (int i = 0; i < classAliases.size(); ++i) {
ClassAliasRow row = (ClassAliasRow)classAliases.get(i);
if (row.className.equals(type.getFullyQualifiedName())) {
return;
}
}
ClassAliasRow row = new ClassAliasRow();
row.alias = "_";
row.className = type.getFullyQualifiedName();
classAliases.add(row);
classAliasesTableViewer.add(type.getFullyQualifiedName());
}
}
}
private void removeClass() {
Table table = classAliasesTableViewer.getTable();
if (table.getSelectionCount() != 1) {
if (classAliasesTableViewer.getSelectionCount() != 1) {
return;
}
String className = classAliasesTableViewer.getItem(classAliasesTableViewer.getSelectionIndex());
boolean confirmed = MessageDialog.openConfirm(getShell(), "Removal confirmation",
"Are you sure to delete the " + table.getSelection()[0].getText(0) + " class?");
"Are you sure to delete the " + className + " class?");
if (!confirmed) {
return;
}
classAliases.remove(table.getSelectionIndex());
classAliasesTableViewer.remove(classAliasesTableViewer.getSelectionIndex());
}
@Override
@ -682,11 +651,8 @@ public class TeaVMProfileDialog extends Dialog {
}
updateCacheFieldsEnabled();
transformersList.setItems(profile.getTransformers());
for (Map.Entry<String, String> entry : profile.getClassAliases().entrySet()) {
ClassAliasRow row = new ClassAliasRow();
row.className = entry.getKey();
row.alias = entry.getValue();
classAliases.add(row);
for (String className : profile.getClassesToPreserve()) {
classAliasesTableViewer.add(className);
}
for (Control control : tabFolder.getTabList()) {
if (control instanceof Composite) {
@ -720,12 +686,11 @@ public class TeaVMProfileDialog extends Dialog {
}
profile.setProperties(properties);
profile.setTransformers(transformersList.getItems());
Map<String, String> classAliasMap = new HashMap<>();
for (int i = 0; i < classAliases.size(); ++i) {
ClassAliasRow row = (ClassAliasRow)classAliases.get(i);
classAliasMap.put(row.className, row.alias);
Set<String> classesToPreserve = new HashSet<>();
for (int i = 0; i < classAliasesTableViewer.getItemCount(); ++i) {
classesToPreserve.add(classAliasesTableViewer.getItem(i));
}
profile.setClassAliases(classAliasMap);
profile.setClassesToPreserve(classesToPreserve);
return true;
}
}

View File

@ -25,8 +25,6 @@ import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.teavm.backend.wasm.render.WasmBinaryVersion;
import org.teavm.tooling.ClassAlias;
import org.teavm.tooling.MethodAlias;
import org.teavm.tooling.RuntimeCopyOperation;
import org.teavm.tooling.TeaVMTargetType;
import org.teavm.tooling.TeaVMTool;
@ -52,10 +50,7 @@ public class TeaVMCompileMojo extends AbstractTeaVMMojo {
private String mainClass;
@Parameter
private ClassAlias[] classAliases;
@Parameter
private MethodAlias[] methodAliases;
private String[] classesToPreserve;
@Parameter
private boolean stopOnErrors = true;
@ -94,11 +89,8 @@ public class TeaVMCompileMojo extends AbstractTeaVMMojo {
tool.setTargetFileName(targetFileName);
}
tool.setOptimizationLevel(optimizationLevel);
if (classAliases != null) {
tool.getClassAliases().addAll(Arrays.asList(classAliases));
}
if (methodAliases != null) {
tool.getMethodAliases().addAll(Arrays.asList(methodAliases));
if (classesToPreserve != null) {
tool.getClassesToPreserve().addAll(Arrays.asList(classesToPreserve));
}
tool.setCacheDirectory(cacheDirectory);
tool.setTargetType(targetType);