RFR: More cleanup patches

Сергей Цыпанов sergei.tsypanov at yandex.ru
Sat Mar 31 20:33:13 UTC 2018


Hi Martin,

as soon as the changes for 8199800: Optimize Boolean.parseBoolean(String) are merged we could replace code snippets like 

if (aValue.toUpperCase().equals("TRUE")) {
  value = Boolean.TRUE;
}
else {
  value = Boolean.FALSE;
}

with

value = Boolean.parseBoolean(aValue);

See javax.swing.plaf.synth.SynthParser for more similar cases.



P. S. I'm not sure about this one in jdk.internal.reflect.ReflectionFactory

String val = props.getProperty("sun.reflect.noInflation");
if (val != null && val.equals("true")) {
  noInflation = true;
}

It could be replaced with 

String val = props.getProperty("sun.reflect.noInflation");
noInflation = Boolean.parseBoolean(val);

but then val="TRUE" means noInflation=true while currently noInflation=true exclusively when val="true".

I've found similar code snippets in:

java.awt.Component
java.awt.Window
javax.swing.DefaultCellEditor
sun.net.www.protocol.httpDigestAuthentication

and some other classes.


More information about the core-libs-dev mailing list