Character, Byte, Short valueOf instead of new instance

Pavel Rappo pavel.rappo at oracle.com
Tue Jul 1 12:39:02 UTC 2014


Otavio,

As with [1], I created an issue to track the progress and also made 2 webrevs. One for the original patch and one for the changes similar to those we discussed in [1].

https://bugs.openjdk.java.net/browse/JDK-8048874

http://cr.openjdk.java.net/~prappo/8048874/webrev.00
http://cr.openjdk.java.net/~prappo/8048874/webrev.01

-----------------------------------------------------------------------
[1] http://mail.openjdk.java.net/pipermail/core-libs-dev/2014-June/027197.html

Thanks,
-Pavel

On 26 Jun 2014, at 16:07, Chris Hegarty <chris.hegarty at oracle.com> wrote:

> 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