Skip to content

Require explicit constraints in @Contract #35157

@sbrannen

Description

@sbrannen

@Contract is currently defined as follows.

public @interface Contract {

	String value() default "";
}

That allows empty declarations such as @Contract or @Contract(); however, a contract is not useful without declared constraints.

In light of that, we should remove the default "" declaration in order to force users to provide explicit constraints.

Even though one could technically still declare the annotation without constraints via @Contract(""), it's unlikely that anyone would intentionally do that.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions