mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
Some 'Result of method call ignored' warnings fixed or suppressed
GitOrigin-RevId: 757e7bc0b1d7cb7cbf4a13c35e4f5c1fc375e0a4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
41675b6959
commit
df1679571e
@@ -3,23 +3,21 @@ package com.intellij.java.codeInsight.daemon;
|
||||
|
||||
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.testFramework.SkipSlowTestLocally;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.ThrowableRunnable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
|
||||
@SkipSlowTestLocally
|
||||
public class RecursiveVisitorTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testHugeConcatenationVisitingPerformance() throws IncorrectOperationException {
|
||||
StringBuilder text = new StringBuilder("String s = null");
|
||||
final int N = 20000;
|
||||
for (int i = 0; i < N; i++) {
|
||||
text.append("+\"xxx\"");
|
||||
}
|
||||
text.append(";");
|
||||
String text = "String s = null" + "+\"xxx\"".repeat(N) + ";";
|
||||
final PsiElement expression =
|
||||
JavaPsiFacade.getElementFactory(getProject()).createStatementFromText(text.toString(), null);
|
||||
JavaPsiFacade.getElementFactory(getProject()).createStatementFromText(text, null);
|
||||
final int[] n = {0};
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), new ThrowableRunnable() {
|
||||
@Override
|
||||
@@ -30,7 +28,7 @@ public class RecursiveVisitorTest extends LightDaemonAnalyzerTestCase {
|
||||
public void visitExpression(@NotNull PsiExpression expression) {
|
||||
PsiExpression s = expression;
|
||||
super.visitExpression(expression);
|
||||
s.hashCode(); //hold on stack
|
||||
Reference.reachabilityFence(s); //hold on stack
|
||||
n[0]++;
|
||||
}
|
||||
});
|
||||
@@ -39,14 +37,10 @@ public class RecursiveVisitorTest extends LightDaemonAnalyzerTestCase {
|
||||
}).start();
|
||||
}
|
||||
public void testHugeMethodChainingVisitingPerformance() throws IncorrectOperationException {
|
||||
StringBuilder text = new StringBuilder("Object s = new StringBuilder()");
|
||||
final int N = 20000;
|
||||
for (int i = 0; i < N; i++) {
|
||||
text.append(".append(\"xxx\")");
|
||||
}
|
||||
text.append(";");
|
||||
String text = "Object s = new StringBuilder()" + ".append(\"xxx\")".repeat(N) + ";";
|
||||
final PsiElement expression =
|
||||
JavaPsiFacade.getElementFactory(getProject()).createStatementFromText(text.toString(), null);
|
||||
JavaPsiFacade.getElementFactory(getProject()).createStatementFromText(text, null);
|
||||
final int[] n = {0};
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), new ThrowableRunnable() {
|
||||
@Override
|
||||
|
||||
@@ -47,6 +47,7 @@ public class SameSourceRootInTwoModulesTest extends JavaPsiTestCase {
|
||||
assertEquals("p.A", psiClass.getQualifiedName());
|
||||
|
||||
PsiFile psiFile = myPsiManager.findFile(myPackDir.findChild("A.java"));
|
||||
//noinspection ResultOfMethodCallIgnored -- load PSI
|
||||
psiFile.getChildren();
|
||||
assertEquals(psiFile, psiClass.getContainingFile());
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class SourceRootAddedAsLibraryRootTest extends JavaPsiTestCase {
|
||||
public void testBug() {
|
||||
touchFileSync();
|
||||
PsiFile psiFile = myPsiManager.findFile(myVFile);
|
||||
psiFile.getText();
|
||||
assertNotNull(psiFile.getText());
|
||||
changeRoots();
|
||||
}
|
||||
|
||||
|
||||
@@ -509,7 +509,7 @@ public class PsiEventsTest extends JavaPsiTestCase {
|
||||
setFileText(file, "aaa");
|
||||
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
|
||||
PsiFile psiFile = fileManager.findFile(file);
|
||||
psiFile.getText();
|
||||
assertNotNull(psiFile.getText()); // Trigger PSI loading
|
||||
|
||||
EventsTestListener listener = new EventsTestListener();
|
||||
myPsiManager.addPsiTreeChangeListener(listener,getTestRootDisposable());
|
||||
|
||||
@@ -335,7 +335,7 @@ public class SmartPsiElementPointersTest extends JavaCodeInsightTestCase {
|
||||
psiDocumentManager.commitAllDocuments();
|
||||
|
||||
if (aClass.isValid()) {
|
||||
aClass.getChildren();
|
||||
assertNotNull(aClass.getChildren()); // trigger PSI loading
|
||||
}
|
||||
|
||||
element = pointer.getElement();
|
||||
|
||||
@@ -99,6 +99,7 @@ public class PropertiesPerformanceTest extends JavaCodeInsightTestCase {
|
||||
aClass.accept(new JavaRecursiveElementWalkingVisitor() {
|
||||
@Override
|
||||
public void visitLiteralExpression(@NotNull PsiLiteralExpression expression) {
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
expression.getNode();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -42,7 +42,8 @@ public class ConfigurationsTest {
|
||||
|
||||
@BeforeMethod
|
||||
public void setUp() throws Exception {
|
||||
JavaTestFixtureFactory.getFixtureFactory(); // registers Java module fixture builder
|
||||
//noinspection ResultOfMethodCallIgnored -- registers Java module fixture builder
|
||||
JavaTestFixtureFactory.getFixtureFactory();
|
||||
final IdeaTestFixtureFactory fixtureFactory = IdeaTestFixtureFactory.getFixtureFactory();
|
||||
final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = fixtureFactory.createFixtureBuilder(getClass().getSimpleName());
|
||||
myFixture = fixtureFactory.createTempDirTestFixture();
|
||||
|
||||
Reference in New Issue
Block a user