Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GreaterThan as dual of LessThan #227

Open
kelloggm opened this issue May 30, 2018 · 2 comments
Open

GreaterThan as dual of LessThan #227

kelloggm opened this issue May 30, 2018 · 2 comments

Comments

@kelloggm
Copy link
Owner

Sometimes it's not possible to write @LessThan - for instance, when the return type of a method is @GreaterThan("#1"). Consider the following example from Guava (>= 16 false positives):

    private static @GreaterThan("#3 - 1") @IndexOrLow("#1") int indexOf(
            short[] array, short target, @IndexOrHigh("#1") int start, @IndexOrHigh("#1") int end) {
        for (int i = start; i < end; i++) {
            if (array[i] == target) {
                return i;
            }
        }
        return -1;
    }
@panacekcz
Copy link

In this code, there is the -1 which never satisfies that condition, so @GreaterThanOrMinusOne would be needed.

@kelloggm
Copy link
Owner Author

Good point. This is probably just not fixable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants