mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Bug 491945 - Remove new String() from expressions
Replace all occurrences of `new String(expr)` with `expr` provided that the `expr` is not a byte array or a char array. Change-Id: Iecae801b83084908b60b9e146eba87550eac640d Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
This commit is contained in:
parent
ca4e5b10ee
commit
470de4e66b
15 changed files with 49 additions and 55 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2015 IBM Corporation and others.
|
* Copyright (c) 2000, 2016 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -132,11 +132,7 @@ public class StringMatcher {
|
||||||
|
|
||||||
/* convert case */
|
/* convert case */
|
||||||
if (fIgnoreCase) {
|
if (fIgnoreCase) {
|
||||||
char[] chars= aPattern.toCharArray();
|
fPattern= aPattern.toUpperCase();
|
||||||
for (int i = 0; i < chars.length; i++) {
|
|
||||||
chars[i]= Character.toUpperCase(chars[i]);
|
|
||||||
}
|
|
||||||
fPattern= new String(chars);
|
|
||||||
} else {
|
} else {
|
||||||
fPattern= aPattern;
|
fPattern= aPattern;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class ManagedBuildCommandLineGenerator implements
|
||||||
String commandLinePattern) {
|
String commandLinePattern) {
|
||||||
ManagedBuildCommandLineInfo info = new ManagedBuildCommandLineInfo();
|
ManagedBuildCommandLineInfo info = new ManagedBuildCommandLineInfo();
|
||||||
// Concatenate the tool name and the passed in command name
|
// Concatenate the tool name and the passed in command name
|
||||||
info.commandName = new String(tool.getName() + commandName);
|
info.commandName = tool.getName() + commandName;
|
||||||
// Put out the flags backwards
|
// Put out the flags backwards
|
||||||
String myflags = ""; // $NON-NLS-1$
|
String myflags = ""; // $NON-NLS-1$
|
||||||
for (int i = flags.length - 1; i >= 0; i--) {
|
for (int i = flags.length - 1; i >= 0; i--) {
|
||||||
|
@ -62,9 +62,9 @@ public class ManagedBuildCommandLineGenerator implements
|
||||||
}
|
}
|
||||||
info.commandInputs = myinputs;
|
info.commandInputs = myinputs;
|
||||||
// Don't change the command line pattern
|
// Don't change the command line pattern
|
||||||
info.commandLinePattern = new String(commandLinePattern);
|
info.commandLinePattern = commandLinePattern;
|
||||||
// Config artifact name
|
// Config artifact name
|
||||||
info.commandOutput = new String(((IToolChain)tool.getParent()).getParent().getArtifactName());
|
info.commandOutput = ((IToolChain)tool.getParent()).getParent().getArtifactName();
|
||||||
// -Oh
|
// -Oh
|
||||||
info.commandOutputFlag = "-0h";
|
info.commandOutputFlag = "-0h";
|
||||||
// ""
|
// ""
|
||||||
|
|
|
@ -58,11 +58,11 @@ public class Test30_2_CommandLineGenerator implements
|
||||||
String commandLinePattern) {
|
String commandLinePattern) {
|
||||||
ManagedBuildCommandLineInfo info = new ManagedBuildCommandLineInfo();
|
ManagedBuildCommandLineInfo info = new ManagedBuildCommandLineInfo();
|
||||||
// We are only going to change the "flags" to remove the "test30_2.tar-list.filename" option
|
// We are only going to change the "flags" to remove the "test30_2.tar-list.filename" option
|
||||||
info.commandName = new String(commandName);
|
info.commandName = commandName;
|
||||||
info.commandOutputFlag = new String(outputFlag);
|
info.commandOutputFlag = outputFlag;
|
||||||
info.commandOutputPrefix = new String(outputPrefix);
|
info.commandOutputPrefix = outputPrefix;
|
||||||
info.commandOutput = new String(outputName);
|
info.commandOutput = outputName;
|
||||||
info.commandLinePattern = new String(commandLinePattern);
|
info.commandLinePattern = commandLinePattern;
|
||||||
info.commandInputs = ""; // $NON-NLS-1$
|
info.commandInputs = ""; // $NON-NLS-1$
|
||||||
for (int i = 0; i < inputResources.length; i++) {
|
for (int i = 0; i < inputResources.length; i++) {
|
||||||
if (i > 0) info.commandInputs += " ";
|
if (i > 0) info.commandInputs += " ";
|
||||||
|
|
|
@ -43,8 +43,6 @@ import org.osgi.framework.Version;
|
||||||
|
|
||||||
public class ResourceConfiguration extends ResourceInfo implements IFileInfo {
|
public class ResourceConfiguration extends ResourceInfo implements IFileInfo {
|
||||||
|
|
||||||
private static final String EMPTY_STRING = ""; // $NON-NLS-1$
|
|
||||||
|
|
||||||
//property name for holding the rebuild state
|
//property name for holding the rebuild state
|
||||||
private static final String REBUILD_STATE = "rebuildState"; //$NON-NLS-1$
|
private static final String REBUILD_STATE = "rebuildState"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -139,7 +137,7 @@ public class ResourceConfiguration extends ResourceInfo implements IFileInfo {
|
||||||
setManagedBuildRevision(folderInfo.getParent().getManagedBuildRevision());
|
setManagedBuildRevision(folderInfo.getParent().getManagedBuildRevision());
|
||||||
|
|
||||||
setDirty(false);
|
setDirty(false);
|
||||||
toolsToInvoke = EMPTY_STRING;
|
toolsToInvoke = ""; // $NON-NLS-1$
|
||||||
rcbsApplicability = KIND_DISABLE_RCBS_TOOL;
|
rcbsApplicability = KIND_DISABLE_RCBS_TOOL;
|
||||||
|
|
||||||
|
|
||||||
|
@ -187,7 +185,7 @@ public class ResourceConfiguration extends ResourceInfo implements IFileInfo {
|
||||||
|
|
||||||
// Copy the remaining attributes
|
// Copy the remaining attributes
|
||||||
if (cloneConfig.toolsToInvoke != null) {
|
if (cloneConfig.toolsToInvoke != null) {
|
||||||
toolsToInvoke = new String(cloneConfig.toolsToInvoke);
|
toolsToInvoke = cloneConfig.toolsToInvoke;
|
||||||
}
|
}
|
||||||
if (cloneConfig.rcbsApplicability != null) {
|
if (cloneConfig.rcbsApplicability != null) {
|
||||||
rcbsApplicability = cloneConfig.rcbsApplicability;
|
rcbsApplicability = cloneConfig.rcbsApplicability;
|
||||||
|
@ -554,10 +552,10 @@ public class ResourceConfiguration extends ResourceInfo implements IFileInfo {
|
||||||
* An empty string implies treat as if no resource configuration, i.e., use project level tool.
|
* An empty string implies treat as if no resource configuration, i.e., use project level tool.
|
||||||
* This getter routine returns an ITool[] to consumers (i.e., the makefile generator).
|
* This getter routine returns an ITool[] to consumers (i.e., the makefile generator).
|
||||||
*/
|
*/
|
||||||
String t_ToolsToInvoke = EMPTY_STRING;
|
String t_ToolsToInvoke = ""; // $NON-NLS-1$
|
||||||
ITool[] resConfigTools;
|
ITool[] resConfigTools;
|
||||||
ITool[] tools;
|
ITool[] tools;
|
||||||
String rcbsToolId = EMPTY_STRING;
|
String rcbsToolId = ""; // $NON-NLS-1$
|
||||||
int len;
|
int len;
|
||||||
int j;
|
int j;
|
||||||
int rcbsToolIdx=-1;
|
int rcbsToolIdx=-1;
|
||||||
|
@ -573,7 +571,7 @@ public class ResourceConfiguration extends ResourceInfo implements IFileInfo {
|
||||||
* If no tools are currently defined, return a zero lengh array of ITool.
|
* If no tools are currently defined, return a zero lengh array of ITool.
|
||||||
*/
|
*/
|
||||||
if (resConfigTools.length == 0) {
|
if (resConfigTools.length == 0) {
|
||||||
toolsToInvoke = EMPTY_STRING;
|
toolsToInvoke = ""; // $NON-NLS-1$
|
||||||
tools = new ITool[0];
|
tools = new ITool[0];
|
||||||
return tools;
|
return tools;
|
||||||
}
|
}
|
||||||
|
@ -588,7 +586,7 @@ public class ResourceConfiguration extends ResourceInfo implements IFileInfo {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!rcbsToolId.equals(EMPTY_STRING)){
|
if (!rcbsToolId.equals("")){ // $NON-NLS-1$
|
||||||
/*
|
/*
|
||||||
* Here if an rcbs tool is defined.
|
* Here if an rcbs tool is defined.
|
||||||
* Apply the tools according to the current rcbsApplicability setting.
|
* Apply the tools according to the current rcbsApplicability setting.
|
||||||
|
@ -634,7 +632,7 @@ public class ResourceConfiguration extends ResourceInfo implements IFileInfo {
|
||||||
*/
|
*/
|
||||||
if(resConfigTools.length == 1){
|
if(resConfigTools.length == 1){
|
||||||
tools = new ITool[0];
|
tools = new ITool[0];
|
||||||
toolsToInvoke = EMPTY_STRING;
|
toolsToInvoke = ""; // $NON-NLS-1$
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
j = 0;
|
j = 0;
|
||||||
|
|
|
@ -138,7 +138,7 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
|
||||||
superClass = targetPlatform.isExtensionTargetPlatform ? targetPlatform : targetPlatform.superClass;
|
superClass = targetPlatform.isExtensionTargetPlatform ? targetPlatform : targetPlatform.superClass;
|
||||||
if (superClass != null) {
|
if (superClass != null) {
|
||||||
// if (targetPlatform.superClassId != null) {
|
// if (targetPlatform.superClassId != null) {
|
||||||
superClassId = superClass.getId();// new String(targetPlatform.superClassId);
|
superClassId = superClass.getId();// targetPlatform.superClassId;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
setId(Id);
|
setId(Id);
|
||||||
|
@ -150,10 +150,10 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
|
||||||
|
|
||||||
// Copy the remaining attributes
|
// Copy the remaining attributes
|
||||||
if (targetPlatform.unusedChildren != null) {
|
if (targetPlatform.unusedChildren != null) {
|
||||||
unusedChildren = new String(targetPlatform.unusedChildren);
|
unusedChildren = targetPlatform.unusedChildren;
|
||||||
}
|
}
|
||||||
if (targetPlatform.errorParserIds != null) {
|
if (targetPlatform.errorParserIds != null) {
|
||||||
errorParserIds = new String(targetPlatform.errorParserIds);
|
errorParserIds = targetPlatform.errorParserIds;
|
||||||
}
|
}
|
||||||
if (targetPlatform.isAbstract != null) {
|
if (targetPlatform.isAbstract != null) {
|
||||||
isAbstract = targetPlatform.isAbstract;
|
isAbstract = targetPlatform.isAbstract;
|
||||||
|
|
|
@ -793,7 +793,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getMakefileName() {
|
public String getMakefileName() {
|
||||||
return new String(MAKEFILE_NAME);
|
return MAKEFILE_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -75,10 +75,10 @@ public class BuildStepsTab extends AbstractCBuildPropertyTab {
|
||||||
private Set<String> set4 = new TreeSet<String>();
|
private Set<String> set4 = new TreeSet<String>();
|
||||||
|
|
||||||
private static final String[] rcbsApplicabilityRules = {
|
private static final String[] rcbsApplicabilityRules = {
|
||||||
new String(Messages.ResourceCustomBuildStepBlock_label_applicability_rule_override),
|
Messages.ResourceCustomBuildStepBlock_label_applicability_rule_override,
|
||||||
// new String(ManagedBuilderMessages_getResourceString("ResourceCustomBuildStepBlock_label_applicability_rule_before")),
|
// ManagedBuilderMessages_getResourceString("ResourceCustomBuildStepBlock_label_applicability_rule_before"),
|
||||||
// new String(ManagedBuilderMessages_getResourceString("ResourceCustomBuildStepBlock_label_applicability_rule_after")),
|
// ManagedBuilderMessages_getResourceString("ResourceCustomBuildStepBlock_label_applicability_rule_after"),
|
||||||
new String(Messages.ResourceCustomBuildStepBlock_label_applicability_rule_disable),
|
Messages.ResourceCustomBuildStepBlock_label_applicability_rule_disable,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class ExpectedStrings {
|
||||||
int x;
|
int x;
|
||||||
expStrings=new String[values.length];
|
expStrings=new String[values.length];
|
||||||
for (x=0;x<values.length;x++) {
|
for (x=0;x<values.length;x++) {
|
||||||
expStrings[x]=new String(values[x]);
|
expStrings[x]=values[x];
|
||||||
}
|
}
|
||||||
foundStrings=new boolean[values.length];
|
foundStrings=new boolean[values.length];
|
||||||
for (x=0;x<values.length;x++) {
|
for (x=0;x<values.length;x++) {
|
||||||
|
@ -62,7 +62,7 @@ public class ExpectedStrings {
|
||||||
* and extra string
|
* and extra string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extraStrings.push(new String(current));
|
extraStrings.push(current);
|
||||||
extra=true;
|
extra=true;
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008, 2015 Wind River Systems, Inc. and others.
|
* Copyright (c) 2008, 2016 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -248,7 +248,7 @@ public abstract class ASTTranslationUnit extends ASTNode implements IASTTranslat
|
||||||
public final String getFilePath() {
|
public final String getFilePath() {
|
||||||
if (fLocationResolver == null)
|
if (fLocationResolver == null)
|
||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
return new String(fLocationResolver.getTranslationUnitPath());
|
return fLocationResolver.getTranslationUnitPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2013 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2016 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -32,7 +32,7 @@ class LocationCtxFile extends LocationCtxContainer {
|
||||||
int parentOffset, int parentEndOffset, int sequenceNumber,
|
int parentOffset, int parentEndOffset, int sequenceNumber,
|
||||||
ASTInclusionStatement inclusionStatement, boolean isSource) {
|
ASTInclusionStatement inclusionStatement, boolean isSource) {
|
||||||
super(parent, source, parentOffset, parentEndOffset, sequenceNumber);
|
super(parent, source, parentOffset, parentEndOffset, sequenceNumber);
|
||||||
fFilename= new String(filename);
|
fFilename= filename;
|
||||||
fASTInclude= inclusionStatement;
|
fASTInclude= inclusionStatement;
|
||||||
fIsSource= isSource;
|
fIsSource= isSource;
|
||||||
}
|
}
|
||||||
|
@ -156,4 +156,4 @@ class LocationCtxFile extends LocationCtxContainer {
|
||||||
public void setOffsetOfIncludeExport(int fOffsetOfIncludeExport) {
|
public void setOffsetOfIncludeExport(int fOffsetOfIncludeExport) {
|
||||||
this.fOffsetOfIncludeExport = fOffsetOfIncludeExport;
|
this.fOffsetOfIncludeExport = fOffsetOfIncludeExport;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2014 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2016 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -481,7 +481,7 @@ public class LocationMap implements ILocationResolver {
|
||||||
@Override
|
@Override
|
||||||
public String getContainingFilePath(int sequenceNumber) {
|
public String getContainingFilePath(int sequenceNumber) {
|
||||||
LocationCtx ctx= fRootContext.findSurroundingContext(sequenceNumber, 1);
|
LocationCtx ctx= fRootContext.findSurroundingContext(sequenceNumber, 1);
|
||||||
return new String(ctx.getFilePath());
|
return ctx.getFilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005, 2014 IBM Corporation and others.
|
* Copyright (c) 2005, 2016 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -603,7 +603,7 @@ outer:
|
||||||
* @return the previous line, save in the working buffer.
|
* @return the previous line, save in the working buffer.
|
||||||
*/
|
*/
|
||||||
public String getPreviousLine() {
|
public String getPreviousLine() {
|
||||||
return new String((previousLine) == null ? "" : previousLine); //$NON-NLS-1$
|
return previousLine == null ? "" : previousLine; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class ExpectedStrings {
|
||||||
int x;
|
int x;
|
||||||
expStrings=new String[values.length];
|
expStrings=new String[values.length];
|
||||||
for (x=0;x<values.length;x++) {
|
for (x=0;x<values.length;x++) {
|
||||||
expStrings[x]=new String(values[x]);
|
expStrings[x]=values[x];
|
||||||
}
|
}
|
||||||
foundStrings=new boolean[values.length];
|
foundStrings=new boolean[values.length];
|
||||||
for (x=0;x<values.length;x++) {
|
for (x=0;x<values.length;x++) {
|
||||||
|
@ -62,7 +62,7 @@ public class ExpectedStrings {
|
||||||
* and extra string
|
* and extra string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extraStrings.push(new String(current));
|
extraStrings.push(current);
|
||||||
extra=true;
|
extra=true;
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005, 2015 IBM Corporation and others.
|
* Copyright (c) 2005, 2016 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -605,7 +605,7 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
|
||||||
if (i < tabWidth)
|
if (i < tabWidth)
|
||||||
indentPrefixes[i+1]= spaces + '\t';
|
indentPrefixes[i+1]= spaces + '\t';
|
||||||
else
|
else
|
||||||
indentPrefixes[i+1]= new String(spaces);
|
indentPrefixes[i+1]= spaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
indentPrefixes[tabWidth + 1]= ""; //$NON-NLS-1$
|
indentPrefixes[tabWidth + 1]= ""; //$NON-NLS-1$
|
||||||
|
|
|
@ -128,18 +128,18 @@ public class MIBreakpoint {
|
||||||
|
|
||||||
public MIBreakpoint(MIBreakpoint other) {
|
public MIBreakpoint(MIBreakpoint other) {
|
||||||
number = other.number;
|
number = other.number;
|
||||||
type = new String(other.type);
|
type = other.type;
|
||||||
disp = new String(other.disp);
|
disp = other.disp;
|
||||||
enabled = other.enabled;
|
enabled = other.enabled;
|
||||||
address = new String(other.address);
|
address = other.address;
|
||||||
func = new String(other.func);
|
func = other.func;
|
||||||
fullName = new String(other.fullName);
|
fullName = other.fullName;
|
||||||
file = new String(other.file);
|
file = other.file;
|
||||||
line = other.line;
|
line = other.line;
|
||||||
cond = new String(other.cond);
|
cond = other.cond;
|
||||||
times = other.times;
|
times = other.times;
|
||||||
exp = new String(other.exp);
|
exp = other.exp;
|
||||||
threadId = new String(other.threadId);
|
threadId = other.threadId;
|
||||||
ignore = other.ignore;
|
ignore = other.ignore;
|
||||||
commands = other.commands;
|
commands = other.commands;
|
||||||
passcount= other.passcount;
|
passcount= other.passcount;
|
||||||
|
|
Loading…
Add table
Reference in a new issue