mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
groovy: add to recompilation classes with cyclic references that are mentioned as static method call qualifiers
This commit is contained in:
@@ -51,9 +51,10 @@ import org.jetbrains.plugins.groovy.GroovyFileType;
|
||||
import org.jetbrains.plugins.groovy.GroovyFileTypeLoader;
|
||||
import org.jetbrains.plugins.groovy.GroovyIcons;
|
||||
import org.jetbrains.plugins.groovy.config.GroovyConfigUtils;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GroovyScriptClass;
|
||||
import org.jetbrains.plugins.groovy.util.GroovyUtils;
|
||||
import org.jetbrains.plugins.groovy.util.LibrariesUtil;
|
||||
@@ -169,8 +170,9 @@ public class GroovyCompiler extends GroovyCompilerBase {
|
||||
psi.acceptChildren(new PsiElementVisitor() {
|
||||
@Override
|
||||
public void visitElement(PsiElement element) {
|
||||
if (element instanceof GrCodeReferenceElement) {
|
||||
GrCodeReferenceElement referenceElement = (GrCodeReferenceElement)element;
|
||||
if (element instanceof GrReferenceElement &&
|
||||
(!(element instanceof GrReferenceExpression) || !((GrReferenceExpression)element).isQualified())) {
|
||||
GrReferenceElement referenceElement = (GrReferenceElement)element;
|
||||
try {
|
||||
final PsiElement target = referenceElement.resolve();
|
||||
if (target instanceof GrTypeDefinition || target instanceof GroovyScriptClass) {
|
||||
|
||||
@@ -311,6 +311,21 @@ class Foo {
|
||||
assertEmpty make()
|
||||
}
|
||||
|
||||
public void testRecompileExpressionReferences() throws Exception {
|
||||
def rusCon = myFixture.addFileToProject('RusCon.groovy', '''
|
||||
interface RusCon {
|
||||
Closure foo = { Seq.foo() }
|
||||
}''')
|
||||
myFixture.addFileToProject "Seq.groovy", """
|
||||
class Seq implements RusCon {
|
||||
static def foo() { }
|
||||
}"""
|
||||
assertEmpty make()
|
||||
|
||||
touch(rusCon.virtualFile)
|
||||
assertEmpty make()
|
||||
}
|
||||
|
||||
public void testRecompileImportedClass() throws Exception {
|
||||
def bar = myFixture.addFileToProject("pack/Bar.groovy", """
|
||||
package pack
|
||||
|
||||
Reference in New Issue
Block a user