On 09.08.2014 4:44, Claes Redestad wrote:
Looks good to me, if that matters...

Thanks Claes!

Not sure if worth considering, but for simple cases like src/share/classes/java/util/PropertyPermission.java, you could return the possible constant values instead:

static String getActions(int mask) {
    switch (mask & 0x3) {
        case 1:
            return SecurityConstants.READ;
        case 2:
            return SecurityConstants.WRITE;
        case 3:
            return SecurityConstants.RW;
        default:
            return "";
    }
}

Yes, this will surely work faster. I've incorporated your suggestion:
http://cr.openjdk.java.net/~igerasim/8054714/1/webrev/

Also, now that it's backed by a String[], some of these cases could be optimized if StringJoiner had a way to set/ensure capacity (what leaky abstractions?).

I wasn't planning to change the StringJoiner's API with this fix :-)

Sincerely yours,
Ivan


Thanks!

/Claes


On 2014-08-08 23:26, Ivan Gerasimov wrote:
Hello everyone!

This is a follower of the recently fixed [8051382] -- Optimize java.lang.reflect.Modifier.toString().

I found a dozen+ other places in jdk, where using the StringJoiner makes the code shorter and cleaner.

Would you please help review the fix?

http://cr.openjdk.java.net/~igerasim/8054714/0/webrev/

Sincerely yours,
Ivan




Reply via email to