OpenJDK 11: Merging in java.util.jar.JarEntry

This is part of merging upstream changes from OpenJDK 11.28. This CL
updates java.util.jar.JarEntry.

There is a new API added in java.util.jar.JarEntry:
 * public String getRealName();

A test was added for the new API.

Test: m droid
Test: atest JarEntryTest
Change-Id: I4fbaf331eed02f1be9b19c749b47bad3a5fa20be
diff --git a/api/current.txt b/api/current.txt
index 218dce1..c0b2db2 100755
--- a/api/current.txt
+++ b/api/current.txt
@@ -16106,6 +16106,7 @@
     method public java.util.jar.Attributes getAttributes() throws java.io.IOException;
     method public java.security.cert.Certificate[] getCertificates();
     method public java.security.CodeSigner[] getCodeSigners();
+    method public String getRealName();
     field public static final int CENATT = 36; // 0x24
     field public static final int CENATX = 38; // 0x26
     field public static final int CENCOM = 32; // 0x20
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/jar/JarEntryTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/jar/JarEntryTest.java
index 3f4ed3b..ab2397b 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/jar/JarEntryTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/jar/JarEntryTest.java
@@ -114,6 +114,19 @@
         attrJar.close();
     }
 
+    public void test_getRealName() throws Exception {
+        Support_Resources.copyFile(resources, null, attJarName);
+        File file = new File(resources, attJarName);
+        JarFile attrJar = new JarFile(file);
+
+        jarEntry = attrJar.getJarEntry(attEntryName);
+        assertEquals("HasAttributes.txt", jarEntry.getRealName());
+
+        jarEntry = attrJar.getJarEntry(attEntryName2);
+        assertEquals("NoAttributes.txt", jarEntry.getRealName());
+        attrJar.close();
+    }
+
     // http://b/1864326
     public void testCertificatesAndCodesigners() throws Exception {
         zipEntry = jarFile.getEntry(entryName2);
diff --git a/ojluni/src/main/java/java/util/jar/JarEntry.java b/ojluni/src/main/java/java/util/jar/JarEntry.java
index b0e6841..a483842 100644
--- a/ojluni/src/main/java/java/util/jar/JarEntry.java
+++ b/ojluni/src/main/java/java/util/jar/JarEntry.java
@@ -32,6 +32,8 @@
 
 /**
  * This class is used to represent a JAR file entry.
+ *
+ * @since 1.2
  */
 public
 class JarEntry extends ZipEntry {
@@ -126,4 +128,25 @@
     public CodeSigner[] getCodeSigners() {
         return signers == null ? null : signers.clone();
     }
+
+    /**
+     * Returns the real name of this {@code JarEntry}.
+     *
+     * If this {@code JarEntry} is an entry of a
+     * <a href="JarFile.html#multirelease">multi-release jar file</a> and the
+     * {@code JarFile} is configured to be processed as such, the name returned
+     * by this method is the path name of the versioned entry that the
+     * {@code JarEntry} represents, rather than the path name of the base entry
+     * that {@link #getName()} returns. If the {@code JarEntry} does not represent
+     * a versioned entry of a multi-release {@code JarFile} or the {@code JarFile}
+     * is not configured for processing a multi-release jar file, this method
+     * returns the same name that {@link #getName()} returns.
+     *
+     * @return the real name of the JarEntry
+     *
+     * @since 10
+     */
+    public String getRealName() {
+        return super.getName();
+    }
 }