[GTK] Look up the accessibility class once in os_custom.c - #3595
Merged
akurtakov merged 1 commit intoSep 16, 2026
Merged
Conversation
call_accessible_object_function() called FindClass for every accessibility callback. The class is now looked up once and kept as a global reference, primed when an accessible is registered, and a failed lookup clears the pending exception instead of leaving it for the next JNI call. FindClass resolves against the class loader of the calling Java method, so it only finds AccessibleObject while the C code is entered from a JNI native method. Assisted-by: multiple AI agents and layers of automated tooling 🤖
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A failed global-reference allocation can still leave a pending JNI exception.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Caches the GTK accessibility Java class to avoid repeated JNI class lookups.
Changes:
- Adds a global
AccessibleObjectclass reference. - Primes the cache during accessibility registration.
- Clears failed
FindClassexceptions.
File summaries
| File | Description |
|---|---|
bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c |
Implements cached accessibility-class lookup. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every accessibility callback from GTK went through
FindClassto locateAccessibleObject, which is a hash lookup and class loader walk per call. The class is now resolved once and kept as a global reference, primed when an accessible is registered, so the repeated lookups disappear from the ATK call paths.A failed lookup previously returned while leaving a
NoClassDefFoundErrorpending on the thread, which is undefined behaviour for the next JNI call on that thread; it is now cleared. The natives build clean with-Werrorand the accessibility tests pass against the rebuilt GTK3 libraries.