Fixed unnecessarily escaped character

GitOrigin-RevId: 9532833be54e94cfe74dee90f4ca815790d7f5be
This commit is contained in:
Tagir Valeev
2020-05-13 08:15:05 +00:00
committed by intellij-monorepo-bot
parent 6515b045d9
commit 7d59ffde38
63 changed files with 114 additions and 107 deletions
@@ -85,7 +85,7 @@ public class PrimitiveRenderer extends NodeRendererImpl {
static void appendCharValue(CharValue value, StringBuilder buf) {
buf.append('\'');
String s = value.toString();
StringUtil.escapeStringCharacters(s.length(), s, "\'", buf);
StringUtil.escapeStringCharacters(s.length(), s, "'", buf);
buf.append('\'');
}
@@ -212,7 +212,7 @@ public class ModuleNameLocationComponent implements ModuleNameLocationSettings {
module = ModuleManager.getInstance(project).findModuleByName(moduleName);
}
if (module != null) {
throw new ConfigurationException("Module \'" + moduleName + "\' already exist in project. Please, specify another name.");
throw new ConfigurationException("Module '" + moduleName + "' already exist in project. Please, specify another name.");
}
}
@@ -55,10 +55,10 @@ public class CreateModuleFromSourcesMode extends CreateFromSourcesMode {
final String path = myPathPanel.getText().trim();
final File file = new File(path);
if (!file.exists()) {
throw new ConfigurationException("File \'" + path + "\' doesn't exist");
throw new ConfigurationException("File '" + path + "' doesn't exist");
}
if (!file.isDirectory()) {
throw new ConfigurationException("\'" + path + "\' is not a directory");
throw new ConfigurationException("'" + path + "' is not a directory");
}
return super.validate();
}
@@ -58,7 +58,7 @@ public abstract class QualifyThisOrSuperArgumentFix implements IntentionAction {
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
if (!myExpression.isValid()) return false;
if (!myPsiClass.isValid()) return false;
myText = "Qualify " + getQualifierText() + " expression with \'" + myPsiClass.getQualifiedName() + "\'";
myText = "Qualify " + getQualifierText() + " expression with '" + myPsiClass.getQualifiedName() + "'";
return true;
}
@@ -191,7 +191,7 @@ public class CodeStyleGenerationConfigurable implements CodeStyleConfigurable {
text = text.trim();
if (text.isEmpty()) return text;
if (!StringUtil.isJavaIdentifier(text)) {
throw new ConfigurationException("Not a valid java identifier part in " + (prefix ? "prefix" : "suffix") + " \'" + text + "\'");
throw new ConfigurationException("Not a valid java identifier part in " + (prefix ? "prefix" : "suffix") + " '" + text + "'");
}
return text;
}
@@ -143,25 +143,25 @@ public class PullAsAbstractUpFix extends LocalQuickFixAndIntentionActionOnPsiEle
final PsiManager manager = containingClass.getManager();
boolean canBePulledUp = true;
String name = "Pull method \'" + methodWithOverrides.getName() + "\' up";
String name = "Pull method '" + methodWithOverrides.getName() + "' up";
if (containingClass instanceof PsiAnonymousClass) {
final PsiClassType baseClassType = ((PsiAnonymousClass)containingClass).getBaseClassType();
final PsiClass baseClass = baseClassType.resolve();
if (baseClass == null) return;
if (!BaseIntentionAction.canModify(baseClass)) return;
if (!baseClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
name = "Pull method \'" + methodWithOverrides.getName() + "\' up and make it abstract";
name = "Pull method '" + methodWithOverrides.getName() + "' up and make it abstract";
}
} else {
final LinkedHashSet<PsiClass> classesToPullUp = new LinkedHashSet<>();
collectClassesToPullUp(manager, classesToPullUp, containingClass.getExtendsListTypes());
collectClassesToPullUp(manager, classesToPullUp, containingClass.getImplementsListTypes());
if (classesToPullUp.isEmpty()) {
name = "Extract method \'" + methodWithOverrides.getName() + "\' to new interface";
name = "Extract method '" + methodWithOverrides.getName() + "' to new interface";
canBePulledUp = false;
} else if (classesToPullUp.size() == 1) {
final PsiClass baseClass = classesToPullUp.iterator().next();
name = "Pull method \'" + methodWithOverrides.getName() + "\' to \'" + baseClass.getName() + "\'";
name = "Pull method '" + methodWithOverrides.getName() + "' to '" + baseClass.getName() + "'";
if (!baseClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
name+= " and make it abstract";
}
@@ -250,7 +250,7 @@ public class StringLiteralCopyPasteProcessor implements CopyPastePreProcessor {
@NotNull
protected String escapeCharCharacters(@NotNull String s, @NotNull PsiElement token) {
StringBuilder buffer = new StringBuilder();
StringUtil.escapeStringCharacters(s.length(), s, isStringLiteral(token) ? "\"" : "\'", buffer);
StringUtil.escapeStringCharacters(s.length(), s, isStringLiteral(token) ? "\"" : "'", buffer);
return buffer.toString();
}
@@ -32,7 +32,7 @@ public class LiteralFixer implements Fixer {
editor.getDocument().insertString(psiElement.getTextRange().getEndOffset(), "\"");
} else if (((PsiJavaToken) psiElement).getTokenType() == JavaTokenType.CHARACTER_LITERAL &&
!StringUtil.endsWithChar(psiElement.getText(), '\'')) {
editor.getDocument().insertString(psiElement.getTextRange().getEndOffset(), "\'");
editor.getDocument().insertString(psiElement.getTextRange().getEndOffset(), "'");
}
}
}
@@ -159,7 +159,7 @@ class ExtractClassDialog extends RefactoringDialog implements MemberInfoChangeLi
final String className = getClassName();
if (className.length() == 0 || !nameHelper.isIdentifier(className)) {
throw new ConfigurationException("\'" + className + "\' is invalid extracted class name");
throw new ConfigurationException("'" + className + "' is invalid extracted class name");
}
/*final String packageName = getPackageName();
@@ -169,7 +169,7 @@ class ExtractClassDialog extends RefactoringDialog implements MemberInfoChangeLi
for (PsiClass innerClass : innerClasses) {
if (className.equals(innerClass.getName())) {
throw new ConfigurationException(
"Extracted class should have unique name. Name " + "\'" + className + "\' is already in use by one of the inner classes");
"Extracted class should have unique name. Name " + "'" + className + "' is already in use by one of the inner classes");
}
}
}
@@ -175,13 +175,13 @@ public class ExtractClassProcessor extends FixableUsagesRefactoringProcessor {
fieldsNeedingGetter.addAll(visitor.getFieldsNeedingGetter());
fieldsNeedingGetter.addAll(srcVisitor.getFieldsNeedingGetter());
for (PsiField field : fieldsNeedingGetter) {
conflicts.putValue(field, "Field \'" + field.getName() + "\' needs getter");
conflicts.putValue(field, "Field '" + field.getName() + "' needs getter");
}
final Set<PsiField> fieldsNeedingSetter = new LinkedHashSet<>();
fieldsNeedingSetter.addAll(visitor.getFieldsNeedingSetter());
fieldsNeedingSetter.addAll(srcVisitor.getFieldsNeedingSetter());
for (PsiField field : fieldsNeedingSetter) {
conflicts.putValue(field, "Field \'" + field.getName() + "\' needs setter");
conflicts.putValue(field, "Field '" + field.getName() + "' needs setter");
}
}
checkConflicts(refUsages, conflicts);
@@ -98,12 +98,12 @@ public class InheritanceToDelegationDialog extends RefactoringDialog {
final String fieldName = getFieldName();
final PsiNameHelper helper = PsiNameHelper.getInstance(myProject);
if (!helper.isIdentifier(fieldName)){
throw new ConfigurationException("\'" + fieldName + "\' is invalid field name for delegation");
throw new ConfigurationException("'" + fieldName + "' is invalid field name for delegation");
}
if (myInnerClassNameField != null) {
final String className = myInnerClassNameField.getEnteredName();
if (!helper.isIdentifier(className)) {
throw new ConfigurationException("\'" + className + "\' is invalid inner class name");
throw new ConfigurationException("'" + className + "' is invalid inner class name");
}
}
}
@@ -238,7 +238,7 @@ public class InlineSuperClassRefactoringProcessor extends FixableUsagesRefactori
conflicts.putValue(targetClass, "Cannot inline into anonymous class.");
}
else if (PsiTreeUtil.isAncestor(mySuperClass, targetClass, false)) {
conflicts.putValue(targetClass, "Cannot inline into the inner class. Move \'" + targetClass.getName() + "\' to upper level");
conflicts.putValue(targetClass, "Cannot inline into the inner class. Move '" + targetClass.getName() + "' to upper level");
}
else {
for (MemberInfo info : myMemberInfos) {
@@ -59,11 +59,11 @@ public class ReplaceWithSubtypeUsageInfo extends FixableUsageInfo {
if (!TypeConversionUtil.isAssignable(myOriginalType, myTargetClassType)) {
final String conflict = "No consistent substitution found for " +
getElement().getText() +
". Expected \'" +
". Expected '" +
myOriginalType.getPresentableText() +
"\' but found \'" +
"' but found '" +
myTargetClassType.getPresentableText() +
"\'.";
"'.";
if (myConflict == null) {
myConflict = conflict;
} else {
@@ -290,7 +290,7 @@ public class IntroduceParameterDialog extends RefactoringDialog {
protected void canRun() throws ConfigurationException {
String name = getParameterName();
if (!PsiNameHelper.getInstance(myProject).isIdentifier(name)) {
throw new ConfigurationException("\'" + name + "\' is invalid parameter name");
throw new ConfigurationException("'" + name + "' is invalid parameter name");
}
}
@@ -203,26 +203,28 @@ public class IntroduceParameterObjectDialog extends AbstractIntroduceParameterOb
final PsiNameHelper nameHelper = PsiNameHelper.getInstance(project);
if (myCreateInnerClassRadioButton.isSelected()) {
final String innerClassName = getInnerClassName();
if (!nameHelper.isIdentifier(innerClassName)) throw new ConfigurationException("\'" + innerClassName + "\' is invalid inner class name");
if (mySourceMethod.getContainingClass().findInnerClassByName(innerClassName, false) != null) throw new ConfigurationException("Inner class with name \'" + innerClassName + "\' already exist");
if (!nameHelper.isIdentifier(innerClassName)) throw new ConfigurationException("'" + innerClassName + "' is invalid inner class name");
if (mySourceMethod.getContainingClass().findInnerClassByName(innerClassName, false) != null) throw new ConfigurationException(
"Inner class with name '" + innerClassName +
"' already exist");
} else if (!useExistingClass()) {
final String className = getClassName();
if (className.length() == 0 || !nameHelper.isIdentifier(className)) {
throw new ConfigurationException("\'" + className + "\' is invalid parameter class name");
throw new ConfigurationException("'" + className + "' is invalid parameter class name");
}
final String packageName = getPackageName();
if (packageName.length() == 0 || !nameHelper.isQualifiedName(packageName)) {
throw new ConfigurationException("\'" + packageName + "\' is invalid parameter class package name");
throw new ConfigurationException("'" + packageName + "' is invalid parameter class package name");
}
}
else {
final String className = getExistingClassName();
if (className.length() == 0 || !nameHelper.isQualifiedName(className)) {
throw new ConfigurationException("\'" + className + "\' is invalid qualified parameter class name");
throw new ConfigurationException("'" + className + "' is invalid qualified parameter class name");
}
if (JavaPsiFacade.getInstance(getProject()).findClass(className, GlobalSearchScope.allScope(getProject())) == null) {
throw new ConfigurationException("\'" + className + "\' does not exist");
throw new ConfigurationException("'" + className + "' does not exist");
}
}
}
@@ -69,7 +69,7 @@ public class AppendAccessorsUsageInfo extends FixableUsageInfo{
if (myField != null) {
fieldName = myField.getName();
}
return (myGetter ? "Getter" : "Setter") + " for field \'" + fieldName + "\' is required";
return (myGetter ? "Getter" : "Setter") + " for field '" + fieldName + "' is required";
}
return null;
}
@@ -332,9 +332,9 @@ public class JavaMoveClassesOrPackagesHandler extends MoveHandlerDelegate {
inLib |= !fileIndex.isInContent(psiDirectory.getVirtualFile());
}
return inLib ? "Package \'" +
return inLib ? "Package '" +
aPackage.getName() +
"\' contains directories in libraries which cannot be moved. Do you want to move current directory" : null;
"' contains directories in libraries which cannot be moved. Do you want to move current directory" : null;
}
private static boolean canMoveOrRearrangePackages(PsiElement[] elements) {
@@ -146,7 +146,7 @@ public class RenamePsiPackageProcessor extends RenamePsiElementProcessor {
final String qualifiedNameAfterRename = getPackageQualifiedNameAfterRename(aPackage, newName, true);
final PsiClass psiClass = JavaPsiFacade.getInstance(project).findClass(qualifiedNameAfterRename, GlobalSearchScope.allScope(project));
if (psiClass != null) {
conflicts.putValue(psiClass, "Class with qualified name \'" + qualifiedNameAfterRename + "\' already exist");
conflicts.putValue(psiClass, "Class with qualified name '" + qualifiedNameAfterRename + "' already exist");
}
}
@@ -198,17 +198,22 @@ public class ReplaceConstructorWithBuilderDialog extends RefactoringDialog {
protected void canRun() throws ConfigurationException {
final PsiNameHelper nameHelper = PsiNameHelper.getInstance(myProject);
for (ParameterData parameterData : myParametersMap.values()) {
if (!nameHelper.isIdentifier(parameterData.getFieldName())) throw new ConfigurationException("\'" + parameterData.getFieldName() + "\' is not a valid field name");
if (!nameHelper.isIdentifier(parameterData.getSetterName())) throw new ConfigurationException("\'" + parameterData.getSetterName() + "\' is not a valid setter name");
if (!nameHelper.isIdentifier(parameterData.getFieldName())) throw new ConfigurationException("'" + parameterData.getFieldName() +
"' is not a valid field name");
if (!nameHelper.isIdentifier(parameterData.getSetterName())) throw new ConfigurationException("'" + parameterData.getSetterName() +
"' is not a valid setter name");
}
if (myCreateBuilderClassRadioButton.isSelected()) {
final String className = myNewClassName.getText().trim();
if (className.length() == 0 || !nameHelper.isQualifiedName(className)) throw new ConfigurationException("\'" + className + "\' is invalid builder class name");
if (className.length() == 0 || !nameHelper.isQualifiedName(className)) throw new ConfigurationException("'" + className +
"' is invalid builder class name");
final String packageName = myPackageTextField.getText().trim();
if (packageName.length() > 0 && !nameHelper.isQualifiedName(packageName)) throw new ConfigurationException("\'" + packageName + "\' is invalid builder package name");
if (packageName.length() > 0 && !nameHelper.isQualifiedName(packageName)) throw new ConfigurationException("'" + packageName +
"' is invalid builder package name");
} else {
final String qualifiedName = myExistentClassTF.getText().trim();
if (qualifiedName.length() == 0 || !nameHelper.isQualifiedName(qualifiedName)) throw new ConfigurationException("\'" + qualifiedName + "\' is invalid builder qualified class name");
if (qualifiedName.length() == 0 || !nameHelper.isQualifiedName(qualifiedName)) throw new ConfigurationException("'" + qualifiedName +
"' is invalid builder qualified class name");
}
}
@@ -397,7 +402,7 @@ public class ReplaceConstructorWithBuilderDialog extends RefactoringDialog {
return null;
}
return !PsiNameHelper.getInstance(myProject).isIdentifier(inputString)
? "Identifier \'" + inputString + "\' is invalid" : null;
? "Identifier '" + inputString + "' is invalid" : null;
}
}
}
@@ -191,7 +191,7 @@ public class ReplaceConstructorWithFactoryDialog extends RefactoringDialog {
final String name = myNameField.getEnteredName();
final PsiNameHelper nameHelper = PsiNameHelper.getInstance(myContainingClass.getProject());
if (!nameHelper.isIdentifier(name)) {
throw new ConfigurationException("\'" + name + "\' is invalid factory method name");
throw new ConfigurationException("'" + name + "' is invalid factory method name");
}
}
}
@@ -181,8 +181,8 @@ public abstract class TypeMigrationDialog extends RefactoringDialog {
protected void canRun() throws ConfigurationException {
super.canRun();
if (!checkType(getMigrationType()))
throw new ConfigurationException("\'" + StringUtil.escapeXmlEntities(myTypeCodeFragment.getText()) + "\' is an invalid type");
if (isVoidVariableMigration()) throw new ConfigurationException("\'void\' is not applicable");
throw new ConfigurationException("'" + StringUtil.escapeXmlEntities(myTypeCodeFragment.getText()) + "' is an invalid type");
if (isVoidVariableMigration()) throw new ConfigurationException("'void' is not applicable");
}
@Override
@@ -96,15 +96,15 @@ class WrapReturnValueDialog extends RefactoringDialog {
final PsiNameHelper nameHelper = PsiNameHelper.getInstance(project);
if (myCreateInnerClassButton.isSelected()) {
final String innerClassName = getInnerClassName().trim();
if (!nameHelper.isIdentifier(innerClassName)) throw new ConfigurationException("\'" + innerClassName + "\' is invalid inner class name");
if (!nameHelper.isIdentifier(innerClassName)) throw new ConfigurationException("'" + innerClassName + "' is invalid inner class name");
final PsiClass containingClass = sourceMethod.getContainingClass();
if (containingClass != null && containingClass.findInnerClassByName(innerClassName, false) != null) {
throw new ConfigurationException("Inner class with name \'" + innerClassName + "\' already exist");
throw new ConfigurationException("Inner class with name '" + innerClassName + "' already exist");
}
} else if (useExistingClassButton.isSelected()) {
final String className = existingClassField.getText().trim();
if (className.length() == 0 || !nameHelper.isQualifiedName(className)) {
throw new ConfigurationException("\'" + className + "\' is invalid qualified wrapper class name");
throw new ConfigurationException("'" + className + "' is invalid qualified wrapper class name");
}
final Object item = myFieldsCombo.getSelectedItem();
if (item == null) {
@@ -113,12 +113,12 @@ class WrapReturnValueDialog extends RefactoringDialog {
} else {
final String className = getClassName();
if (className.length() == 0 || !nameHelper.isIdentifier(className)) {
throw new ConfigurationException("\'" + className + "\' is invalid wrapper class name");
throw new ConfigurationException("'" + className + "' is invalid wrapper class name");
}
final String packageName = getPackageName();
if (packageName.length() == 0 || !nameHelper.isQualifiedName(packageName)) {
throw new ConfigurationException("\'" + packageName + "\' is invalid wrapper class package name");
throw new ConfigurationException("'" + packageName + "' is invalid wrapper class package name");
}
}
}
@@ -52,7 +52,7 @@ public final class CustomFileTypeLexer extends AbstractCustomLexer {
final QuotedStringParser quotedStringParser = new QuotedStringParser("\"", CustomHighlighterTokenType.STRING, table.isHasStringEscapes());
final QuotedStringParser quotedStringParser2 = new QuotedStringParser(
"\'",
"'",
forHighlighting ? CustomHighlighterTokenType.SINGLE_QUOTED_STRING:CustomHighlighterTokenType.STRING,
table.isHasStringEscapes()
);
@@ -165,7 +165,7 @@ public class CharTableImpl implements CharTable {
r.add("</");
r.add("/>");
r.add("\"");
r.add("\'");
r.add("'");
r.add("<![CDATA[");
r.add("]]>");
r.add("<!--");
@@ -142,7 +142,7 @@ public final class CommentByLineCommentHandler extends MultiCaretCodeInsightActi
}
if (context.textContains('\'') || context.textContains('\"') || context.textContains('/')) {
final String s = context.getText();
return StringUtil.startsWith(s, "\"") || StringUtil.startsWith(s, "\'") || StringUtil.startsWith(s, "/");
return StringUtil.startsWith(s, "\"") || StringUtil.startsWith(s, "'") || StringUtil.startsWith(s, "/");
}
return false;
}
@@ -214,7 +214,7 @@ public class CodeInspectionAction extends BaseAnalysisAction {
final InspectionProfileImpl profile = appProfileManager.getProfile(lastSelectedProfileName, false);
if (profile != null) return profile;
} else {
LOG.assertTrue(type == 'p', "Unexpected last selected profile: \'" + lastSelectedProfile + "\'");
LOG.assertTrue(type == 'p', "Unexpected last selected profile: '" + lastSelectedProfile + "'");
final InspectionProfileImpl profile = projectProfileManager.getProfile(lastSelectedProfileName, false);
if (profile != null && profile.isProjectLevel()) return profile;
}
@@ -1532,7 +1532,7 @@ public abstract class ChooseByNameBase implements ChooseByNameViewModel {
final UsageViewPresentation presentation = new UsageViewPresentation();
final String text = getTrimmedText();
final String prefixPattern = myFindUsagesTitle + " \'" + text + "\'";
final String prefixPattern = myFindUsagesTitle + " '" + text + "'";
presentation.setCodeUsagesString(prefixPattern);
presentation.setUsagesInGeneratedCodeString(prefixPattern + " in generated code");
presentation.setTabName(prefixPattern);
@@ -76,7 +76,7 @@ public class ModuleDeleteProvider implements DeleteProvider, TitledHandler {
moduleDescriptions.addAll(unloadedModules);
}
String names = StringUtil.join(moduleDescriptions, description -> "\'" + description.getName() + "\'", ", ");
String names = StringUtil.join(moduleDescriptions, description -> "'" + description.getName() + "'", ", ");
int ret = Messages.showOkCancelDialog(getConfirmationText(names, moduleDescriptions.size()), getActionTitle(), CommonBundle.message("button.remove"), CommonBundle.getCancelButtonText(), Messages.getQuestionIcon());
if (ret != Messages.OK) return;
CommandProcessor.getInstance().executeCommand(project, () -> {
@@ -267,7 +267,7 @@ public class TemplateModuleBuilder extends ModuleBuilder {
for (Trinity<String, String, VelocityException> failure : myFailures) {
reportBuilder.append("File: ").append(failure.getFirst()).append("\n");
reportBuilder.append("Exception:\n").append(ExceptionUtil.getThrowableText(failure.getThird())).append("\n");
reportBuilder.append("File content:\n\'").append(failure.getSecond()).append("\'\n");
reportBuilder.append("File content:\n'").append(failure.getSecond()).append("'\n");
reportBuilder.append("\n===========================================\n");
}
@@ -49,7 +49,7 @@ public class DefaultSearchScopeProviders {
@NotNull
@Override
public String getDisplayName() {
return "Favorite \'" + favorite + "\'";
return "Favorite '" + favorite + "'";
}
@Override
@@ -407,7 +407,7 @@ public class AutomaticRenamingDialog extends DialogWrapper {
public String getErrorText(String inputString) {
final int selectedRow = myTable.getSelectedRow();
if (!isValidName(inputString, selectedRow)) {
return "Identifier \'" + inputString + "\' is invalid";
return "Identifier '" + inputString + "' is invalid";
}
return null;
}
@@ -20,7 +20,7 @@ public final class CommandLineUtil {
private static final Pattern WIN_BACKSLASHES_PRECEDING_QUOTE = Pattern.compile("(\\\\+)(?=\"|$)");
private static final Pattern WIN_CARET_SPECIAL = Pattern.compile("[&<>()@^|!%]");
private static final Pattern WIN_QUOTE_SPECIAL = Pattern.compile("[ \t\"*?\\[{}~()\']"); // + glob [*?] + Cygwin glob [*?\[{}~] + [()']
private static final Pattern WIN_QUOTE_SPECIAL = Pattern.compile("[ \t\"*?\\[{}~()']"); // + glob [*?] + Cygwin glob [*?\[{}~] + [()']
private static final Pattern WIN_QUIET_COMMAND = Pattern.compile("((?:@\\s*)++)(.*)", Pattern.CASE_INSENSITIVE);
private static final String SHELL_WHITELIST_CHARACTERS = "-._/@=";
@@ -82,7 +82,7 @@ public class LengthOneStringInIndexOfInspection
final int length = text.length();
final String character = text.substring(1, length - 1);
switch (character) {
case "\'":
case "'":
return "'\\''";
case "\\\"":
return "'\"'";
@@ -47,12 +47,12 @@ class MakePublicStaticVoidFix extends InspectionGadgetsFix {
MakePublicStaticVoidFix(PsiMethod method, boolean makeStatic, @PsiModifier.ModifierConstant String newVisibility) {
String presentableVisibility = VisibilityUtil.getVisibilityString(newVisibility);
myName = "Change signature of \'" +
myName = "Change signature of '" +
PsiFormatUtil.formatMethod(method, PsiSubstitutor.EMPTY,
PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_MODIFIERS |
PsiFormatUtilBase.SHOW_PARAMETERS | PsiFormatUtilBase.SHOW_TYPE, PsiFormatUtilBase.SHOW_TYPE) +
"\' to \'" + (presentableVisibility.isEmpty() ? "" : presentableVisibility + " ") + (makeStatic ? "static " : "") +
"void " + method.getName() + "()\'";
"' to '" + (presentableVisibility.isEmpty() ? "" : presentableVisibility + " ") + (makeStatic ? "static " : "") +
"void " + method.getName() + "()'";
myMakeStatic = makeStatic;
myNewVisibility = newVisibility;
}
@@ -110,8 +110,8 @@ public class ParameterizedParametersStaticCollectionInspection extends BaseInspe
JavaPsiFacade.getInstance(project).findClass(Collection.class.getName(), GlobalSearchScope.allScope(project));
if (AnnotationUtil.isAnnotated(method, PARAMETERS_FQN, 0)) {
final PsiModifierList modifierList = method.getModifierList();
String fixMessage = "Make method \'" + method.getName() + "\' ";
String errorString = "Method \'#ref()\' should";
String fixMessage = "Make method '" + method.getName() + "' ";
String errorString = "Method '#ref()' should";
String signatureDescription = "";
if (!modifierList.hasModifierProperty(PsiModifier.PUBLIC)) {
signatureDescription += PsiModifier.PUBLIC;
@@ -139,7 +139,7 @@ class CopyrightProfilesPanel extends MasterDetailsComponent implements Searchabl
final String profileName = ((CopyrightConfigurable)node.getConfigurable()).getEditableObject().getName();
if (profiles.contains(profileName)) {
selectNodeInTree(profileName);
throw new ConfigurationException("Duplicate copyright profile name: \'" + profileName + "\'");
throw new ConfigurationException("Duplicate copyright profile name: '" + profileName + "'");
}
profiles.add(profileName);
}
@@ -184,7 +184,7 @@ public class TestDataGuessByExistingFilesUtil {
Module module = ReadAction.compute(() -> ModuleUtilCore.findModuleForPsiElement(psiClass));
Collection<String> fileNames = getAllFileNames(possibleFileName, gotoModel);
ProgressIndicator indicator = EmptyProgressIndicator.notNullize(ProgressManager.getInstance().getProgressIndicator());
indicator.setText("Searching for \'" + test + "\' test data files...");
indicator.setText("Searching for '" + test + "' test data files...");
indicator.setIndeterminate(false);
int fileNamesCount = fileNames.size();
double currentIndex = 0;
@@ -70,26 +70,26 @@ public class EclipseClasspathStorageProvider implements ClasspathStorageProvider
libraryEntry.getRootUrls(OrderRootType.CLASSES).length != 1 ||
library.isJarDirectory(library.getUrls(OrderRootType.CLASSES)[0])) {
throw new ConfigurationException(
"Library \'" +
"Library '" +
entry.getPresentableName() +
"\' from module \'" +
"' from module '" +
moduleName +
"\' dependencies is incompatible with eclipse format which supports only one library content root");
"' dependencies is incompatible with eclipse format which supports only one library content root");
}
}
}
}
if (model.getContentRoots().length == 0) {
throw new ConfigurationException("Module \'" + moduleName + "\' has no content roots thus is not compatible with eclipse format");
throw new ConfigurationException("Module '" + moduleName + "' has no content roots thus is not compatible with eclipse format");
}
final String output = model.getModuleExtension(CompilerModuleExtension.class).getCompilerOutputUrl();
final String contentRoot = getContentRoot(model);
if (output == null ||
!StringUtil.startsWith(VfsUtilCore.urlToPath(output), contentRoot) &&
PathMacroManager.getInstance(model.getModule()).collapsePath(output).equals(output)) {
throw new ConfigurationException("Module \'" +
throw new ConfigurationException("Module '" +
moduleName +
"\' output path is incompatible with eclipse format which supports output under content root only.\nPlease make sure that \"Inherit project compile output path\" is not selected");
"' output path is incompatible with eclipse format which supports output under content root only.\nPlease make sure that \"Inherit project compile output path\" is not selected");
}
}
@@ -181,7 +181,7 @@ public class EPathUtil {
if (file.getFileSystem() instanceof JarFileSystem) {
final VirtualFile jarFile = JarFileSystem.getInstance().getVirtualFileForJar(file);
if (jarFile == null) {
LOG.error("Url: \'" + url + "\'; file: " + file);
LOG.error("Url: '" + url + "'; file: " + file);
return ProjectRootManagerImpl.extractLocalPath(url);
}
file = jarFile;
@@ -582,7 +582,7 @@ class GitHttpGuiAuthenticator implements GitHttpAuthenticator {
@Override
public String toString() {
return "provider=\'" + myProvider.getName() + "\', login='" + myLogin + '\'';
return "provider='" + myProvider.getName() + "', login='" + myLogin + '\'';
}
}
}
@@ -44,6 +44,6 @@ public class DefaultUnresolvedExternalDependency extends AbstractExternalDepende
@Override
public String toString() {
return "Unresolved dependency '" + getId() + "\':" + failureMessage;
return "Unresolved dependency '" + getId() + "':" + failureMessage;
}
}
@@ -224,7 +224,7 @@ public class ConvertStringToMultilineIntention extends Intention {
@Override
public boolean satisfiedBy(@NotNull PsiElement element) {
return element instanceof GrLiteral && ("\"".equals(GrStringUtil.getStartQuote(element.getText())) ||
"\'".equals(GrStringUtil.getStartQuote(element.getText())))
"'".equals(GrStringUtil.getStartQuote(element.getText())))
|| element instanceof GrBinaryExpression && isAppropriateBinary((GrBinaryExpression)element, null);
}
};
@@ -28,7 +28,7 @@ public class ConstExprent extends Exprent {
CHAR_ESCAPES.put(0xC, "\\f"); /* \u000c: form feed FF */
CHAR_ESCAPES.put(0xD, "\\r"); /* \u000d: carriage return CR */
//CHAR_ESCAPES.put(0x22, "\\\""); /* \u0022: double quote " */
CHAR_ESCAPES.put(0x27, "\\\'"); /* \u0027: single quote ' */
CHAR_ESCAPES.put(0x27, "\\'"); /* \u0027: single quote ' */
CHAR_ESCAPES.put(0x5C, "\\\\"); /* \u005c: backslash \ */
}
@@ -97,7 +97,7 @@ public class JavaFxBuiltInAttributeDescriptor extends JavaFxPropertyAttributeDes
if (tagClass != null) {
final PsiField field = controllerClass.findFieldByName(value, true);
if (field != null && !InheritanceUtil.isInheritorOrSelf(tagClass, PsiUtil.resolveClassInType(field.getType()), true)) {
return "Cannot set " + tagClass.getQualifiedName() + " to field \'" + field.getName() + "\'";
return "Cannot set " + tagClass.getQualifiedName() + " to field '" + field.getName() + "'";
}
}
}
@@ -247,7 +247,7 @@ public class JavaFxBuiltInTagDescriptor implements XmlElementDescriptor, Validat
}
}
if (!copyConstructorFound) {
host.addMessage(context.getNavigationElement(), "Copy constructor not found for \'" + psiClass.getName() + "\'",
host.addMessage(context.getNavigationElement(), "Copy constructor not found for '" + psiClass.getName() + "'",
ValidationHost.ErrorType.ERROR);
}
}
@@ -84,7 +84,7 @@ class TestDirectory extends TestPackage {
}
final VirtualFile file = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(dirName));
if (file == null) {
throw new RuntimeConfigurationError("Directory \'" + dirName + "\' is not found");
throw new RuntimeConfigurationError("Directory '" + dirName + "' is not found");
}
final Module module = getConfiguration().getConfigurationModule().getModule();
if (module == null) {
@@ -205,8 +205,8 @@ public class JUnit3IdeaTestRunner extends TestRunner implements IdeaTestRunner {
public void endTest(Test test) {
final long duration = System.currentTimeMillis() - myCurrentTestStart;
System.out.println("\n##teamcity[testFinished name=\'" + escapeName(getMethodName(test)) +
(duration > 0 ? "\' duration=\'" + duration : "") + "\']");
System.out.println("\n##teamcity[testFinished name='" + escapeName(getMethodName(test)) +
(duration > 0 ? "' duration='" + duration : "") + "']");
}
public void startTest(Test test) {
@@ -215,17 +215,17 @@ public class JUnit3IdeaTestRunner extends TestRunner implements IdeaTestRunner {
if (className != null && !className.equals(myClassName)) {
finishSuite();
myClassName = className;
System.out.println("##teamcity[testSuiteStarted name =\'" + escapeName(myClassName) +
"\' locationHint=\'java:suite://" + escapeName(className) + "\']");
System.out.println("##teamcity[testSuiteStarted name ='" + escapeName(myClassName) +
"' locationHint='java:suite://" + escapeName(className) + "']");
}
final String methodName = getMethodName(test);
System.out.println("##teamcity[testStarted name=\'" + escapeName(methodName) +
"\' locationHint=\'java:test://" + escapeName(className + "/" + methodName) + "\']");
System.out.println("##teamcity[testStarted name='" + escapeName(methodName) +
"' locationHint='java:test://" + escapeName(className + "/" + methodName) + "']");
}
protected void finishSuite() {
if (myClassName != null) {
System.out.println("##teamcity[testSuiteFinished name=\'" + escapeName(myClassName) + "\']");
System.out.println("##teamcity[testSuiteFinished name='" + escapeName(myClassName) + "']");
}
}
@@ -104,7 +104,7 @@ public class MavenEffectivePomDumper {
effectivePom = addMavenNamespace(sWriter.toString(), true);
writeComment(writer, "Effective POM for project \'" + project.getId() + "\'");
writeComment(writer, "Effective POM for project '" + project.getId() + "'");
writer.writeMarkup(effectivePom);
}
@@ -181,7 +181,7 @@ public class PropertiesCopyHandler extends CopyHandlerDelegateBase {
return new ValidationInfo("Property name must be not empty");
}
return PropertiesUtil.containsProperty(myCurrentResourceBundle, myCurrentPropertyName)
? new ValidationInfo(String.format("Property with name \'%s\' already exists", myCurrentPropertyName))
? new ValidationInfo(String.format("Property with name '%s' already exists", myCurrentPropertyName))
: null;
}
@@ -148,7 +148,7 @@ public class CombinePropertiesFilesAction extends AnAction {
@Nullable
@Override
public String getErrorText(String inputString) {
return checkInput(inputString) ? null : String.format("Base name must be valid for file \'%s\'", checkBaseName(inputString).getFailedFile());
return checkInput(inputString) ? null : String.format("Base name must be valid for file '%s'", checkBaseName(inputString).getFailedFile());
}
@Nullable
@@ -57,7 +57,7 @@ public class RenamePropertyProcessor extends RenamePsiElementProcessor {
result.add(new UnresolvableCollisionUsageInfo(property.getPsiElement(), key) {
@Override
public String getDescription() {
return "New property name \'" + value + "\' hides existing property";
return "New property name '" + value + "' hides existing property";
}
});
}
@@ -21,7 +21,7 @@ import java.util.regex.Pattern;
public class CmdRevertClient extends BaseSvnClient implements RevertClient {
private static final String STATUS = "\\s*(.+?)\\s*";
private static final String PATH = "\\s*\'(.*?)\'\\s*";
private static final String PATH = "\\s*'(.*?)'\\s*";
private static final String OPTIONAL_COMMENT = "(.*)";
private static final Pattern CHANGED_PATH = Pattern.compile(STATUS + PATH + OPTIONAL_COMMENT);
@@ -23,7 +23,7 @@ import java.util.regex.Pattern;
public class CmdUpgradeClient extends BaseSvnClient implements UpgradeClient {
private static final String STATUS = "\\s*(.+?)\\s*";
private static final String PATH = "\\s*\'(.*?)\'\\s*";
private static final String PATH = "\\s*'(.*?)'\\s*";
private static final Pattern CHANGED_PATH = Pattern.compile(STATUS + PATH);
@Override
@@ -209,7 +209,7 @@ public class GotoTaskAction extends GotoActionBase implements DumbAware {
private String taskName;
public String getActionText() {
return "Create New Task \'" + taskName + "\'";
return "Create New Task '" + taskName + "'";
}
public void setTaskName(final String taskName) {
@@ -93,7 +93,7 @@ public class PyQuotedStringIntention extends PyBaseIntentionAction {
stringBuilder.append('\'');
}
else if (ch == '\'') {
stringBuilder.append("\\\'");
stringBuilder.append("\\'");
}
else if (ch == '\\' && charArr[i+1] == '\"' && !(i+2 == charArr.length)) {
skipNext = true;
@@ -119,7 +119,7 @@ public class PyStringConcatenationToFormatIntention extends PyBaseIntentionActio
final LanguageLevel languageLevel = LanguageLevel.forElement(element);
final boolean useFormatMethod = languageLevel.isAtLeast(LanguageLevel.PYTHON27);
NotNullFunction<String,String> escaper = StringUtil.escaper(false, "\"\'\\");
NotNullFunction<String,String> escaper = StringUtil.escaper(false, "\"'\\");
StringBuilder stringLiteral = new StringBuilder();
List<String> parameters = new ArrayList<>();
Pair<String, String> quotes = Pair.create("\"", "\"");
@@ -408,7 +408,7 @@ public class PyStringFormatInspection extends PyInspection {
if ("*".equals(width)) {
++myExpectedArguments;
if (myUsedMappingKeys.size() > 0) {
registerProblem(formatExpression, "Can't use \'*\' in formats when using a mapping");
registerProblem(formatExpression, "Can't use '*' in formats when using a mapping");
}
}
}
@@ -41,10 +41,10 @@ public class PyStringLiteralFixer extends PyFixer<PyStringLiteralExpression> {
editor.getDocument().insertString(psiElement.getTextRange().getEndOffset(), "\"\"\"".substring(suffixLength));
}
}
else if (StringUtil.startsWith(text, "\'\'\'")) {
final int suffixLength = StringUtil.commonSuffixLength(text, "\'\'\'");
else if (StringUtil.startsWith(text, "'''")) {
final int suffixLength = StringUtil.commonSuffixLength(text, "'''");
if (suffixLength != 3) {
editor.getDocument().insertString(psiElement.getTextRange().getEndOffset(), "\'\'\'".substring(suffixLength));
editor.getDocument().insertString(psiElement.getTextRange().getEndOffset(), "'''".substring(suffixLength));
}
}
else if (StringUtil.startsWith(text, "\"")) {
@@ -52,9 +52,9 @@ public class PyStringLiteralFixer extends PyFixer<PyStringLiteralExpression> {
editor.getDocument().insertString(psiElement.getTextRange().getEndOffset(), "\"");
}
}
else if (StringUtil.startsWith(text, "\'")) {
if (!StringUtil.endsWith(text, "\'")) {
editor.getDocument().insertString(psiElement.getTextRange().getEndOffset(), "\'");
else if (StringUtil.startsWith(text, "'")) {
if (!StringUtil.endsWith(text, "'")) {
editor.getDocument().insertString(psiElement.getTextRange().getEndOffset(), "'");
}
}
}
@@ -107,7 +107,7 @@ public class AsyncArrayTableModel extends AbstractTableModel {
if (value instanceof String) {
String corrected = (String)value;
if (myStrategy.isNumeric(myDebugValue.getType())) {
if (corrected.startsWith("\'") || corrected.startsWith("\"")) {
if (corrected.startsWith("'") || corrected.startsWith("\"")) {
corrected = corrected.substring(1, corrected.length() - 1);
}
}
@@ -68,7 +68,7 @@ public class XmlAttributeInsertHandler implements InsertHandler<LookupElement> {
if(fileContext != null) {
if (fileContext.getText().startsWith("\"")) toInsert = "=''";
if (fileContext.getText().startsWith("\'")) toInsert = "=\"\"";
if (fileContext.getText().startsWith("'")) toInsert = "=\"\"";
}
if (toInsert == null) {
toInsert = "=" + quote + quote;
@@ -89,7 +89,7 @@ public class XmlEqTypedHandler extends TypedHandlerDelegate {
private static String tryCompleteQuotes(@Nullable PsiElement fileContext) {
if (fileContext != null) {
if (fileContext.getText().startsWith("\"")) return "''";
if (fileContext.getText().startsWith("\'")) return "\"\"";
if (fileContext.getText().startsWith("'")) return "\"\"";
}
return null;
}
@@ -88,7 +88,7 @@ public class HtmlQuotesFormatPreprocessor implements PreFormatProcessor {
myDocument = file.getViewProvider().getDocument();
switch (style) {
case Single:
myNewQuote = "\'";
myNewQuote = "'";
break;
case Double:
myNewQuote = "\"";
@@ -77,7 +77,7 @@ public class XmlDoctypeImpl extends XmlElementImpl implements XmlDoctype {
private static String extractValue(PsiElement element) {
String text = element.getText();
if (!text.startsWith("\"") && !text.startsWith("\'")) {
if (!text.startsWith("\"") && !text.startsWith("'")) {
if (hasInjectedEscapingQuotes(element, text)) return stripInjectedEscapingQuotes(text);
}
return StringUtil.stripQuotesAroundValue(text);