Sub-task of #301.
Goal
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.
Status
Implemented in #320, which closes this issue.
Sub-task of #301.
Goal
In the contract check for referenced builders (
JavaLangAnalyser.hasBuildMethodReturning, called fromBuilderScopeResolver.resolveByBuilderContract), detect the build function by signature instead of by name: anypublic, non-static, parameterless method whose return type is the referenced typeTcounts — regardless of whether it is namedbuild().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 literalbuild()check rejects builders that would otherwise satisfy the contract. It also aligns the resolver withSimpleBuildersBuilderProvider.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 forString— the exact false positive the check is meant to prevent.Status
Implemented in #320, which closes this issue.