On 25.04.16 19:19, Phil Race wrote:
On 04/25/2016 08:34 AM, Sergey Bylokhov wrote:
Some tweaks are possible also:
- In some cases like in PrintServiceLookupProvider.java it is
possible to use Integer.parseInt() instead of "Integer.valueOf()" +
"intValue()".
That [one] seems easy enough but I don't see any more in the webrev.
The similar code can be found in the documentation of NumberFormatter.java:
" * <code>Number</code>, the corresponding instance of the value class
72 * will be created using the constructor appropriate for the primitive
73 * type the value class represents. For example:
74 * <code>setValueClass(Integer.class)</code> will cause the resulting
75 * value to be created via
76 *
<code>Integer.valueOf(((Number)formatter.parseObject(string)).intValue())</code>."
Note about the sentence about the constructor: "will be created using
the constructor appropriate for the primitive type". Actually our
implementation of NumberFormatter contradicts this spec so I think it is
not a problem for this fix, but it will be good to file separately?
http://cr.openjdk.java.net/~prr/8154213.1
- also fixes the typo in JLayeredPane.java
- It is also possible to use classes like Integer =
GetIntegerAction() instead of "String = GetPropertyAction()".
I don't see this used anywhere in the patch and so it seems like that
should
be dealt with as a separate issue.
-phil.
On 25.04.16 8:11, prasanta sadhukhan wrote:
Hi Phil,
My 2 cents:
JLayeredPane.java has typo Integer.valueOf.valueOf.
In some cases, you have used
Float.valueOf(xx) like in ServiceDialog.java, PNGImageDecoder.java
but in some cases you jave used
lmObj = lmVal; without using Float.valueOf(). Shouldn't we be consistent
to use auto-boxing? Regards Prasanta
On 4/22/2016 11:36 PM, Phil Race wrote:
Bug: https://bugs.openjdk.java.net/browse/JDK-8154213
Webrev: http://cr.openjdk.java.net/~prr/8154213/
https://bugs.openjdk.java.net/browse/JDK-8145468 has caused
the following constructors usages to be deprecated :
new Long(long) and new Integer(String)
new Integer(int) and new Integer(String)
new Float(int) and new Float(String)
new Double(int) and new Double(String)
new Character(char)
The deprecations warnings were suppressed for the java.desktop module.
This fix changes all uses in the java.desktop module to use
Foo.valueOf(..)
or in a few cases where we directly assign to a variable use
auto-boxing.
Additionally doc comments that use constructors were updated.
Finally the deprecation suppression was removed.
JPRT has been used to verify the build and I have run through the
various affected Swing L&Fs using SwingSet as a sanity check.
I do not have any information on the performance difference (benefits
or otherwise)
of this change but I did not see any usage in java.desktop that
appears to be
remotely performance critical.
-phil.
--
Best regards, Sergey.