Hi, I have this application with an @Raw annotation. My question is, if these two functions in the code below are valid because of the RAW annotation and WHY ? this.setX(some.getX()); or some.setX(this.getX());
/**
* @invar …
* | getX() <= 0
*/
public class SomeClass {
@Raw
public float getX() {
return this.x;
}
public void setX(float x) throws IllegalArgumentException {
if (x > 0)
throw new IllegalArgumentException();
this.x = x;
}
private float x;
@Raw
public void someMethod(SomeClass some) throws NullPointerException {
this.setX(some.getX());
some.setX(this.getX());
}
}
You dont specify where the @Raw annotation comes from, so I'll assume you mean the checker framework. From the docs:
The functions in your code are valid and will work by themselves, too. Someone just wanted some safeguards to make sure the objects they are using are fully initialized.