8371162: Compiler warns about implicit cast from long to int in shift operation #28180
+41
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Consider code like this:
The compiler currently emits this warning:
By definition, bit shift operations only use the bottom 5 or 6 bits of the specified shift amount (in this example,
1L), and the JLS does not require the shift amount to be any specific integral type, only that that it be some integral type. So as long all but the bottom 5 or 6 bits are zero, there is no loss of information and the warning is inappropriate.The case where the bottom 5 or 6 bits are not all zero is addressed separately in JDK-5038439.
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28180/head:pull/28180$ git checkout pull/28180Update a local copy of the PR:
$ git checkout pull/28180$ git pull https://git.openjdk.org/jdk.git pull/28180/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28180View PR using the GUI difftool:
$ git pr show -t 28180Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28180.diff
Using Webrev
Link to Webrev Comment