mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
workarounds to make compilable with groovy 2.5 and jdk9 compiler
This commit is contained in:
+1
-1
@@ -51,7 +51,7 @@ public class TestStubHierarchyAction extends InheritanceAction {
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
if (project != null) {
|
||||
ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ReadAction.run(new TestHierarchy(project)::run),
|
||||
ProgressManager.getInstance().runProcessWithProgressSynchronously((Runnable)() -> ReadAction.run(new TestHierarchy(project)::run),
|
||||
"Testing Hierarchy", true, project);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public class QuickFixAction extends AnAction implements CustomComponentAction {
|
||||
try {
|
||||
Ref<CommonProblemDescriptor[]> descriptors = Ref.create();
|
||||
Set<VirtualFile> readOnlyFiles = new THashSet<>();
|
||||
if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ReadAction.run(() -> {
|
||||
if (!ProgressManager.getInstance().runProcessWithProgressSynchronously((Runnable)() -> ReadAction.run(() -> {
|
||||
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
|
||||
indicator.setText("Checking problem descriptors...");
|
||||
descriptors.set(tree.getSelectedDescriptors(true, readOnlyFiles, false, false));
|
||||
|
||||
@@ -718,7 +718,7 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
|
||||
}
|
||||
|
||||
public void addProblemDescriptors(InspectionToolWrapper wrapper, RefEntity refElement, CommonProblemDescriptor[] descriptors) {
|
||||
myTreeUpdater.submit(() -> ReadAction.run(() -> {
|
||||
myTreeUpdater.submit((Runnable)() -> ReadAction.run(() -> {
|
||||
if (!isDisposed()) {
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
synchronized (myTreeStructureUpdateLock) {
|
||||
|
||||
+4
-7
@@ -30,10 +30,7 @@ import com.intellij.openapi.util.EmptyRunnable;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.ThrowableComputable;
|
||||
import com.intellij.testFramework.*;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.ConcurrencyUtil;
|
||||
import com.intellij.util.ExceptionUtil;
|
||||
import com.intellij.util.TimeoutUtil;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.concurrency.Semaphore;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -576,14 +573,14 @@ public class ApplicationImplTest extends LightPlatformTestCase {
|
||||
log.add("write started");
|
||||
app.executeSuspendingWriteAction(ourProject, "", () -> {
|
||||
app.invokeAndWait(() ->
|
||||
futures.add(app.executeOnPooledThread(() -> ReadAction.run(() -> log.add("foreign read")))));
|
||||
futures.add(app.executeOnPooledThread((Runnable)() -> ReadAction.run((ThrowableRunnable<RuntimeException>)() -> log.add("foreign read")))));
|
||||
|
||||
mayStartForeignRead.up();
|
||||
TimeoutUtil.sleep(50);
|
||||
|
||||
ReadAction.run(() -> log.add("progress read"));
|
||||
app.invokeAndWait(() -> WriteAction.run(() -> log.add("nested write")));
|
||||
waitForFuture(app.executeOnPooledThread(() -> ReadAction.run(() -> log.add("forked read"))));
|
||||
waitForFuture(app.executeOnPooledThread((Runnable)() -> ReadAction.run((ThrowableRunnable<RuntimeException>)() -> log.add("forked read"))));
|
||||
});
|
||||
log.add("write finished");
|
||||
});
|
||||
@@ -610,7 +607,7 @@ public class ApplicationImplTest extends LightPlatformTestCase {
|
||||
assertTrue(app.hasWriteAction(actionClass));
|
||||
app.executeSuspendingWriteAction(ourProject, "", () -> ReadAction.run(() -> {
|
||||
assertTrue(app.hasWriteAction(actionClass));
|
||||
waitForFuture(app.executeOnPooledThread(() -> ReadAction.run(() -> assertTrue(app.hasWriteAction(actionClass)))));
|
||||
waitForFuture(app.executeOnPooledThread((Runnable)() -> ReadAction.run((ThrowableRunnable<RuntimeException>)() -> assertTrue(app.hasWriteAction(actionClass)))));
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -663,7 +663,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase {
|
||||
for (VirtualFile file : files) {
|
||||
assertNull(fdm.getCachedDocument(file));
|
||||
for (int i = 0; i < 30; i++) {
|
||||
futures.add(ApplicationManager.getApplication().executeOnPooledThread(() -> ReadAction.run(() -> {
|
||||
futures.add(ApplicationManager.getApplication().executeOnPooledThread((Runnable)() -> ReadAction.run(() -> {
|
||||
Document document = fdm.getDocument(file);
|
||||
assertEquals(file, fdm.getFile(document));
|
||||
})));
|
||||
|
||||
+1
-1
@@ -983,7 +983,7 @@ public class VirtualFilePointerTest extends PlatformTestCase {
|
||||
LOG.info("i = " + i);
|
||||
assertTrue(file.createNewFile());
|
||||
refreshVFS();
|
||||
Future<?> future = ApplicationManager.getApplication().executeOnPooledThread(() -> ReadAction.run(() -> {
|
||||
Future<?> future = ApplicationManager.getApplication().executeOnPooledThread((Runnable)() -> ReadAction.run(() -> {
|
||||
for (int k=0;k<100;k++) {
|
||||
vTemp.getChildren();
|
||||
}
|
||||
|
||||
+13
-5
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy.dsl.toplevel.scopes
|
||||
|
||||
import com.intellij.patterns.ElementPattern
|
||||
import com.intellij.patterns.PsiClassPattern
|
||||
import com.intellij.patterns.PsiJavaPatterns
|
||||
import com.intellij.psi.SyntheticElement
|
||||
import groovy.transform.CompileStatic
|
||||
import org.jetbrains.plugins.groovy.dsl.toplevel.*
|
||||
@@ -24,12 +27,10 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrCall
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames
|
||||
|
||||
import static com.intellij.patterns.PlatformPatterns.*
|
||||
import static com.intellij.patterns.PsiJavaPatterns.psiClass
|
||||
import static com.intellij.patterns.StandardPatterns.*
|
||||
import static org.jetbrains.plugins.groovy.lang.psi.patterns.GrAnnotationPattern.annotation
|
||||
import static org.jetbrains.plugins.groovy.lang.psi.patterns.GroovyPatterns.groovyScript
|
||||
import static org.jetbrains.plugins.groovy.lang.psi.patterns.GroovyPatterns.methodCall
|
||||
|
||||
/**
|
||||
* @author ilyas
|
||||
*/
|
||||
@@ -51,8 +52,8 @@ class ClassScope extends Scope {
|
||||
if (namePattern) {
|
||||
def match = string().matches(namePattern)
|
||||
result << new PlaceContextFilter(psiElement().inside(or(
|
||||
psiClass().withQualifiedName(match),
|
||||
psiClass().withName(match))
|
||||
PsiJavaPatterns.psiClass().withQualifiedName(match),
|
||||
PsiJavaPatterns.psiClass().withName(match))
|
||||
))
|
||||
}
|
||||
return result
|
||||
@@ -137,12 +138,19 @@ class ScriptScope extends Scope {
|
||||
|
||||
// Process unqualified references only
|
||||
if (!args.ctype) {
|
||||
result << ClassContextFilter.fromClassPattern(psiClass().and(instanceOf(SyntheticElement)))
|
||||
ElementPattern synt = instanceOf(SyntheticElement)
|
||||
|
||||
PsiClassPattern psiClass = PsiJavaPatterns.psiClass()
|
||||
ElementPattern pattern = doAnd(psiClass, synt)
|
||||
result << ClassContextFilter.fromClassPattern(pattern)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
private PsiClassPattern doAnd(PsiClassPattern psiClass, ElementPattern synt) {
|
||||
psiClass.and(synt)
|
||||
}
|
||||
}
|
||||
|
||||
@CompileStatic
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.intellij.debugger.engine.evaluation.CodeFragmentKind
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl
|
||||
import com.intellij.debugger.engine.evaluation.TextWithImportsImpl
|
||||
import com.intellij.debugger.engine.events.DebuggerCommandImpl
|
||||
import com.intellij.debugger.engine.events.DebuggerContextCommandImpl
|
||||
import com.intellij.debugger.impl.DebuggerContextImpl
|
||||
import com.intellij.debugger.impl.DebuggerContextUtil
|
||||
@@ -108,9 +109,10 @@ trait DebuggerMethods extends CompilerMethods {
|
||||
semaphore.down()
|
||||
def process = debugProcess
|
||||
// wait for all events processed
|
||||
process.managerThread.schedule {
|
||||
semaphore.up()
|
||||
}
|
||||
DebuggerCommandImpl cl = {
|
||||
semaphore.up()
|
||||
}
|
||||
process.managerThread.schedule cl
|
||||
def finished = semaphore.waitFor(ourTimeout)
|
||||
assert finished: 'Too long debugger actions'
|
||||
|
||||
|
||||
+5
-3
@@ -23,7 +23,9 @@ import com.intellij.openapi.roots.ModuleRootManager
|
||||
import com.intellij.openapi.roots.ModuleRootModificationUtil
|
||||
import com.intellij.testFramework.PsiTestUtil
|
||||
import groovy.transform.CompileStatic
|
||||
import org.jetbrains.jps.model.java.JavaResourceRootProperties
|
||||
import org.jetbrains.jps.model.java.JavaResourceRootType
|
||||
import org.jetbrains.jps.model.module.JpsModuleSourceRootType
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
@@ -35,7 +37,7 @@ class GroovyResourceCheckerTest extends GroovyCompilerTestCase {
|
||||
PsiTestUtil.removeAllRoots(myModule, ModuleRootManager.getInstance(myModule).sdk)
|
||||
addGroovyLibrary(myModule)
|
||||
PsiTestUtil.addSourceRoot(myModule, myFixture.tempDirFixture.findOrCreateDir('src'))
|
||||
PsiTestUtil.addSourceRoot(myModule, myFixture.tempDirFixture.findOrCreateDir('res'), JavaResourceRootType.RESOURCE)
|
||||
PsiTestUtil.addSourceRoot(myModule, myFixture.tempDirFixture.findOrCreateDir('res'), (JpsModuleSourceRootType<JavaResourceRootProperties>)JavaResourceRootType.RESOURCE)
|
||||
}
|
||||
|
||||
private List<CompilerMessage> checkResources() {
|
||||
@@ -58,7 +60,7 @@ class GroovyResourceCheckerTest extends GroovyCompilerTestCase {
|
||||
ModuleRootModificationUtil.addDependency(myModule, depModule)
|
||||
addGroovyLibrary(depModule)
|
||||
PsiTestUtil.addSourceRoot(depModule, myFixture.tempDirFixture.findOrCreateDir('dependent/src'))
|
||||
PsiTestUtil.addSourceRoot(depModule, myFixture.tempDirFixture.findOrCreateDir('dependent/res'), JavaResourceRootType.RESOURCE)
|
||||
PsiTestUtil.addSourceRoot(depModule, myFixture.tempDirFixture.findOrCreateDir('dependent/res'), (JpsModuleSourceRootType<JavaResourceRootProperties>)JavaResourceRootType.RESOURCE)
|
||||
|
||||
myFixture.addFileToProject('src/a.groovy', 'class SrcClass {}')
|
||||
myFixture.addFileToProject('res/b.groovy', 'interface ThisResource {}')
|
||||
@@ -81,7 +83,7 @@ class GroovyResourceCheckerTest extends GroovyCompilerTestCase {
|
||||
Module depModule = addModule("dependent", false)
|
||||
ModuleRootModificationUtil.addDependency(depModule, myModule)
|
||||
addGroovyLibrary(depModule)
|
||||
PsiTestUtil.addSourceRoot(depModule, myFixture.tempDirFixture.findOrCreateDir('dependent/res'), JavaResourceRootType.RESOURCE)
|
||||
PsiTestUtil.addSourceRoot(depModule, myFixture.tempDirFixture.findOrCreateDir('dependent/res'), (JpsModuleSourceRootType<JavaResourceRootProperties>)JavaResourceRootType.RESOURCE)
|
||||
|
||||
myFixture.addFileToProject('res/Util.groovy', '@groovy.transform.CompileStatic class C1 {{ println Xxx1.name }}')
|
||||
myFixture.addFileToProject('dependent/res/Usage.groovy', '@groovy.transform.CompileStatic class C2 {{ println Xxx2.name }}')
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ import org.jetbrains.plugins.groovy.util.TestUtils
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
class GroovyLiveTemplatesTest extends LightCodeInsightFixtureTestCase {
|
||||
public class GroovyLiveTemplatesTest extends LightCodeInsightFixtureTestCase {
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return TestUtils.getTestDataPath() + "liveTemplates/"
|
||||
@@ -66,7 +66,7 @@ void usage(int num, boolean someBoolean, List<String> args){
|
||||
'''
|
||||
}
|
||||
|
||||
static void expandTemplate(final Editor editor) {
|
||||
public static void expandTemplate(final Editor editor) {
|
||||
new ListTemplatesAction().actionPerformedImpl(editor.getProject(), editor)
|
||||
((LookupImpl)LookupManager.getActiveLookup(editor)).finishLookup(Lookup.NORMAL_SELECT_CHAR)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user