[2021.1 compat] Use raw Result as parameter in `ReadAction#run`
The API of `ReadAction#run` was changed to take wildcard generics (Result<? super T> instead of Result<T>) in [this commit](https://github.com/JetBrains/intellij-community/commit/f2b30746d517145865ca7b8021b09d5e523fbfe6#diff-990213c2da7fc2da4f634c7682919c1c750a5d9f2827593d424c617e62bb2232).
To make this work across both API levels, we use Result as a raw parameter.
@@ -109,10 +109,14 @@ public class TestFileSystem {
}
/** Finds PsiFile, and asserts that it's not null. */
+ // #api203: remove "@SuppressWarnings({"rawtypes", "RedundantSuppression"})"
+ @SuppressWarnings({"rawtypes", "RedundantSuppression"})
public PsiFile getPsiFile(VirtualFile file) {
return new ReadAction<PsiFile>() {
@Override
- protected void run(Result<PsiFile> result) throws Throwable {
+ protected void run(
+ // #api203 replace with "Result<? super PsiFile>"
+ Result result) {
PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
assertThat(psiFile).isNotNull();
result.setResult(psiFile);
@@ -121,10 +125,14 @@ public class TestFileSystem {
}
/** Finds PsiDirectory, and asserts that it's not null. */
+ // #api203: remove "@SuppressWarnings({"rawtypes", "RedundantSuppression"})"
+ @SuppressWarnings({"rawtypes", "RedundantSuppression"})
public PsiDirectory getPsiDirectory(VirtualFile file) {
return new ReadAction<PsiDirectory>() {
@Override
- protected void run(Result<PsiDirectory> result) throws Throwable {
+ protected void run(
+ // #api203 replace with "Result<? super PsiDirectory>"
+ Result result) {
PsiDirectory psiFile = PsiManager.getInstance(project).findDirectory(file);
assertThat(psiFile).isNotNull();
result.setResult(psiFile);
