mirror of
https://github.com/corda/corda.git
synced 2025-01-18 02:39:51 +00:00
CORDA-2352 Be more lenient with setter property signature validation (#4442)
This commit is contained in:
parent
466bff4121
commit
9d8618224a
@ -207,7 +207,9 @@ private data class PropertyNamedMethod(val fieldName: String, val classifier: Me
|
||||
fun hasValidSignature(): Boolean = method.run {
|
||||
when (classifier) {
|
||||
GET -> parameterCount == 0 && returnType != Void.TYPE
|
||||
SET -> parameterCount == 1 && returnType == Void.TYPE
|
||||
// We don't check the return type, because some Java frameworks (such as Lombok) generate setters
|
||||
// with non-void returns for method chaining.
|
||||
SET -> parameterCount == 1
|
||||
IS -> parameterCount == 0 &&
|
||||
(returnType == Boolean::class.java ||
|
||||
returnType == Boolean::class.javaObjectType)
|
||||
|
@ -25,7 +25,12 @@ public class SetterConstructorTests {
|
||||
|
||||
public void setA(int a) { this.a = a; }
|
||||
public void setB(int b) { this.b = b; }
|
||||
public void setC(int c) { this.c = c; }
|
||||
|
||||
// See https://r3-cev.atlassian.net/browse/CORDA-2352
|
||||
public C setC(int c) {
|
||||
this.c = c;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
static class C2 {
|
||||
|
Loading…
Reference in New Issue
Block a user