Fix warnings

GitOrigin-RevId: b055acda48e69f36862e8c494f0189aef21e985b
This commit is contained in:
Tagir Valeev
2025-05-28 11:30:56 +02:00
committed by intellij-monorepo-bot
parent 09ee1759eb
commit 857e72f73e
8 changed files with 19 additions and 28 deletions

View File

@@ -5,7 +5,6 @@ import com.intellij.openapi.util.SystemInfoRt;
import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.util.ArrayUtilRt; import com.intellij.util.ArrayUtilRt;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.*; import java.io.*;
import java.sql.Blob; import java.sql.Blob;
@@ -22,12 +21,7 @@ public abstract class LobInfo<T extends LobInfo<?>> implements Comparable<T>, Se
private boolean isFullyReloaded; private boolean isFullyReloaded;
private static final ThreadLocal<byte[]> BUFFER = new ThreadLocal<byte[]>() { private static final ThreadLocal<byte[]> BUFFER = ThreadLocal.withInitial(() -> new byte[8192]);
@Override
protected byte[] initialValue() {
return new byte[8192];
}
};
public LobInfo(long length) { public LobInfo(long length) {
this.length = length; this.length = length;
@@ -121,11 +115,11 @@ public abstract class LobInfo<T extends LobInfo<?>> implements Comparable<T>, Se
return maxLength < 0 ? Integer.MAX_VALUE : maxLength; return maxLength < 0 ? Integer.MAX_VALUE : maxLength;
} }
public static @Nullable Object fromInputStream(InputStream o, int maxLength) throws IOException { public static @NotNull Object fromInputStream(InputStream o, int maxLength) throws IOException {
return fromByteArray(loadBytes(o, realMaxLength(maxLength)), maxLength); return fromByteArray(loadBytes(o, realMaxLength(maxLength)), maxLength);
} }
public static @Nullable Object fromReader(Reader o, int maxLength) throws IOException { public static @NotNull Object fromReader(Reader o, int maxLength) throws IOException {
return fromString(String.valueOf(FileUtilRt.loadText(o, realMaxLength(maxLength))), maxLength); return fromString(String.valueOf(FileUtilRt.loadText(o, realMaxLength(maxLength))), maxLength);
} }
@@ -147,7 +141,7 @@ public abstract class LobInfo<T extends LobInfo<?>> implements Comparable<T>, Se
@Override @Override
public int hashCode() { public int hashCode() {
return (int)(length ^ (length >>> 32)); return Long.hashCode(length);
} }
public static class ClobInfo extends LobInfo<ClobInfo> { public static class ClobInfo extends LobInfo<ClobInfo> {
@@ -217,7 +211,7 @@ public abstract class LobInfo<T extends LobInfo<?>> implements Comparable<T>, Se
return Comparing.compare(data, o.data); return Comparing.compare(data, o.data);
} }
public int compareTo(@NotNull byte[] bytes) { public int compareTo(byte @NotNull [] bytes) {
final int lenVal = Long.compare(length, bytes.length); final int lenVal = Long.compare(length, bytes.length);
if (lenVal != 0 || length == 0) return lenVal; if (lenVal != 0 || length == 0) return lenVal;
return Comparing.compare(data, bytes); return Comparing.compare(data, bytes);

View File

@@ -3,7 +3,6 @@ package org.jetbrains.jps.incremental.relativizer;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.VisibleForTesting; import org.jetbrains.annotations.VisibleForTesting;
import org.jetbrains.jps.model.serialization.JpsMavenSettings; import org.jetbrains.jps.model.serialization.JpsMavenSettings;
@@ -16,8 +15,8 @@ public final class MavenPathRelativizer extends CommonPathRelativizer {
super(mavenRepositoryPath, IDENTIFIER); super(mavenRepositoryPath, IDENTIFIER);
} }
public static @Nullable String getNormalizedMavenRepositoryPath() { public static @NotNull String getNormalizedMavenRepositoryPath() {
String path = JpsMavenSettings.getMavenRepositoryPath(); String path = JpsMavenSettings.getMavenRepositoryPath();
return path == null ? null : PathRelativizerService.normalizePath(path); return PathRelativizerService.normalizePath(path);
} }
} }

