Accepting request 963732 from Java:packages

fix build with jdk17 + remove asm3 dependency

OBS-URL: https://build.opensuse.org/request/show/963732
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/groovy18?expand=0&rev=5
This commit is contained in:
Dominique Leuenberger 2022-03-21 19:13:15 +00:00 committed by Git OBS Bridge
commit 2f1373a438
5 changed files with 127 additions and 13 deletions

View File

@ -0,0 +1,38 @@
--- groovy-core-GROOVY_1_8_9/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java 2013-02-15 09:42:29.000000000 +0100
+++ groovy-core-GROOVY_1_8_9/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java 2022-03-21 09:20:24.640511870 +0100
@@ -7425,7 +7425,7 @@
*/
@SuppressWarnings("unchecked")
public static <T> T[] plus(T[] left, T[] right) {
- return (T[]) plus(toList(left), toList(right)).toArray();
+ return (T[]) plus((Collection<T>)toList(left), (Collection<T>)toList(right)).toArray();
}
/**
@@ -7443,7 +7443,7 @@
*/
@SuppressWarnings("unchecked")
public static <T> T[] plus(T[] left, T right) {
- return (T[]) plus(toList(left), right).toArray();
+ return (T[]) plus((Collection<T>)toList(left), right).toArray();
}
/**
@@ -7461,7 +7461,7 @@
*/
@SuppressWarnings("unchecked")
public static <T> T[] plus(T[] left, Collection<T> right) {
- return (T[]) plus(toList(left), right).toArray();
+ return (T[]) plus((Collection<T>)toList(left), right).toArray();
}
/**
@@ -7483,7 +7483,7 @@
*/
@SuppressWarnings("unchecked")
public static <T> T[] plus(T[] left, Iterable<T> right) {
- return (T[]) plus(toList(left), toList(right)).toArray();
+ return (T[]) plus((Collection<T>)toList(left), toList(right)).toArray();
}
/**

57
groovy18-asm7.patch Normal file
View File

@ -0,0 +1,57 @@
--- groovy-core-GROOVY_1_8_9/src/main/org/codehaus/groovy/ant/VerifyClass.java 2013-02-15 09:42:29.000000000 +0100
+++ groovy-core-GROOVY_1_8_9/src/main/org/codehaus/groovy/ant/VerifyClass.java 2022-03-21 08:55:34.604198152 +0100
@@ -119,23 +119,7 @@
log("verifying of class " + clazz + " failed");
}
if (verbose) log(method.name + method.desc);
- TraceMethodVisitor mv = new TraceMethodVisitor(null) {
- public void visitMaxs(int maxStack, int maxLocals) {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < text.size(); ++i) {
- String s = frames[i] == null ? "null" : frames[i].toString();
- while (s.length() < maxStack + maxLocals + 1) {
- s += " ";
- }
- buffer.append(Integer.toString(i + 100000).substring(1));
- buffer.append(" ");
- buffer.append(s);
- buffer.append(" : ");
- buffer.append(text.get(i));
- }
- if (verbose) log(buffer.toString());
- }
- };
+ TraceMethodVisitor mv = new TraceMethodVisitor(null);
for (int j = 0; j < method.instructions.size(); ++j) {
Object insn = method.instructions.get(j);
if (insn instanceof AbstractInsnNode) {
--- groovy-core-GROOVY_1_8_9/src/main/org/codehaus/groovy/runtime/callsite/GroovySunClassLoader.java 2013-02-15 09:42:29.000000000 +0100
+++ groovy-core-GROOVY_1_8_9/src/main/org/codehaus/groovy/runtime/callsite/GroovySunClassLoader.java 2022-03-21 08:58:16.241090031 +0100
@@ -15,9 +15,10 @@
*/
package org.codehaus.groovy.runtime.callsite;
+import org.codehaus.groovy.reflection.SunClassLoader;
import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
-import org.codehaus.groovy.reflection.SunClassLoader;
import java.io.IOException;
import java.io.InputStream;
@@ -56,12 +57,13 @@
private void loadAbstract() throws IOException {
final InputStream asStream = GroovySunClassLoader.class.getClass().getClassLoader().getResourceAsStream(resName("org.codehaus.groovy.runtime.callsite.AbstractCallSite"));
ClassReader reader = new ClassReader(asStream);
- final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS) {
+ final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
+ final ClassVisitor cv = new ClassVisitor(4, cw) {
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
super.visit(version, access, name, signature, "sun/reflect/GroovyMagic", interfaces);
}
};
- reader.accept(cw, ClassWriter.COMPUTE_MAXS);
+ reader.accept(cv, ClassWriter.COMPUTE_MAXS);
asStream.close();
define(cw.toByteArray(), "org.codehaus.groovy.runtime.callsite.AbstractCallSite");
}

View File

