< prev index next >

src/jdk.jartool/share/classes/sun/tools/jar/Main.java

Print this page

        

*** 60,69 **** --- 60,70 ---- import jdk.internal.misc.JavaLangModuleAccess; import jdk.internal.misc.SharedSecrets; import jdk.internal.module.Checks; import jdk.internal.module.ModuleHashes; import jdk.internal.module.ModuleInfoExtender; + import jdk.internal.module.WarnIfResolvedReason; import jdk.internal.util.jar.JarIndex; import static jdk.internal.util.jar.JarIndex.INDEX_NAME; import static java.util.jar.JarFile.MANIFEST_NAME; import static java.util.stream.Collectors.joining;
*** 223,232 **** --- 224,235 ---- /* Modular jar related options */ boolean printModuleDescriptor; Version moduleVersion; Pattern modulesToHash; ModuleFinder moduleFinder = ModuleFinder.of(); + boolean doNotResolveByDefault; + WarnIfResolvedReason warnIfResolvedReason = WarnIfResolvedReason.NONE; private static final String MODULE_INFO = "module-info.class"; static final String MANIFEST_DIR = "META-INF/"; static final String VERSIONS_DIR = MANIFEST_DIR + "versions/";
*** 2092,2102 **** for (Map.Entry<String,byte[]> e: moduleInfos.entrySet()) { ModuleDescriptor vd = ModuleDescriptor.read(ByteBuffer.wrap(e.getValue())); if (!(isValidVersionedDescriptor(vd, rd))) return false; ! e.setValue(extendedInfoBytes(rd, vd, e.getValue(), packages)); } return true; } private Set<String> findConcealedPackages(ModuleDescriptor md) { --- 2095,2110 ---- for (Map.Entry<String,byte[]> e: moduleInfos.entrySet()) { ModuleDescriptor vd = ModuleDescriptor.read(ByteBuffer.wrap(e.getValue())); if (!(isValidVersionedDescriptor(vd, rd))) return false; ! e.setValue(extendedInfoBytes(rd, ! vd, ! e.getValue(), ! packages, ! doNotResolveByDefault, ! warnIfResolvedReason)); } return true; } private Set<String> findConcealedPackages(ModuleDescriptor md) {
*** 2177,2187 **** * module-info here. */ private byte[] extendedInfoBytes(ModuleDescriptor rootDescriptor, ModuleDescriptor md, byte[] miBytes, ! Set<String> packages) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream is = new ByteArrayInputStream(miBytes); ModuleInfoExtender extender = ModuleInfoExtender.newExtender(is); --- 2185,2197 ---- * module-info here. */ private byte[] extendedInfoBytes(ModuleDescriptor rootDescriptor, ModuleDescriptor md, byte[] miBytes, ! Set<String> packages, ! boolean doNotResolveByDefault, ! WarnIfResolvedReason warnReason) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream is = new ByteArrayInputStream(miBytes); ModuleInfoExtender extender = ModuleInfoExtender.newExtender(is);
*** 2212,2221 **** --- 2222,2234 ---- // should it issue warning or silent? System.out.println("warning: no module is recorded in hash in " + mn); } } + if (doNotResolveByDefault || warnReason != WarnIfResolvedReason.NONE) + extender.moduleResolution(doNotResolveByDefault, warnReason); + extender.write(baos); return baos.toByteArray(); } /**
< prev index next >