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
[BEAM-10402] Enable checkerframework globally #13134
[BEAM-10402] Enable checkerframework globally #13134
Conversation
75a9fe8
to
78f9fb0
Compare
@TheNeuralBit I don't know why I think you would enjoy / be amused by this, but I chose arbitrarily. @jayendra13 may also be interested.
So this involved suppression or tweaking on about 2k out of 5.5k files. You can image how it is important to get this done before we grow even bigger... |
Oh now I remember - there was some runtime ramification of enabling checker for certain modules. Do you recall? |
I am definitely interested in this, but got stuck with my own work. Will resume soon may be in a week or two 🙂 . |
New files since I ran it, of course. It may not be possible to review without that happening during review. It doesn't mean much for the review of the concept, I think. |
a9342ef
to
fa57261
Compare
The NPE reproduced on Since the annotations are MIT licensed they can be |
fa57261
to
9af1770
Compare
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.
The concept looks good. Do you think you could change it so all of the @SuppressWarnings
annotations are added in a separate commit? Then we'd just be left with the gradle changes, and any other java changes that make sense to review manually.
@@ -42,6 +42,7 @@ | |||
|
|||
/** End-to-end tests of TrafficRoutes. */ | |||
@RunWith(JUnit4.class) | |||
@SuppressWarnings("nullness") |
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.
Could we add a TODO(BEAM-10402) on these?
Great ideas. I learned a bit from:
In particular, I did not know about The enabling (somewhat of a leap of faith?) which I will later
I figured out I could commit everything that wasn't a new suppression (interactively, somewhat tedious but far less than 2k files)
And the API surface checks all include a new line of
(needed to tweak interactively)
Confirmation that the only things remaining are suppressions at the top level:
(oops there were a few more, which I isolated and committed) |
9af1770
to
48ba7a1
Compare
Gya, I botched the API surface patches versus moving nullable annotation patches |
b9d51f4
to
21dbf7a
Compare
OK. The commits look right to me. Let me know if it helps to split things any other way. I had hoped this would be a pretty silly PR but it got slightly involved. I would say two things to check are:
Yea? |
21dbf7a
to
4b4b8fc
Compare
Run Java PreCommit |
Hmm this might slow the build down enough that it has to be separated from the CI build. |
Run Python_PVR_Flink PreCommit |
Run Java_Examples_Dataflow PreCommit |
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, thank you! This will be much better, hopefully seeing the SuppressWarnings annotations will inspire some more crowdsourced fixes.
I did a quick check over the monster commit to make sure it was just SuppressWarnings, and looked over the other one more closely.
I'm assuming you'll have to re-generate the monster commit to sync with master, can you add TODOs at the same time?
publish: configuration.publish, | ||
generatedClassPatterns: [ | ||
'^org\\.apache\\.beam\\..*' | ||
], |
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.
This looked concerning until I looked around and realized the "portability" nature means its for making modules that generate protobuf/grpc code. The comment above "applyPortabilityNature should only be applied to projects that want to use vendored gRPC / protobuf dependencies" isn't very helpful. Maybe I'll send you a PR to document these natures.
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.
Yea. I could be .model
except it is also used by the windmill proto generation. I have changed it so that it is passed in and the default is the model.
'^org\\.apache\\.beam\\.sdk\\.extensions\\.protobuf\\.Proto2CoderTestMessages', | ||
'^org\\.apache\\.beam\\.sdk\\.extensions\\.protobuf\\.Proto2SchemaMessages', | ||
'^org\\.apache\\.beam\\.sdk\\.extensions\\.protobuf\\.Proto3SchemaMessages', | ||
'^org\\.apache\\.beam\\.sdk\\.extensions\\.protobuf\\.Proto3SchemaOptions', |
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.
Is it possible to use slashy strings in our gradle files? That'd clean these arrays up a bit.
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.
Didn't know about slashy strings. Nice. Done.
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.
Nice! I was unaware of them before, but did a check to see if there was some kind of regex literal we could use. I guess ~"pattern"
is an option as well, but produces Pattern
instances.
applyJavaNature( | ||
automaticModuleName: 'org.apache.beam.sdk.extensions.sql.meta.provider.hcatalog', | ||
classesTriggerCheckerBugs: [ | ||
'HCatalogTable': '', |
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.
not yet filed or TODO
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.
Done
@@ -20,7 +20,7 @@ import groovy.json.JsonOutput | |||
|
|||
plugins { id 'org.apache.beam.module' } | |||
applyJavaNature( | |||
enableChecker:false, | |||
|
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.
nit: some of these are left with unnecessary whitespace (not a big deal if its a pain to fix)
sdks/java/io/kudu/build.gradle
Outdated
ignoreRawtypeErrors:true, | ||
classesTriggerCheckerBugs: [ | ||
'KuduTestUtils': '', | ||
'KuduIOIT': '', |
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.
not yet filed or TODO
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.
Done
'-Werror' | ||
'-Werror', | ||
'-Xmaxerrs', | ||
'10000' |
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.
Is this a typo for maxerrors?
I'm assuming you added this to make it quicker to run, can/should we drop it now?
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.
I did this so that it would expose all the errors and I could grep the log to pass the right files through sed
. Presumably in mostly-functioning code you would be at 0 or a handful anyhow so the number doesn't matter. But I'll remove it because might as well leave it at default.
Seeing really wonky errors on Jenkins that I cannot repro locally. Could be checkerframework bugs related to particular JDKs? |
Run Java PreCommit |
1 similar comment
Run Java PreCommit |
The re-run was 38 minutes, pretty normal. Many things pulled from cache. https://scans.gradle.com/s/wyh5rgkbd3rjq/timeline?sort=longest "2463 tasks executed in 116 projects in 33m 22.938s, with 173 avoided tasks saving 4h 12m 58.349s" |
Here are some samples of runs against commits and phrases:
It is hard to determine the real likely slowdown in practice. The tasks that were the longest and most problematic in the bad run are almost always |
ecd1e0a
to
00aa127
Compare
On my idle desktop machine:
Unfortunate that the build seems very unhealthy on master so I am just looking at particular tasks. It does look like compile tasks are perhaps 5x as slow but it does not affect the overall runtime very much. One option is to cease analyzing test java. These seem to have a much greater slowdown factor. I wonder if incorrect types are more expensive than correct ones... |
00aa127
to
8ef235f
Compare
We have fixed some of the modules, so I think creating a map somewhere denoting modules fixed and not fixed would help for better tracking this issue. What do you think? I am soon going to start this again. |
4ebfe54
to
7c1127c
Compare
Are you thinking something like a spreadsheet that we would keep up-to-date, or would this be a part of the build? With the change in #13191 we could identify fixed vs. not fixed classes and/or modules by grepping for |
64f2f07
to
249643f
Compare
This commit is independently useful, since checkerframework annotations are helpful for users. We should preserve them at runtime.
249643f
to
c5d5b9a
Compare
Not part of a build, but some where publicly accessible like kanban board on jira or on github . |
OK this is finally healthy and ran in a normal amount of time (precommits tend to be in the 30-60 minute range and this was 30). Only the tests for SDK core are skipped. Hopefully we won't have to skip them forever, since carelessness with nulls in tests is an annoying source of false issues. Going to merge it! |
Confirmed that there are no breakages introduced in master since the tests ran here. |
Since there are 2000+ classes with issues, probably this is too many Jiras and too much for a kanban? I don't know. Actually each class can be enough of a challenge for a Jira. But maybe Jiras for the module level is easier to manage. A spreadsheet containing the output of a bash script that finds the |
Instead of opting out whole modules now only existing classes are opted out of type checking. This has the following benefits:
I produced the needed warnings (merged in other PRs) by removing the flag and then repeating the following, more or less:
There are two ways to still suppress type checking, arguments to
applyJavaNature
:generatedClassPatterns
to exclude various generated code that is not annotated with nullness typesclassesTriggerCheckerBugs
a map from classes which cannot be analyzed to their checkerframework bug URLThank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username
).[BEAM-XXX] Fixes bug in ApproximateQuantiles
, where you replaceBEAM-XXX
with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.CHANGES.md
with noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
Post-Commit Tests Status (on master branch)
Pre-Commit Tests Status (on master branch)
See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI.