chore: Fix some xlint warnings

This commit is contained in:
FalsePattern 2024-05-13 21:29:51 +02:00
parent 21ed7d66e1
commit ec7e9c4894
Signed by: falsepattern
GPG key ID: E930CDEC50C50E23
4 changed files with 10 additions and 6 deletions

View file

@ -96,7 +96,8 @@ public class WinDAPDriver extends DAPDriver<
return capabilitiesCompletableFuture.thenCombine(handshakeFuture, (res, hs) -> res); return capabilitiesCompletableFuture.thenCombine(handshakeFuture, (res, hs) -> res);
} }
@SuppressWarnings("unused") //Weird nested generics interaction, not suppressing unchecked causes a linter error, I have no idea how to fix this
@SuppressWarnings({"unchecked", "RedundantSuppression"})
protected class WinDAPDebuggerClient extends DAPDebuggerClient { protected class WinDAPDebuggerClient extends DAPDebuggerClient {
@Override @Override
public void output(OutputEventArguments args) { public void output(OutputEventArguments args) {

View file

@ -218,6 +218,7 @@ public class LSPAnnotator extends ExternalAnnotator<Object, Object> {
annotation = annotation.highlightType(ProblemHighlightType.LIKE_DEPRECATED); annotation = annotation.highlightType(ProblemHighlightType.LIKE_DEPRECATED);
} }
annotation.create(); annotation.create();
@SuppressWarnings("unchecked")
var theList = (SmartList<Annotation>) holder; var theList = (SmartList<Annotation>) holder;
annotations.add(theList.get(theList.size() - 1)); annotations.add(theList.get(theList.size() - 1));
}); });

View file

@ -572,7 +572,7 @@ public class EditorEventManager {
try { try {
request.thenAccept(formatting -> { request.thenAccept(formatting -> {
if (formatting != null) { if (formatting != null) {
invokeLater(() -> applyEdit(toEither((List<TextEdit>) formatting), "Reformat document", false)); invokeLater(() -> applyEdit(toEither(formatting), "Reformat document", false));
} }
}); });
} catch (IndexOutOfBoundsException e) { } catch (IndexOutOfBoundsException e) {
@ -614,7 +614,7 @@ public class EditorEventManager {
} }
invokeLater(() -> { invokeLater(() -> {
if (!editor.isDisposed()) { if (!editor.isDisposed()) {
applyEdit(toEither((List<TextEdit>) formatting), "Reformat selection", false); applyEdit(toEither(formatting), "Reformat selection", false);
} }
}); });
}); });
@ -1347,13 +1347,15 @@ public class EditorEventManager {
.withFix(new LSPCodeActionFix(FileUtils.editorToURIString(editor), codeAction)) .withFix(new LSPCodeActionFix(FileUtils.editorToURIString(editor), codeAction))
.create(); .create();
SmartList<Annotation> asList = (SmartList<Annotation>) this.anonHolder; @SuppressWarnings("unchecked")
SmartList<? extends Annotation> asList = (SmartList<Annotation>) this.anonHolder;
this.annotations.add(asList.get(asList.size() - 1)); this.annotations.add(asList.get(asList.size() - 1));
diagnosticSyncRequired = true; diagnosticSyncRequired = true;
} catch (IllegalArgumentException ignored) { } catch (IllegalArgumentException e) {
//TODO Suppressed error, fix this somehow //TODO Suppressed error, fix this somehow
e.printStackTrace();
} }
} }
} }

View file

@ -163,7 +163,7 @@ public class DocumentUtils {
return computableReadAction(() -> !editor.getSettings().isUseTabCharacter(editor.getProject())); return computableReadAction(() -> !editor.getSettings().isUseTabCharacter(editor.getProject()));
} }
public static List<Either<TextEdit, InsertReplaceEdit>> toEither(List<TextEdit> edits) { public static List<Either<TextEdit, InsertReplaceEdit>> toEither(List<? extends TextEdit> edits) {
return edits.stream().map(Either::<TextEdit, InsertReplaceEdit>forLeft).collect(Collectors.toList()); return edits.stream().map(Either::<TextEdit, InsertReplaceEdit>forLeft).collect(Collectors.toList());
} }
} }