You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Typically this needs to happen in the constructor. For example, consider the following class:
class MyArray<T> {
T @SameLen("this") [] backingArray;
@SuppressWarnings("index") // establish representation invariant
public MyArray(@NonNegative int length) {
backingArray = new T[length];
}
public @LengthOf("this") int length() { return backingArray.length; }
public T get(@IndexFor("this") int index) { return backingArray[index]; }
}
Ideally, this suppressed warning wouldn't be required. It's not really a false positive, so we should replace it with an annotation.
The text was updated successfully, but these errors were encountered:
Is an annotation needed, and if so which one? It would be nicer if the checker could had logic to permit an assignment to a @SameLen("this") field in the constructor (perhaps with some caveats).
Typically this needs to happen in the constructor. For example, consider the following class:
Ideally, this suppressed warning wouldn't be required. It's not really a false positive, so we should replace it with an annotation.
The text was updated successfully, but these errors were encountered: