Skip to content

Commit 46c40e7

Browse files
committed
Require explicit constraints in @⁠Contract
Prior to this commit, the value attribute in @⁠Contract was declared as follows. String value() default ""; That allowed empty declarations such as @⁠Contract or @⁠Contract(); however, a contract is not useful without declared constraints. To address that, this commit removes the `default ""` declaration in order to force users to provide explicit constraints. Although one could technically still declare the annotation without constraints via @⁠Contract(""), it's unlikely that anyone would intentionally do that. Closes gh-35157
1 parent 6dc3c11 commit 46c40e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-core/src/main/java/org/springframework/lang/Contract.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@
8181
/**
8282
* Contains the contract clauses describing causal relations between call arguments and the returned value.
8383
*/
84-
String value() default "";
84+
String value();
8585

8686
}

0 commit comments

Comments
 (0)