@ -5,7 +5,7 @@
destdir="${targetDirectory}/tools"
includeantruntime="false"
- source="1.5" target="1.5" fork="true" classpathref="compilePath"/>
+ source="1.6" target="1.6" fork="true" classpathref="compilePath"/>
+ source="1.8" target="1.8" fork="true" classpathref="compilePath"/>
<java classpath="${targetDirectory}/tools"
classpathref="compilePath"
classname="org.codehaus.groovy.ExceptionUtilsGenerator">
@ -14,7 +14,7 @@
<javac srcdir="${mainSourcePath}" includeantruntime="false" destdir="${mainClassesDirectory}"
- deprecation="on" debug="yes" source="1.5" target="1.5" fork="true" classpathref="compilePath">
+ deprecation="on" debug="yes" source="1.6" target="1.6" fork="true" classpathref="compilePath">
+ deprecation="on" debug="yes" source="1.8" target="1.8" fork="true" classpathref="compilePath">
<exclude name="groovy/ui/**/*.java"/>
</javac>
<java classname="org.codehaus.groovy.tools.DgmConverter"
@ -23,7 +23,7 @@
<path refid="compilePath"/>
</classpath>
- <javac deprecation="on" debug="yes" source="1.5" target="1.5"/>
+ <javac deprecation="on" debug="yes" source="1.6" target="1.6"/>
+ <javac deprecation="on" debug="yes" source="1.8" target="1.8"/>
</groovyc>
</target>
@ -32,7 +32,7 @@
<path refid="testLibPath"/>
</classpath>
- <javac source="1.5" target="1.5" nowarn="on"/>
+ <javac source="1.6" target="1.6" nowarn="on"/>
+ <javac source="1.8" target="1.8" nowarn="on"/>
</groovyc>
</target>
@ -42,7 +42,7 @@
</classpath>
- <!-- currently not needed, add in if/when required -->
- <!--<javac source="1.5" target="1.5" nowarn="on"/>-->
+ <javac source="1.6" target="1.6" nowarn="on"/>
+ <javac source="1.8" target="1.8" nowarn="on"/>
</groovyc>
</target>
@ -52,8 +52,8 @@
destdir="${examplesClassesDirectory}"
- source="1.5"
- target="1.5"
+ source="1.6"
+ target="1.6"
+ source="1.8"
+ target="1.8"
fork="true">
<classpath>
<pathelement path="${mainClassesDirectory}"/>
@ -62,7 +62,7 @@
<path refid="examplesPath"/>
</classpath>
- <javac source="1.5" target="1.5"/>
+ <javac source="1.6" target="1.6"/>
+ <javac source="1.8" target="1.8"/>
</groovyc>
</target>
@ -71,7 +71,7 @@
<javadoc destdir="${docsDirectory}/api" author="true" version="true"
windowtitle="${title}" doctitle="${title}"
- encoding="ISO-8859-1" useexternalfile="true" source="1.5"
+ encoding="ISO-8859-1" useexternalfile="true" source="1.6"
+ encoding="ISO-8859-1" useexternalfile="true" source="1.8"
footer="${docFooter}"
overview="src/main/overviewj.html"
maxmemory="${javaDoc_mx}"

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Mon Mar 21 15:03:23 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Modified patch:
* groovy18-sourcetarget.patch
+ Build with source and target levels 8
- Added patches:
* groovy18-amgiguous-function-calls.patch
+ Cast to Collection to help compiler to resolve ambiguities
with new JDKs
* groovy18-asm7.patch
+ Remove dependency on the old asm3
-------------------------------------------------------------------
Mon Dec 16 09:21:49 UTC 2019 - Fridrich Strba <fstrba@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package groovy18
#
# Copyright (c) 2019 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -40,12 +40,13 @@ Patch5: groovy18-sourcetarget.patch
Patch6: groovy18-iterator.patch
Patch7: groovy18-securitymanager.patch
Patch8: groovy18-notarget.patch
Patch9: groovy18-amgiguous-function-calls.patch
Patch10: groovy18-asm7.patch
BuildRequires: ant
BuildRequires: ant-antlr
BuildRequires: antlr
BuildRequires: apache-commons-cli
BuildRequires: apache-ivy
BuildRequires: asm3
BuildRequires: bsf
BuildRequires: desktop-file-utils
BuildRequires: fdupes
@ -57,6 +58,7 @@ BuildRequires: javapackages-local
BuildRequires: jline1
BuildRequires: jpackage-utils
BuildRequires: junit
BuildRequires: objectweb-asm
BuildRequires: unzip
BuildRequires: xmvn-install
BuildRequires: xmvn-resolve
@ -131,6 +133,8 @@ cp %{SOURCE3} .
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
# build.xml is not compatible with Ant 1.10+
sed -i "s| depends=\"-excludeLegacyAntVersion\"||" build.xml
@ -138,6 +142,8 @@ sed -i "s| depends=\"-excludeLegacyAntVersion\"||" build.xml
# We don't want to generate auto-R on optional dependencies
%pom_xpath_replace "pom:dependency[pom:optional[text()='true']]/pom:scope" "<scope>provided</scope>"
%pom_change_dep asm::: org.ow2.asm::7.0:
# java 7 apis
%pom_remove_dep org.livetribe:livetribe-jsr223
# explicit tomcat apis
@ -164,8 +170,8 @@ mkdir -p target/lib/{compile,tools}
# Construct classpath
build-jar-repository target/lib/compile glassfish-servlet-api glassfish-jsp-api/javax.servlet.jsp-api \
asm3/asm-tree asm3/asm \
asm3/asm-util asm3/asm-analysis \
objectweb-asm/asm-tree objectweb-asm/asm \
objectweb-asm/asm-util objectweb-asm/asm-analysis \
antlr ant/ant-antlr antlr \
bsf jline1/jline-1 xstream ant junit apache-ivy commons-cli \
jansi