RFR: 8277983: Remove unused fields from s.n.w.p.j.JarURLConnection
Сергей Цыпанов
duke at openjdk.java.net
Wed Dec 1 18:44:43 UTC 2021
There are some fields that are unused in current implementation of `JarURLConnection`:
- debug
- jarFileURL
- permission
- jarFileURLConnection (inherited one can be used)
They can be safely removed reducing object footprint. Before:
sun.net.www.protocol.jar.JarURLConnection object internals:
OFFSET SIZE TYPE DESCRIPTION VALUE
0 12 (object header) N/A
12 4 int URLConnection.connectTimeout N/A
16 8 long URLConnection.ifModifiedSince N/A
24 4 int URLConnection.readTimeout N/A
28 1 boolean URLConnection.doInput N/A
29 1 boolean URLConnection.doOutput N/A
30 1 boolean URLConnection.allowUserInteraction N/A
31 1 boolean URLConnection.useCaches N/A
32 1 boolean URLConnection.connected N/A
33 3 (alignment/padding gap)
36 4 java.net.URL URLConnection.url N/A
40 4 sun.net.www.MessageHeader URLConnection.requests N/A
44 4 java.net.URL JarURLConnection.jarFileURL N/A
48 4 java.lang.String JarURLConnection.entryName N/A
52 4 java.net.URLConnection JarURLConnection.jarFileURLConnection N/A
56 4 java.net.URL JarURLConnection.jarFileURL N/A
60 4 java.security.Permission JarURLConnection.permission N/A
64 4 java.net.URLConnection JarURLConnection.jarFileURLConnection N/A
68 4 java.lang.String JarURLConnection.entryName N/A
72 4 java.util.jar.JarEntry JarURLConnection.jarEntry N/A
76 4 java.util.jar.JarFile JarURLConnection.jarFile N/A
80 4 java.lang.String JarURLConnection.contentType N/A
84 4 (loss due to the next object alignment)
Instance size: 88 bytes
Space losses: 3 bytes internal + 4 bytes external = 7 bytes total
After:
sun.net.www.protocol.jar.JarURLConnection object internals:
OFFSET SIZE TYPE DESCRIPTION VALUE
0 12 (object header) N/A
12 4 int URLConnection.connectTimeout N/A
16 8 long URLConnection.ifModifiedSince N/A
24 4 int URLConnection.readTimeout N/A
28 1 boolean URLConnection.doInput N/A
29 1 boolean URLConnection.doOutput N/A
30 1 boolean URLConnection.allowUserInteraction N/A
31 1 boolean URLConnection.useCaches N/A
32 1 boolean URLConnection.connected N/A
33 3 (alignment/padding gap)
36 4 java.net.URL URLConnection.url N/A
40 4 sun.net.www.MessageHeader URLConnection.requests N/A
44 4 java.net.URL JarURLConnection.jarFileURL N/A
48 4 java.lang.String JarURLConnection.entryName N/A
52 4 java.net.URLConnection JarURLConnection.jarFileURLConnection N/A
56 4 java.util.jar.JarEntry JarURLConnection.jarEntry N/A
60 4 java.util.jar.JarFile JarURLConnection.jarFile N/A
64 4 java.lang.String JarURLConnection.contentType N/A
68 4 (loss due to the next object alignment)
Instance size: 72 bytes
Space losses: 3 bytes internal + 4 bytes external = 7 bytes total
-------------
Commit messages:
- Remove entryName
- 8277983: Remove unused fields from s.n.w.p.j.JarURLConnection
Changes: https://git.openjdk.java.net/jdk/pull/6649/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6649&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8277983
Stats: 35 lines in 1 file changed: 4 ins; 24 del; 7 mod
Patch: https://git.openjdk.java.net/jdk/pull/6649.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/6649/head:pull/6649
PR: https://git.openjdk.java.net/jdk/pull/6649
More information about the net-dev
mailing list