Accepting request 1091132 from Java:packages
Clean up the spec to allow building on sle12-sp1 OBS-URL: https://build.opensuse.org/request/show/1091132 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/javassist?expand=0&rev=21
This commit is contained in:
commit
d99c5ea5e4
@ -1,8 +1,130 @@
|
|||||||
Index: javassist-rel_3_28_0_ga/src/main/javassist/Loader.java
|
--- a/src/main/javassist/ClassPool.java 2023-06-06 17:43:01.915579458 +0200
|
||||||
===================================================================
|
+++ b/src/main/javassist/ClassPool.java 2023-06-06 18:01:26.034999321 +0200
|
||||||
--- javassist-rel_3_28_0_ga.orig/src/main/javassist/Loader.java
|
@@ -1141,59 +1141,6 @@
|
||||||
+++ javassist-rel_3_28_0_ga/src/main/javassist/Loader.java
|
* Once this method is called, further modifications are not allowed
|
||||||
@@ -421,9 +421,6 @@ public class Loader extends ClassLoader
|
* any more.
|
||||||
|
*
|
||||||
|
- * <p>This method is available in Java 9 or later.
|
||||||
|
- * It loads the class
|
||||||
|
- * by using {@code java.lang.invoke.MethodHandles} with {@code neighbor}.
|
||||||
|
- * </p>
|
||||||
|
- *
|
||||||
|
- * @param ct the class converted into {@code java.lang.Class}.
|
||||||
|
- * @param neighbor a class belonging to the same package that
|
||||||
|
- * the converted class belongs to.
|
||||||
|
- * @since 3.24
|
||||||
|
- */
|
||||||
|
- public Class<?> toClass(CtClass ct, Class<?> neighbor)
|
||||||
|
- throws CannotCompileException
|
||||||
|
- {
|
||||||
|
- try {
|
||||||
|
- return javassist.util.proxy.DefineClassHelper.toClass(neighbor,
|
||||||
|
- ct.toBytecode());
|
||||||
|
- }
|
||||||
|
- catch (IOException e) {
|
||||||
|
- throw new CannotCompileException(e);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /**
|
||||||
|
- * Converts the class to a <code>java.lang.Class</code> object.
|
||||||
|
- * Once this method is called, further modifications are not allowed
|
||||||
|
- * any more.
|
||||||
|
- *
|
||||||
|
- * <p>This method is available in Java 9 or later.
|
||||||
|
- * It loads the class
|
||||||
|
- * by using the given {@code java.lang.invoke.MethodHandles.Lookup}.
|
||||||
|
- * </p>
|
||||||
|
- *
|
||||||
|
- * @param ct the class converted into {@code java.lang.Class}.
|
||||||
|
- * @since 3.24
|
||||||
|
- */
|
||||||
|
- public Class<?> toClass(CtClass ct,
|
||||||
|
- java.lang.invoke.MethodHandles.Lookup lookup)
|
||||||
|
- throws CannotCompileException
|
||||||
|
- {
|
||||||
|
- try {
|
||||||
|
- return javassist.util.proxy.DefineClassHelper.toClass(lookup,
|
||||||
|
- ct.toBytecode());
|
||||||
|
- }
|
||||||
|
- catch (IOException e) {
|
||||||
|
- throw new CannotCompileException(e);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /**
|
||||||
|
- * Converts the class to a <code>java.lang.Class</code> object.
|
||||||
|
- * Once this method is called, further modifications are not allowed
|
||||||
|
- * any more.
|
||||||
|
- *
|
||||||
|
* <p>When the JVM is Java 11 or later, this method loads the class
|
||||||
|
* by using {@code java.lang.invoke.MethodHandles} with {@code neighbor}.
|
||||||
|
* The other arguments {@code loader} and {@code domain} are not used;
|
||||||
|
--- a/src/main/javassist/CtClass.java 2023-06-06 17:43:01.915579458 +0200
|
||||||
|
+++ b/src/main/javassist/CtClass.java 2023-06-06 18:02:41.811506992 +0200
|
||||||
|
@@ -1300,59 +1300,6 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts this class to a <code>java.lang.Class</code> object.
|
||||||
|
- * Once this method is called, further modifications are not
|
||||||
|
- * allowed any more.
|
||||||
|
- *
|
||||||
|
- * <p>This method is provided for convenience. You should use
|
||||||
|
- * {@code toClass(Lookup)} for better compatibility with the
|
||||||
|
- * module system.
|
||||||
|
- *
|
||||||
|
- * <p>Note: this method calls <code>toClass()</code>
|
||||||
|
- * in <code>ClassPool</code>.
|
||||||
|
- *
|
||||||
|
- * <p><b>Warning:</b> A Class object returned by this method may not
|
||||||
|
- * work with a security manager or a signed jar file because a
|
||||||
|
- * protection domain is not specified.
|
||||||
|
- *
|
||||||
|
- * @param neighbor A class belonging to the same package that this
|
||||||
|
- * class belongs to. It is used to load the class.
|
||||||
|
- * @see ClassPool#toClass(CtClass,Class)
|
||||||
|
- * @see #toClass(java.lang.invoke.MethodHandles.Lookup)
|
||||||
|
- * @since 3.24
|
||||||
|
- */
|
||||||
|
- public Class<?> toClass(Class<?> neighbor) throws CannotCompileException
|
||||||
|
- {
|
||||||
|
- return getClassPool().toClass(this, neighbor);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /**
|
||||||
|
- * Converts this class to a <code>java.lang.Class</code> object.
|
||||||
|
- * Once this method is called, further modifications are not
|
||||||
|
- * allowed any more.
|
||||||
|
- *
|
||||||
|
- * <p>This method is provided for convenience. If you need more
|
||||||
|
- * complex functionality, you should write your own class loader.
|
||||||
|
- *
|
||||||
|
- * <p>Note: this method calls <code>toClass()</code>
|
||||||
|
- * in <code>ClassPool</code>.
|
||||||
|
- *
|
||||||
|
- * <p><b>Warning:</b> A Class object returned by this method may not
|
||||||
|
- * work with a security manager or a signed jar file because a
|
||||||
|
- * protection domain is not specified.
|
||||||
|
- *
|
||||||
|
- * @param lookup used when loading the class. It has to have
|
||||||
|
- * an access right to define a new class.
|
||||||
|
- * @see ClassPool#toClass(CtClass,java.lang.invoke.MethodHandles.Lookup)
|
||||||
|
- * @since 3.24
|
||||||
|
- */
|
||||||
|
- public Class<?> toClass(java.lang.invoke.MethodHandles.Lookup lookup)
|
||||||
|
- throws CannotCompileException
|
||||||
|
- {
|
||||||
|
- return getClassPool().toClass(this, lookup);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /**
|
||||||
|
- * Converts this class to a <code>java.lang.Class</code> object.
|
||||||
|
* Once this method is called, further modifications are not allowed
|
||||||
|
* any more.
|
||||||
|
*
|
||||||
|
--- a/src/main/javassist/Loader.java 2023-06-06 17:43:01.923579511 +0200
|
||||||
|
+++ b/src/main/javassist/Loader.java 2023-06-06 17:43:21.591712028 +0200
|
||||||
|
@@ -421,9 +421,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDefinedPackage(String name) {
|
private boolean isDefinedPackage(String name) {
|
||||||
@ -12,14 +134,70 @@ Index: javassist-rel_3_28_0_ga/src/main/javassist/Loader.java
|
|||||||
return getPackage(name) == null;
|
return getPackage(name) == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Index: javassist-rel_3_28_0_ga/src/main/javassist/util/proxy/DefineClassHelper.java
|
--- a/src/main/javassist/util/proxy/DefineClassHelper.java 2023-06-06 17:43:01.979579888 +0200
|
||||||
===================================================================
|
+++ b/src/main/javassist/util/proxy/DefineClassHelper.java 2023-06-06 17:56:53.241171849 +0200
|
||||||
--- javassist-rel_3_28_0_ga.orig/src/main/javassist/util/proxy/DefineClassHelper.java
|
@@ -44,15 +44,11 @@
|
||||||
+++ javassist-rel_3_28_0_ga/src/main/javassist/util/proxy/DefineClassHelper.java
|
ClassLoader loader, ProtectionDomain protectionDomain)
|
||||||
@@ -317,23 +317,5 @@ public class DefineClassHelper {
|
throws ClassFormatError, CannotCompileException
|
||||||
|
{
|
||||||
|
- if (neighbor != null)
|
||||||
|
- return toClass(neighbor, bcode);
|
||||||
|
- else {
|
||||||
|
// Lookup#defineClass() is not available. So fallback to invoking defineClass on
|
||||||
|
// ClassLoader, which causes a warning message.
|
||||||
|
return super.defineClass(name, bcode, off, len, neighbor, loader, protectionDomain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- }
|
||||||
|
|
||||||
|
private static class Java9 extends Helper {
|
||||||
|
final class ReferencedUnsafe {
|
||||||
|
@@ -275,65 +271,5 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-
|
||||||
|
- /**
|
||||||
|
- * Loads a class file by {@code java.lang.invoke.MethodHandles.Lookup}.
|
||||||
|
- * It is obtained by using {@code neighbor}.
|
||||||
|
- *
|
||||||
|
- * @param neighbor a class belonging to the same package that the loaded
|
||||||
|
- * class belogns to.
|
||||||
|
- * @param bcode the bytecode.
|
||||||
|
- * @since 3.24
|
||||||
|
- */
|
||||||
|
- public static Class<?> toClass(Class<?> neighbor, byte[] bcode)
|
||||||
|
- throws CannotCompileException
|
||||||
|
- {
|
||||||
|
- try {
|
||||||
|
- DefineClassHelper.class.getModule().addReads(neighbor.getModule());
|
||||||
|
- Lookup lookup = MethodHandles.lookup();
|
||||||
|
- Lookup prvlookup = MethodHandles.privateLookupIn(neighbor, lookup);
|
||||||
|
- return prvlookup.defineClass(bcode);
|
||||||
|
- } catch (IllegalAccessException | IllegalArgumentException e) {
|
||||||
|
- throw new CannotCompileException(e.getMessage() + ": " + neighbor.getName()
|
||||||
|
- + " has no permission to define the class");
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /**
|
||||||
|
- * Loads a class file by {@code java.lang.invoke.MethodHandles.Lookup}.
|
||||||
|
- * It can be obtained by {@code MethodHandles.lookup()} called from
|
||||||
|
- * somewhere in the package that the loaded class belongs to.
|
||||||
|
- *
|
||||||
|
- * @param bcode the bytecode.
|
||||||
|
- * @since 3.24
|
||||||
|
- */
|
||||||
|
- public static Class<?> toClass(Lookup lookup, byte[] bcode)
|
||||||
|
- throws CannotCompileException
|
||||||
|
- {
|
||||||
|
- try {
|
||||||
|
- return lookup.defineClass(bcode);
|
||||||
|
- } catch (IllegalAccessException | IllegalArgumentException e) {
|
||||||
|
- throw new CannotCompileException(e.getMessage());
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
- /**
|
- /**
|
||||||
- * Loads a class file by {@code java.lang.invoke.MethodHandles.Lookup}.
|
- * Loads a class file by {@code java.lang.invoke.MethodHandles.Lookup}.
|
||||||
- *
|
- *
|
||||||
@ -40,11 +218,9 @@ Index: javassist-rel_3_28_0_ga/src/main/javassist/util/proxy/DefineClassHelper.j
|
|||||||
-
|
-
|
||||||
private DefineClassHelper() {}
|
private DefineClassHelper() {}
|
||||||
}
|
}
|
||||||
Index: javassist-rel_3_28_0_ga/src/main/javassist/util/proxy/FactoryHelper.java
|
--- a/src/main/javassist/util/proxy/FactoryHelper.java 2023-06-06 17:43:01.979579888 +0200
|
||||||
===================================================================
|
+++ b/src/main/javassist/util/proxy/FactoryHelper.java 2023-06-06 18:03:56.172005165 +0200
|
||||||
--- javassist-rel_3_28_0_ga.orig/src/main/javassist/util/proxy/FactoryHelper.java
|
@@ -148,29 +148,7 @@
|
||||||
+++ javassist-rel_3_28_0_ga/src/main/javassist/util/proxy/FactoryHelper.java
|
|
||||||
@@ -148,11 +148,7 @@ public class FactoryHelper {
|
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
byte[] b = toBytecode(cf);
|
byte[] b = toBytecode(cf);
|
||||||
@ -53,7 +229,38 @@ Index: javassist-rel_3_28_0_ga/src/main/javassist/util/proxy/FactoryHelper.java
|
|||||||
- else
|
- else
|
||||||
- return DefineClassHelper.toClass(cf.getName(), neighbor,
|
- return DefineClassHelper.toClass(cf.getName(), neighbor,
|
||||||
- loader, domain, b);
|
- loader, domain, b);
|
||||||
|
- }
|
||||||
|
- catch (IOException e) {
|
||||||
|
- throw new CannotCompileException(e);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /**
|
||||||
|
- * Loads a class file by a given lookup.
|
||||||
|
- *
|
||||||
|
- * @param lookup used to define the class.
|
||||||
|
- * @since 3.24
|
||||||
|
- */
|
||||||
|
- public static Class<?> toClass(ClassFile cf, java.lang.invoke.MethodHandles.Lookup lookup)
|
||||||
|
- throws CannotCompileException
|
||||||
|
- {
|
||||||
|
- try {
|
||||||
|
- byte[] b = toBytecode(cf);
|
||||||
|
- return DefineClassHelper.toClass(lookup, b);
|
||||||
+ return DefineClassHelper.toClass(cf.getName(), neighbor, loader, domain, b);
|
+ return DefineClassHelper.toClass(cf.getName(), neighbor, loader, domain, b);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
throw new CannotCompileException(e);
|
throw new CannotCompileException(e);
|
||||||
|
--- a/src/main/javassist/util/proxy/ProxyFactory.java 2023-06-06 17:43:01.979579888 +0200
|
||||||
|
+++ b/src/main/javassist/util/proxy/ProxyFactory.java 2023-06-06 18:05:06.452476007 +0200
|
||||||
|
@@ -636,10 +636,7 @@
|
||||||
|
if (writeDirectory != null)
|
||||||
|
FactoryHelper.writeFile(cf, writeDirectory);
|
||||||
|
|
||||||
|
- if (lookup == null)
|
||||||
|
thisClass = FactoryHelper.toClass(cf, getClassInTheSamePackage(), cl, getDomain());
|
||||||
|
- else
|
||||||
|
- thisClass = FactoryHelper.toClass(cf, lookup);
|
||||||
|
|
||||||
|
setField(FILTER_SIGNATURE_FIELD, signature);
|
||||||
|
// legacy behaviour : we only set the default interceptor static field if we are not using the cache
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jun 6 16:20:35 UTC 2023 - Fridrich Strba <fstrba@suse.com>
|
||||||
|
|
||||||
|
- Clean up the spec file and make it actually build on a vanilla
|
||||||
|
SLE-12-SP5
|
||||||
|
- Modified patch:
|
||||||
|
* javassist-java8-compat.patch
|
||||||
|
+ make remove functions that are not available in java 8
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Sep 20 16:10:40 UTC 2022 - David Anes <david.anes@suse.com>
|
Tue Sep 20 16:10:40 UTC 2022 - David Anes <david.anes@suse.com>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package javassist
|
# spec file for package javassist
|
||||||
#
|
#
|
||||||
# Copyright (c) 2022 SUSE LLC
|
# Copyright (c) 2023 SUSE LLC
|
||||||
# Copyright (c) 2000-2005, JPackage Project
|
# Copyright (c) 2000-2005, JPackage Project
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
@ -30,6 +30,7 @@ Patch0: javassist-java8-compat.patch
|
|||||||
Patch1: javassist-osgi.patch
|
Patch1: javassist-osgi.patch
|
||||||
BuildRequires: ant >= 1.6
|
BuildRequires: ant >= 1.6
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
|
BuildRequires: java-devel >= 1.8
|
||||||
BuildRequires: javapackages-local
|
BuildRequires: javapackages-local
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
@ -76,13 +77,11 @@ Tutorial for javassist.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n %{name}-%{tar_version}
|
%setup -q -n %{name}-%{tar_version}
|
||||||
%if %{?pkg_vcmp:%pkg_vcmp java-devel < 9}%{!?pkg_vcmp:1}
|
%if %{!?pkg_vcmp:1}%{?pkg_vcmp:%pkg_vcmp java-devel < 9}
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
%endif
|
%endif
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
for j in $(find . -name "*.jar"); do
|
find . -name "*.jar" -print -delete
|
||||||
mv $j $j.no
|
|
||||||
done
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
ant -Dant.build.javac.source=1.8 -Dant.build.javac.target=1.8 dist
|
ant -Dant.build.javac.source=1.8 -Dant.build.javac.target=1.8 dist
|
||||||
@ -90,14 +89,12 @@ ant -Dant.build.javac.source=1.8 -Dant.build.javac.target=1.8 dist
|
|||||||
%install
|
%install
|
||||||
# jars
|
# jars
|
||||||
mkdir -p %{buildroot}/%{_javadir}
|
mkdir -p %{buildroot}/%{_javadir}
|
||||||
cp -p %{name}.jar \
|
cp -p %{name}.jar %{buildroot}/%{_javadir}/%{name}.jar
|
||||||
%{buildroot}/%{_javadir}/%{name}-%{version}.jar
|
|
||||||
(cd %{buildroot}/%{_javadir} && for jar in *-%{version}.jar; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
|
|
||||||
|
|
||||||
# pom
|
# pom
|
||||||
install -d -m 755 %{buildroot}%{_mavenpomdir}
|
install -d -m 755 %{buildroot}%{_mavenpomdir}
|
||||||
install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/%{name}.pom
|
install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
|
||||||
%add_maven_depmap %{name}.pom %{name}.jar -a javassist:javassist
|
%add_maven_depmap JPP-%{name}.pom %{name}.jar -a javassist:javassist
|
||||||
|
|
||||||
# demo
|
# demo
|
||||||
mkdir -p %{buildroot}/%{_datadir}/%{name}-%{version}
|
mkdir -p %{buildroot}/%{_datadir}/%{name}-%{version}
|
||||||
@ -107,35 +104,23 @@ cp -pr sample/* %{buildroot}/%{_datadir}/%{name}-%{version}
|
|||||||
mkdir -p %{buildroot}/%{_javadocdir}/%{name}
|
mkdir -p %{buildroot}/%{_javadocdir}/%{name}
|
||||||
cp -pr html/* %{buildroot}/%{_javadocdir}/%{name}
|
cp -pr html/* %{buildroot}/%{_javadocdir}/%{name}
|
||||||
|
|
||||||
%fdupes -s %{buildroot}/%{_javadocdir}/%{name}/jquery/
|
%fdupes -s %{buildroot}/%{_javadocdir}/%{name}
|
||||||
|
|
||||||
# manual
|
# manual
|
||||||
mkdir -p %{buildroot}/%{_docdir}/%{name}-%{version}/tutorial
|
mkdir -p %{buildroot}/%{_docdir}/%{name}-%{version}/tutorial
|
||||||
cp -pr tutorial/* %{buildroot}/%{_docdir}/%{name}-%{version}/tutorial
|
cp -pr tutorial/* %{buildroot}/%{_docdir}/%{name}-%{version}/tutorial
|
||||||
cp -p License.html %{buildroot}/%{_docdir}/%{name}-%{version}
|
|
||||||
|
|
||||||
%files
|
%files -f .mfiles
|
||||||
%defattr(0644,root,root,0755)
|
%license License.html
|
||||||
%dir %{_docdir}/%{name}-%{version}
|
|
||||||
%license %{_docdir}/%{name}-%{version}/License.html
|
|
||||||
%{_javadir}/*.jar
|
|
||||||
%{_mavenpomdir}/*
|
|
||||||
%if %{defined _maven_repository}
|
|
||||||
%{_mavendepmapfragdir}/%{name}
|
|
||||||
%else
|
|
||||||
%{_datadir}/maven-metadata/%{name}.xml*
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%files demo
|
%files demo
|
||||||
%defattr(0644,root,root,0755)
|
|
||||||
%{_datadir}/%{name}-%{version}
|
%{_datadir}/%{name}-%{version}
|
||||||
|
|
||||||
%files javadoc
|
%files javadoc
|
||||||
%defattr(0644,root,root,0755)
|
%{_javadocdir}/%{name}
|
||||||
%doc %{_javadocdir}/%{name}
|
|
||||||
|
|
||||||
%files manual
|
%files manual
|
||||||
%defattr(0644,root,root,0755)
|
%dir %{_docdir}/%{name}-%{version}
|
||||||
%doc %{_docdir}/%{name}-%{version}/tutorial
|
%{_docdir}/%{name}-%{version}/tutorial
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
Loading…
Reference in New Issue
Block a user