diff --git a/make/autoconf/spec.gmk.in b/make/autoconf/spec.gmk.in index ac590a32bce..afea6cb3051 100644 --- a/make/autoconf/spec.gmk.in +++ b/make/autoconf/spec.gmk.in @@ -565,12 +565,10 @@ BUILD_JAVA_FLAGS := @BOOTCYCLE_JVM_ARGS_BIG@ BUILD_JAVA=@FIXPATH@ $(BUILD_JDK)/bin/java $(BUILD_JAVA_FLAGS) # Interim langtools and rmic modules and arguments -INTERIM_LANGTOOLS_BASE_MODULES := java.compiler jdk.compiler jdk.jdeps jdk.javadoc +INTERIM_LANGTOOLS_BASE_MODULES := java.compiler jdk.compiler jdk.javadoc INTERIM_LANGTOOLS_MODULES := $(addsuffix .interim, $(INTERIM_LANGTOOLS_BASE_MODULES)) INTERIM_LANGTOOLS_ADD_EXPORTS := \ --add-exports java.base/sun.reflect.annotation=jdk.compiler.interim \ - --add-exports java.base/jdk.internal.util.jar=jdk.jdeps.interim \ - --add-exports java.base/jdk.internal.misc=jdk.jdeps.interim \ # INTERIM_LANGTOOLS_MODULES_COMMA := $(strip $(subst $(SPACE),$(COMMA),$(strip \ $(INTERIM_LANGTOOLS_MODULES)))) diff --git a/make/gendata/Gendata-jdk.compiler.gmk b/make/gendata/Gendata-jdk.compiler.gmk index c648867c648..7a7f5c6647e 100644 --- a/make/gendata/Gendata-jdk.compiler.gmk +++ b/make/gendata/Gendata-jdk.compiler.gmk @@ -49,13 +49,13 @@ COMPILECREATESYMBOLS_ADD_EXPORTS := \ --add-exports jdk.compiler.interim/com.sun.tools.javac.code=ALL-UNNAMED \ --add-exports jdk.compiler.interim/com.sun.tools.javac.util=ALL-UNNAMED \ --add-exports jdk.compiler.interim/com.sun.tools.javac.jvm=ALL-UNNAMED \ - --add-exports jdk.jdeps.interim/com.sun.tools.classfile=ALL-UNNAMED \ # $(eval $(call SetupJavaCompilation, COMPILE_CREATE_SYMBOLS, \ SETUP := GENERATE_OLDBYTECODE, \ - SRC := $(TOPDIR)/make/langtools/src/classes, \ - INCLUDES := build/tools/symbolgenerator, \ + SRC := $(TOPDIR)/make/langtools/src/classes \ + $(TOPDIR)/src/jdk.jdeps/share/classes, \ + INCLUDES := build/tools/symbolgenerator com/sun/tools/classfile, \ BIN := $(BUILDTOOLS_OUTPUTDIR)/create_symbols, \ ADD_JAVAC_FLAGS := $(INTERIM_LANGTOOLS_ARGS) \ $(COMPILECREATESYMBOLS_ADD_EXPORTS), \ diff --git a/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java b/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java index a8c5cf73aea..0844b9171d1 100644 --- a/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java +++ b/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java @@ -60,8 +60,4 @@ class JavaUtilJarAccessImpl implements JavaUtilJarAccess { public List getManifestDigests(JarFile jar) { return jar.getManifestDigests(); } - - public String getRealName(JarFile jar, JarEntry entry) { - return jar.getRealName(entry); - } } diff --git a/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java b/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java index f1f7d8be2c0..bf59351dee6 100644 --- a/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java +++ b/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java @@ -41,5 +41,4 @@ public interface JavaUtilJarAccess { public Enumeration entries2(JarFile jar); public void setEagerValidation(JarFile jar, boolean eager); public List getManifestDigests(JarFile jar); - public String getRealName(JarFile jar, JarEntry entry); } diff --git a/src/java.base/share/classes/module-info.java b/src/java.base/share/classes/module-info.java index cc90ac9b5d6..ac0cd9995bc 100644 --- a/src/java.base/share/classes/module-info.java +++ b/src/java.base/share/classes/module-info.java @@ -210,8 +210,7 @@ module java.base { jdk.internal.vm.ci, jdk.incubator.httpclient; exports jdk.internal.util.jar to - jdk.jartool, - jdk.jdeps; + jdk.jartool; exports sun.net to jdk.incubator.httpclient; exports sun.net.ext to diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java index 990976dca91..9483247b227 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java @@ -30,8 +30,6 @@ import com.sun.tools.classfile.ClassFile; import com.sun.tools.classfile.ConstantPoolException; import com.sun.tools.classfile.Dependencies.ClassFileError; -import jdk.internal.util.jar.VersionedStream; - import java.io.Closeable; import java.io.File; import java.io.FileNotFoundException; @@ -336,7 +334,7 @@ public class ClassFileReader implements Closeable { protected Set scan() { try (JarFile jf = openJarFile(path.toFile(), version)) { - return VersionedStream.stream(jf).map(JarEntry::getName) + return jf.versionedStream().map(JarEntry::getName) .filter(n -> n.endsWith(".class")) .collect(Collectors.toSet()); } catch (IOException e) { @@ -383,24 +381,9 @@ public class ClassFileReader implements Closeable { } } - Enumeration versionedEntries(JarFile jf) { - Iterator it = VersionedStream.stream(jf).iterator(); - return new Enumeration<>() { - @Override - public boolean hasMoreElements() { - return it.hasNext(); - } - - @Override - public JarEntry nextElement() { - return it.next(); - } - }; - } - class JarFileIterator implements Iterator { protected final JarFileReader reader; - protected Enumeration entries; + protected Iterator entries; protected JarFile jf; protected JarEntry nextEntry; protected ClassFile cf; @@ -416,7 +399,7 @@ public class ClassFileReader implements Closeable { if (jarfile == null) return; this.jf = jarfile; - this.entries = versionedEntries(jf); + this.entries = jarfile.versionedStream().iterator(); this.nextEntry = nextEntry(); } @@ -450,8 +433,8 @@ public class ClassFileReader implements Closeable { } protected JarEntry nextEntry() { - while (entries.hasMoreElements()) { - JarEntry e = entries.nextElement(); + while (entries.hasNext()) { + JarEntry e = entries.next(); String name = e.getName(); if (name.endsWith(".class")) { return e; diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/VersionHelper.java b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/VersionHelper.java index b94d87c1397..9ff358a63d3 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/VersionHelper.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/VersionHelper.java @@ -27,7 +27,6 @@ package com.sun.tools.jdeps; import com.sun.tools.classfile.ClassFile; import com.sun.tools.classfile.ConstantPoolException; -import jdk.internal.misc.SharedSecrets; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -48,7 +47,7 @@ public class VersionHelper { public static void add(JarFile jarfile, JarEntry e, ClassFile cf) throws ConstantPoolException { - String realName = SharedSecrets.javaUtilJarAccess().getRealName(jarfile, e); + String realName = e.getRealName(); if (realName.startsWith(META_INF_VERSIONS)) { int len = META_INF_VERSIONS.length(); int n = realName.indexOf('/', len);