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

Fix and Test String.equals(Object) Implementation in JPF #491

Merged
merged 2 commits into from
Aug 13, 2024
Merged

Fix and Test String.equals(Object) Implementation in JPF #491

merged 2 commits into from
Aug 13, 2024

Conversation

shreyasCs012
Copy link
Contributor

This pull request addresses a bug in the Java Pathfinder(JPF) related to implementing the 'String. equals(Object)' method. I have made the following changes :

Test Addition :

I added a test to check if the equals method works if a non-String object was passed as an argument but the previous implementation of the equals method did not check this condition which was revealed via test.

Bug Fix :

  1. argRef Handling:

    • The argRef variable which is one of the parameters passed in 'equals__Ljava_lang_Object_2__Z '. The purpose of the argRef
      is a reference to the symbolic object in the jpf heap but it does not check if the object is a String object before comparing
      the objects(concrete).
  2. Updates :

    • The method now uses env.isInstanceOf(argRef, "java.lang.String") which checks if the object is a String before it checks the
      equality of the different objects.

@cyrille-artho
Copy link
Member

Thanks!

@cyrille-artho cyrille-artho merged commit 17cfba7 into javapathfinder:master Aug 13, 2024
2 checks passed
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.

2 participants