Inspectopedia Help

Contract issues

Reports issues in method @Contract annotations. The types of issues that can be reported are:

  • Errors in contract syntax

  • Contracts that do not conform to the method signature (wrong parameter count)

  • Method implementations that contradict the contract (e.g. return true when the contract says false)

Example:

// method has no parameters, but contract expects 1 @Contract("_ -> fail") void x() { throw new AssertionError(); }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023