[groovy] update bundled Groovy to 3.0.9 (IDEA-284495)

Explicit implementation of some default methods in interfaces from Groovy library are added to work around compilation problems (modules which target Java 6 doesn't see default method in interfaces). Test data for ClsStubBuilderTest is changed to reflect changes in bytecode.

GitOrigin-RevId: 258ce1a42102102850b74721fc929bceae35e3d7
This commit is contained in:
Nikolay Chashnikov
2022-01-18 13:03:39 +03:00
committed by intellij-monorepo-bot
parent 841e0094a9
commit 0c1b721b52
14 changed files with 124 additions and 24 deletions

View File

@@ -1,12 +1,12 @@
<component name="libraryTable">
<library name="org.codehaus.groovy:groovy" type="repository">
<properties include-transitive-deps="false" maven-id="org.codehaus.groovy:groovy:2.5.14" />
<properties include-transitive-deps="false" maven-id="org.codehaus.groovy:groovy:3.0.9" />
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy/2.5.14/groovy-2.5.14.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy/3.0.9/groovy-3.0.9.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy/2.5.14/groovy-2.5.14-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy/3.0.9/groovy-3.0.9-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,12 +1,12 @@
<component name="libraryTable">
<library name="org.codehaus.groovy:groovy-ant" type="repository">
<properties include-transitive-deps="false" maven-id="org.codehaus.groovy:groovy-ant:2.5.14" />
<properties include-transitive-deps="false" maven-id="org.codehaus.groovy:groovy-ant:3.0.9" />
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-ant/2.5.14/groovy-ant-2.5.14.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-ant/3.0.9/groovy-ant-3.0.9.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-ant/2.5.14/groovy-ant-2.5.14-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-ant/3.0.9/groovy-ant-3.0.9-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,12 +1,12 @@
<component name="libraryTable">
<library name="org.codehaus.groovy:groovy-json" type="repository">
<properties include-transitive-deps="false" maven-id="org.codehaus.groovy:groovy-json:2.5.14" />
<properties include-transitive-deps="false" maven-id="org.codehaus.groovy:groovy-json:3.0.9" />
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-json/2.5.14/groovy-json-2.5.14.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-json/3.0.9/groovy-json-3.0.9.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-json/2.5.14/groovy-json-2.5.14-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-json/3.0.9/groovy-json-3.0.9-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,12 +1,12 @@
<component name="libraryTable">
<library name="org.codehaus.groovy:groovy-jsr223" type="repository">
<properties include-transitive-deps="false" maven-id="org.codehaus.groovy:groovy-jsr223:2.5.14" />
<properties include-transitive-deps="false" maven-id="org.codehaus.groovy:groovy-jsr223:3.0.9" />
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-jsr223/2.5.14/groovy-jsr223-2.5.14.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-jsr223/3.0.9/groovy-jsr223-3.0.9.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-jsr223/2.5.14/groovy-jsr223-2.5.14-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-jsr223/3.0.9/groovy-jsr223-3.0.9-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,12 +1,12 @@
<component name="libraryTable">
<library name="org.codehaus.groovy:groovy-templates" type="repository">
<properties include-transitive-deps="false" maven-id="org.codehaus.groovy:groovy-templates:2.5.14" />
<properties include-transitive-deps="false" maven-id="org.codehaus.groovy:groovy-templates:3.0.9" />
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-templates/2.5.14/groovy-templates-2.5.14.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-templates/3.0.9/groovy-templates-3.0.9.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-templates/2.5.14/groovy-templates-2.5.14-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-templates/3.0.9/groovy-templates-3.0.9-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,12 +1,12 @@
<component name="libraryTable">
<library name="org.codehaus.groovy:groovy-xml" type="repository">
<properties include-transitive-deps="false" maven-id="org.codehaus.groovy:groovy-xml:2.5.14" />
<properties include-transitive-deps="false" maven-id="org.codehaus.groovy:groovy-xml:3.0.9" />
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-xml/2.5.14/groovy-xml-2.5.14.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-xml/3.0.9/groovy-xml-3.0.9.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-xml/2.5.14/groovy-xml-2.5.14-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy-xml/3.0.9/groovy-xml-3.0.9-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,5 +1,4 @@
class GroovyStuff {
// https://issues.apache.org/jira/browse/GROOVY-8360
private enum Enum {
Value("", "");
private Enum(String s1, @Deprecated String s2) { }

View File

@@ -5,7 +5,7 @@ PsiJavaFileStub []
PsiRefListStub[EXTENDS_LIST:]
PsiRefListStub[IMPLEMENTS_LIST:groovy.lang.GroovyObject]
PsiClassStub[enum name=Enum fqn=GroovyStuff.Enum]
PsiModifierListStub[mask=4120]
PsiModifierListStub[mask=26]
PsiTypeParameterListStub
PsiRefListStub[EXTENDS_LIST:]
PsiRefListStub[IMPLEMENTS_LIST:groovy.lang.GroovyObject]
@@ -25,8 +25,37 @@ PsiJavaFileStub []
PsiModifierListStub[mask=0]
PsiAnnotationStub[@java.lang.Deprecated]
PsiRefListStub[THROWS_LIST:]
PsiMethodStub[next:GroovyStuff.Enum]
PsiModifierListStub[mask=1]
PsiAnnotationStub[@groovy.transform.Generated]
PsiTypeParameterListStub
PsiParameterListStub
PsiRefListStub[THROWS_LIST:]
PsiMethodStub[previous:GroovyStuff.Enum]
PsiModifierListStub[mask=1]
PsiAnnotationStub[@groovy.transform.Generated]
PsiTypeParameterListStub
PsiParameterListStub
PsiRefListStub[THROWS_LIST:]
PsiMethodStub[getMetaClass:groovy.lang.MetaClass]
PsiModifierListStub[mask=1]
PsiAnnotationStub[@groovy.transform.Generated]
PsiAnnotationStub[@groovy.transform.Internal]
PsiAnnotationStub[@java.beans.Transient]
PsiTypeParameterListStub
PsiParameterListStub
PsiRefListStub[THROWS_LIST:]
PsiMethodStub[setMetaClass:void]
PsiModifierListStub[mask=1]
PsiAnnotationStub[@groovy.transform.Generated]
PsiAnnotationStub[@groovy.transform.Internal]
PsiTypeParameterListStub
PsiParameterListStub
PsiParameterStub[p1:groovy.lang.MetaClass]
PsiModifierListStub[mask=0]
PsiRefListStub[THROWS_LIST:]
PsiClassStub[name=Inner fqn=GroovyStuff.Inner]
PsiModifierListStub[mask=4096]
PsiModifierListStub[mask=2]
PsiTypeParameterListStub
PsiRefListStub[EXTENDS_LIST:]
PsiRefListStub[IMPLEMENTS_LIST:groovy.lang.GroovyObject]
@@ -40,6 +69,23 @@ PsiJavaFileStub []
PsiModifierListStub[mask=0]
PsiAnnotationStub[@java.lang.Deprecated]
PsiRefListStub[THROWS_LIST:]
PsiMethodStub[getMetaClass:groovy.lang.MetaClass]
PsiModifierListStub[mask=1]
PsiAnnotationStub[@groovy.transform.Generated]
PsiAnnotationStub[@groovy.transform.Internal]
PsiAnnotationStub[@java.beans.Transient]
PsiTypeParameterListStub
PsiParameterListStub
PsiRefListStub[THROWS_LIST:]
PsiMethodStub[setMetaClass:void]
PsiModifierListStub[mask=1]
PsiAnnotationStub[@groovy.transform.Generated]
PsiAnnotationStub[@groovy.transform.Internal]
PsiTypeParameterListStub
PsiParameterListStub
PsiParameterStub[p1:groovy.lang.MetaClass]
PsiModifierListStub[mask=0]
PsiRefListStub[THROWS_LIST:]
PsiMethodStub[cons GroovyStuff:void]
PsiModifierListStub[mask=1]
PsiTypeParameterListStub
@@ -69,4 +115,21 @@ PsiJavaFileStub []
PsiParameterStub[intStaticParam:int]
PsiModifierListStub[mask=0]
PsiAnnotationStub[@java.lang.Deprecated]
PsiRefListStub[THROWS_LIST:]
PsiMethodStub[getMetaClass:groovy.lang.MetaClass]
PsiModifierListStub[mask=1]
PsiAnnotationStub[@groovy.transform.Generated]
PsiAnnotationStub[@groovy.transform.Internal]
PsiAnnotationStub[@java.beans.Transient]
PsiTypeParameterListStub
PsiParameterListStub
PsiRefListStub[THROWS_LIST:]
PsiMethodStub[setMetaClass:void]
PsiModifierListStub[mask=1]
PsiAnnotationStub[@groovy.transform.Generated]
PsiAnnotationStub[@groovy.transform.Internal]
PsiTypeParameterListStub
PsiParameterListStub
PsiParameterStub[p1:groovy.lang.MetaClass]
PsiModifierListStub[mask=0]
PsiRefListStub[THROWS_LIST:]

View File

@@ -134,7 +134,7 @@ public class ScriptSupport {
}
catch (MultipleCompilationErrorsException e) {
final ErrorCollector errorCollector = e.getErrorCollector();
@SuppressWarnings("unchecked") final List<Message> errors = errorCollector.getErrors();
final List<? extends Message> errors = errorCollector.getErrors();
for (Message error : errors) {
if (error instanceof SyntaxErrorMessage) {
final SyntaxErrorMessage errorMessage = (SyntaxErrorMessage)error;

View File

@@ -12,6 +12,7 @@ import com.intellij.util.Function
import com.intellij.util.containers.HashingStrategy
import com.intellij.util.lang.UrlClassLoader
import gnu.trove.TObjectHashingStrategy
import groovy.transform.CompileDynamic
import groovy.transform.CompileStatic
import groovy.transform.TypeCheckingMode
import it.unimi.dsi.fastutil.Hash
@@ -198,4 +199,29 @@ class GradleDaemonServices {
}
gradleUserHomes
}
//these methods are added to work around compilation problems with Groovy 3: these methods get default implementation in GroovyObject interface,
//and stub generator doesn't add implementations for them, but here Groovy 2.4 library from intellij.gradle.toolingExtension module is used
//where default implementations are absent
Object invokeMethod(String name, Object args) {
return super.invokeMethod(name, args)
}
@CompileDynamic
Object getProperty(String propertyName) {
return super.getProperty(propertyName)
}
@CompileDynamic
void setProperty(String propertyName, Object newValue) {
super.setProperty(propertyName, newValue)
}
MetaClass getMetaClass() {
return super.getMetaClass()
}
void setMetaClass(MetaClass metaClass) {
super.setMetaClass(metaClass)
}
}

View File

@@ -109,6 +109,10 @@ public final class DependentGroovycRunner {
resourceLoader.myClass2File.put(aClass.getName(), file);
}
}
public void doPhaseOperation(CompilationUnit unit) throws CompilationFailedException {
super.doPhaseOperation(unit);
}
}, Phases.CONVERSION);
addSources(forStubs, srcFiles, unit);
@@ -458,6 +462,10 @@ public final class DependentGroovycRunner {
catch (LinkageError ignored) {
}
}
public void doPhaseOperation(CompilationUnit unit) throws CompilationFailedException {
super.doPhaseOperation(unit);
}
}, phase);
}

