Clarification on javap's -bootclasspath Behavior in JDK 24
Babneet Singh
sbabneet at ca.ibm.com
Mon Feb 24 18:08:57 UTC 2025
One or more of the following files ( object_i.txt ) violates IBM policy and all attachment(s) have been removed from the message.
**********************************************************************
Hi,
I would like to inquire about changes to javap's -bootclasspath option in JDK 24. In previous versions, -bootclasspath allowed overriding classes in the java.base module. However, I have observed different behavior in JDK 24 when using javap -bootclasspath.
I have attached object_i.jar (as object_i.txt; it should be renamed before use), which contains a modified version of the java.lang.Object class with an injected field: private int i. In JDK 23, using -bootclasspath successfully overrides the default java.lang.Object class with this modified version. However, in JDK 24, the override does not occur. The observed behaviour across JDK23 and JDK24 is shown below.
Is this new behavior intentional (part of a new feature), or is it a bug? I couldn't find a mailing list specifically for javap. If this is not the appropriate mailing list for this inquiry, I would appreciate guidance on where to direct my question.
Regards,
Babneet
Observed Behavior:
==== JDK 23 and Prior Versions ====
# jdk23/Contents/Home/bin/javap -p -bootclasspath object_i.jar java/lang/Object
Compiled from "Object.java"
public class java.lang.Object { // Injected field shows up
private int i;
public java.lang.Object();
protected java.lang.Object clone() throws java.lang.CloneNotSupportedException;
public boolean equals(java.lang.Object);
protected void finalize() throws java.lang.Throwable;
public final native java.lang.Class<? extends java.lang.Object> getClass();
public int hashCode();
public final native void notify();
public final native void notifyAll();
public java.lang.String toString();
public final void wait() throws java.lang.InterruptedException;
public final void wait(long) throws java.lang.InterruptedException;
public final void wait(long, int) throws java.lang.InterruptedException;
private final native void waitImpl(long, int) throws java.lang.InterruptedException;
private java.lang.Object newInstancePrototype(java.lang.Class);
}
==== JDK 24 ====
# jdk24/Contents/Home/bin/javap -p -bootclasspath object_i.jar java/lang/Object
Compiled from "Object.java"
public class java.lang.Object { // Injected field doesn't show up
public java.lang.Object();
public final native java.lang.Class<?> getClass();
public native int hashCode();
public boolean equals(java.lang.Object);
protected native java.lang.Object clone() throws java.lang.CloneNotSupportedException;
public java.lang.String toString();
public final native void notify();
public final native void notifyAll();
public final void wait() throws java.lang.InterruptedException;
public final void wait(long) throws java.lang.InterruptedException;
private final native void wait0(long) throws java.lang.InterruptedException;
public final void wait(long, int) throws java.lang.InterruptedException;
protected void finalize() throws java.lang.Throwable;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jdk-dev/attachments/20250224/007573c2/attachment.htm>
More information about the jdk-dev
mailing list