mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup - isEmpty
GitOrigin-RevId: 100d69abb6a423556574a72e82508fdb8f5d7fa3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ddcc95124c
commit
25233df1b1
+1
-1
@@ -66,7 +66,7 @@ public class SimpleSurroundDescriptor implements SurroundDescriptor {
|
||||
}
|
||||
}
|
||||
|
||||
if (startOffset == endOffset && atoms.size() > 0) {
|
||||
if (startOffset == endOffset && !atoms.isEmpty()) {
|
||||
PsiElement[] elements = PsiUtilCore.toPsiElementArray(atoms);
|
||||
if ((atoms.size() == 1 || PsiTreeUtil.findCommonParent(elements) == elements[0].getParent())) {
|
||||
return elements;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.uiDesigner.lw;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -49,7 +49,7 @@ public final class FontDescriptor {
|
||||
return null;
|
||||
}
|
||||
String name = myFontName;
|
||||
if (name == null || name.length() == 0) {
|
||||
if (name == null || name.isEmpty()) {
|
||||
if (defaultFont == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.compiler.instrumentation;
|
||||
|
||||
import org.jetbrains.org.objectweb.asm.ClassReader;
|
||||
@@ -516,7 +516,7 @@ public class InstrumentationClassFinder {
|
||||
s = url.getFile();
|
||||
}
|
||||
|
||||
if (s != null && s.length() > 0) {
|
||||
if (s != null && !s.isEmpty()) {
|
||||
if (Loader.JRT_PROTOCOL.equals(protocol)) {
|
||||
final Loader jrtLoader = JrtClassHolder.create(url, index);
|
||||
if (jrtLoader != null) {
|
||||
|
||||
@@ -16,7 +16,7 @@ public abstract class DeploymentUtil {
|
||||
}
|
||||
|
||||
public static String trimForwardSlashes(@NotNull String path) {
|
||||
while (path.length() != 0 && (path.charAt(0) == '/' || path.charAt(0) == File.separatorChar)) {
|
||||
while (!path.isEmpty() && (path.charAt(0) == '/' || path.charAt(0) == File.separatorChar)) {
|
||||
path = path.substring(1);
|
||||
}
|
||||
return path;
|
||||
@@ -25,7 +25,7 @@ public abstract class DeploymentUtil {
|
||||
public static String concatPaths(String... paths) {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
for (String path : paths) {
|
||||
if (path.length() == 0) continue;
|
||||
if (path.isEmpty()) continue;
|
||||
|
||||
final int len = builder.length();
|
||||
if (len > 0 && builder.charAt(len - 1) != '/' && builder.charAt(len - 1) != File.separatorChar) {
|
||||
@@ -43,7 +43,7 @@ public abstract class DeploymentUtil {
|
||||
if (endsWithSlash && startsWithSlash) {
|
||||
tail = trimForwardSlashes(relativePath);
|
||||
}
|
||||
else if (!endsWithSlash && !startsWithSlash && basePath.length() > 0 && relativePath.length() > 0) {
|
||||
else if (!endsWithSlash && !startsWithSlash && !basePath.isEmpty() && !relativePath.isEmpty()) {
|
||||
tail = "/" + relativePath;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -470,7 +470,7 @@ public abstract class JavaTestFrameworkRunnableState<T extends
|
||||
}
|
||||
}
|
||||
if (enabled) {
|
||||
if (buf.length() > 0) buf.append(delimiter);
|
||||
if (!buf.isEmpty()) buf.append(delimiter);
|
||||
final Class<?> classListener = listener.getClass();
|
||||
buf.append(classListener.getName());
|
||||
javaParameters.getClassPath().add(PathUtil.getJarPathForClass(classListener));
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.execution;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionResultSet;
|
||||
@@ -45,7 +31,7 @@ public abstract class MethodBrowser extends BrowseModuleValueActionListener<JCom
|
||||
@Override
|
||||
protected String showDialog() {
|
||||
final String className = getClassName();
|
||||
if (className.trim().length() == 0) {
|
||||
if (className.trim().isEmpty()) {
|
||||
Messages.showMessageDialog(getField(), ExecutionBundle.message("set.class.name.message"),
|
||||
ExecutionBundle.message("cannot.browse.method.dialog.title"), Messages.getInformationIcon());
|
||||
return null;
|
||||
@@ -84,7 +70,7 @@ public abstract class MethodBrowser extends BrowseModuleValueActionListener<JCom
|
||||
@Override
|
||||
protected void addCompletionVariants(@NotNull String text, int offset, @NotNull String prefix, @NotNull CompletionResultSet result) {
|
||||
final String className = getClassName();
|
||||
if (className.trim().length() == 0) {
|
||||
if (className.trim().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final PsiClass testClass = getModuleSelector().findClass(className);
|
||||
|
||||
@@ -241,7 +241,7 @@ public final class JShellHandler {
|
||||
if (protocolJar != null) {
|
||||
launchCp.append(File.pathSeparator).append(protocolJar);
|
||||
}
|
||||
if (launchCp.length() > 0) {
|
||||
if (!launchCp.isEmpty()) {
|
||||
cmdLine.addParameter("-classpath");
|
||||
cmdLine.addParameter(launchCp.toString());
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public final class RefactoringListeners {
|
||||
final StringBuilder path = new StringBuilder();
|
||||
for (PsiPackage parent = accessor.getPsiElement(); parent != null; parent = parent.getParentPackage()) {
|
||||
if (parent.equals(psiPackage)) return new RefactorPackage(accessor, path.toString());
|
||||
if (path.length() > 0) path.insert(0, '.');
|
||||
if (!path.isEmpty()) path.insert(0, '.');
|
||||
path.insert(0, parent.getName());
|
||||
}
|
||||
return null;
|
||||
@@ -33,7 +33,7 @@ public final class RefactoringListeners {
|
||||
final StringBuilder path = new StringBuilder();
|
||||
for (PsiClass parent = aClass; parent != null; parent = PsiTreeUtil.getParentOfType(parent, PsiClass.class, true)) {
|
||||
if (parent.equals(psiClass)) return new RefactorClass(accessor, path.toString());
|
||||
if (path.length() > 0) path.insert(0, '$');
|
||||
if (!path.isEmpty()) path.insert(0, '$');
|
||||
path.insert(0, parent.getName());
|
||||
}
|
||||
return null;
|
||||
@@ -104,7 +104,7 @@ public final class RefactoringListeners {
|
||||
T newElement1 = convertNewElement(newElement);
|
||||
if (newElement1 == null) return;
|
||||
String qualifiedName = getQualifiedName(newElement1);
|
||||
if (myPath.length() > 0) {
|
||||
if (!myPath.isEmpty()) {
|
||||
qualifiedName = qualifiedName + "." + myPath;
|
||||
newElement1 = findNewElement(newElement1, qualifiedName);
|
||||
}
|
||||
@@ -258,7 +258,7 @@ public final class RefactoringListeners {
|
||||
}
|
||||
|
||||
private String getClassQName(final String packageQName) {
|
||||
if (packageQName.length() > 0) {
|
||||
if (!packageQName.isEmpty()) {
|
||||
return packageQName + '.' + myInpackageName;
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public class JavaScratchConfiguration extends ApplicationConfiguration {
|
||||
public void checkConfiguration() throws RuntimeConfigurationException {
|
||||
JavaParametersUtil.checkAlternativeJRE(this);
|
||||
final String className = getMainClassName();
|
||||
if (className == null || className.length() == 0) {
|
||||
if (className == null || className.isEmpty()) {
|
||||
throw new RuntimeConfigurationError(ExecutionBundle.message("no.main.class.specified.error.text"));
|
||||
}
|
||||
if (getScratchFileUrl() == null) {
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ public class JavaRunConfigurationModule extends RunConfigurationModule {
|
||||
}
|
||||
|
||||
public PsiClass checkClassName(final String className, final @NlsContexts.DialogMessage String errorMessage) throws RuntimeConfigurationException {
|
||||
if (className == null || className.length() == 0) {
|
||||
if (className == null || className.isEmpty()) {
|
||||
throw new RuntimeConfigurationError(errorMessage);
|
||||
}
|
||||
return findNotNullClass(className);
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.execution.configurations;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -119,11 +119,11 @@ public class RemoteConnection {
|
||||
if (shmem) {
|
||||
if (serverMode) {
|
||||
result = "-Xdebug -Xrunjdwp:transport=dt_shmem,server=n,address=" +
|
||||
((address.length() > 0) ? address : "...") + ",suspend=y" + ONTHROW + ONUNCAUGHT;
|
||||
((!address.isEmpty()) ? address : "...") + ",suspend=y" + ONTHROW + ONUNCAUGHT;
|
||||
}
|
||||
else {
|
||||
result = "-Xdebug -Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=" +
|
||||
((address.length() > 0) ? address : "...");
|
||||
((!address.isEmpty()) ? address : "...");
|
||||
}
|
||||
}
|
||||
else { // socket transport
|
||||
|
||||
@@ -120,7 +120,7 @@ public class ModuleNameLocationComponent implements ModuleNameLocationSettings {
|
||||
}
|
||||
String path = getDefaultBaseDir(myWizardContext, namePathComponent);
|
||||
final String moduleName = getModuleName();
|
||||
if (path.length() > 0 && !Comparing.strEqual(moduleName, namePathComponent.getNameValue())) {
|
||||
if (!path.isEmpty() && !Comparing.strEqual(moduleName, namePathComponent.getNameValue())) {
|
||||
path += "/" + moduleName;
|
||||
}
|
||||
if (!myContentRootChangedByUser) {
|
||||
|
||||
@@ -217,7 +217,7 @@ public final class JavaModuleInsight extends ModuleInsight {
|
||||
}
|
||||
|
||||
String packageName = buffer.toString();
|
||||
if (packageName.length() == 0 || StringUtil.endsWithChar(packageName, '.') || StringUtil.startsWithChar(packageName, '*')) {
|
||||
if (packageName.isEmpty() || StringUtil.endsWithChar(packageName, '.') || StringUtil.startsWithChar(packageName, '*')) {
|
||||
return null;
|
||||
}
|
||||
return packageName;
|
||||
|
||||
@@ -78,7 +78,7 @@ public class JavaSettingsStep extends SdkSettingsStep {
|
||||
if (contentEntryPath != null) {
|
||||
final String dirName = mySourcePath.getText().trim().replace(File.separatorChar, '/');
|
||||
PropertiesComponent.getInstance().setValue(MODULE_SOURCE_ROOT_KEY, dirName);
|
||||
String text = dirName.length() > 0? contentEntryPath + "/" + dirName : contentEntryPath;
|
||||
String text = !dirName.isEmpty() ? contentEntryPath + "/" + dirName : contentEntryPath;
|
||||
((JavaModuleBuilder)myModuleBuilder).setSourcePaths(Collections.singletonList(Pair.create(text, "")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,13 +97,13 @@ public final class ProjectNameStep extends ModuleWizardStep {
|
||||
@Override
|
||||
public boolean validate() throws ConfigurationException {
|
||||
String name = myNamePathComponent.getNameValue();
|
||||
if (name.length() == 0) {
|
||||
if (name.isEmpty()) {
|
||||
ApplicationNamesInfo info = ApplicationNamesInfo.getInstance();
|
||||
throw new ConfigurationException(JavaUiBundle.message("prompt.new.project.file.name", info.getFullProductName(), myWizardContext.getPresentationName()));
|
||||
}
|
||||
|
||||
final String projectFileDirectory = getProjectFileDirectory();
|
||||
if (projectFileDirectory.length() == 0) {
|
||||
if (projectFileDirectory.isEmpty()) {
|
||||
throw new ConfigurationException(JavaUiBundle.message("prompt.enter.project.file.location", myWizardContext.getPresentationName()));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ public final class JavaSourceRootDetectionUtil {
|
||||
skipWhiteSpaceAndComments(lexer);
|
||||
}
|
||||
String packageName = buffer.toString();
|
||||
if (packageName.length() == 0 || StringUtil.endsWithChar(packageName, '.')) return null;
|
||||
if (packageName.isEmpty() || StringUtil.endsWithChar(packageName, '.')) return null;
|
||||
return packageName;
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ public class AnnotationsEditor extends ModuleElementsEditor {
|
||||
@Override
|
||||
public void run(AnActionButton button) {
|
||||
final List<Object[]> removedItems = TableUtil.removeSelectedItems(myTable);
|
||||
if (removedItems.size() > 0) {
|
||||
if (!removedItems.isEmpty()) {
|
||||
saveData();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ public abstract class JavaResourceRootEditHandlerBase extends ModuleSourceRootEd
|
||||
if (!relativeOutputPath.isEmpty()) {
|
||||
buffer.append(" (").append(relativeOutputPath).append(")");
|
||||
}
|
||||
return buffer.length() > 0 ? buffer.toString() : null;
|
||||
return !buffer.isEmpty() ? buffer.toString() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -115,7 +115,7 @@ public class JavadocEditor extends ModuleElementsEditor {
|
||||
@Override
|
||||
public void run(AnActionButton button) {
|
||||
final List<Object[]> removedItems = TableUtil.removeSelectedItems(myTable);
|
||||
if (removedItems.size() > 0) {
|
||||
if (!removedItems.isEmpty()) {
|
||||
saveData();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ public class ProjectConfigurable extends ProjectStructureElementConfigurable<Pro
|
||||
// set the output path first so that handlers of RootsChanged event sent after JDK is set
|
||||
// would see the updated path
|
||||
String canonicalPath = myUi.getProjectCompilerOutput();
|
||||
if (canonicalPath.length() > 0) {
|
||||
if (!canonicalPath.isEmpty()) {
|
||||
try {
|
||||
canonicalPath = FileUtil.resolveShortWindowsName(canonicalPath);
|
||||
}
|
||||
|
||||
+2
-2
@@ -145,7 +145,7 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
|
||||
|
||||
private @Nullable String getConfiguredOutputPath() {
|
||||
String outputPath = FileUtil.toSystemIndependentName(myOutputDirectoryField.getText().trim());
|
||||
if (outputPath.length() == 0) {
|
||||
if (outputPath.isEmpty()) {
|
||||
outputPath = null;
|
||||
}
|
||||
return outputPath;
|
||||
@@ -472,7 +472,7 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
|
||||
final String name = ((ArchivePackagingElement)root).getArchiveFileName();
|
||||
final String fileName = FileUtilRt.getNameWithoutExtension(name);
|
||||
final String extension = FileUtilRt.getExtension(name);
|
||||
if (fileName.equals(oldFileName) && extension.length() > 0) {
|
||||
if (fileName.equals(oldFileName) && !extension.isEmpty()) {
|
||||
myLayoutTreeComponent.editLayout(
|
||||
() -> ((ArchivePackagingElement)getRootElement()).setArchiveFileName(ArtifactUtil.suggestArtifactFileName(newArtifactName) + "." + extension));
|
||||
myLayoutTreeComponent.updateRootNode();
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public abstract class PutIntoDefaultLocationActionBase extends AnAction {
|
||||
String target;
|
||||
if (paths.size() == 1) {
|
||||
final String path = StringUtil.trimStart(StringUtil.trimEnd(paths.iterator().next(), "/"), "/");
|
||||
if (path.length() > 0) {
|
||||
if (!path.isEmpty()) {
|
||||
target = "/" + path;
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ public abstract class LibraryEditorDialogBase extends DialogWrapper {
|
||||
|
||||
protected boolean validateAndApply() {
|
||||
String newName = myNameField.getText().trim();
|
||||
if (newName.length() == 0) {
|
||||
if (newName.isEmpty()) {
|
||||
newName = null;
|
||||
}
|
||||
if (shouldCheckName(newName)) {
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ public class LibraryRootsComponent implements Disposable, LibraryEditorComponent
|
||||
type != null ? Collections.singleton(type.getKind()) : Collections.emptySet();
|
||||
for (@Nls String description : LibraryPresentationManager.getInstance().getDescriptions(getLibraryEditor().getFiles(OrderRootType.CLASSES),
|
||||
excluded)) {
|
||||
if (sb.length() > 0) {
|
||||
if (!sb.isEmpty()) {
|
||||
sb.append("\n");
|
||||
}
|
||||
sb.append(description);
|
||||
|
||||
+1
-1
@@ -265,7 +265,7 @@ public abstract class BaseLibrariesConfigurable extends BaseStructureConfigurabl
|
||||
final LibraryProjectStructureElement libraryElement = new LibraryProjectStructureElement(myContext, library);
|
||||
final Collection<ProjectStructureElementUsage> usages =
|
||||
new ArrayList<>(myContext.getDaemonAnalyzer().getUsages(libraryElement));
|
||||
if (usages.size() > 0) {
|
||||
if (!usages.isEmpty()) {
|
||||
if (librariesWithUsages == 0) {
|
||||
final MultiMap<String, ProjectStructureElementUsage> containerType2Usage = new MultiMap<>();
|
||||
for (final ProjectStructureElementUsage usage : usages) {
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.projectImport;
|
||||
|
||||
import com.intellij.ide.util.projectWizard.ModuleWizardStep;
|
||||
@@ -42,7 +28,7 @@ public abstract class ProjectImportWizardStep extends ModuleWizardStep {
|
||||
}
|
||||
|
||||
protected void suggestProjectNameAndPath(final String alternativePath, final String path) {
|
||||
getWizardContext().setProjectFileDirectory(alternativePath != null && alternativePath.length() > 0 ? alternativePath : path);
|
||||
getWizardContext().setProjectFileDirectory(alternativePath != null && !alternativePath.isEmpty() ? alternativePath : path);
|
||||
final String global = FileUtil.toSystemIndependentName(path);
|
||||
getWizardContext().setProjectName(global.substring(global.lastIndexOf("/") + 1));
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public abstract class SelectImportedProjectsStep<T> extends ProjectImportWizardS
|
||||
@Override
|
||||
public boolean validate() throws ConfigurationException {
|
||||
getContext().setList(fileChooser.getMarkedElements());
|
||||
if (fileChooser.getMarkedElements().size() == 0) {
|
||||
if (fileChooser.getMarkedElements().isEmpty()) {
|
||||
throw new ConfigurationException(JavaUiBundle.message("select.imported.projects.dialog.message.nothing.found"),
|
||||
JavaUiBundle.message("select.imported.projects.dialog.title.unable.to.proceed"));
|
||||
}
|
||||
|
||||
+1
-1
@@ -380,7 +380,7 @@ class ContractInferenceInterpreter {
|
||||
List<PreContract> conditionResults = visitExpression(states, findExpressionChild(myTree, statement));
|
||||
|
||||
List<LighterASTNode> thenElse = getStatements(statement, myTree);
|
||||
if (thenElse.size() > 0) {
|
||||
if (!thenElse.isEmpty()) {
|
||||
result.addAll(visitStatements(antecedentsReturning(conditionResults, returnTrue()), singletonList(thenElse.get(0))));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ public final class JavaModuleNamingInspection extends AbstractBaseJavaLocalInspe
|
||||
Ref<String> newName = Ref.create();
|
||||
psiTraverser().children(name).filter(PsiIdentifier.class).forEach(id -> {
|
||||
String text = id.getText();
|
||||
if (text.length() > 0 && Character.isDigit(text.charAt(text.length() - 1))) {
|
||||
if (!text.isEmpty() && Character.isDigit(text.charAt(text.length() - 1))) {
|
||||
String message = JavaAnalysisBundle.message("inspection.java.module.naming.terminal.digits", text);
|
||||
if (newName.isNull()) {
|
||||
newName.set(StringUtil.join(psiTraverser().children(name).filter(PsiIdentifier.class).map(i -> trimDigits(i.getText())), "."));
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ public final class JavaModuleExternalPathsImpl extends JavaModuleExternalPaths {
|
||||
List<Element> toWrite = null;
|
||||
for (OrderRootType orderRootType : myOrderRootPointerContainers.keySet()) {
|
||||
VirtualFilePointerContainer container = myOrderRootPointerContainers.get(orderRootType);
|
||||
if (container != null && container.size() > 0) {
|
||||
if (container != null && !container.isEmpty()) {
|
||||
final Element content = new Element(((PersistentOrderRootType)orderRootType).getModulePathsName());
|
||||
container.writeExternal(content, ROOT_ELEMENT, false);
|
||||
if (toWrite == null) {
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ public final class BreakStatementWithLabelInspection extends BaseInspection {
|
||||
if (labelText == null) {
|
||||
return;
|
||||
}
|
||||
if (labelText.length() == 0) {
|
||||
if (labelText.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
registerStatementError(statement);
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ public final class ContinueStatementWithLabelInspection extends BaseInspection {
|
||||
if (labelText == null) {
|
||||
return;
|
||||
}
|
||||
if (labelText.length() == 0) {
|
||||
if (labelText.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
registerStatementError(statement);
|
||||
|
||||
+1
-1
@@ -224,7 +224,7 @@ public final class ImplicitNumericConversionInspection extends BaseInspection {
|
||||
|
||||
private static boolean isDecimalLiteral(String text) {
|
||||
// should not be binary, octal or hexadecimal: 0b101, 077, 0xFF
|
||||
return text.length() > 0 && text.charAt(0) != '0';
|
||||
return !text.isEmpty() && text.charAt(0) != '0';
|
||||
}
|
||||
|
||||
private static boolean isNegatedLiteral(PsiExpression expression) {
|
||||
|
||||
@@ -152,7 +152,7 @@ public final class CommentTracker {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (PsiElement comment : comments) {
|
||||
PsiElement prev = comment.getPrevSibling();
|
||||
if (sb.length() == 0 && prev instanceof PsiWhiteSpace) {
|
||||
if (sb.isEmpty() && prev instanceof PsiWhiteSpace) {
|
||||
sb.append(prev.getText());
|
||||
}
|
||||
sb.append(comment.getText());
|
||||
|
||||
@@ -368,7 +368,7 @@ public final class MethodUtils {
|
||||
} else {
|
||||
expressions = List.of(bodyExpression);
|
||||
}
|
||||
if (expressions.size() == 0) return true;
|
||||
if (expressions.isEmpty()) return true;
|
||||
for (UExpression expression : expressions) {
|
||||
ProgressManager.checkCanceled();
|
||||
if (expression instanceof UastEmptyExpression || trivialPredicate != null && trivialPredicate.test(expression)) continue;
|
||||
|
||||
+1
-1
@@ -169,7 +169,7 @@ class RecordBuilder {
|
||||
}
|
||||
|
||||
private void trimEndingWhiteSpaces() {
|
||||
if (myRecordText.length() == 0) return;
|
||||
if (myRecordText.isEmpty()) return;
|
||||
int endIndex = myRecordText.length() - 1;
|
||||
if (myRecordText.charAt(endIndex) != ' ') return;
|
||||
|
||||
|
||||
+1
-1
@@ -145,7 +145,7 @@ final class JavaLangReflectHandleInvocationChecker {
|
||||
final List<Supplier<ReflectiveType>> lazyMethodSignature = getLazyMethodSignature(signatureExpression);
|
||||
if (lazyMethodSignature == null) return true;
|
||||
|
||||
if (!isConstructor && lazyMethodSignature.size() != 0) {
|
||||
if (!isConstructor && !lazyMethodSignature.isEmpty()) {
|
||||
final ReflectiveType returnType = lazyMethodSignature.get(0).get();
|
||||
checkReturnType(invokeCall, returnType, isExact, holder);
|
||||
}
|
||||
|
||||
+3
-3
@@ -901,7 +901,7 @@ public class JoiningMigration extends BaseStreamApiMigration {
|
||||
@Nullable List<PsiVariable> nonFinalVariables) {
|
||||
if (nonFinalVariables != null && !nonFinalVariables.isEmpty()) return null;
|
||||
List<PsiStatement> statements = Arrays.asList(terminalBlock.getStatements());
|
||||
if (statements.size() < 1) return null;
|
||||
if (statements.isEmpty()) return null;
|
||||
PsiVariable targetBuilder = extractStringBuilder(statements.get(0));
|
||||
if(!(targetBuilder instanceof PsiLocalVariable)) return null;
|
||||
List<PsiExpression> joinParts = extractJoinParts(statements);
|
||||
@@ -1285,7 +1285,7 @@ public class JoiningMigration extends BaseStreamApiMigration {
|
||||
delimiterJoinParts.add(joinPart);
|
||||
sb.append(constantExpression);
|
||||
}
|
||||
String separator = sb.length() == 0 ? null : sb.toString();
|
||||
String separator = sb.isEmpty() ? null : sb.toString();
|
||||
if (firstNonConstant != -1) {
|
||||
List<PsiExpression> mainJoinParts = joinParts.subList(firstNonConstant, joinParts.size());
|
||||
return new JoinData(separator, mainJoinParts, delimiterJoinParts);
|
||||
@@ -1307,7 +1307,7 @@ public class JoiningMigration extends BaseStreamApiMigration {
|
||||
sb.append(constantExpression);
|
||||
delimiterJoinParts.add(joinPart);
|
||||
}
|
||||
String separator = sb.length() == 0 ? null : sb.toString();
|
||||
String separator = sb.isEmpty() ? null : sb.toString();
|
||||
if (firstNonConstant != -1) {
|
||||
List<PsiExpression> mainJoinParts = joinParts.subList(0, firstNonConstant + 1);
|
||||
return new JoinData(separator, mainJoinParts, delimiterJoinParts);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.refactoring.copy;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
@@ -148,7 +148,7 @@ class CopyClassDialog extends RefactoringDialog implements DumbAware {
|
||||
final String[] errorString = new String[1];
|
||||
final PsiManager manager = PsiManager.getInstance(myProject);
|
||||
final PsiNameHelper nameHelper = PsiNameHelper.getInstance(manager.getProject());
|
||||
if (packageName.length() > 0 && !nameHelper.isQualifiedName(packageName)) {
|
||||
if (!packageName.isEmpty() && !nameHelper.isQualifiedName(packageName)) {
|
||||
errorString[0] = JavaRefactoringBundle.message("invalid.target.package.name.specified");
|
||||
} else if (className != null && className.isEmpty()) {
|
||||
errorString[0] = JavaRefactoringBundle.message("no.class.name.specified");
|
||||
@@ -170,7 +170,7 @@ class CopyClassDialog extends RefactoringDialog implements DumbAware {
|
||||
}
|
||||
|
||||
if (errorString[0] != null) {
|
||||
if (errorString[0].length() > 0) {
|
||||
if (!errorString[0].isEmpty()) {
|
||||
Messages.showMessageDialog(myProject, errorString[0], RefactoringBundle.message("error.title"), Messages.getErrorIcon());
|
||||
}
|
||||
myNameField.requestFocusInWindow();
|
||||
|
||||
+2
-2
@@ -105,7 +105,7 @@ public final class CopyClassesHandler extends CopyHandlerDelegateBase implements
|
||||
if (element instanceof PsiDirectory) {
|
||||
if (!fromUpdate) {
|
||||
final String name = ((PsiDirectory)element).getName();
|
||||
final String path = relativePath != null ? (relativePath.length() > 0 ? (relativePath + "/") : "") + name : null;
|
||||
final String path = relativePath != null ? (!relativePath.isEmpty() ? (relativePath + "/") : "") + name : null;
|
||||
final Map<PsiFile, PsiClass[]> map = convertToTopLevelClasses(element.getChildren(), false, path, relativeMap);
|
||||
if (map == null) return null;
|
||||
for (Map.Entry<PsiFile, PsiClass[]> entry : map.entrySet()) {
|
||||
@@ -212,7 +212,7 @@ public final class CopyClassesHandler extends CopyHandlerDelegateBase implements
|
||||
openInEditor = dialog.isOpenInEditor();
|
||||
targetDirectory = dialog.getTargetDirectory();
|
||||
className = dialog.getClassName();
|
||||
if (className == null || className.length() == 0) return;
|
||||
if (className == null || className.isEmpty()) return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-1
@@ -601,7 +601,7 @@ public class ExtractMethodDialog extends RefactoringDialog implements AbstractEx
|
||||
final int declarationOffset = buffer.length();
|
||||
final String visibilityString = VisibilityUtil.getVisibilityString(getVisibility());
|
||||
buffer.append(visibilityString);
|
||||
if (buffer.length() > 0) {
|
||||
if (!buffer.isEmpty()) {
|
||||
buffer.append(" ");
|
||||
}
|
||||
if (isMakeStatic() && !isChainedConstructor()) {
|
||||
|
||||
+1
-1
@@ -317,7 +317,7 @@ public class ExtractMethodObjectDialog extends DialogWrapper implements Abstract
|
||||
final String visibilityString = VisibilityUtil.getVisibilityString(getVisibility());
|
||||
if (myCreateInnerClassRb.isSelected()) {
|
||||
buffer.append(visibilityString);
|
||||
if (buffer.length() > 0) {
|
||||
if (!buffer.isEmpty()) {
|
||||
buffer.append(" ");
|
||||
}
|
||||
if (isMakeStatic()) {
|
||||
|
||||
+1
-1
@@ -160,7 +160,7 @@ class ExtractClassDialog extends RefactoringDialog implements MemberInfoChangeLi
|
||||
}
|
||||
|
||||
final String className = getClassName();
|
||||
if (className.length() == 0 || !nameHelper.isIdentifier(className)) {
|
||||
if (className.isEmpty() || !nameHelper.isIdentifier(className)) {
|
||||
throw new ConfigurationException(JavaBundle.message("invalid.extracted.class.name", className));
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -220,7 +220,7 @@ public class ExtractClassProcessor extends FixableUsagesRefactoringProcessor {
|
||||
final Project project = sourceClass.getProject();
|
||||
final JavaCodeStyleSettings settings = JavaCodeStyleSettings.getInstance(sourceClass.getContainingFile());
|
||||
|
||||
final String baseName = settings.FIELD_NAME_PREFIX.length() == 0 ? StringUtil.decapitalize(newClassName) : newClassName;
|
||||
final String baseName = settings.FIELD_NAME_PREFIX.isEmpty() ? StringUtil.decapitalize(newClassName) : newClassName;
|
||||
String name = settings.FIELD_NAME_PREFIX + baseName + settings.FIELD_NAME_SUFFIX;
|
||||
if (!existsFieldWithName(name) && !PsiNameHelper.getInstance(project).isKeyword(name)) {
|
||||
return name;
|
||||
@@ -429,7 +429,7 @@ public class ExtractClassProcessor extends FixableUsagesRefactoringProcessor {
|
||||
final CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(manager.getProject());
|
||||
final @NonNls StringBuilder fieldBuffer = new StringBuilder();
|
||||
final String delegateVisibility = calculateDelegateVisibility();
|
||||
if (delegateVisibility.length() > 0) fieldBuffer.append(delegateVisibility).append(' ');
|
||||
if (!delegateVisibility.isEmpty()) fieldBuffer.append(delegateVisibility).append(' ');
|
||||
fieldBuffer.append("final ");
|
||||
final String fullyQualifiedName = getQualifiedName();
|
||||
fieldBuffer.append(fullyQualifiedName);
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.refactoring.extractclass;
|
||||
|
||||
import com.intellij.codeInsight.generation.GenerateMembersUtil;
|
||||
@@ -89,7 +89,7 @@ class ExtractedClassBuilder {
|
||||
calculateBackpointerName();
|
||||
}
|
||||
final @NonNls StringBuilder out = new StringBuilder(1024);
|
||||
if (packageName.length() > 0) out.append("package ").append(packageName).append(";\n");
|
||||
if (!packageName.isEmpty()) out.append("package ").append(packageName).append(";\n");
|
||||
|
||||
out.append("public ");
|
||||
fields.removeAll(enumConstantFields);
|
||||
|
||||
+1
-1
@@ -579,7 +579,7 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
|
||||
System.arraycopy(instanceCreationArguments, 0, exprs, 0, parameters.length - 1);
|
||||
StringBuilder varargs = new StringBuilder();
|
||||
for (int i = parameters.length - 1; i < instanceCreationArguments.length; i++) {
|
||||
if (varargs.length() > 0) varargs.append(", ");
|
||||
if (!varargs.isEmpty()) varargs.append(", ");
|
||||
varargs.append(instanceCreationArguments[i].getText());
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -210,20 +210,20 @@ public class IntroduceParameterObjectDialog extends AbstractIntroduceParameterOb
|
||||
JavaRefactoringBundle.message("introduce.parameter.object.error.inner.class.already.exist", innerClassName));
|
||||
} else if (!useExistingClass()) {
|
||||
final String className = getClassName();
|
||||
if (className.length() == 0 || !nameHelper.isIdentifier(className)) {
|
||||
if (className.isEmpty() || !nameHelper.isIdentifier(className)) {
|
||||
throw new ConfigurationException(
|
||||
JavaRefactoringBundle.message("introduce.parameter.object.error.invalid.parameter.class.name", className));
|
||||
}
|
||||
final String packageName = getPackageName();
|
||||
|
||||
if (packageName.length() == 0 || !nameHelper.isQualifiedName(packageName)) {
|
||||
if (packageName.isEmpty() || !nameHelper.isQualifiedName(packageName)) {
|
||||
throw new ConfigurationException(
|
||||
JavaRefactoringBundle.message("introduce.parameter.object.error.invalid.parameter.class.package.name", packageName));
|
||||
}
|
||||
}
|
||||
else {
|
||||
final String className = getExistingClassName();
|
||||
if (className.length() == 0 || !nameHelper.isQualifiedName(className)) {
|
||||
if (className.isEmpty() || !nameHelper.isQualifiedName(className)) {
|
||||
throw new ConfigurationException(
|
||||
JavaRefactoringBundle.message("introduce.parameter.object.error.invalid.qualified.parameter.class.name", className));
|
||||
}
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ class ParameterObjectBuilder {
|
||||
boolean recordsAvailable = PsiUtil.isAvailable(JavaFeature.RECORDS, myFile) &&
|
||||
!ContainerUtil.exists(fields, ParameterSpec::isSetterRequired);
|
||||
final @NonNls StringBuilder out = new StringBuilder(1024);
|
||||
if (packageName.length() > 0) out.append("package ").append(packageName).append(';');
|
||||
if (!packageName.isEmpty()) out.append("package ").append(packageName).append(';');
|
||||
out.append('\n');
|
||||
out.append(myVisibility).append(" ");
|
||||
out.append(recordsAvailable ? PsiKeyword.RECORD : PsiKeyword.CLASS);
|
||||
|
||||
+3
-3
@@ -128,7 +128,7 @@ public class MoveClassesOrPackagesDialog extends MoveDialogBase {
|
||||
|
||||
myTargetDirectoryFixed = initialTargetDirectory == null;
|
||||
mySuggestToMoveToAnotherRoot = initialTargetElement == null;
|
||||
if (targetPackageName.length() != 0) {
|
||||
if (!targetPackageName.isEmpty()) {
|
||||
myWithBrowseButtonReference.prependItem(targetPackageName);
|
||||
myClassPackageChooser.prependItem(targetPackageName);
|
||||
}
|
||||
@@ -316,7 +316,7 @@ public class MoveClassesOrPackagesDialog extends MoveDialogBase {
|
||||
protected void canRun() throws ConfigurationException {
|
||||
if (isMoveToPackage()) {
|
||||
String name = getTargetPackage().trim();
|
||||
if (name.length() != 0 && !PsiNameHelper.getInstance(myManager.getProject()).isQualifiedName(name)) {
|
||||
if (!name.isEmpty() && !PsiNameHelper.getInstance(myManager.getProject()).isQualifiedName(name)) {
|
||||
throw new ConfigurationException(JavaBundle.message("move.classes.invalid.destination.package.name.message", name));
|
||||
}
|
||||
}
|
||||
@@ -472,7 +472,7 @@ public class MoveClassesOrPackagesDialog extends MoveDialogBase {
|
||||
|
||||
private @Nullable MoveDestination selectDestination() {
|
||||
final String packageName = getTargetPackage().trim();
|
||||
if (packageName.length() > 0 && !PsiNameHelper.getInstance(myManager.getProject()).isQualifiedName(packageName)) {
|
||||
if (!packageName.isEmpty() && !PsiNameHelper.getInstance(myManager.getProject()).isQualifiedName(packageName)) {
|
||||
Messages.showErrorDialog(myProject, JavaRefactoringBundle.message("please.enter.a.valid.target.package.name"),
|
||||
RefactoringBundle.message("move.title"));
|
||||
return null;
|
||||
|
||||
+1
-1
@@ -278,7 +278,7 @@ public class MoveInnerDialog extends MoveDialogBase {
|
||||
|
||||
if (message == null) {
|
||||
final String packageName = getPackageName();
|
||||
if (packageName.length() > 0 && !PsiNameHelper.getInstance(myProject).isQualifiedName(packageName)) {
|
||||
if (!packageName.isEmpty() && !PsiNameHelper.getInstance(myProject).isQualifiedName(packageName)) {
|
||||
message = RefactoringMessageUtil.getIncorrectIdentifierMessage(packageName);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -226,7 +226,7 @@ public class MoveMembersDialog extends MoveDialogBase implements MoveMembersOpti
|
||||
String message = validateInputData();
|
||||
|
||||
if (message != null) {
|
||||
if (message.length() != 0) {
|
||||
if (!message.isEmpty()) {
|
||||
CommonRefactoringUtil.showErrorMessage(
|
||||
MoveMembersImpl.getRefactoringName(),
|
||||
message,
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ public final class JavaNameSuggestionProvider implements NameSuggestionProvider
|
||||
StringBuilder buffer = new StringBuilder(prefix);
|
||||
for (int i = 0; i < words.length; i++) {
|
||||
String word = words[i];
|
||||
final boolean prefixRequiresCapitalization = prefix.length() > 0 && !StringUtil.endsWithChar(prefix, '_');
|
||||
final boolean prefixRequiresCapitalization = !prefix.isEmpty() && !StringUtil.endsWithChar(prefix, '_');
|
||||
if (i > 0 || prefixRequiresCapitalization) {
|
||||
buffer.append(StringUtil.capitalize(word));
|
||||
}
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ public final class PsiPackageRenameValidator implements RenameInputValidatorEx {
|
||||
return JavaBundle.message("rename.package.ignored.name.warning");
|
||||
}
|
||||
|
||||
if (newName.length() > 0) {
|
||||
if (!newName.isEmpty()) {
|
||||
if (!PsiDirectoryFactory.getInstance(project).isValidPackageName(newName)) {
|
||||
return JavaBundle.message("rename.package.invalid.name.error");
|
||||
}
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.refactoring.rename.naming;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -37,7 +23,7 @@ public abstract class PsiNamedElementAutomaticRenamer<T extends PsiNamedElement>
|
||||
String elementName = getName(element);
|
||||
final NameSuggester suggester = new NameSuggester(getOldName(), getNewName());
|
||||
final String newCanonicalName = suggester.suggestName(elementName);
|
||||
if (newCanonicalName.length() == 0) {
|
||||
if (newCanonicalName.isEmpty()) {
|
||||
LOG.error("oldName = " + getOldName() + ", newName = " + getNewName() + ", name = " + elementName + ", canonicalName = " +
|
||||
elementName + ", newCanonicalName = " + newCanonicalName);
|
||||
}
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.refactoring.util.classMembers;
|
||||
|
||||
import com.intellij.openapi.util.NlsContexts;
|
||||
@@ -77,7 +63,7 @@ public class InterfaceMemberDependencyGraph<T extends PsiMember, M extends Membe
|
||||
|
||||
public @NlsContexts.Tooltip String getElementTooltip(PsiMember member) {
|
||||
final Set<? extends PsiMember> dependencies = getDependenciesOf(member);
|
||||
if(dependencies == null || dependencies.size() == 0) return null;
|
||||
if(dependencies == null || dependencies.isEmpty()) return null;
|
||||
String interfaces = StringUtil.join(dependencies, PsiMember::getName, ", ");
|
||||
return RefactoringBundle.message("interface.member.dependency.required.by.interfaces.list", dependencies.size(), interfaces);
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ public final class MatchUtil {
|
||||
if (!match.myChangedParams.isEmpty() || returnType != null) {
|
||||
@NonNls StringBuilder buffer = new StringBuilder();
|
||||
buffer.append(visibility);
|
||||
if (buffer.length() > 0) {
|
||||
if (!buffer.isEmpty()) {
|
||||
buffer.append(" ");
|
||||
}
|
||||
if (shouldBeStatic) {
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.refactoring.util.occurrences;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightUtil;
|
||||
@@ -69,7 +69,7 @@ public class ExpressionOccurrenceManager extends BaseOccurrenceManager {
|
||||
findModel.setCaseSensitive(true);
|
||||
findModel.setRegularExpressions(false);
|
||||
String value = StringUtil.unquoteString(myMainOccurence.getText());
|
||||
if (value.length() > 0) {
|
||||
if (!value.isEmpty()) {
|
||||
findModel.setStringToFind(value);
|
||||
final List<PsiExpression> results = new ArrayList<>();
|
||||
final PsiFile file = getScope().getContainingFile();
|
||||
|
||||
+1
-1
@@ -162,7 +162,7 @@ abstract class StaticMembersProcessor<T extends PsiMember & PsiDocCommentOwner>
|
||||
}
|
||||
|
||||
ApplicableType type = isApplicable(member, myPlace);
|
||||
if (list.size() > 0) {
|
||||
if (!list.isEmpty()) {
|
||||
Pair<T, ApplicableType> previousPair = list.get(list.size() - 1);
|
||||
if (previousPair.getFirst().getContainingClass() == containingClass &&
|
||||
previousPair.getSecond().ordinal() < type.ordinal()) {
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@ public final class FinishMarker {
|
||||
List<PsiExpression> nonTerminalReturns = StreamEx.<PsiReturnStatement>of(returns).without(terminalReturn)
|
||||
.map(PsiReturnStatement::getReturnValue)
|
||||
.map(PsiUtil::skipParenthesizedExprDown).toList();
|
||||
if (nonTerminalReturns.size() == 0) {
|
||||
if (nonTerminalReturns.isEmpty()) {
|
||||
return new FinishMarker(FinishMarkerType.SEPARATE_VAR, null);
|
||||
}
|
||||
Set<Object> nonTerminalReturnValues = StreamEx.of(nonTerminalReturns)
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.template;
|
||||
|
||||
import com.intellij.codeInsight.template.impl.JavaTemplateUtil;
|
||||
@@ -42,7 +28,7 @@ public class PsiTypeResult implements RecalculatableResult {
|
||||
|
||||
@Override
|
||||
public boolean equalsToText(String text, PsiElement context) {
|
||||
if (text.length() == 0) return false;
|
||||
if (text.isEmpty()) return false;
|
||||
final PsiType type = getType();
|
||||
if (text.equals(toString())) return true;
|
||||
try {
|
||||
|
||||
+4
-4
@@ -32,7 +32,7 @@ public final class DescendantClassesEnumMacro extends Macro {
|
||||
@Override
|
||||
public Result calculateResult(Expression @NotNull [] params, ExpressionContext context) {
|
||||
final List<PsiClass> classes = findDescendants(context, params);
|
||||
if (classes == null || classes.size() == 0) return null;
|
||||
if (classes == null || classes.isEmpty()) return null;
|
||||
Result[] results = calculateResults(classes);
|
||||
|
||||
return results[0];
|
||||
@@ -84,7 +84,7 @@ public final class DescendantClassesEnumMacro extends Macro {
|
||||
@Override
|
||||
public Result calculateQuickResult(Expression @NotNull [] params, ExpressionContext context) {
|
||||
final List<PsiClass> classes = findDescendants(context, params);
|
||||
if (classes == null || classes.size() == 0) return null;
|
||||
if (classes == null || classes.isEmpty()) return null;
|
||||
Result[] results = calculateResults(classes);
|
||||
|
||||
return results[0];
|
||||
@@ -93,14 +93,14 @@ public final class DescendantClassesEnumMacro extends Macro {
|
||||
@Override
|
||||
public LookupElement[] calculateLookupItems(Expression @NotNull [] params, ExpressionContext context) {
|
||||
final List<PsiClass> classes = findDescendants(context, params);
|
||||
if (classes == null || classes.size() == 0) return null;
|
||||
if (classes == null || classes.isEmpty()) return null;
|
||||
|
||||
Set<LookupElement> set = new LinkedHashSet<>();
|
||||
boolean isShortName = params.length > 1 && !Boolean.parseBoolean(params[1].calculateResult(context).toString());
|
||||
|
||||
for (PsiClass object : classes) {
|
||||
final String name = isShortName ? object.getName() : object.getQualifiedName();
|
||||
if (name != null && name.length() > 0) {
|
||||
if (name != null && !name.isEmpty()) {
|
||||
set.add(LookupElementBuilder.create(name));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ import javax.swing.tree.TreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
import javax.swing.tree.TreeSelectionModel;
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
public final class CyclicDependenciesPanel extends JPanel implements Disposable, UiDataProvider {
|
||||
private static final Set<PsiFile> EMPTY_FILE_SET = new HashSet<>(0);
|
||||
@@ -155,7 +155,7 @@ public final class CyclicDependenciesPanel extends JPanel implements Disposable,
|
||||
|
||||
private static PackageDependenciesNode hideEmptyMiddlePackages(PackageDependenciesNode node, StringBuffer result){
|
||||
if (node.getChildCount() == 0 || node.getChildCount() > 1 || node.getChildCount() == 1 && node.getChildAt(0) instanceof FileNode){
|
||||
result.append(result.length() != 0 ? "." : "").append(node.toString().equals(getDefaultPackageAbbreviation()) ? "" : node.toString());//toString()
|
||||
result.append(!result.isEmpty() ? "." : "").append(node.toString().equals(getDefaultPackageAbbreviation()) ? "" : node.toString());//toString()
|
||||
} else {
|
||||
if (node.getChildCount() == 1){
|
||||
PackageDependenciesNode child = (PackageDependenciesNode)node.getChildAt(0);
|
||||
@@ -166,7 +166,7 @@ public final class CyclicDependenciesPanel extends JPanel implements Disposable,
|
||||
} else {
|
||||
if (child instanceof PackageNode){
|
||||
node.removeAllChildren();
|
||||
result.append(result.length() != 0 ? "." : "")
|
||||
result.append(!result.isEmpty() ? "." : "")
|
||||
.append(node.toString().equals(getDefaultPackageAbbreviation()) ? "" : node.toString());
|
||||
node = hideEmptyMiddlePackages(child, result);
|
||||
((PackageNode)node).setPackageName(result.toString());//toString()
|
||||
|
||||
@@ -170,7 +170,7 @@ public final class JavaQualifiedNameProvider implements QualifiedNameProvider {
|
||||
PsiClass aClass = member.getContainingClass();
|
||||
String className = aClass == null ? "" : aClass.getQualifiedName();
|
||||
toInsert = className == null ? "" : className;
|
||||
if (toInsert.length() != 0) toInsert += "#";
|
||||
if (!toInsert.isEmpty()) toInsert += "#";
|
||||
toInsert += member.getName();
|
||||
if (member instanceof PsiMethod) {
|
||||
toInsert += getParameterString((PsiMethod)member, true);
|
||||
@@ -203,7 +203,8 @@ public final class JavaQualifiedNameProvider implements QualifiedNameProvider {
|
||||
// pasting reference to default constructor of the class after new
|
||||
suffix = "()";
|
||||
}
|
||||
else if (toInsert != null && toInsert.length() != 0 && Character.isJavaIdentifierPart(toInsert.charAt(toInsert.length()-1)) && Character.isJavaIdentifierPart(elementAtCaret.getText().charAt(0))) {
|
||||
else if (toInsert != null &&
|
||||
!toInsert.isEmpty() && Character.isJavaIdentifierPart(toInsert.charAt(toInsert.length()-1)) && Character.isJavaIdentifierPart(elementAtCaret.getText().charAt(0))) {
|
||||
//separate identifiers with space
|
||||
suffix = " ";
|
||||
}
|
||||
|
||||
+2
-2
@@ -72,7 +72,7 @@ public class JavaCreateFromTemplateHandler implements CreateFromTemplateHandler
|
||||
if (!template.isTemplateOfType(JavaFileType.INSTANCE)) return;
|
||||
|
||||
String packageName = (String)props.get(FileTemplate.ATTRIBUTE_PACKAGE_NAME);
|
||||
if(packageName == null || packageName.length() == 0 || packageName.equals(FileTemplate.ATTRIBUTE_PACKAGE_NAME)){
|
||||
if(packageName == null || packageName.isEmpty() || packageName.equals(FileTemplate.ATTRIBUTE_PACKAGE_NAME)){
|
||||
PsiPackageStatement packageStatement = file.getPackageStatement();
|
||||
if (packageStatement != null) {
|
||||
packageStatement.delete();
|
||||
@@ -120,7 +120,7 @@ public class JavaCreateFromTemplateHandler implements CreateFromTemplateHandler
|
||||
@Override
|
||||
public void prepareProperties(@NotNull Map<String, Object> props) {
|
||||
String packageName = (String)props.get(FileTemplate.ATTRIBUTE_PACKAGE_NAME);
|
||||
if (packageName == null || packageName.length() == 0) {
|
||||
if (packageName == null || packageName.isEmpty()) {
|
||||
props.put(FileTemplate.ATTRIBUTE_PACKAGE_NAME, FileTemplate.ATTRIBUTE_PACKAGE_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public final class SaveJavaAsTemplateHandler implements SaveFileAsTemplateHandle
|
||||
public @Nullable String getTemplateText(final PsiFile psiFile, String fileText, String nameWithoutExtension) {
|
||||
if(psiFile instanceof PsiJavaFile javaFile){
|
||||
String packageName = javaFile.getPackageName();
|
||||
if (packageName.length() > 0){
|
||||
if (!packageName.isEmpty()){
|
||||
fileText = StringUtil.replace(fileText, packageName, "${PACKAGE_NAME}");
|
||||
}
|
||||
PsiClass[] classes = javaFile.getClasses();
|
||||
|
||||
@@ -35,8 +35,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
final class GenerateVisitorByHierarchyAction extends AnAction {
|
||||
|
||||
@@ -126,7 +126,7 @@ final class GenerateVisitorByHierarchyAction extends AnAction {
|
||||
dialog.show();
|
||||
if (dialog.getExitCode() != DialogWrapper.OK_EXIT_CODE ||
|
||||
dialog.getSelectedPackage() == null ||
|
||||
dialog.getSelectedPackage().getQualifiedName().length() == 0 ||
|
||||
dialog.getSelectedPackage().getQualifiedName().isEmpty() ||
|
||||
parentClassRef.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ public class ArtifactoryRepositoryService extends MavenRepositoryService {
|
||||
|
||||
|
||||
final String className = template.getClassNames();
|
||||
if (className == null || className.length() == 0) {
|
||||
if (className == null || className.isEmpty()) {
|
||||
return searchArtifacts(url, template);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.javadoc;
|
||||
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
@@ -133,7 +133,7 @@ public final class JavadocConfigurable implements Configurable {
|
||||
}
|
||||
|
||||
private static String toSystemIndependentFormat(String directory) {
|
||||
if (directory.length() == 0) {
|
||||
if (directory.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return directory.replace(File.separatorChar, '/');
|
||||
|
||||
@@ -145,7 +145,7 @@ public final class JavadocGeneratorRunProfile implements ModuleRunProfile {
|
||||
}
|
||||
cmdLine.setExePath(tool.getPath());
|
||||
|
||||
if (myConfiguration.HEAP_SIZE != null && myConfiguration.HEAP_SIZE.trim().length() != 0) {
|
||||
if (myConfiguration.HEAP_SIZE != null && !myConfiguration.HEAP_SIZE.trim().isEmpty()) {
|
||||
String param = JavaSdkUtil.isJdkAtLeast(jdk, JavaSdkVersion.JDK_1_2) ? "-J-Xmx" : "-J-mx";
|
||||
cmdLine.getParametersList().prepend(param + myConfiguration.HEAP_SIZE + "m");
|
||||
}
|
||||
@@ -155,7 +155,7 @@ public final class JavadocGeneratorRunProfile implements ModuleRunProfile {
|
||||
private void setParameters(Sdk jdk, GeneralCommandLine cmdLine) throws CantRunException {
|
||||
ParametersList parameters = cmdLine.getParametersList();
|
||||
|
||||
if (myConfiguration.LOCALE != null && myConfiguration.LOCALE.length() > 0) {
|
||||
if (myConfiguration.LOCALE != null && !myConfiguration.LOCALE.isEmpty()) {
|
||||
parameters.add("-locale");
|
||||
parameters.add(myConfiguration.LOCALE);
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
|
||||
|
||||
if (file instanceof PsiJavaFile) {
|
||||
String packageName = ((PsiJavaFile)file).getPackageName();
|
||||
if (packageName.length() > 0) {
|
||||
if (!packageName.isEmpty()) {
|
||||
buffer.append(packageName);
|
||||
newLine(buffer);
|
||||
}
|
||||
@@ -649,7 +649,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
|
||||
createTypeParamsListComment(builder, commenter, typeParameterList);
|
||||
}
|
||||
}
|
||||
return builder.length() > 0 ? builder.toString() : null;
|
||||
return !builder.isEmpty() ? builder.toString() : null;
|
||||
}
|
||||
|
||||
public static void generateParametersTakingDocFromSuperMethods(StringBuilder builder,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.packageDependencies.ui;
|
||||
|
||||
import com.intellij.cyclicDependencies.ui.CyclicDependenciesPanel;
|
||||
@@ -26,11 +26,11 @@ public class PackageNode extends PackageDependenciesNode {
|
||||
super(aPackage.getProject());
|
||||
myPackage = aPackage;
|
||||
myPackageName = showFQName ? aPackage.getQualifiedName() : aPackage.getName();
|
||||
if (myPackageName == null || myPackageName.length() == 0) {
|
||||
if (myPackageName == null || myPackageName.isEmpty()) {
|
||||
myPackageName = CyclicDependenciesPanel.getDefaultPackageAbbreviation();
|
||||
}
|
||||
String packageQName = aPackage.getQualifiedName();
|
||||
if (packageQName.length() == 0) {
|
||||
if (packageQName.isEmpty()) {
|
||||
packageQName = null;
|
||||
}
|
||||
myPackageQName = packageQName;
|
||||
|
||||
@@ -26,7 +26,7 @@ public class JavaPackageEntryTableAccessor extends ValueListPropertyAccessor<Pac
|
||||
PackageEntryTable entryTable = new PackageEntryTable();
|
||||
for (String strValue : strList) {
|
||||
String parseStr = strValue.trim();
|
||||
if (parseStr.length() > 0 && parseStr.charAt(0) == BLANK_LINE_CHAR) {
|
||||
if (!parseStr.isEmpty() && parseStr.charAt(0) == BLANK_LINE_CHAR) {
|
||||
for (int i = 0; i < parseStr.length(); i ++) {
|
||||
if (parseStr.charAt(i) == BLANK_LINE_CHAR) {
|
||||
entryTable.addEntry(PackageEntry.BLANK_LINE_ENTRY);
|
||||
|
||||
@@ -29,8 +29,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.psi.codeStyle.arrangement.std.StdArrangementTokens.EntryType.*;
|
||||
import static com.intellij.psi.codeStyle.arrangement.std.StdArrangementTokens.General.*;
|
||||
@@ -273,7 +273,7 @@ public final class JavaRearranger implements Rearranger<JavaElementArrangementEn
|
||||
for (ArrangementEntryDependencyInfo fieldInInitializerInfo : root.getDependentEntriesInfos()) {
|
||||
JavaElementArrangementEntry fieldInInitializer = fieldInInitializerInfo.getAnchorEntry();
|
||||
if (arrangedFields.indexOf(fieldInInitializer) > anchorEntryIndex ||
|
||||
fieldInInitializerInfo.getDependentEntriesInfos().size() > 0) {
|
||||
!fieldInInitializerInfo.getDependentEntriesInfos().isEmpty()) {
|
||||
anchorField.addDependency(fieldInInitializer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -874,7 +874,7 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
|
||||
// hence, no alignment should be applied to them in order to avoid subsequent blocks aligned with the same alignment to
|
||||
// be located at the left editor edge as well.
|
||||
CharSequence prevChars;
|
||||
if (previous != null && previous.getElementType() == TokenType.WHITE_SPACE && (prevChars = previous.getChars()).length() > 0
|
||||
if (previous != null && previous.getElementType() == TokenType.WHITE_SPACE && !(prevChars = previous.getChars()).isEmpty()
|
||||
&& prevChars.charAt(prevChars.length() - 1) == '\n') {
|
||||
return false;
|
||||
}
|
||||
|
||||
+1
-1
@@ -222,7 +222,7 @@ class ChainMethodCallsBlockBuilder {
|
||||
}
|
||||
|
||||
private @Nullable String getIndentString() {
|
||||
if (nodes.size() > 0) {
|
||||
if (!nodes.isEmpty()) {
|
||||
ASTNode prev = nodes.get(0).getTreePrev();
|
||||
if (prev != null && prev.getPsi() instanceof PsiWhiteSpace && prev.textContains('\n')) {
|
||||
CharSequence whitespace = prev.getChars();
|
||||
|
||||
@@ -125,7 +125,7 @@ public class JDComment {
|
||||
sb.delete(nlen, sb.length());
|
||||
}
|
||||
}
|
||||
else if (sb.length() == 0 && !StringUtil.isEmpty(myEndLine)) {
|
||||
else if (sb.isEmpty() && !StringUtil.isEmpty(myEndLine)) {
|
||||
sb.append(prefix).append('\n');
|
||||
}
|
||||
|
||||
|
||||
@@ -255,14 +255,14 @@ public class JDParser {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (sb.length() > 0) {
|
||||
if (!sb.isEmpty()) {
|
||||
sb.append('\n');
|
||||
}
|
||||
sb.append(line);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (sb.length() > 0) {
|
||||
if (!sb.isEmpty()) {
|
||||
sb.append('\n');
|
||||
}
|
||||
}
|
||||
@@ -606,7 +606,7 @@ public class JDParser {
|
||||
endParagraph(result, sb);
|
||||
}
|
||||
|
||||
if (sb.length() != 0) sb.append(' ');
|
||||
if (!sb.isEmpty()) sb.append(' ');
|
||||
if (markdownComment && !sb.isEmpty()) {
|
||||
// When fusing lines together, horizontal spacing loses its meaning
|
||||
sb.append(s1.trim());
|
||||
@@ -617,7 +617,7 @@ public class JDParser {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!mySettings.JD_PRESERVE_LINE_FEEDS && sb.length() != 0) {
|
||||
if (!mySettings.JD_PRESERVE_LINE_FEEDS && !sb.isEmpty()) {
|
||||
result.add(new Pair<>(sb.toString(), false));
|
||||
}
|
||||
return result;
|
||||
@@ -656,7 +656,7 @@ public class JDParser {
|
||||
}
|
||||
|
||||
private static void endParagraph(@NotNull List<? super Pair<String, Boolean>> result, @NotNull StringBuilder sb) {
|
||||
if (sb.length() > 0) {
|
||||
if (!sb.isEmpty()) {
|
||||
result.add(new Pair<>(sb.toString(), false));
|
||||
sb.setLength(0);
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ public class MyTestInjector {
|
||||
if (!method.hasModifierProperty(PsiModifier.NATIVE) || !method.hasModifierProperty(PsiModifier.PUBLIC)) return;
|
||||
StringBuilder paramList = new StringBuilder();
|
||||
for (PsiParameter parameter : method.getParameterList().getParameters()) {
|
||||
if (paramList.length() > 0) paramList.append(",");
|
||||
if (!paramList.isEmpty()) paramList.append(",");
|
||||
paramList.append(parameter.getName());
|
||||
}
|
||||
@NonNls String header = "function " + method.getName() + "("+paramList+") {";
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package com.intellij.psi.search.scope.packageSet;
|
||||
|
||||
@@ -72,7 +72,7 @@ public final class PatternPackageSetParserExtension implements PackageSetParserE
|
||||
lexer.advance();
|
||||
}
|
||||
|
||||
if (pattern.length() == 0) {
|
||||
if (pattern.isEmpty()) {
|
||||
error(CodeInsightBundle.message("error.package.set.pattern.expectations"), lexer);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.testIntegration.createTest.CreateTestUtils.selectTargetDirectory;
|
||||
|
||||
@@ -449,7 +449,7 @@ public class CreateTestDialog extends DialogWrapper {
|
||||
|
||||
public @Nullable String getSuperClassName() {
|
||||
String result = mySuperClassField.getText().trim();
|
||||
if (result.length() == 0) return null;
|
||||
if (result.isEmpty()) return null;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ReferenceEditorComboWithBrowseButton extends ComponentWithBrowseBut
|
||||
if (recentEntries != null) {
|
||||
setHistory(ArrayUtilRt.toStringArray(recentEntries));
|
||||
}
|
||||
if (text != null && text.length() > 0) {
|
||||
if (text != null && !text.isEmpty()) {
|
||||
prependItem(text);
|
||||
}
|
||||
else if (text != null) {
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.util.text;
|
||||
|
||||
import com.intellij.core.JavaPsiBundle;
|
||||
@@ -67,7 +53,7 @@ public abstract class ElementPresentation {
|
||||
public String getNameWithFQComment() {
|
||||
String comment = getComment();
|
||||
String result = getName();
|
||||
if (comment.trim().length() == 0) return result;
|
||||
if (comment.trim().isEmpty()) return result;
|
||||
return result + " (" + comment + ")";
|
||||
}
|
||||
|
||||
@@ -180,7 +166,7 @@ public abstract class ElementPresentation {
|
||||
@Override
|
||||
public @NlsSafe String getQualifiedName() {
|
||||
String qualifiedName = myPsiPackage.getQualifiedName();
|
||||
if (qualifiedName.length() == 0) return JavaBundle.message("default.package.presentable.name");
|
||||
if (qualifiedName.isEmpty()) return JavaBundle.message("default.package.presentable.name");
|
||||
return qualifiedName;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ public final class ExtendsClassChecker extends DomCustomAnnotationChecker<Extend
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
final SmartList<DomElementProblemDescriptor> list = new SmartList<>();
|
||||
if (toExtend.size() > 0) {
|
||||
if (!toExtend.isEmpty()) {
|
||||
if (!Arrays.asList(names).contains(value.getQualifiedName())
|
||||
&& ContainerUtil.find(toExtend, aClass -> value.isInheritor(aClass, true)) == null) {
|
||||
String message = JavaBundle.message("class.is.not.a.subclass", value.getQualifiedName(), StringUtil.join(names, ","));
|
||||
|
||||
+1
-1
@@ -152,7 +152,7 @@ public final class ThrowableSupplierOnlyThrowExceptionInspection extends BaseIns
|
||||
}
|
||||
|
||||
List<PsiThrowStatement> all = getThrowStatements(lambdaSupplier);
|
||||
if (all.size() == 0) {
|
||||
if (all.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
PsiIdentifier[] identifiers = PsiTreeUtil.getChildrenOfType(expression.getMethodExpression(), PsiIdentifier.class);
|
||||
|
||||
+4
-4
@@ -100,17 +100,17 @@ public final class ReplaceFormatStringWithConcatenationIntention extends MCInten
|
||||
int count = 0;
|
||||
while (end >= 0) {
|
||||
if (end > start) {
|
||||
if (builder.length() > 0) {
|
||||
if (!builder.isEmpty()) {
|
||||
builder.append('+');
|
||||
}
|
||||
builder.append('"').append(StringUtil.escapeStringCharacters(value.substring(start, end))).append('"');
|
||||
}
|
||||
if (builder.length() > 0) {
|
||||
if (!builder.isEmpty()) {
|
||||
builder.append('+');
|
||||
}
|
||||
count++;
|
||||
final PsiExpression argument = arguments[indexOfFormatString + count];
|
||||
if (builder.length() == 0 && !ExpressionUtils.hasStringType(argument)) {
|
||||
if (builder.isEmpty() && !ExpressionUtils.hasStringType(argument)) {
|
||||
builder.append("String.valueOf(").append(commentTracker.text(argument)).append(')');
|
||||
}
|
||||
else {
|
||||
@@ -120,7 +120,7 @@ public final class ReplaceFormatStringWithConcatenationIntention extends MCInten
|
||||
end = value.indexOf("%s", start);
|
||||
}
|
||||
if (start < value.length()) {
|
||||
if (builder.length() > 0) {
|
||||
if (!builder.isEmpty()) {
|
||||
builder.append('+');
|
||||
}
|
||||
builder.append('"').append(StringUtil.escapeStringCharacters(value.substring(start))).append('"');
|
||||
|
||||
@@ -90,7 +90,7 @@ public final class ConstantSubexpressionIntention extends MCIntention {
|
||||
newExpressionText.append(prevToken.getText());
|
||||
}
|
||||
if (token == currentToken) {
|
||||
if (newExpressionText.length() > 0) {
|
||||
if (!newExpressionText.isEmpty()) {
|
||||
newExpressionText.append(' ');
|
||||
}
|
||||
if (value instanceof Long) {
|
||||
|
||||
+1
-1
@@ -210,7 +210,7 @@ public final class CommentFoldingUtil {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(prefix);
|
||||
|
||||
if (text != null && text.length() > 0) {
|
||||
if (text != null && !text.isEmpty()) {
|
||||
sb.append(text);
|
||||
sb.append(" ");
|
||||
}
|
||||
|
||||
+1
-1
@@ -164,7 +164,7 @@ public final class InferenceVariablesOrder {
|
||||
boolean includeSelfDependency = false;
|
||||
for (Iterator<InferenceGraphNode<T>> iterator = myDependencies.iterator(); iterator.hasNext(); ) {
|
||||
InferenceGraphNode<T> d = iterator.next();
|
||||
assert d.myValue.size() >= 1;
|
||||
assert !d.myValue.isEmpty();
|
||||
final T initialNodeValue = d.myValue.get(0);
|
||||
if (myValue.contains(initialNodeValue)) {
|
||||
includeSelfDependency = true;
|
||||
|
||||
@@ -32,7 +32,7 @@ public final class LiteralFormatUtil {
|
||||
groupSize = 4; // hex, bin
|
||||
}
|
||||
|
||||
if (text.length() == 0) return original;
|
||||
if (text.isEmpty()) return original;
|
||||
|
||||
final char last = text.charAt(text.length() - 1);
|
||||
if (StringUtil.containsChar("Ll", last) ||
|
||||
@@ -42,7 +42,7 @@ public final class LiteralFormatUtil {
|
||||
text = text.substring(0, pos);
|
||||
}
|
||||
|
||||
if (text.length() == 0) return original;
|
||||
if (text.isEmpty()) return original;
|
||||
|
||||
boolean hasPoint = false;
|
||||
String fractional = "";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.rt.ant.execution;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
@@ -26,7 +26,7 @@ public class IdeaInputHandler implements InputHandler {
|
||||
if (request instanceof MultipleChoiceInputRequest) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> choices = ((MultipleChoiceInputRequest)request).getChoices();
|
||||
if (choices != null && choices.size() > 0) {
|
||||
if (choices != null && !choices.isEmpty()) {
|
||||
int count = choices.size();
|
||||
packet.appendLong(count);
|
||||
for (String choice : choices) {
|
||||
|
||||
+3
-17
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.rt.execution.testFrameworks;
|
||||
|
||||
import java.io.*;
|
||||
@@ -83,7 +69,7 @@ public abstract class ForkedByModuleSplitter {
|
||||
}
|
||||
|
||||
builder.add("-classpath");
|
||||
if (myDynamicClasspath.length() > 0) {
|
||||
if (!myDynamicClasspath.isEmpty()) {
|
||||
try {
|
||||
if ("ARGS_FILE".equals(myDynamicClasspath)) {
|
||||
File argFile = File.createTempFile("arg_file", null);
|
||||
@@ -154,7 +140,7 @@ public abstract class ForkedByModuleSplitter {
|
||||
final String classpath = perDirReader.readLine();
|
||||
List<String> moduleOptions = new ArrayList<>();
|
||||
String modulePath = perDirReader.readLine();
|
||||
if (modulePath != null && modulePath.length() > 0) {
|
||||
if (modulePath != null && !modulePath.isEmpty()) {
|
||||
moduleOptions.add("-p");
|
||||
moduleOptions.add(modulePath);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.rt.execution.testFrameworks;
|
||||
|
||||
import com.intellij.rt.execution.junit.RepeatCount;
|
||||
@@ -30,7 +30,7 @@ public abstract class ForkedSplitter<T> extends ForkedByModuleSplitter {
|
||||
final String classpath = System.getProperty("java.class.path");
|
||||
final String modulePath = System.getProperty("jdk.module.path");
|
||||
final List<String> moduleOptions = new ArrayList<>();
|
||||
if (modulePath != null && modulePath.length() > 0) {
|
||||
if (modulePath != null && !modulePath.isEmpty()) {
|
||||
moduleOptions.add("-p");
|
||||
moduleOptions.add(modulePath);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.rt.execution.testFrameworks;
|
||||
|
||||
import java.io.File;
|
||||
@@ -67,7 +53,7 @@ public class ProcessBuilder {
|
||||
//
|
||||
// If either of these becomes an issue, please refer to [util] CommandLineUtil.addToWindowsCommandLine() for a possible implementation.
|
||||
public Process createProcess() throws IOException {
|
||||
if (myParameters.size() < 1) {
|
||||
if (myParameters.isEmpty()) {
|
||||
throw new IllegalArgumentException("Executable name not specified");
|
||||
}
|
||||
|
||||
@@ -91,7 +77,7 @@ public class ProcessBuilder {
|
||||
while ((pos = parameter.indexOf('\"', pos)) >= 0);
|
||||
parameter = buffer.toString();
|
||||
}
|
||||
else if (parameter.length() == 0) {
|
||||
else if (parameter.isEmpty()) {
|
||||
parameter = "\"\"";
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -351,7 +351,7 @@ public final class JavaStructuralSearchProfile extends StructuralSearchProfile {
|
||||
}
|
||||
|
||||
private static boolean shouldTryExpressionPattern(@NotNull List<? extends PsiElement> elements) {
|
||||
if (elements.size() >= 1 && elements.size() <= 3) {
|
||||
if (!elements.isEmpty() && elements.size() <= 3) {
|
||||
final PsiElement firstElement = elements.get(0);
|
||||
if (firstElement instanceof PsiDeclarationStatement) {
|
||||
final PsiElement lastChild = firstElement.getLastChild();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.debugger;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
@@ -144,7 +144,7 @@ public final class BreakpointComment {
|
||||
public void done() {
|
||||
if (kind != null) throw error("Unprocessed kind '" + kind + "'");
|
||||
if (kindValue != null) throw error("Unprocessed kind value '" + kindValue + "'");
|
||||
if (values.size() >= 1) {
|
||||
if (!values.isEmpty()) {
|
||||
String valid = String.join(", ", validValues);
|
||||
String msg = "Unprocessed %s '%s', %s".formatted(
|
||||
values.size() > 1 ? "values" : "value",
|
||||
|
||||
+2
-2
@@ -110,11 +110,11 @@ public class TypeConversionDescriptor extends TypeConversionDescriptorBase {
|
||||
buf.append(myReplaceByString);
|
||||
}
|
||||
if (myStringToReplace != null) {
|
||||
if (buf.length() > 0) buf.append(" ");
|
||||
if (!buf.isEmpty()) buf.append(" ");
|
||||
buf.append(myStringToReplace);
|
||||
}
|
||||
if (myExpression != null) {
|
||||
if (buf.length() > 0) buf.append(" ");
|
||||
if (!buf.isEmpty()) buf.append(" ");
|
||||
buf.append(myExpression.getText());
|
||||
}
|
||||
return buf.toString();
|
||||
|
||||
@@ -111,7 +111,7 @@ public final class UnscrambleUtils {
|
||||
int linesCount = 0;
|
||||
for (String line : text.split("\n")) {
|
||||
line = line.trim();
|
||||
if (line.length() == 0) continue;
|
||||
if (line.isEmpty()) continue;
|
||||
line = StringUtil.trimEnd(line, "\r");
|
||||
if (STACKTRACE_LINE.matcher(line).matches()) {
|
||||
linesCount++;
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package jetbrains.antlayout.datatypes;
|
||||
|
||||
import jetbrains.antlayout.util.LayoutFileSet;
|
||||
@@ -56,7 +42,7 @@ public class ExtractedDirContent extends Content {
|
||||
if (pathInJar.startsWith("/")) {
|
||||
pathInJar = pathInJar.substring(1);
|
||||
}
|
||||
if (pathInJar.length() > 0) {
|
||||
if (!pathInJar.isEmpty()) {
|
||||
final PatternSet patternSet = new PatternSet();
|
||||
patternSet.createInclude().setName(pathInJar + "**");
|
||||
expandTask.addPatternset(patternSet);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package jetbrains.antlayout.datatypes;
|
||||
|
||||
import jetbrains.antlayout.util.LayoutFileSet;
|
||||
@@ -32,7 +32,7 @@ public class RootContainer extends Container {
|
||||
task.setTaskName("copy");
|
||||
task.setProject(getProject());
|
||||
String prefix = set.getPrefix(getProject());
|
||||
File target = prefix.length() > 0 ? new File(destDirectory, prefix + "/") : destDirectory;
|
||||
File target = !prefix.isEmpty() ? new File(destDirectory, prefix + "/") : destDirectory;
|
||||
|
||||
target.mkdirs();
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ final class InputFileObject extends JpsFileObject {
|
||||
final String fPath = myFile.getPath();
|
||||
for (File dir: path) {
|
||||
String dirPath = dir.getPath();
|
||||
if (dirPath.length() == 0) {
|
||||
if (dirPath.isEmpty()) {
|
||||
dirPath = System.getProperty("user.dir");
|
||||
}
|
||||
if (!fPath.regionMatches(!caseSensitiveFS, 0, dirPath, 0, dirPath.length())) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user