-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[CALCITE-6552] Enable CheckerFramework in 'server' module #3939
Conversation
… where list is empty and immutable
I imagine many of these conversions are automatically performed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I see @NobiGo has reviewed and approved. I think we're good. The vast majority of changes don't require review - there was only one choice to make. In one or two places I had to make a decision; e.g. in MongoEnumerator I added the 3
Agreed. I will minimize conflicts by merging this quickly, and avoiding changes that require discretion. I will probably merge today. @NobiGo, Thanks for your review. |
Quality Gate passedIssues Measures |
In [CALCITE-4199] we enabled CheckerFramework (via annotations and CI jobs) in the 'core' and 'linq4j' modules; this change further enables CheckerFramework in the 'server' module, and fixes all violations. There are also a large number of 'cosmetic' modifications to improve code quality without changing behavior, including: * Replace `this.x = x; assert x != null;` with `this.x = requireNonNull(x);` in constructors * Replace `assert` in other code locations where it implements an invariant. We don't use `requireNonNull` because it throws `NullPointerException`; we would prefer to throw `AssertionError` or `IllegalStateException` * Replace `x.equals("")` and `x.size() == 0` with `x.isEmpty()` * Make fields `final` where possible * Make private methods and inner classes `static` where possible * In class `Pair<K, V>` make the type variables `K` and `V` no longer nullable by default (you can make each of them nullable if you need) * Always import `Objects.requireNonNull`, `Integer.parseInt`, `Float.parseFloat`, `Double.parseDouble`, `Byte.parseByte`, `Short.parseShort`, `Boolean.parseBoolean`, `Long.parseLong` via static import, and change autostyle rules to enforce this automatically * Remove redundant 'throws' clauses * Add `@Nullable` annotations for method parameters and return values so that types are nullable only if they need to be; the goal is that you should not pass null or a nullable value as an argument that has non-nullable type, and after this change we are nearer to that goal In Util, optimize methods `transform` and `transformIndexed` for the case where list is empty and immutable. Close apache#3939
In CALCITE-4199 we enabled CheckerFramework (via annotations and CI jobs) in the 'core' and 'linq4j' modules; this change further enables CheckerFramework in the 'server' module, and fixes all violations.
There are also a large number of 'cosmetic' modifications to improve code quality without changing behavior, including:
this.x = x; assert x != null;
withthis.x = requireNonNull(x);
in constructorsassert
in other code locations where it implements an invariant. We don't userequireNonNull
because it throwsNullPointerException
; we would prefer to throwAssertionError
orIllegalStateException
x.equals("")
andx.size() == 0
withx.isEmpty()
final
where possiblestatic
where possiblePair<K, V>
make the type variablesK
andV
no longer nullable by default (you can make each of them nullable if you need)Objects.requireNonNull
,Integer.parseInt
,Float.parseFloat
,Double.parseDouble
,Byte.parseByte
,Short.parseShort
,Boolean.parseBoolean
,Long.parseLong
via static importThis PR supersedes #3937