mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -40,8 +40,7 @@ public class QuickFixWrapper implements IntentionAction {
|
||||
private static final Logger LOG = Logger.getInstance("com.intellij.codeInspection.ex.QuickFixWrapper");
|
||||
|
||||
private final ProblemDescriptor myDescriptor;
|
||||
private final int myFixNumber;
|
||||
|
||||
private final LocalQuickFix myFix;
|
||||
|
||||
@NotNull
|
||||
public static IntentionAction wrap(@NotNull ProblemDescriptor descriptor, int fixNumber) {
|
||||
@@ -50,12 +49,12 @@ public class QuickFixWrapper implements IntentionAction {
|
||||
LOG.assertTrue(fixes != null && fixes.length > fixNumber);
|
||||
|
||||
final QuickFix fix = fixes[fixNumber];
|
||||
return fix instanceof IntentionAction ? (IntentionAction)fix : new QuickFixWrapper(descriptor, fixNumber);
|
||||
return fix instanceof IntentionAction ? (IntentionAction)fix : new QuickFixWrapper(descriptor, (LocalQuickFix)fix);
|
||||
}
|
||||
|
||||
private QuickFixWrapper(@NotNull ProblemDescriptor descriptor, int fixNumber) {
|
||||
private QuickFixWrapper(@NotNull ProblemDescriptor descriptor, @NotNull LocalQuickFix fix) {
|
||||
myDescriptor = descriptor;
|
||||
myFixNumber = fixNumber;
|
||||
myFix = fix;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +66,7 @@ public class QuickFixWrapper implements IntentionAction {
|
||||
@Override
|
||||
@NotNull
|
||||
public String getFamilyName() {
|
||||
return myDescriptor.getFixes()[myFixNumber].getName();
|
||||
return getFix().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -104,8 +103,9 @@ public class QuickFixWrapper implements IntentionAction {
|
||||
return getFix().getElementToMakeWritable(file);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public LocalQuickFix getFix() {
|
||||
return (LocalQuickFix)myDescriptor.getFixes()[myFixNumber];
|
||||
return myFix;
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
|
||||
@@ -30,7 +30,7 @@ public interface BaseComponent extends NamedComponent {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see {@link com.intellij.openapi.Disposable}
|
||||
* @see com.intellij.openapi.Disposable
|
||||
*/
|
||||
default void disposeComponent() {
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public class VfsData {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static VirtualFileSystemEntry getFileById(int id, VirtualDirectoryImpl parent) {
|
||||
static VirtualFileSystemEntry getFileById(int id, VirtualDirectoryImpl parent) {
|
||||
Segment segment = getSegment(id, false);
|
||||
if (segment == null) return null;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class IdeEventQueueTest extends PlatformTestCase {
|
||||
public void testManyEvents() {
|
||||
public void testManyEventsStress() {
|
||||
int N = 100000;
|
||||
PlatformTestUtil.startPerformanceTest("Event queue dispatch", 10000, () -> {
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
|
||||
+12
-14
@@ -287,7 +287,7 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addingManyChildrenToTheSameDirectoryMustNotBeQuadratic() throws IOException {
|
||||
public void addingManyChildrenToTheSameDirectoryMustNotBeQuadratic() throws Exception {
|
||||
int N = 1_000_000;
|
||||
// measures create N children inside one directory.
|
||||
// to avoid slow local file system try to use MyFakeVirtualFile which doesn't actually query disk
|
||||
@@ -296,21 +296,19 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase {
|
||||
Disposer.register(getTestRootDisposable(), ()-> ApplicationInfoImpl.setInStressTest(false));
|
||||
List<VirtualFile> toDelete = new ArrayList<>();
|
||||
try {
|
||||
UIUtil.invokeLaterIfNeeded(()->{
|
||||
PlatformTestUtil.startPerformanceTest("adding many children", 15000, () -> {
|
||||
VirtualFile validVTemp = new MyFakeDirectory("vtemp");
|
||||
toDelete.add(validVTemp);
|
||||
List<VFileEvent> events = IntStream.range(0, N)
|
||||
.mapToObj(i -> new VFileCreateEvent(this, validVTemp, i + ".txt", false, false))
|
||||
.collect(Collectors.toList());
|
||||
UIUtil.invokeLaterIfNeeded(()-> PlatformTestUtil.startPerformanceTest("adding many children", 15000, () -> {
|
||||
VirtualFile validVTemp = new MyFakeDirectory("vtemp");
|
||||
toDelete.add(validVTemp);
|
||||
List<VFileEvent> events = IntStream.range(0, N)
|
||||
.mapToObj(i -> new VFileCreateEvent(this, validVTemp, i + ".txt", false, false))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
WriteCommandAction.runWriteCommandAction(null, () -> {
|
||||
PersistentFS.getInstance().processEvents(events);
|
||||
});
|
||||
WriteCommandAction.runWriteCommandAction(null, () -> {
|
||||
PersistentFS.getInstance().processEvents(events);
|
||||
});
|
||||
|
||||
assertEquals(N, validVTemp.getChildren().length);
|
||||
}).assertTiming();
|
||||
});
|
||||
assertEquals(N, validVTemp.getChildren().length);
|
||||
}).assertTiming());
|
||||
}
|
||||
finally {
|
||||
toDelete.forEach(VfsTestUtil::deleteFile);
|
||||
|
||||
Reference in New Issue
Block a user