View File

@@ -160,9 +160,7 @@ public final class PathRelativizerService {
} }
String mavenRepositoryPath = MavenPathRelativizer.getNormalizedMavenRepositoryPath(); String mavenRepositoryPath = MavenPathRelativizer.getNormalizedMavenRepositoryPath();
if (mavenRepositoryPath != null) { result.add(new MavenPathRelativizer(mavenRepositoryPath));
result.add(new MavenPathRelativizer(mavenRepositoryPath));
}
String gradleRepositoryPath = GradlePathRelativizer.initializeGradleRepositoryPath(); String gradleRepositoryPath = GradlePathRelativizer.initializeGradleRepositoryPath();
if (gradleRepositoryPath != null) { if (gradleRepositoryPath != null) {

View File

@@ -50,7 +50,6 @@ import java.util.stream.Stream;
public class FileSystemTreeImpl implements FileSystemTree { public class FileSystemTreeImpl implements FileSystemTree {
private final Tree myTree; private final Tree myTree;
private final FileTreeStructure myTreeStructure;
private final Project myProject; private final Project myProject;
private final ArrayList<Runnable> myOkActions = new ArrayList<>(2); private final ArrayList<Runnable> myOkActions = new ArrayList<>(2);
private final FileChooserDescriptor myDescriptor; private final FileChooserDescriptor myDescriptor;
@@ -72,14 +71,15 @@ public class FileSystemTreeImpl implements FileSystemTree {
final @Nullable Runnable onInitialized, final @Nullable Runnable onInitialized,
final @Nullable Convertor<? super TreePath, String> speedSearchConverter) { final @Nullable Convertor<? super TreePath, String> speedSearchConverter) {
myProject = project; myProject = project;
FileTreeStructure treeStructure;
if (renderer == null) { if (renderer == null) {
renderer = new FileRenderer().forTree(); renderer = new FileRenderer().forTree();
myFileTreeModel = createFileTreeModel(descriptor, tree); myFileTreeModel = createFileTreeModel(descriptor, tree);
myTreeStructure = null; treeStructure = null;
} }
else { else {
myTreeStructure = new FileTreeStructure(project, descriptor); treeStructure = new FileTreeStructure(project, descriptor);
myFileTreeModel = new StructureTreeModel<>(myTreeStructure, getFileComparator(), this); myFileTreeModel = new StructureTreeModel<>(treeStructure, getFileComparator(), this);
} }
myDescriptor = descriptor; myDescriptor = descriptor;
myTree = tree; myTree = tree;

View File

@@ -135,6 +135,7 @@ public class TextRange implements Segment, Serializable {
* @return true if the given offset is within the range, false otherwise * @return true if the given offset is within the range, false otherwise
* @see #containsOffset(int) * @see #containsOffset(int)
*/ */
@Override
@Contract(pure = true) @Contract(pure = true)
public boolean contains(int offset) { public boolean contains(int offset) {
return myStartOffset <= offset && offset < myEndOffset; return myStartOffset <= offset && offset < myEndOffset;

View File

@@ -36,7 +36,7 @@ final class EditorConfigStatusListener implements CodeStyleSettingsListener {
@NotNull VirtualFile virtualFile, @NotNull VirtualFile virtualFile,
@NotNull Set<String> encodings) { @NotNull Set<String> encodings) {
myProject = project; myProject = project;
myEnabledStatus = Utils.INSTANCE.isEnabled(project); myEnabledStatus = Utils.isEnabled(project);
myVirtualFile = virtualFile; myVirtualFile = virtualFile;
myEncodings = encodings; myEncodings = encodings;
} }
@@ -49,7 +49,7 @@ final class EditorConfigStatusListener implements CodeStyleSettingsListener {
return; return;
} }
boolean newEnabledStatus = Utils.INSTANCE.isEnabled(myProject); boolean newEnabledStatus = Utils.isEnabled(myProject);
if (myEnabledStatus != newEnabledStatus) { if (myEnabledStatus != newEnabledStatus) {
myEnabledStatus = newEnabledStatus; myEnabledStatus = newEnabledStatus;
onEditorConfigEnabled(newEnabledStatus); onEditorConfigEnabled(newEnabledStatus);

View File

@@ -48,7 +48,7 @@ final class GithubRepository extends BaseRepository {
private @NotNull String myUser = ""; private @NotNull String myUser = "";
private boolean myAssignedIssuesOnly = false; private boolean myAssignedIssuesOnly = false;
@SuppressWarnings({"UnusedDeclaration"}) @SuppressWarnings("UnusedDeclaration")
GithubRepository() { GithubRepository() {
} }

View File

@@ -47,7 +47,6 @@ import com.intellij.xdebugger.*;
import com.intellij.xdebugger.breakpoints.*; import com.intellij.xdebugger.breakpoints.*;
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider; import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
import com.intellij.xdebugger.frame.*; import com.intellij.xdebugger.frame.*;
import com.intellij.xdebugger.impl.XDebugSessionImpl;
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl; import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
import com.intellij.xdebugger.stepping.XSmartStepIntoHandler; import com.intellij.xdebugger.stepping.XSmartStepIntoHandler;
import com.jetbrains.python.PyBundle; import com.jetbrains.python.PyBundle;
@@ -581,7 +580,7 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
} }
public void setUnitTestDebuggingMode() { public void setUnitTestDebuggingMode() {
ExecutionEnvironment environment = ((XDebugSessionImpl)getSession()).getExecutionEnvironment(); ExecutionEnvironment environment = getSession().getExecutionEnvironment();
if (environment == null) return; if (environment == null) return;
RunProfile runProfile = environment.getRunProfile(); RunProfile runProfile = environment.getRunProfile();
if (runProfile instanceof AbstractPythonTestRunConfiguration if (runProfile instanceof AbstractPythonTestRunConfiguration
@@ -851,7 +850,7 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
public @Nullable XValueChildrenList loadFrame(final @Nullable XStackFrame contextFrame) throws PyDebuggerException { public @Nullable XValueChildrenList loadFrame(final @Nullable XStackFrame contextFrame) throws PyDebuggerException {
final PyStackFrame frame = contextFrame == null ? currentFrame() : (PyStackFrame)contextFrame; final PyStackFrame frame = contextFrame == null ? currentFrame() : (PyStackFrame)contextFrame;
synchronized (myFrameCacheObject) { synchronized (myFrameCacheObject) {
// Do not reload frame every time it is needed, because due to a bug in pdb, reloading frame clears all variable changes. // Do not reload the frame every time it is needed, because due to a bug in pdb, reloading frame clears all variable changes.
if (!myStackFrameCache.containsKey(frame.getThreadFrameId())) { if (!myStackFrameCache.containsKey(frame.getThreadFrameId())) {
XValueChildrenList values = myDebugger.loadFrame(frame.getThreadId(), frame.getFrameId(), ProcessDebugger.GROUP_TYPE.DEFAULT); XValueChildrenList values = myDebugger.loadFrame(frame.getThreadId(), frame.getFrameId(), ProcessDebugger.GROUP_TYPE.DEFAULT);
// Could be null when the current function is called for a thread that is already dead. // Could be null when the current function is called for a thread that is already dead.
@@ -1204,7 +1203,7 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
} }
} }
else { else {
((XDebugSessionImpl)getSession()).positionReached(suspendContext, isFailedTestStop(threadInfo)); getSession().positionReached(suspendContext, isFailedTestStop(threadInfo));
} }
} }
else { else {