X Tutup
Skip to content

Fix findPubliclyAccessibleMethod to search interfaces for accessible methods#4287

Merged
andimarek merged 8 commits intomasterfrom
claude/fix-graphql-java-4278-v6Z3y
Mar 9, 2026
Merged

Fix findPubliclyAccessibleMethod to search interfaces for accessible methods#4287
andimarek merged 8 commits intomasterfrom
claude/fix-graphql-java-4278-v6Z3y

Conversation

@andimarek
Copy link
Member

Summary

Test plan

  • Added unit tests for fetching value and key properties from TreeMap.Entry instances
  • Tests cover both PropertyDataFetcher and SingletonPropertyDataFetcher
  • Tests explicitly disable lambda factory to exercise the reflection code path

https://claude.ai/code/session_01KSM9EgschAaxJVFeqM1enw

…methods (#4278)

The findPubliclyAccessibleMethod algorithm only traversed superclasses
when looking for a publicly accessible method. This caused
InaccessibleObjectException on Java 16+ for non-public classes that
implement public interfaces (e.g., TreeMap.Entry implementing Map.Entry),
because the method was never found through the public interface and the
fallback to setAccessible fails on JDK internal classes.

Now the algorithm also checks interfaces implemented by each class in the
hierarchy, finding methods declared on public interfaces like Map.Entry.

https://claude.ai/code/session_0172bEhuTAQF3gcvxip6wz5K
}
}
// Also search super-interfaces of non-public interfaces
Method method = findMethodOnPublicInterfaces(cacheKey, iface.getInterfaces(), methodName, dfeInUse, allowStaticMethods);
Copy link
Member

Choose a reason for hiding this comment

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

You allowing interfaces implementing interfaces - fair enough - but there is not tests for that

I think you need to create the complicated structure that tests this

@graphql-java graphql-java deleted a comment from github-actions bot Mar 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

Test Report

Test Results

Java Version Total Passed Failed Errors Skipped
Java 11 5692 (+8 🟢) 5636 (+8 🟢) 0 (±0) 0 (±0) 56 (±0)
Java 17 5692 (+8 🟢) 5635 (+8 🟢) 0 (±0) 0 (±0) 57 (±0)
Java 21 5692 (+8 🟢) 5635 (+8 🟢) 0 (±0) 0 (±0) 57 (±0)
Java 25 5692 (+8 🟢) 5635 (+8 🟢) 0 (±0) 0 (±0) 57 (±0)
jcstress 32 (±0) 32 (±0) 0 (±0) 0 (±0) 0 (±0)
Total 22800 (+32 🟢) 22573 (+32 🟢) 0 (±0) 0 (±0) 227 (±0)

Code Coverage (Java 25)

Metric Covered Missed Coverage vs Master
Lines 28727 3121 90.2% ±0.0%
Branches 8345 1511 84.7% ±0.0%
Methods 7684 1222 86.3% ±0.0%

Changed Class Coverage (1 class)

Class Line Branch Method
g.s.PropertyFetchingImpl +0.4% 🟢 +2.0% 🟢 ±0.0%

Full HTML report: build artifact jacoco-html-report

Updated: 2026-03-09 02:16:42 UTC

andimarek and others added 3 commits March 5, 2026 20:56
Test that findMethodOnPublicInterfaces correctly traverses package-private
intermediate interfaces to find methods declared on public super-interfaces.
Covers linear chain (pkg-private -> public grandparent) and diamond
inheritance patterns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cover the dfeInUse path and NoSuchMethodException fallthrough in
findMethodOnPublicInterfaces. Raises PropertyFetchingImpl line
coverage from 86.1% to 88.2%, above the 87.8% baseline.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@andimarek andimarek merged commit 426a2cc into master Mar 9, 2026
11 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.

PropertyFetchingImpl findPubliclyAccessibleMethod algorithm cannot find methods on non-public classes implementing public interfaces

3 participants

X Tutup