You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Detect build function by signature, not by name, in referenced-builder contract #319
In the contract check for referenced builders (JavaLangAnalyser.hasBuildMethodReturning, called from BuilderScopeResolver.resolveByBuilderContract), detect the build function by signature instead of by name: any public, non-static, parameterless method whose return type is the referenced type T counts — regardless of whether it is named build().
Why
The contract should verify capability, not a naming convention. MapStruct-style and hand-written builders may name the terminal method differently (toTarget(), assemble(), …); a literal build() check rejects builders that would otherwise satisfy the contract. It also aligns the resolver with SimpleBuildersBuilderProvider.findBuildMethods, which already matches build methods by signature (public, non-static, no params, return type == T).
Pitfall
Needs an java.lang.Object-method guard (e.g. toString()): without it, StringBuilder.toString() + StringBuilder(String) satisfy the contract for String — the exact false positive the check is meant to prevent.
Activity