Hi Pavel,

I'm not sure what the style guide for the source code says, but
there is a space between the cast operator and the field name in
src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServer.java (line 881):

     @Override
     public Long getSnmpOutGenErrs() {
-        return new Long(snmpOutGenErrs);
+        return (long) snmpOutGenErrs;

     }

In all other changes there is no space after the cast operator.


> Also, I removed one useless creation of a Long object here:
> 
> (line 191):
> 
> http://cr.openjdk.java.net/~prappo/8048267/webrev.01/src/share/classes/sun/security/krb5/internal/KerberosTime.java.sdiff.html
> http://cr.openjdk.java.net/~prappo/8048267/webrev.02/src/share/classes/sun/security/krb5/internal/KerberosTime.java.sdiff.html

And I have found one more :-) in KerberosTime.java:

252     public int getSeconds() {
253         Long temp_long = kerberosTime / 1000L;
254         return temp_long.intValue();
255     }

This can be changed to:

252     public int getSeconds() {
253         long temp_long = kerberosTime / 1000L;
254         return (int) temp_long;
255     }


> 
> I wonder if we should leave a cast to int here:
> 
> (line 383):
> 
> http://cr.openjdk.java.net/~prappo/8048267/webrev.01/src/share/classes/sun/management/snmp/jvminstr/JvmMemoryImpl.java.sdiff.html
> http://cr.openjdk.java.net/~prappo/8048267/webrev.02/src/share/classes/sun/management/snmp/jvminstr/JvmMemoryImpl.java.sdiff.html
> 
> Well it's probably nothing to worry about, but strictly speaking this changes 
> the behaviour. Before the change, long was truncated to fit int. And now it's 
> not.

I would not change the behavior now. I think it is better to file a new issue 
and change
it in a separate commit. Having this change in a separate commit may simplify 
tracking
this change back in case it would cause some problems (I don't believe it).
And in the new issue you may provide better description for this change.

And a minor comment for JvmMemoryImpl.java:
Maybe it is better to use Long0 in the line 387. So the code of the method 
JvmMemoryImpl.getJvmMemoryPendingFinalCount() will look similar to the code
of other methods in the JvmMemoryImpl class. They all use the Long0 constant
to return 0L.

In sun/management/snmp/jvminstr/JvmThreadingImpl.java in the line 313:

312     public Long getJvmThreadPeakCount() throws SnmpStatusException {
313         return  (long)getThreadMXBean().getPeakThreadCount();
314     }

There is one space too much between "return" and the cast operator. The 
additional space
was in the original version too, but maybe we can clean up here the code a 
little bit.

> 
> P.S. Andrej, it looks like you don't have an 'Author' status. Well, that's a 
> pity. We could mention you in the 'Reviewed-by' line. Your contributions are 
> really good.

Thanks! But I don't really care about it as long as I can help to improve the 
overall code quality.

Best regards,
Andrej Golovnin

Reply via email to