8243117: Cleanups in Java code of module jdk.jlink
Reviewed-by: redestad, alanb
This commit is contained in:
parent
7553c132d3
commit
a7830958e3
src/jdk.jlink/share/classes/jdk/tools
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -162,7 +162,6 @@ class JImageTask {
|
||||
private static final int EXIT_OK = 0; // No errors.
|
||||
private static final int EXIT_ERROR = 1; // Completed but reported errors.
|
||||
private static final int EXIT_CMDERR = 2; // Bad command-line arguments and/or switches.
|
||||
private static final int EXIT_SYSERR = 3; // System error or resource exhaustion.
|
||||
private static final int EXIT_ABNORMAL = 4; // Terminated abnormally.
|
||||
|
||||
int run(String[] args) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,15 +29,11 @@ import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.io.Writer;
|
||||
import java.lang.module.ModuleDescriptor;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.FileAlreadyExistsException;
|
||||
@ -55,16 +51,19 @@ import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import static java.util.stream.Collectors.*;
|
||||
|
||||
import jdk.tools.jlink.internal.BasicImageWriter;
|
||||
import jdk.tools.jlink.internal.ExecutableImage;
|
||||
import jdk.tools.jlink.internal.Platform;
|
||||
import jdk.tools.jlink.plugin.PluginException;
|
||||
import jdk.tools.jlink.plugin.ResourcePool;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolEntry;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolEntry.Type;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolModule;
|
||||
import jdk.tools.jlink.plugin.PluginException;
|
||||
|
||||
import static java.util.stream.Collectors.groupingBy;
|
||||
import static java.util.stream.Collectors.mapping;
|
||||
import static java.util.stream.Collectors.toSet;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -441,13 +440,6 @@ public final class DefaultImageBuilder implements ImageBuilder {
|
||||
Files.copy(in, dstFile);
|
||||
}
|
||||
|
||||
private void writeSymEntry(Path dstFile, Path target) throws IOException {
|
||||
Objects.requireNonNull(dstFile);
|
||||
Objects.requireNonNull(target);
|
||||
Files.createDirectories(Objects.requireNonNull(dstFile.getParent()));
|
||||
Files.createLink(dstFile, target);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a symbolic link to the given target if the target platform
|
||||
* supports symbolic link; otherwise, it will create a tiny file
|
||||
@ -515,13 +507,6 @@ public final class DefaultImageBuilder implements ImageBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
private static void createUtf8File(File file, String content) throws IOException {
|
||||
try (OutputStream fout = new FileOutputStream(file);
|
||||
Writer output = new OutputStreamWriter(fout, "UTF-8")) {
|
||||
output.write(content);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExecutableImage getExecutableImage() {
|
||||
return new DefaultExecutableImage(root, modules);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -36,8 +36,6 @@ import jdk.internal.jimage.ImageStringsReader;
|
||||
public final class BasicImageWriter {
|
||||
public static final String MODULES_IMAGE_NAME = "modules";
|
||||
|
||||
private final static int RETRY_LIMIT = 1000;
|
||||
|
||||
private ByteOrder byteOrder;
|
||||
private ImageStringsWriter strings;
|
||||
private int length;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -75,8 +75,6 @@ public class DirArchive implements Archive {
|
||||
}
|
||||
}
|
||||
|
||||
private static final String MODULE_INFO = "module-info.class";
|
||||
|
||||
private final Path dirPath;
|
||||
private final String moduleName;
|
||||
private final List<InputStream> open = new ArrayList<>();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,17 +25,16 @@
|
||||
package jdk.tools.jlink.internal;
|
||||
|
||||
import java.io.DataOutputStream;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import jdk.tools.jlink.builder.ImageBuilder;
|
||||
import jdk.tools.jlink.plugin.Plugin;
|
||||
import jdk.tools.jlink.plugin.PluginException;
|
||||
import jdk.tools.jlink.plugin.Plugin.Category;
|
||||
import jdk.tools.jlink.plugin.PluginException;
|
||||
import jdk.tools.jlink.plugin.ResourcePool;
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -28,30 +28,19 @@ import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.module.ModuleDescriptor;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import jdk.internal.jimage.decompressor.Decompressor;
|
||||
import jdk.internal.module.ModuleInfo.Attributes;
|
||||
import jdk.internal.module.ModuleTarget;
|
||||
import jdk.tools.jlink.plugin.Plugin;
|
||||
import jdk.tools.jlink.builder.ImageBuilder;
|
||||
import jdk.tools.jlink.plugin.Plugin;
|
||||
import jdk.tools.jlink.plugin.PluginException;
|
||||
import jdk.tools.jlink.plugin.ResourcePool;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolModule;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolEntry;
|
||||
import jdk.tools.jlink.internal.ResourcePoolManager.ResourcePoolImpl;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolModule;
|
||||
|
||||
/**
|
||||
* Plugins Stack. Plugins entry point to apply transformations onto resources
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,9 +27,7 @@ package jdk.tools.jlink.internal;
|
||||
import java.lang.module.Configuration;
|
||||
import java.lang.module.ModuleFinder;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -37,10 +35,9 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.internal.module.ModulePath;
|
||||
import jdk.tools.jlink.builder.ImageBuilder;
|
||||
import jdk.tools.jlink.plugin.Plugin;
|
||||
import jdk.tools.jlink.plugin.PluginException;
|
||||
import jdk.tools.jlink.builder.ImageBuilder;
|
||||
|
||||
/**
|
||||
* API to call jlink.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -92,7 +92,6 @@ public class JlinkTask {
|
||||
// So, clear previous values, if any.
|
||||
task.options.modulePath.clear();
|
||||
String[] dirs = arg.split(File.pathSeparator);
|
||||
int i = 0;
|
||||
Arrays.stream(dirs)
|
||||
.map(Paths::get)
|
||||
.forEach(task.options.modulePath::add);
|
||||
@ -734,36 +733,6 @@ public class JlinkTask {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static String getBomHeader() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("#").append(new Date()).append("\n");
|
||||
sb.append("#Please DO NOT Modify this file").append("\n");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private String genBOMContent() throws IOException {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getBomHeader());
|
||||
StringBuilder command = new StringBuilder();
|
||||
for (String c : optionsHelper.getInputCommand()) {
|
||||
command.append(c).append(" ");
|
||||
}
|
||||
sb.append("command").append(" = ").append(command);
|
||||
sb.append("\n");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static String genBOMContent(JlinkConfiguration config,
|
||||
PluginsConfiguration plugins)
|
||||
throws IOException {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getBomHeader());
|
||||
sb.append(config);
|
||||
sb.append(plugins);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static class ImageHelper implements ImageProvider {
|
||||
final ByteOrder order;
|
||||
final Path packagedModulesPath;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -55,10 +55,12 @@ public class Main {
|
||||
}
|
||||
|
||||
public static class JlinkToolProvider implements ToolProvider {
|
||||
@Override
|
||||
public String name() {
|
||||
return "jlink";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int run(PrintWriter out, PrintWriter err, String... args) {
|
||||
return Main.run(out, err, args);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,7 +37,6 @@ import jdk.tools.jlink.internal.Archive.Entry.EntryType;
|
||||
public class ModularJarArchive extends JarArchive {
|
||||
|
||||
private static final String JAR_EXT = ".jar";
|
||||
private static final String MODULE_INFO = "module-info.class";
|
||||
|
||||
public ModularJarArchive(String mn, Path jmod, Runtime.Version version) {
|
||||
super(mn, jmod, version);
|
||||
|
@ -114,7 +114,6 @@ public final class PluginRepository {
|
||||
ModuleLayer pluginsLayer) {
|
||||
Objects.requireNonNull(name);
|
||||
Objects.requireNonNull(pluginsLayer);
|
||||
@SuppressWarnings("unchecked")
|
||||
T provider = null;
|
||||
List<T> javaProviders = getPlugins(clazz, pluginsLayer);
|
||||
for(T factory : javaProviders) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -30,18 +30,13 @@ import java.lang.module.ModuleDescriptor;
|
||||
import java.lang.module.ModuleFinder;
|
||||
import java.lang.module.ModuleReader;
|
||||
import java.lang.module.ModuleReference;
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import jdk.tools.jlink.plugin.PluginException;
|
||||
|
||||
import jdk.tools.jlink.plugin.ResourcePool;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolEntry;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolModule;
|
||||
|
||||
final class ResourcePoolConfiguration {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -65,8 +65,6 @@ public final class TaskHelper {
|
||||
public static final String JLINK_BUNDLE = "jdk.tools.jlink.resources.jlink";
|
||||
public static final String JIMAGE_BUNDLE = "jdk.tools.jimage.resources.jimage";
|
||||
|
||||
private static final String DEFAULTS_PROPERTY = "jdk.jlink.defaults";
|
||||
|
||||
public final class BadArgs extends Exception {
|
||||
|
||||
static final long serialVersionUID = 8765093759964640721L;
|
||||
@ -206,16 +204,17 @@ public final class TaskHelper {
|
||||
}
|
||||
|
||||
private static class PluginOption extends Option<PluginsHelper> {
|
||||
public PluginOption(boolean hasArg,
|
||||
Processing<PluginsHelper> processing, boolean hidden, String name, String shortname) {
|
||||
public PluginOption(boolean hasArg, Processing<PluginsHelper> processing,
|
||||
boolean hidden, String name, String shortname) {
|
||||
super(hasArg, processing, hidden, name, shortname, false);
|
||||
}
|
||||
|
||||
public PluginOption(boolean hasArg,
|
||||
Processing<PluginsHelper> processing, boolean hidden, String name) {
|
||||
public PluginOption(boolean hasArg, Processing<PluginsHelper> processing,
|
||||
boolean hidden, String name) {
|
||||
super(hasArg, processing, hidden, name, "", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resourcePrefix() {
|
||||
return "plugin.opt.";
|
||||
}
|
||||
@ -510,26 +509,10 @@ public final class TaskHelper {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
private boolean hasArgument(String optionName) throws BadArgs {
|
||||
Option<?> opt = getOption(optionName);
|
||||
if (opt == null) {
|
||||
opt = pluginOptions.getOption(optionName);
|
||||
if (opt == null) {
|
||||
throw new BadArgs("err.unknown.option", optionName).
|
||||
showUsage(true);
|
||||
}
|
||||
}
|
||||
return opt.hasArg;
|
||||
}
|
||||
|
||||
public boolean shouldListPlugins() {
|
||||
return pluginOptions.listPlugins;
|
||||
}
|
||||
|
||||
private String getPluginsPath(String[] args) throws BadArgs {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles all options. This method stops processing the argument
|
||||
* at the first non-option argument i.e. not starts with `-`, or
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,8 +34,8 @@ import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import jdk.tools.jlink.plugin.Plugin;
|
||||
import jdk.tools.jlink.plugin.Plugin.Category;
|
||||
|
||||
public class Utils {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,13 +25,6 @@
|
||||
|
||||
package jdk.tools.jlink.internal.plugins;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.*;
|
||||
import java.util.*;
|
||||
import java.util.function.*;
|
||||
import java.util.stream.*;
|
||||
import jdk.tools.jlink.plugin.*;
|
||||
|
||||
/**
|
||||
* Plugin to add VM command-line options, by storing them in a resource
|
||||
* that's read by the VM at startup
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,12 +25,14 @@
|
||||
|
||||
package jdk.tools.jlink.internal.plugins;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.*;
|
||||
import java.util.*;
|
||||
import java.util.function.*;
|
||||
import java.util.stream.*;
|
||||
import jdk.tools.jlink.plugin.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
import jdk.tools.jlink.plugin.Plugin;
|
||||
import jdk.tools.jlink.plugin.ResourcePool;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolBuilder;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolEntry;
|
||||
|
||||
/**
|
||||
* Base plugin to add a resource
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,7 +29,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.tools.jlink.plugin.Plugin;
|
||||
import jdk.tools.jlink.plugin.PluginException;
|
||||
import jdk.tools.jlink.plugin.ResourcePool;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolBuilder;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolEntry.Type;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -38,11 +38,11 @@ import java.util.stream.Collectors;
|
||||
|
||||
import jdk.tools.jlink.internal.Platform;
|
||||
import jdk.tools.jlink.plugin.Plugin;
|
||||
import jdk.tools.jlink.plugin.PluginException;
|
||||
import jdk.tools.jlink.plugin.ResourcePool;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolBuilder;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolModule;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolEntry;
|
||||
import jdk.tools.jlink.plugin.PluginException;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolModule;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -103,7 +103,6 @@ public final class ExcludeVMPlugin implements Plugin {
|
||||
*/
|
||||
private List<ResourcePoolEntry> getVMs(ResourcePoolModule javaBase, String[] jvmlibs) {
|
||||
List<ResourcePoolEntry> ret = javaBase.entries().filter((t) -> {
|
||||
String path = t.path();
|
||||
for (String jvmlib : jvmlibs) {
|
||||
if (t.path().endsWith("/" + jvmlib)) {
|
||||
return true;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,13 +37,14 @@ import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
import java.util.stream.Stream;
|
||||
import jdk.internal.access.SharedSecrets;
|
||||
|
||||
import jdk.internal.access.JavaLangInvokeAccess;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolEntry;
|
||||
import jdk.internal.access.SharedSecrets;
|
||||
import jdk.tools.jlink.plugin.Plugin;
|
||||
import jdk.tools.jlink.plugin.PluginException;
|
||||
import jdk.tools.jlink.plugin.ResourcePool;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolBuilder;
|
||||
import jdk.tools.jlink.plugin.Plugin;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolEntry;
|
||||
|
||||
/**
|
||||
* Plugin to generate java.lang.invoke classes.
|
||||
@ -289,7 +290,6 @@ public final class GenerateJLIClassesPlugin implements Plugin {
|
||||
return out.build();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void generateBMHClass(String types, ResourcePoolBuilder out) {
|
||||
try {
|
||||
// Generate class
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -283,7 +283,6 @@ public final class IncludeLocalesPlugin implements Plugin, ResourcePrevisitor {
|
||||
}
|
||||
|
||||
private boolean stripUnsupportedLocales(byte[] bytes, ClassReader cr) {
|
||||
char[] buf = new char[cr.getMaxStringLength()];
|
||||
boolean[] modified = new boolean[1];
|
||||
|
||||
IntStream.range(1, cr.getItemCount())
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -35,12 +35,12 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.ToIntFunction;
|
||||
import jdk.tools.jlink.plugin.PluginException;
|
||||
|
||||
import jdk.tools.jlink.internal.Utils;
|
||||
import jdk.tools.jlink.plugin.Plugin;
|
||||
import jdk.tools.jlink.plugin.ResourcePool;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolBuilder;
|
||||
import jdk.tools.jlink.plugin.ResourcePoolEntry;
|
||||
import jdk.tools.jlink.plugin.Plugin;
|
||||
import jdk.tools.jlink.internal.Utils;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -442,6 +442,7 @@ public final class SystemModulesPlugin implements Plugin {
|
||||
int flags,
|
||||
String version) {
|
||||
return new ModuleVisitor(Opcodes.ASM7) {
|
||||
@Override
|
||||
public void visitPackage(String pn) {
|
||||
packages.add(pn);
|
||||
}
|
||||
@ -1708,6 +1709,7 @@ public final class SystemModulesPlugin implements Plugin {
|
||||
/**
|
||||
* Loads an Enum field.
|
||||
*/
|
||||
@Override
|
||||
void visitElement(T t, MethodVisitor mv) {
|
||||
mv.visitFieldInsn(GETSTATIC, className, t.toString(),
|
||||
"L" + className + ";");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -24,10 +24,10 @@
|
||||
*/
|
||||
package jdk.tools.jlink.plugin;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.tools.jlink.internal.plugins.PluginsResourceBundle;
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,7 +25,6 @@
|
||||
package jdk.tools.jlink.plugin;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -24,12 +24,6 @@
|
||||
*/
|
||||
package jdk.tools.jlink.plugin;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Resource pool builder to build a resource pool by incrementally
|
||||
* adding a set of resources one at a time.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -28,7 +28,6 @@ import java.lang.module.ModuleDescriptor;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
import jdk.internal.module.ModuleTarget;
|
||||
|
||||
/**
|
||||
* Link-time representation of a module.
|
||||
|
@ -35,53 +35,30 @@ import java.io.PrintWriter;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.lang.module.Configuration;
|
||||
import java.lang.module.FindException;
|
||||
import java.lang.module.ModuleReader;
|
||||
import java.lang.module.ModuleReference;
|
||||
import java.lang.module.ModuleFinder;
|
||||
import java.lang.module.ModuleDescriptor;
|
||||
import java.lang.module.ModuleDescriptor.Exports;
|
||||
import java.lang.module.ModuleDescriptor.Opens;
|
||||
import java.lang.module.ModuleDescriptor.Provides;
|
||||
import java.lang.module.ModuleDescriptor.Requires;
|
||||
import java.lang.module.ModuleDescriptor.Version;
|
||||
import java.lang.module.ModuleFinder;
|
||||
import java.lang.module.ModuleReader;
|
||||
import java.lang.module.ModuleReference;
|
||||
import java.lang.module.ResolutionException;
|
||||
import java.lang.module.ResolvedModule;
|
||||
import java.net.URI;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.FileVisitOption;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.InvalidPathException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.PathMatcher;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.nio.file.*;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.Optional;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.JarOutputStream;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipException;
|
||||
import java.util.zip.ZipFile;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -50,10 +50,12 @@ public class Main {
|
||||
}
|
||||
|
||||
public static class JmodToolProvider implements ToolProvider {
|
||||
@Override
|
||||
public String name() {
|
||||
return "jmod";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int run(PrintWriter out, PrintWriter err, String... args) {
|
||||
return Main.run(out, err, args);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user