Character, Byte, Short valueOf instead of new instance

Chris Hegarty chris.hegarty at oracle.com
Thu Jun 26 15:07:52 UTC 2014


Otavio,

I scanner the patches and they mainly look fine to me. Just a minor issue, as per the Long thread.

diff -r d02b062bc827 src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java
--- a/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java	Fri Jun 13 11:21:30 2014 -0700
+++ b/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java	Sat Jun 14 13:33:29 2014 -0300
@@ -379,7 +379,7 @@
         // used for substring comparisons (where proto has "*" wildcards
         private boolean substringMatch(String proto, String value) {
             // simple case 1: "*" means attribute presence is being tested
-            if(proto.equals(new Character(WILDCARD_TOKEN).toString())) {
+            if(proto.equals(Character.valueOf(WILDCARD_TOKEN).toString())) {    // << Character.toString(WILDCARD_TOKEN)
                 if(debug) {System.out.println("simple presence assertion");}
                 return true;
             }

-Chris.

On 14 Jun 2014, at 17:38, Otávio Gonçalves de Santana <otaviojava at java.net> wrote:

> Reason: The Character, Byte, Short classes have cache and using it, will
> save memory and will faster than using create new instance.
> 
> webrev:
> https://dl.dropboxusercontent.com/u/16109193/open_jdk/byte_short_character_value_of.zip
> 
> similar: https://bugs.openjdk.java.net/browse/JDK-8044461
> 
> -- 
> Atenciosamente.
> 
> Otávio Gonçalves de Santana
> 
> blog:     http://otaviosantana.blogspot.com.br/
> twitter: http://twitter.com/otaviojava
> site:     http://www.otaviojava.com.br
> (11)     98255-3513
> <sun_tools.diff><sun_security.diff><sun_misc.diff><sun_management.diff><jdk_internal.diff><javax_management.diff><java_beans.diff><java_awt.diff><com_sun_security.diff><com_sun_jndi.diff><com_sun_jmx.diff><com_sun.diff>




More information about the core-libs-dev mailing list