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

Add support for UNSIGNED_RIGHT_SHIFT. #303

Merged
merged 4 commits into from Apr 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions nullaway/src/main/java/com/uber/nullaway/NullAway.java
Expand Up @@ -1889,6 +1889,7 @@ private boolean mayBeNullExpr(VisitorState state, ExpressionTree expr) {
case XOR:
case LEFT_SHIFT:
case RIGHT_SHIFT:
case UNSIGNED_RIGHT_SHIFT:
// clearly not null
exprMayBeNull = false;
break;
Expand Down
Expand Up @@ -809,4 +809,19 @@ static void testTwoParamIter() {
s.hashCode();
}
}

static String boxAndDeref(Integer boxed) {
return boxed.toString();
}

static String testNoCrashOnUnboxedShifts(int n) {
Integer m = n << 2;
String s = "";
s += boxAndDeref(m);
s += boxAndDeref(m <<= 2);
s += boxAndDeref(n >>= 1);
s += boxAndDeref(m >>>= 4);
s += boxAndDeref(n >>> 3);
return s;
}
}