8214971: Replace use of string.equals("") with isEmpty()

Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad
This commit is contained in:
Roger Riggs 2018-12-07 11:51:17 -05:00
parent df5b42f33b
commit 938b844088
95 changed files with 195 additions and 195 deletions

View file

@ -1366,7 +1366,7 @@ class ConstantPool {
}
if (tag == CONSTANT_Utf8) {
// Special case: First Utf8 must always be empty string.
assert(cpMap.length == 0 || cpMap[0].stringValue().equals(""));
assert(cpMap.length == 0 || cpMap[0].stringValue().isEmpty());
}
indexByTag[tag] = ix;
// decache indexes derived from this one:

View file

@ -208,7 +208,7 @@ class Driver {
}
}
if (logFile != null && !logFile.equals("")) {
if (logFile != null && !logFile.isEmpty()) {
if (logFile.equals("-")) {
System.setErr(System.out);
} else {
@ -246,7 +246,7 @@ class Driver {
}
newfile = packfile;
// The optional second argument is the source JAR file.
if (jarfile.equals("")) {
if (jarfile.isEmpty()) {
// If only one file is given, it is the only JAR.
// It serves as both input and output.
jarfile = newfile;
@ -352,7 +352,7 @@ class Driver {
if (Utils.isGZIPMagic(Utils.readMagic(inBuf))) {
in = new GZIPInputStream(in);
}
String outfile = newfile.equals("")? jarfile: newfile;
String outfile = newfile.isEmpty()? jarfile: newfile;
OutputStream fileOut;
if (outfile.equals("-"))
fileOut = System.out;
@ -366,7 +366,7 @@ class Driver {
// At this point, we have a good jarfile (or newfile, if -r)
}
if (!bakfile.equals("")) {
if (!bakfile.isEmpty()) {
// On success, abort jarfile recovery bracket.
new File(bakfile).delete();
bakfile = "";
@ -374,13 +374,13 @@ class Driver {
} finally {
// Close jarfile recovery bracket.
if (!bakfile.equals("")) {
if (!bakfile.isEmpty()) {
File jarFile = new File(jarfile);
jarFile.delete(); // Win32 requires this, see above
new File(bakfile).renameTo(jarFile);
}
// In all cases, delete temporary *.pack.
if (!tmpfile.equals(""))
if (!tmpfile.isEmpty())
new File(tmpfile).delete();
}
}

View file

@ -685,7 +685,7 @@ class Package {
return; // do not choose yet
}
String canonName = canonicalFileName();
if (file.nameString.equals("")) {
if (file.nameString.isEmpty()) {
file.nameString = canonName;
}
if (file.nameString.equals(canonName)) {
@ -706,7 +706,7 @@ class Package {
public java.io.File getFileName(java.io.File parent) {
String name = file.name.stringValue();
if (name.equals(""))
if (name.isEmpty())
name = canonicalFileName();
String fname = name.replace('/', java.io.File.separatorChar);
return new java.io.File(parent, fname);
@ -779,7 +779,7 @@ class Package {
}
public boolean isTrivialClassStub() {
return isClassStub()
&& name.stringValue().equals("")
&& name.stringValue().isEmpty()
&& (modtime == NO_MODTIME || modtime == default_modtime)
&& (options &~ FO_IS_CLASS_STUB) == 0;
}

View file

@ -646,7 +646,7 @@ class PackageWriter extends BandStructure {
return; // nothing to write
// The first element must always be the empty string.
assert(cpMap[0].stringValue().equals(""));
assert(cpMap[0].stringValue().isEmpty());
final int SUFFIX_SKIP_1 = 1;
final int PREFIX_SKIP_2 = 2;

View file

@ -237,7 +237,7 @@ public class PackerImpl extends TLGlobals implements Pack200.Packer {
final long segmentLimit;
{
long limit;
if (props.getProperty(Pack200.Packer.SEGMENT_LIMIT, "").equals(""))
if (props.getProperty(Pack200.Packer.SEGMENT_LIMIT, "").isEmpty())
limit = -1;
else
limit = props.getLong(Pack200.Packer.SEGMENT_LIMIT);