View File

@@ -147,6 +147,10 @@ public class GroovyCompilerWrapper {
compiledFiles.add(item);
}
}
public void doPhaseOperation(CompilationUnit unit) throws CompilationFailedException {
super.doPhaseOperation(unit);
}
});
return compiledFiles;
}

View File

@@ -137,7 +137,7 @@ class GroovyStringKindTest extends GroovyLatestTest {
'\f' : '\\u000C',
/a\b/ : /a\b/,
$/5/6/$ : $/5/6/$,
$/$$/$ : /$$/,
//$/$$/$ : /$$/, //caused compilation error in Groovy 3.0.9 because of Groovy bug (https://issues.apache.org/jira/projects/GROOVY/issues/GROOVY-10406)
$/'/$ : $/'/$,
$/"/$ : $/"/$,
'$_' : '$$_',

View File

@@ -144,7 +144,7 @@ class GrAssignAutoTest extends GrHighlightingTestBase {
}
''',
typesXTypes,
['int -> double[]', 'short -> int[]', 'short -> double[]', 'byte -> int[]', 'byte -> double[]'],
['int -> double[]', 'short -> int[]', 'short -> double[]', 'byte -> int[]', 'byte -> double[]', 'short -> Integer[]', 'byte -> Integer[]'],
['Integer[] -> int[]', 'Integer[] -> double[]', 'int[] -> double[]', 'int[] -> Integer[]']
}