Skip to content

[GTK] Look up the accessibility class once in os_custom.c - #3595

Merged
akurtakov merged 1 commit into
eclipse-platform:masterfrom
vogella:gtk-accessible-class-cache
Sep 16, 2026
Merged

akurtakov merged 1 commit into
eclipse-platform:masterfrom
vogella:gtk-accessible-class-cache

Conversation

@vogella

@vogella vogella commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Every accessibility callback from GTK went through FindClass to locate AccessibleObject, 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 NoClassDefFoundError pending on the thread, which is undefined behaviour for the next JNI call on that thread; it is now cleared. The natives build clean with -Werror and the accessibility tests pass against the rebuilt GTK3 libraries.

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 🤖
@github-actions

Copy link
Copy Markdown
Contributor

Test Results (linux)

  109 files  ±0    109 suites  ±0   14m 48s ⏱️ -20s
4 630 tests ±0  4 396 ✅ ±0  234 💤 ±0  0 ❌ ±0 
3 464 runs  ±0  3 377 ✅ ±0   87 💤 ±0  0 ❌ ±0 

Results for commit 3daf7a3. ± Comparison against base commit 24f40bd.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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 AccessibleObject class reference.
  • Primes the cache during accessibility registration.
  • Clears failed FindClass exceptions.
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.

Comment thread bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c
@akurtakov
akurtakov merged commit fec1166 into eclipse-platform:master Sep 16, 2026
19 checks passed
@vogella
vogella deleted the gtk-accessible-class-cache branch September 17, 2026 10:43
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.

3 participants