Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use char notation to represent a character to improve performance. #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/main/org/apache/tools/ant/AntClassLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ protected void addPathFile(final File pathComponent) throws IOException {
}

final String absPathPlusTimeAndLength = pathComponent.getAbsolutePath()
+ pathComponent.lastModified() + "-" + pathComponent.length();
+ pathComponent.lastModified() + '-' + pathComponent.length();
String classpath = pathMap.get(absPathPlusTimeAndLength);
if (classpath == null) {
try (JarFile jarFile = new JarFile(pathComponent)) {
Expand Down Expand Up @@ -1232,7 +1232,7 @@ private Certificate[] getCertificates(final File container, final String entry)
* @param manifest the jar's manifest
*/
protected void definePackage(final File container, final String packageName, final Manifest manifest) {
final String sectionName = packageName.replace('.', '/') + "/";
final String sectionName = packageName.replace('.', '/') + '/';

String specificationTitle = null;
String specificationVendor = null;
Expand Down Expand Up @@ -1368,7 +1368,7 @@ private Class<?> findClassInComponents(final String name)
try {
stream = getResourceStream(pathComponent, classFilename);
if (stream != null) {
log("Loaded from " + pathComponent + " "
log("Loaded from " + pathComponent + ' '
+ classFilename, Project.MSG_DEBUG);
return getClassFromStream(stream, name, pathComponent);
}
Expand All @@ -1377,7 +1377,7 @@ private Class<?> findClassInComponents(final String name)
} catch (final IOException ioe) {
// ioe.printStackTrace();
log("Exception reading component " + pathComponent + " (reason: "
+ ioe.getMessage() + ")", Project.MSG_VERBOSE);
+ ioe.getMessage() + ')', Project.MSG_VERBOSE);
} finally {
FileUtils.close(stream);
}
Expand Down Expand Up @@ -1539,7 +1539,7 @@ public void addJavaLibraries() {
*/
@Override
public String toString() {
return "AntClassLoader[" + getClasspath() + "]";
return "AntClassLoader[" + getClasspath() + ']';
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private void collectArgumentProcessors() {
} catch (Exception e) {
System.err.println("Unable to load ArgumentProcessor from service "
+ SERVICE_ID + " (" + e.getClass().getName() + ": "
+ e.getMessage() + ")");
+ e.getMessage() + ')');
if (DEBUG) {
e.printStackTrace(System.err); //NOSONAR
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/org/apache/tools/ant/DefaultLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public void targetStarted(BuildEvent event) {
if (Project.MSG_INFO <= msgOutputLevel
&& !event.getTarget().getName().equals("")) {
String msg = StringUtils.LINE_SEP
+ event.getTarget().getName() + ":";
+ event.getTarget().getName() + ':';
printMessage(msg, out, event.getPriority());
log(msg);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/org/apache/tools/ant/Location.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public String toString() {
buf.append(fileName);

if (lineNumber != 0) {
buf.append(":");
buf.append(':');
buf.append(lineNumber);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/org/apache/tools/ant/NoBannerLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void messageLogged(BuildEvent event) {

synchronized (this) {
if (null != targetName) {
out.println(StringUtils.LINE_SEP + targetName + ":");
out.println(StringUtils.LINE_SEP + targetName + ':');
targetName = null;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/org/apache/tools/ant/PathTokenizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public String nextToken() throws NoSuchElementException {
// we know we are on a DOS style platform and the next path
// starts with a slash or backslash, so we know this is a
// drive spec
token += ":" + nextToken;
token += ':' + nextToken;
} else {
// store the token just read for next time
lookahead = nextToken;
Expand All @@ -145,9 +145,9 @@ public String nextToken() throws NoSuchElementException {
// it indeed is a drive spec, get the next bit
String oneMore = tokenizer.nextToken().trim();
if (!oneMore.equals(File.pathSeparator)) {
token += ":" + oneMore;
token += ':' + oneMore;
} else {
token += ":";
token += ':';
lookahead = oneMore;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/org/apache/tools/ant/XmlLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private static class TimedElement {

@Override
public String toString() {
return element.getTagName() + ":" + element.getAttribute("name");
return element.getTagName() + ':' + element.getAttribute("name");
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/org/apache/tools/ant/input/DefaultInputHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ protected String getPrompt(InputRequest request) {
}
first = false;
}
sb.append(")");
sb.append(')');
return sb.toString();
} else if (def != null) {
return prompt + " [" + def + "]";
return prompt + " [" + def + ']';
} else {
return prompt;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/org/apache/tools/ant/taskdefs/Ant.java
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ && getOwningTarget() != null) {
.addLocationToBuildException(ex, getLocation());
throw be;
} finally {
log("Exiting " + antFile + ".", Project.MSG_VERBOSE);
log("Exiting " + antFile + '.', Project.MSG_VERBOSE);
newProject.fireSubBuildFinished(be);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/org/apache/tools/ant/taskdefs/Classloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void execute() {
// The core loader must be reverse
//reverse=true;
}
getProject().log("Setting parent loader " + name + " "
getProject().log("Setting parent loader " + name + ' '
+ parent + " " + parentFirst, Project.MSG_DEBUG);

// The param is "parentFirst"
Expand All @@ -225,7 +225,7 @@ public void execute() {
for (int i = 0; i < list.length; i++) {
File f = new File(list[i]);
if (f.exists()) {
log("Adding to class loader " + acl + " " + f.getAbsolutePath(),
log("Adding to class loader " + acl + ' ' + f.getAbsolutePath(),
Project.MSG_DEBUG);
acl.addPathElement(f.getAbsolutePath());
}
Expand Down