JetBrains / java-annotations

Annotations for JVM-based languages.
Apache License 2.0
404 stars 47 forks source link

@Contract(pure = true) violation not raising any code inspection issue in Intellij 2021.3.2 ? #88

Closed thibaultfaure closed 1 year ago

thibaultfaure commented 1 year ago

Hello, As I understand from the documentation, the simplest example of a non-pure function would be a setter, as it modifies the object's internal state. Thus I wrote the following class:

public class Employee {

    int age;

    @Contract(pure = true)
    void setAge(int age) {
        this.age = age;
    }

}

Then I ran the code inspection tool. No error shows up for contract violation. I use IntelliJ 2021.3.2. Am I missing something here? Kind regards, Thibault

amaembo commented 1 year ago

Hello! This issue tracker relates to the annotation package itself, not to how this package is supported in a particular IDE. For IntelliJ IDEA, please file an issue at https://youtrack.jetbrains.com/ . Thank you.