From 275cf9d0764577a446e405912cc311475913e1c7 Mon Sep 17 00:00:00 2001 From: Aditya Singh <123162244+adysinghh@users.noreply.github.com> Date: Mon, 8 Jan 2024 18:28:06 +0000 Subject: [PATCH 1/5] fixing issue Orphan NativePeer method with Java 11.0.20.1 #421 --- .../gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java b/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java index 65437f11..2a3e03eb 100644 --- a/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java +++ b/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java @@ -26,8 +26,10 @@ import gov.nasa.jpf.vm.NativePeer; import gov.nasa.jpf.vm.SystemState; import gov.nasa.jpf.vm.ThreadInfo; +import junit.Test; import static gov.nasa.jpf.vm.JPF_java_lang_Class.FIELD_CLASSNAME; +import static org.junit.Assert.assertTrue; /** * we don't want this class! This is a hodgepodge of stuff that shouldn't be in Java, but @@ -43,10 +45,10 @@ public class JPF_jdk_internal_misc_Unsafe extends NativePeer { @MJI - public int getUnsafe____Lsun_misc_Unsafe_2 (MJIEnv env, int clsRef) { + public int getUnsafe____Ljdk_internal_misc_Unsafe_2 (MJIEnv env, int clsRef) { int objRef = env.getStaticReferenceField("jdk.internal.misc.Unsafe", "theUnsafe"); return objRef; - } + } @MJI public long objectFieldOffset__Ljava_lang_reflect_Field_2__J (MJIEnv env, int unsafeRef, int fieldRef) { @@ -60,7 +62,7 @@ public void registerNatives____V(MJIEnv env, int clsObjRef) {} public int addressSize0____I (MJIEnv env, int objRef) { return 0; } - + @MJI public boolean isBigEndian0____Z (MJIEnv env, int objRef) { return true; From 154492d822ad92cf2e378d60a6629d36df87cc5a Mon Sep 17 00:00:00 2001 From: Aditya Singh <123162244+adysinghh@users.noreply.github.com> Date: Fri, 12 Jan 2024 15:12:41 +0000 Subject: [PATCH 2/5] reviewing the pull request --- .../jpf/vm/JPF_jdk_internal_misc_Unsafe.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java b/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java index 2a3e03eb..894a7e91 100644 --- a/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java +++ b/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java @@ -26,10 +26,9 @@ import gov.nasa.jpf.vm.NativePeer; import gov.nasa.jpf.vm.SystemState; import gov.nasa.jpf.vm.ThreadInfo; -import junit.Test; + import static gov.nasa.jpf.vm.JPF_java_lang_Class.FIELD_CLASSNAME; -import static org.junit.Assert.assertTrue; /** * we don't want this class! This is a hodgepodge of stuff that shouldn't be in Java, but @@ -45,22 +44,19 @@ public class JPF_jdk_internal_misc_Unsafe extends NativePeer { @MJI - public int getUnsafe____Ljdk_internal_misc_Unsafe_2 (MJIEnv env, int clsRef) { + public int getUnsafe____Ljdk_internal_misc_Unsafe_2(MJIEnv env, int clsRef) { int objRef = env.getStaticReferenceField("jdk.internal.misc.Unsafe", "theUnsafe"); - return objRef; - } + return objRef; +} @MJI - public long objectFieldOffset__Ljava_lang_reflect_Field_2__J (MJIEnv env, int unsafeRef, int fieldRef) { + public long objectFieldOffset__Ljava_lang_reflect_Field_2__J(MJIEnv env, int unsafeRef, int fieldRef) { return fieldOffset__Ljava_lang_reflect_Field_2__I(env, unsafeRef, fieldRef); } @MJI - public void registerNatives____V(MJIEnv env, int clsObjRef) {} - - @MJI - public int addressSize0____I (MJIEnv env, int objRef) { - return 0; + public void registerNatives____V(MJIEnv env, int clsObjRef) { + // No changes here as suggested by the maintainers } @MJI From 9d3680553adf2a1193f60bf893f6b813c8e3afb5 Mon Sep 17 00:00:00 2001 From: Aditya Singh <123162244+adysinghh@users.noreply.github.com> Date: Fri, 12 Jan 2024 15:13:54 +0000 Subject: [PATCH 3/5] reviewing -2 --- src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java b/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java index 894a7e91..70bd5098 100644 --- a/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java +++ b/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java @@ -56,7 +56,7 @@ public long objectFieldOffset__Ljava_lang_reflect_Field_2__J(MJIEnv env, int uns @MJI public void registerNatives____V(MJIEnv env, int clsObjRef) { - // No changes here as suggested by the maintainers + // No changes here as suggested } @MJI From f2a87a0aa3a52cf57897e62aae241dfcaad1fa17 Mon Sep 17 00:00:00 2001 From: Aditya Singh <123162244+adysinghh@users.noreply.github.com> Date: Sun, 14 Jan 2024 18:27:27 +0000 Subject: [PATCH 4/5] reviewing the pull request -2 --- .../nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java b/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java index 70bd5098..a74296bc 100644 --- a/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java +++ b/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java @@ -46,18 +46,21 @@ public class JPF_jdk_internal_misc_Unsafe extends NativePeer { @MJI public int getUnsafe____Ljdk_internal_misc_Unsafe_2(MJIEnv env, int clsRef) { int objRef = env.getStaticReferenceField("jdk.internal.misc.Unsafe", "theUnsafe"); - return objRef; -} + return objRef; + } @MJI - public long objectFieldOffset__Ljava_lang_reflect_Field_2__J(MJIEnv env, int unsafeRef, int fieldRef) { + public long objectFieldOffset__Ljava_lang_reflect_Field_2__J (MJIEnv env, int unsafeRef, int fieldRef) { return fieldOffset__Ljava_lang_reflect_Field_2__I(env, unsafeRef, fieldRef); } @MJI - public void registerNatives____V(MJIEnv env, int clsObjRef) { - // No changes here as suggested + public int addressSize0____I(MJIEnv env, int objRef) { + return 0; } + + @MJI + public void registerNatives____V(MJIEnv env, int clsObjRef) {} @MJI public boolean isBigEndian0____Z (MJIEnv env, int objRef) { From 48d9c5723957b955dfbdf6470eb81d4aaf0dac96 Mon Sep 17 00:00:00 2001 From: Aditya Singh <123162244+adysinghh@users.noreply.github.com> Date: Sat, 2 Mar 2024 18:11:23 +0000 Subject: [PATCH 5/5] space removed --- src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java b/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java index a74296bc..57efd17b 100644 --- a/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java +++ b/src/peers/gov/nasa/jpf/vm/JPF_jdk_internal_misc_Unsafe.java @@ -27,7 +27,6 @@ import gov.nasa.jpf.vm.SystemState; import gov.nasa.jpf.vm.ThreadInfo; - import static gov.nasa.jpf.vm.JPF_java_lang_Class.FIELD_CLASSNAME; /**