8283801: Cleanup confusing String.toString calls

Reviewed-by: bpb
This commit is contained in:
Andrey Turbanov 2022-03-30 21:09:55 +00:00
parent ce27d9dd5e
commit b8dd21b790
4 changed files with 10 additions and 14 deletions
src
jdk.compiler/share/classes/com/sun/tools/javac/processing
jdk.jdeps/share/classes/com/sun/tools
jdk.jpackage/share/classes/jdk/jpackage/internal

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -54,7 +54,6 @@ import static javax.tools.StandardLocation.CLASS_OUTPUT;
import com.sun.tools.javac.code.Lint;
import com.sun.tools.javac.code.Symbol.ClassSymbol;
import com.sun.tools.javac.code.Symbol.ModuleSymbol;
import com.sun.tools.javac.code.Symbol.TypeSymbol;
import com.sun.tools.javac.code.Symtab;
import com.sun.tools.javac.comp.Modules;
import com.sun.tools.javac.model.JavacElements;
@ -63,10 +62,8 @@ import com.sun.tools.javac.util.*;
import com.sun.tools.javac.util.DefinedBy.Api;
import static com.sun.tools.javac.code.Lint.LintCategory.PROCESSING;
import com.sun.tools.javac.code.Symbol;
import com.sun.tools.javac.code.Symbol.PackageSymbol;
import com.sun.tools.javac.main.Option;
import java.util.stream.Collectors;
/**
* The FilerImplementation class must maintain a number of
@ -547,12 +544,11 @@ public class JavacFiler implements Filer, Closeable {
locationCheck(location);
String strPkg = pkg.toString();
if (strPkg.length() > 0)
checkName(strPkg);
if (pkg.length() > 0)
checkName(pkg);
FileObject fileObject =
fileManager.getFileForOutputForOriginatingFiles(location, strPkg,
fileManager.getFileForOutputForOriginatingFiles(location, pkg,
relativeName.toString(), originatingFiles(originatingElements));
checkFileReopening(fileObject, true);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -62,7 +62,7 @@ public class TypeAnnotation {
@Override
public String toString() {
try {
return "@" + constant_pool.getUTF8Value(annotation.type_index).toString().substring(1) +
return "@" + constant_pool.getUTF8Value(annotation.type_index).substring(1) +
" pos: " + position.toString();
} catch (Exception e) {
e.printStackTrace();

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -125,7 +125,7 @@ public class LocalVariableTypeTableWriter extends InstructionDetailWriter {
print(" // ");
Descriptor d = new Signature(entry.signature_index);
try {
print(d.getFieldType(constant_pool).toString().replace("/", "."));
print(d.getFieldType(constant_pool).replace("/", "."));
} catch (InvalidDescriptor e) {
print(report(e));
} catch (ConstantPoolException e) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -70,7 +70,7 @@ enum Platform {UNKNOWN, WINDOWS, LINUX, MAC;
platform = Platform.UNKNOWN;
}
String version = System.getProperty("os.version").toString();
String version = System.getProperty("os.version");
String[] parts = version.split(Pattern.quote("."));
if (parts.length > 0) {