Skip to content

Conversation

@HritikRaj2
Copy link
Contributor

Summary

Implemented missing Java 11 Nestmate access control methods in the java.lang.Class model. This allows JPF to execute code that relies on getNestHost() and isNestmateOf(), which are increasingly common in modern Java libraries.

Changes

  • Modified: src/classes/modules/java.base/java/lang/Class.java
    • Added getNestHost(): Traversing getEnclosingClass() to find the nest host (top-level class).
    • Added isNestmateOf(Class): Compares nest hosts of two classes.
  • Added: src/tests/gov/nasa/jpf/test/java/lang/NestmateTest.java
    • Verified behavior for Top-Level classes (host is self).
    • Verified behavior for Inner classes (host is enclosing class).

Testing

  • NestmateTest.java passes
  • Full build successful.

Relation to Issues

Partial fix for general "Missing Methods in Class" issues (like #235), specifically targeting Java 11 support.

- Implemented getNestHost() and isNestmateOf() in Class.java model.
- Added NestmateTest.java to verify behavior for top-level and inner classes.
- Enables JPF to support modern Java nest-based access control checks.
@HritikRaj2
Copy link
Contributor Author

Hi @cyrille-artho, following your advice to focus on functionality rather than test optimization, I've submitted a PR adding Java 11 Nestmate support (getNestHost, isNestmateOf) to the Class model.

I included a new unit test to verify the behavior for both top-level and inner classes. Ready for your review!

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.

1 participant