Skip to content

Restore support for Android versions not supporting MethodHandles#1731

Open
matthiasblaesing wants to merge 3 commits into
java-native-access:masterfrom
matthiasblaesing:ancient_android
Open

Restore support for Android versions not supporting MethodHandles#1731
matthiasblaesing wants to merge 3 commits into
java-native-access:masterfrom
matthiasblaesing:ancient_android

Conversation

@matthiasblaesing

Copy link
Copy Markdown
Member

Android supports MethodHandle starting from API release 26 (Android Oreo). While that release happened about 9 years ago, users are stuck there because retailers fail to provide updates and the Dalvik/ART runtime become only independently updateable with Android 12 in 2021.

So this changeset rewrites the MethodHandle based implementation into a reflection based one.

Closes: #1730

Android supports MethodHandle starting from API release 26 (Android
Oreo). While that release happened about 9 years ago, users are stuck
there because retailers fail to provide updates and the Dalvik/ART
runtime become only independently updateable with Android 12 in 2021.

So this changeset rewrites the MethodHandle based implementation into
a reflection based one. 

Closes: java-native-access#1730
@matthiasblaesing

matthiasblaesing commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

@dbwiddis could you please have a look? If ok, I consider to release 1.19.1 with this.

@dbwiddis dbwiddis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One needed fix inline.

And a change log entry needed.

Otherwise LGTM!

Comment thread src/com/sun/jna/Native.java Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you need to add null here similar to the stackWalkerGetInstance invoke() change.

@matthiasblaesing

Copy link
Copy Markdown
Member Author

@dbwiddis you are right in both regards. Updated (will squash before merge)

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.

5.19.0 silently bumps the minSdk version on Android to 26

2 participants