Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing issue Orphan NativePeer method with Java 11.0.20.1 #421 #431

Closed

Conversation

adysinghh
Copy link

fix #421

Copy link
Member

@cyrille-artho cyrille-artho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the update. Please try to minimize the changes; if it is not possible to add a unit test to check against warnings of JPF, then there is no need to add imports for the junit test packages.

int objRef = env.getStaticReferenceField("jdk.internal.misc.Unsafe", "theUnsafe");
return objRef;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to avoid introducing extra formatting changes, as this may make it more difficult to merge your patch in other branches later.

@@ -60,7 +62,7 @@ public void registerNatives____V(MJIEnv env, int clsObjRef) {}
public int addressSize0____I (MJIEnv env, int objRef) {
return 0;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to remove this change as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please revert the second change that swaps the two methods, so we have a patch that only has the first (functional) change?

@@ -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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these two imports needed? You do not (yet) add a new test in this patch.

@adysinghh
Copy link
Author

@cyrille-artho Hi, I had incorporated all the suggested changes

Copy link
Member

@cyrille-artho cyrille-artho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the update. This version is a step forward but still has some changes that do not seem to relate directly to the incorrectly named native peer.
Can you please try to make a minimal patch that does not change any other lines? There are several changes (I've highlighted some of them) that add or remove spaces or empty lines. There is also one change that removes an @MJI method. While the tests still all pass, there may be functionality that the unit tests do not cover but rely on that @MJI method.


@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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the space before the "(" back so we do not have extra changes in the patch; this is important to make future merges to other branches easier.

@adysinghh
Copy link
Author

adysinghh commented Jan 14, 2024

@cyrille-artho Thanks for the valuable feedback! I've incorporated the suggested changes, keeping modifications minimal. Retained necessary methods, removed extra spaces, and ensured consistent spacing.

  • Removed unnecessary spaces and empty lines.
  • Retained @MJI methods.
  • Ensured consistent spacing.

Please review the changes.

@cyrille-artho
Copy link
Member

Thanks for adding the code back. Please try to add it back in the same way it was before, as there are still two changes that merely reformat code, which is best avoided (an empty line at the beginning and reordered/reformatted methods at the end).

@adysinghh
Copy link
Author

@cyrille-artho I had made the changes please review.

Copy link
Member

@cyrille-artho cyrille-artho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
Please try to isolate the first change. If you are not familiar with "diff" and "patch", you can try to apply the first change again manually on a new branch and make a new PR.
Thank you for your perseverance!

@@ -60,7 +62,7 @@ public void registerNatives____V(MJIEnv env, int clsObjRef) {}
public int addressSize0____I (MJIEnv env, int objRef) {
return 0;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please revert the second change that swaps the two methods, so we have a patch that only has the first (functional) change?

@cyrille-artho
Copy link
Member

Subsumed by PR #492

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Orphan NativePeer method with Java 11.0.20.1
2 participants