8251325: Miss 'L' for long value in if statement

齋藤悠太 uc4w6c at bma.biglobe.ne.jp
Tue Aug 11 01:04:22 UTC 2020


Hi Erik,
Great, thank you!

I think your logic is easier and better.
The modifications are as follows.

```
$ hg diff -g
diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java
@@ -125,14 +125,14 @@
         OldObjectSample.updateSettingPathToGcRoots(s, pathToGcRoots);
 
         if (duration != null) {
-            if (duration < 1000L * 1000L * 1000L) {
+            if (duration < 1_000_000_000) {
                 // to avoid typo, duration below 1s makes no sense
                 throw new DCmdException("Could not start recording, duration must be at least 1 second.");
             }
         }
 
         if (delay != null) {
-            if (delay < 1000L * 1000L * 1000) {
+            if (delay < 1_000_000_000) {
                 // to avoid typo, delay shorter than 1s makes no sense.
                 throw new DCmdException("Could not start recording, delay must be at least 1 second.");
             }
```


Thanks
Yuta


> 2020/08/11 6:52、Erik Gahlin <erik.gahlin at oracle.com>のメール:
> 
> Hi Yuta,
> 
> If you are cleaning this up, you might as well change it to:
> 
> if (delay < 1_000_000_000) {
> 
> The ‘L’ is not necessary.
> 
> Thanks
> Erik
> 
>> On 10 Aug 2020, at 14:19, 齋藤悠太 <uc4w6c at bma.biglobe.ne.jp> wrote:
>> 
>> Hi,
>> I want to correct typo.
>> JBS : https://bugs.openjdk.java.net/browse/JDK-8251325 <https://bugs.openjdk.java.net/browse/JDK-8251325>
>> 
>> This will be my first contribution. 
>> In other logic has' L 'at the end of all three, so I think it's a simple typo. (DCmdStart.java: 128) 
>> 
>> If there is no problem with the revision, I would like someone to sponsor me.
>> I will sign the OCA tomorrow.
>> 
>> The modifications are as follows.
>> 
>> ```
>> $ hg diff -g
>> diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java
>> --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java
>> +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java
>> @@ -132,7 +132,7 @@
>>        }
>> 
>>        if (delay != null) {
>> -            if (delay < 1000L * 1000L * 1000) {
>> +            if (delay < 1000L * 1000L * 1000L) {
>>                // to avoid typo, delay shorter than 1s makes no sense.
>>                throw new DCmdException("Could not start recording, delay must be at least 1 second.");
>>            }
>> ```
>> 
>> Thanks to Chihiro Ito for reporting this.
>> 
>> Thanks.
>> 
>> Yuta Saito
>> 
> 



More information about the hotspot-jfr-dev mailing list