Update to upstram version 1.10.16

This commit is contained in:
Marian Koncek 2020-09-30 13:49:22 +02:00
parent b09e2c6986
commit 20e721c240
7 changed files with 271 additions and 508 deletions

View File

@ -1,5 +1,14 @@
From ceca0b287ac211a968e84cee7f05cfd6c2a843ec Mon Sep 17 00:00:00 2001
From: Marian Koncek <mkoncek@redhat.com>
Date: Tue, 29 Sep 2020 14:46:16 +0200
Subject: [PATCH] Avoid bundling asm
---
byte-buddy/pom.xml | 70 ++++++++++------------------------------------
1 file changed, 15 insertions(+), 55 deletions(-)
diff --git a/byte-buddy/pom.xml b/byte-buddy/pom.xml
index ca7891b..0557bc8 100644
index 16388f3..c97b4d9 100644
--- a/byte-buddy/pom.xml
+++ b/byte-buddy/pom.xml
@@ -26,8 +26,6 @@
@ -38,7 +47,7 @@ index ca7891b..0557bc8 100644
</dependencies>
<build>
@@ -105,37 +110,6 @@
@@ -105,44 +110,6 @@
<createDependencyReducedPom>true</createDependencyReducedPom>
<createSourcesJar>${bytebuddy.extras}</createSourcesJar>
<shadeSourcesContent>true</shadeSourcesContent>
@ -50,8 +59,15 @@ index ca7891b..0557bc8 100644
- </relocations>
- <filters>
- <filter>
- <artifact>net.bytebuddy:byte-buddy-dep:*</artifact>
- <excludes>
- <exclude>META-INF/MANIFEST.MF</exclude>
- </excludes>
- </filter>
- <filter>
- <artifact>org.ow2.asm:*</artifact>
- <excludes>
- <exclude>META-INF/MANIFEST.MF</exclude>
- <exclude>**/module-info.class</exclude>
- <exclude>**/LICENSE</exclude>
- <exclude>**/NOTICE</exclude>
@ -60,23 +76,23 @@ index ca7891b..0557bc8 100644
- <filter>
- <artifact>org.ow2.asm:asm-commons</artifact>
- <includes>
- <include>org/objectweb/asm/commons/AnnotationRemapper.class</include>
- <include>org/objectweb/asm/commons/ClassRemapper.class</include>
- <include>org/objectweb/asm/commons/FieldRemapper.class</include>
- <include>org/objectweb/asm/commons/MethodRemapper.class</include>
- <include>org/objectweb/asm/commons/ModuleHashesAttribute.class</include>
- <include>org/objectweb/asm/commons/ModuleRemapper.class</include>
- <include>org/objectweb/asm/commons/RecordComponentRemapper.class</include>
- <include>org/objectweb/asm/commons/Remapper.class</include>
- <include>org/objectweb/asm/commons/SignatureRemapper.class</include>
- <include>org/objectweb/asm/commons/SimpleRemapper.class</include>
- <include>org/objectweb/asm/commons/AnnotationRemapper.**</include>
- <include>org/objectweb/asm/commons/ClassRemapper.**</include>
- <include>org/objectweb/asm/commons/FieldRemapper.**</include>
- <include>org/objectweb/asm/commons/MethodRemapper.**</include>
- <include>org/objectweb/asm/commons/ModuleHashesAttribute.**</include>
- <include>org/objectweb/asm/commons/ModuleRemapper.**</include>
- <include>org/objectweb/asm/commons/RecordComponentRemapper.**</include>
- <include>org/objectweb/asm/commons/Remapper.**</include>
- <include>org/objectweb/asm/commons/SignatureRemapper.**</include>
- <include>org/objectweb/asm/commons/SimpleRemapper.**</include>
- </includes>
- </filter>
- </filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>net.bytebuddy.build.Plugin$Engine$Default</mainClass>
@@ -144,21 +118,14 @@
@@ -151,21 +118,14 @@
<resource>META-INF/LICENSE</resource>
</transformer>
</transformers>
@ -103,3 +119,6 @@ index ca7891b..0557bc8 100644
</plugin>
<!-- Disable pitest as it fails for empty modules -->
<plugin>
--
2.26.2

View File

@ -1,17 +1,17 @@
From a588d17702b23f3656ec5e05575e308597f6472a Mon Sep 17 00:00:00 2001
From 4dcae48a47d1c2123d5ec86f3e2d6ef1adab8a83 Mon Sep 17 00:00:00 2001
From: Marian Koncek <mkoncek@redhat.com>
Date: Thu, 21 Nov 2019 16:23:31 +0100
Date: Wed, 30 Sep 2020 13:04:45 +0200
Subject: [PATCH] Remove dependency on jna
---
.../net/bytebuddy/agent/VirtualMachine.java | 2242 +++--------------
1 file changed, 357 insertions(+), 1885 deletions(-)
.../net/bytebuddy/agent/VirtualMachine.java | 2275 +++--------------
1 file changed, 357 insertions(+), 1918 deletions(-)
diff --git a/byte-buddy-agent/src/main/java/net/bytebuddy/agent/VirtualMachine.java b/byte-buddy-agent/src/main/java/net/bytebuddy/agent/VirtualMachine.java
index 7e37395..535af5e 100644
index 245581d..80cab63 100644
--- a/byte-buddy-agent/src/main/java/net/bytebuddy/agent/VirtualMachine.java
+++ b/byte-buddy-agent/src/main/java/net/bytebuddy/agent/VirtualMachine.java
@@ -15,11 +15,6 @@
@@ -15,13 +15,6 @@
*/
package net.bytebuddy.agent;
@ -20,10 +20,12 @@ index 7e37395..535af5e 100644
-import com.sun.jna.ptr.IntByReference;
-import com.sun.jna.win32.StdCallLibrary;
-import com.sun.jna.win32.W32APIOptions;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
import java.io.*;
@@ -227,23 +222,6 @@ public interface VirtualMachine {
import java.net.ServerSocket;
import java.net.Socket;
@@ -227,23 +220,6 @@ public interface VirtualMachine {
this.connection = connection;
}
@ -47,7 +49,15 @@ index 7e37395..535af5e 100644
/**
* Attaches to the supplied process id using the supplied connection factory.
*
@@ -679,1918 +657,412 @@ public interface VirtualMachine {
@@ -515,7 +491,6 @@ public interface VirtualMachine {
/**
* {@inheritDoc}
*/
- @SuppressFBWarnings(value = "DMI_HARDCODED_ABSOLUTE_FILENAME", justification = "File name convention is specified.")
public Connection connect(String processId) throws IOException {
File socket = new File(temporaryDirectory, SOCKET_FILE_PREFIX + processId);
if (!socket.exists()) {
@@ -679,1949 +654,413 @@ public interface VirtualMachine {
*/
protected abstract int read(T connection, byte[] buffer) throws IOException;
}
@ -128,7 +138,7 @@ index 7e37395..535af5e 100644
- library.connect(handle, address, address.size());
- return handle;
- } finally {
- address.clear();
- address = null;
- }
- } catch (RuntimeException exception) {
- library.close(handle);
@ -301,12 +311,18 @@ index 7e37395..535af5e 100644
- * @param timeUnit The time unit of the pause time.
- * @return An appropriate connection factory.
- */
- @SuppressWarnings("deprecation")
- public static Connection.Factory withDefaultTemporaryFolder(int attempts, long pause, TimeUnit timeUnit) {
- String temporaryDirectory;
- if (Platform.isMac()) {
- temporaryDirectory = System.getenv("TMPDIR");
- if (temporaryDirectory == null) {
- temporaryDirectory = "/tmp";
- MacLibrary library = Native.loadLibrary("c", MacLibrary.class);
- Memory memory = new Memory(4096);
- try {
- long length = library.confstr(MacLibrary.CS_DARWIN_USER_TEMP_DIR, memory, memory.size());
- if (length == 0 || length > 4096) {
- temporaryDirectory = "/tmp";
- } else {
- temporaryDirectory = memory.getString(0);
+ long userId = dispatcher.userId();
+ virtualMachines = new ArrayList<Properties>();
+ for (File aVmFolder : vmFolder) {
@ -346,7 +362,9 @@ index 7e37395..535af5e 100644
+ }
+ }
+ }
+ }
}
- } finally {
- memory = null;
}
- } else {
- temporaryDirectory = "/tmp";
@ -364,6 +382,27 @@ index 7e37395..535af5e 100644
- @Override
- public Connection doConnect(File socket) {
- return new Connection.ForJnaPosixSocket(library, socket);
- }
-
- /**
- * A library for reading a Mac user's temporary directory.
- */
- public interface MacLibrary extends Library {
-
- /**
- * The temporary directory.
- */
- int CS_DARWIN_USER_TEMP_DIR = 65537;
-
- /**
- * Reads a configuration dependant variable into a memory segment.
- *
- * @param name The name of the variable.
- * @param buffer The buffer to read the variable into.
- * @param length The length of the buffer.
- * @return The amount of bytes written to the buffer.
- */
- long confstr(int name, Pointer buffer, long length);
+ } finally {
+ master.close();
}
@ -804,13 +843,13 @@ index 7e37395..535af5e 100644
- return new Response(library, door.descriptorPointer.getInt(4));
- }
- } finally {
- result.clear();
- result = null;
- }
- } finally {
- dataPointer.clear();
- dataPointer = null;
- }
- } finally {
- door.clear();
- door = null;
- }
- } finally {
- library.close(handle);
@ -1179,6 +1218,7 @@ index 7e37395..535af5e 100644
- if (answer.contains(' ' + key + ' ')) {
- return new ForOpenJ9(socket);
- } else {
- socket.close();
- throw new IllegalStateException("Unexpected answered to attachment: " + answer);
- }
- } finally {
@ -1517,7 +1557,7 @@ index 7e37395..535af5e 100644
- Thread.sleep(timeUnit.toMillis(pause));
- } catch (InterruptedException exception) {
- Thread.currentThread().interrupt();
- throw new IllegalStateException("Interrupted while waiting for stat", exception);
- throw new IllegalStateException(exception);
+ String pid = Long.toString(dispatcher.pid());
+ for (Properties virtualMachine : virtualMachines) {
+ if (!virtualMachine.getProperty("processId").equalsIgnoreCase(pid)) {
@ -1607,7 +1647,7 @@ index 7e37395..535af5e 100644
- }
- }
- } finally {
- target.clear();
- target = null;
- }
- }
-
@ -1901,6 +1941,7 @@ index 7e37395..535af5e 100644
+ if (answer.contains(' ' + key + ' ')) {
+ return new ForOpenJ9(socket);
+ } else {
+ socket.close();
+ throw new IllegalStateException("Unexpected answered to attachment: " + answer);
}
- } else {
@ -1953,13 +1994,13 @@ index 7e37395..535af5e 100644
+ }
}
} finally {
- securityAttributes.clear();
- securityAttributes = null;
+ if (!reply.delete()) {
+ reply.deleteOnExit();
+ }
}
} finally {
- securityDescriptor.clear();
- securityDescriptor = null;
+ serverSocket.close();
}
+ } finally {
@ -2324,5 +2365,5 @@ index 7e37395..535af5e 100644
}
}
--
2.21.0
2.26.2

View File

@ -0,0 +1,156 @@
From e938b662ab78d1ae88309502cc0273e29d4a54f7 Mon Sep 17 00:00:00 2001
From: Marian Koncek <mkoncek@redhat.com>
Date: Wed, 30 Sep 2020 13:32:09 +0200
Subject: [PATCH] Remove Java 14 tests
---
.../test/precompiled/SampleRecord.java | 24 -----
.../type/AbstractTypeDescriptionTest.java | 101 ------------------
2 files changed, 125 deletions(-)
delete mode 100644 byte-buddy-dep/src/precompiled/java/net/bytebuddy/test/precompiled/SampleRecord.java
diff --git a/byte-buddy-dep/src/precompiled/java/net/bytebuddy/test/precompiled/SampleRecord.java b/byte-buddy-dep/src/precompiled/java/net/bytebuddy/test/precompiled/SampleRecord.java
deleted file mode 100644
index c760fae..0000000
--- a/byte-buddy-dep/src/precompiled/java/net/bytebuddy/test/precompiled/SampleRecord.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2014 - 2020 Rafael Winterhalter
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.bytebuddy.test.precompiled;
-
-import net.bytebuddy.description.type.AbstractTypeDescriptionTest;
-
-import java.util.List;
-
-public record SampleRecord(@AbstractTypeDescriptionTest.SampleAnnotation @TypeAnnotation(42) List<@TypeAnnotation(84) String> foo) {
- /* empty */
-}
diff --git a/byte-buddy-dep/src/test/java/net/bytebuddy/description/type/AbstractTypeDescriptionTest.java b/byte-buddy-dep/src/test/java/net/bytebuddy/description/type/AbstractTypeDescriptionTest.java
index 64c765b..e677900 100644
--- a/byte-buddy-dep/src/test/java/net/bytebuddy/description/type/AbstractTypeDescriptionTest.java
+++ b/byte-buddy-dep/src/test/java/net/bytebuddy/description/type/AbstractTypeDescriptionTest.java
@@ -753,107 +753,6 @@ public abstract class AbstractTypeDescriptionTest extends AbstractTypeDescriptio
assertThat(describe(String.class).getRecordComponents().size(), is(0));
}
- @Test
- @JavaVersionRule.Enforce(14)
- @Ignore("Requires preview features")
- public void testRecordComponents() throws Exception {
- Class<?> sampleRecord = Class.forName("net.bytebuddy.test.precompiled.SampleRecord");
- assertThat(describe(sampleRecord).isRecord(), is(true));
- @SuppressWarnings("unchecked")
- Class<? extends Annotation> typeAnnotation = (Class<? extends Annotation>) Class.forName("net.bytebuddy.test.precompiled.TypeAnnotation");
- MethodDescription.InDefinedShape value = new MethodDescription.ForLoadedMethod(typeAnnotation.getMethod("value"));
- RecordComponentList<RecordComponentDescription.InDefinedShape> recordComponents = describe(sampleRecord).getRecordComponents();
- assertThat(recordComponents.size(), is(1));
- assertThat(recordComponents.getOnly().getActualName(), is(FOO));
- assertThat(recordComponents.getOnly().getAccessor(), is((MethodDescription) new MethodDescription.ForLoadedMethod(sampleRecord.getMethod(FOO))));
- assertThat(recordComponents.getOnly().getDeclaringType(), is((TypeDefinition) TypeDescription.ForLoadedType.of(sampleRecord)));
- assertThat(recordComponents.getOnly().getDeclaredAnnotations().size(), is(1));
- assertThat(recordComponents.getOnly().getDeclaredAnnotations().getOnly().getAnnotationType().represents(SampleAnnotation.class), is(true));
- assertThat(recordComponents.getOnly().getType().asErasure().represents(List.class), is(true));
- assertThat(recordComponents.getOnly().getType().getSort(), is(TypeDefinition.Sort.PARAMETERIZED));
- assertThat(recordComponents.getOnly().getType().getDeclaredAnnotations().size(), is(1));
- assertThat(recordComponents.getOnly().getType().getDeclaredAnnotations().getOnly().getAnnotationType().represents(typeAnnotation), is(true));
- assertThat(recordComponents.getOnly().getType().getDeclaredAnnotations().getOnly().prepare(typeAnnotation).getValue(value).resolve(), is((Object) 42));
- assertThat(recordComponents.getOnly().getType().getTypeArguments().size(), is(1));
- assertThat(recordComponents.getOnly().getType().getTypeArguments().getOnly().getSort(), is(TypeDefinition.Sort.NON_GENERIC));
- assertThat(recordComponents.getOnly().getType().getTypeArguments().getOnly().asErasure().represents(String.class), is(true));
- assertThat(recordComponents.getOnly().getType().getTypeArguments().getOnly().getDeclaredAnnotations().size(), is(1));
- assertThat(recordComponents.getOnly().getType().getTypeArguments().getOnly().getDeclaredAnnotations().getOnly().getAnnotationType().represents(typeAnnotation), is(true));
- assertThat(recordComponents.getOnly().getType().getTypeArguments().getOnly().getDeclaredAnnotations().getOnly().prepare(typeAnnotation).getValue(value).resolve(), is((Object) 84));
- }
-
- @Test
- @JavaVersionRule.Enforce(14)
- @Ignore("Requires preview features")
- public void testRecordComponentsField() throws Exception {
- Class<?> sampleRecord = Class.forName("net.bytebuddy.test.precompiled.SampleRecord");
- @SuppressWarnings("unchecked")
- Class<? extends Annotation> typeAnnotation = (Class<? extends Annotation>) Class.forName("net.bytebuddy.test.precompiled.TypeAnnotation");
- MethodDescription.InDefinedShape value = new MethodDescription.ForLoadedMethod(typeAnnotation.getMethod("value"));
- FieldDescription fieldDescription = describe(sampleRecord).getDeclaredFields().filter(named(FOO)).getOnly();
- assertThat(fieldDescription.getDeclaredAnnotations().size(), is(1));
- assertThat(fieldDescription.getDeclaredAnnotations().getOnly().getAnnotationType().represents(SampleAnnotation.class), is(true));
- assertThat(fieldDescription.getType().asErasure().represents(List.class), is(true));
- assertThat(fieldDescription.getType().getSort(), is(TypeDefinition.Sort.PARAMETERIZED));
- assertThat(fieldDescription.getType().getDeclaredAnnotations().size(), is(1));
- assertThat(fieldDescription.getType().getDeclaredAnnotations().getOnly().getAnnotationType().represents(typeAnnotation), is(true));
- assertThat(fieldDescription.getType().getDeclaredAnnotations().getOnly().prepare(typeAnnotation).getValue(value).resolve(), is((Object) 42));
- assertThat(fieldDescription.getType().getTypeArguments().size(), is(1));
- assertThat(fieldDescription.getType().getTypeArguments().getOnly().getSort(), is(TypeDefinition.Sort.NON_GENERIC));
- assertThat(fieldDescription.getType().getTypeArguments().getOnly().asErasure().represents(String.class), is(true));
- assertThat(fieldDescription.getType().getTypeArguments().getOnly().getDeclaredAnnotations().size(), is(1));
- assertThat(fieldDescription.getType().getTypeArguments().getOnly().getDeclaredAnnotations().getOnly().getAnnotationType().represents(typeAnnotation), is(true));
- assertThat(fieldDescription.getType().getTypeArguments().getOnly().getDeclaredAnnotations().getOnly().prepare(typeAnnotation).getValue(value).resolve(), is((Object) 84));
- }
-
- @Test
- @JavaVersionRule.Enforce(14)
- @Ignore("javac does not currently add type annotation meta data correctly")
- public void testRecordComponentsAccessor() throws Exception {
- Class<?> sampleRecord = Class.forName("net.bytebuddy.test.precompiled.SampleRecord");
- @SuppressWarnings("unchecked")
- Class<? extends Annotation> typeAnnotation = (Class<? extends Annotation>) Class.forName("net.bytebuddy.test.precompiled.TypeAnnotation");
- MethodDescription.InDefinedShape value = new MethodDescription.ForLoadedMethod(typeAnnotation.getMethod("value"));
- MethodDescription methodDescription = describe(sampleRecord).getDeclaredMethods().filter(named(FOO)).getOnly();
- assertThat(methodDescription.getDeclaredAnnotations().size(), is(1));
- assertThat(methodDescription.getDeclaredAnnotations().getOnly().getAnnotationType().represents(SampleAnnotation.class), is(true));
- assertThat(methodDescription.getReturnType().asErasure().represents(List.class), is(true));
- assertThat(methodDescription.getReturnType().getSort(), is(TypeDefinition.Sort.PARAMETERIZED));
- assertThat(methodDescription.getReturnType().getDeclaredAnnotations().size(), is(1));
- assertThat(methodDescription.getReturnType().getDeclaredAnnotations().getOnly().getAnnotationType().represents(typeAnnotation), is(true));
- assertThat(methodDescription.getReturnType().getDeclaredAnnotations().getOnly().prepare(typeAnnotation).getValue(value).resolve(), is((Object) 42));
- assertThat(methodDescription.getReturnType().getTypeArguments().size(), is(1));
- assertThat(methodDescription.getReturnType().getTypeArguments().getOnly().getSort(), is(TypeDefinition.Sort.NON_GENERIC));
- assertThat(methodDescription.getReturnType().getTypeArguments().getOnly().asErasure().represents(String.class), is(true));
- assertThat(methodDescription.getReturnType().getTypeArguments().getOnly().getDeclaredAnnotations().size(), is(1));
- assertThat(methodDescription.getReturnType().getTypeArguments().getOnly().getDeclaredAnnotations().getOnly().getAnnotationType().represents(typeAnnotation), is(true));
- assertThat(methodDescription.getReturnType().getTypeArguments().getOnly().getDeclaredAnnotations().getOnly().prepare(typeAnnotation).getValue(value).resolve(), is((Object) 84));
- }
-
- @Test
- @JavaVersionRule.Enforce(14)
- @Ignore("javac does not currently add type annotation meta data correctly")
- public void testRecordComponentsConstructorParameter() throws Exception {
- Class<?> sampleRecord = Class.forName("net.bytebuddy.test.precompiled.SampleRecord");
- @SuppressWarnings("unchecked")
- Class<? extends Annotation> typeAnnotation = (Class<? extends Annotation>) Class.forName("net.bytebuddy.test.precompiled.TypeAnnotation");
- MethodDescription.InDefinedShape value = new MethodDescription.ForLoadedMethod(typeAnnotation.getMethod("value"));
- ParameterDescription parameterDescription = describe(sampleRecord).getDeclaredMethods().filter(isConstructor()).getOnly().getParameters().getOnly();
- assertThat(parameterDescription.getDeclaredAnnotations().size(), is(1));
- assertThat(parameterDescription.getDeclaredAnnotations().getOnly().getAnnotationType().represents(SampleAnnotation.class), is(true));
- assertThat(parameterDescription.getType().asErasure().represents(List.class), is(true));
- assertThat(parameterDescription.getType().getSort(), is(TypeDefinition.Sort.PARAMETERIZED));
- assertThat(parameterDescription.getType().getDeclaredAnnotations().size(), is(1));
- assertThat(parameterDescription.getType().getDeclaredAnnotations().getOnly().getAnnotationType().represents(typeAnnotation), is(true));
- assertThat(parameterDescription.getType().getDeclaredAnnotations().getOnly().prepare(typeAnnotation).getValue(value).resolve(), is((Object) 42));
- assertThat(parameterDescription.getType().getTypeArguments().size(), is(1));
- assertThat(parameterDescription.getType().getTypeArguments().getOnly().getSort(), is(TypeDefinition.Sort.NON_GENERIC));
- assertThat(parameterDescription.getType().getTypeArguments().getOnly().asErasure().represents(String.class), is(true));
- assertThat(parameterDescription.getType().getTypeArguments().getOnly().getDeclaredAnnotations().size(), is(1));
- assertThat(parameterDescription.getType().getTypeArguments().getOnly().getDeclaredAnnotations().getOnly().getAnnotationType().represents(typeAnnotation), is(true));
- assertThat(parameterDescription.getType().getTypeArguments().getOnly().getDeclaredAnnotations().getOnly().prepare(typeAnnotation).getValue(value).resolve(), is((Object) 84));
- }
-
private Class<?> inMethodClass() {
class InMethod {
/* empty */
--
2.26.2

View File

@ -1,15 +1,16 @@
Name: byte-buddy
Version: 1.10.7
Release: 1%{?dist}
Summary: Runtime code generation for the Java virtual machine
License: ASL 2.0
URL: http://bytebuddy.net/
Name: byte-buddy
Version: 1.10.16
Release: 1%{?dist}
Summary: Runtime code generation for the Java virtual machine
License: ASL 2.0
URL: http://bytebuddy.net/
# ./generate-tarball.sh
Source0: %{name}-%{version}.tar.gz
Source0: %{name}-%{version}.tar.gz
# Patch the build to avoid bundling inside shaded jars
Patch1: avoid-bundling-asm.patch
Patch2: 0001-Remove-dependency-on-jna.patch
Patch1: 0001-Avoid-bundling-asm.patch
Patch2: 0002-Remove-dependency-on-jna.patch
Patch3: 0003-Remove-Java-14-tests.patch
BuildRequires: maven-local
BuildRequires: mvn(junit:junit)
@ -31,7 +32,7 @@ BuildRequires: mvn(org.eclipse.aether:aether-util)
BuildRequires: mvn(org.ow2.asm:asm)
BuildRequires: mvn(org.ow2.asm:asm-commons)
BuildArch: noarch
BuildArch: noarch
%description
Byte Buddy is a code generation library for creating Java classes during the
@ -70,6 +71,9 @@ This package contains API documentation for %{name}.
%patch1 -p1
%patch2 -p1
%patch3 -p1
rm byte-buddy-agent/src/test/java/net/bytebuddy/agent/VirtualMachineAttachmentTest.java
# Cause pre-compiled stuff to be re-compiled
mv byte-buddy-dep/src/precompiled/java/net/bytebuddy/build/*.java \
@ -142,6 +146,9 @@ sed -i -e '/SuppressFBWarnings/d' $(grep -lr SuppressFBWarnings)
%license LICENSE NOTICE
%changelog
* Tue Sep 29 2020 Marian Koncek <mkoncek@redhat.com> - 1.10.16-1
- Update to upstram version 1.10.16
* Tue Jan 21 2020 Marian Koncek <mkoncek@redhat.com> - 1.10.7-1
- Update to upstream version 1.10.7

View File

@ -10,7 +10,7 @@ wget "https://github.com/raphw/byte-buddy/archive/${name}-${version}.tar.gz" -O
rm -rf tarball-tmp
mkdir tarball-tmp
pushd tarball-tmp
tar xf "../${name}-${version}.orig.tar.gz"
tar -xf "../${name}-${version}.orig.tar.gz"
# CLEAN TARBALL
find -name '*.jar' -delete

View File

@ -1,460 +0,0 @@
--- byte-buddy-agent/pom.xml.orig 2018-11-30 11:43:29.016481386 +0000
+++ byte-buddy-agent/pom.xml 2018-11-30 11:43:42.676439662 +0000
@@ -15,7 +15,6 @@
<bytebuddy.agent>net.bytebuddy.agent.Installer</bytebuddy.agent>
<attach.package.sun>com.sun.tools.attach</attach.package.sun>
<attach.package.ibm>com.ibm.tools.attach</attach.package.ibm>
- <version.unixsocket>2.0.4</version.unixsocket>
<packages.list>net.bytebuddy.agent</packages.list>
</properties>
@@ -30,12 +29,6 @@
<dependencies>
<dependency>
- <groupId>com.kohlschutter.junixsocket</groupId>
- <artifactId>junixsocket-native-common</artifactId>
- <version>${version.unixsocket}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${version.junit}</version>
--- byte-buddy-agent/src/main/java/net/bytebuddy/agent/ByteBuddyAgent.java.orig 2018-11-30 11:22:23.274443432 +0000
+++ byte-buddy-agent/src/main/java/net/bytebuddy/agent/ByteBuddyAgent.java 2018-11-30 11:42:22.236685381 +0000
@@ -541,8 +541,7 @@
ForStandardToolsJarVm.JVM_ROOT,
ForStandardToolsJarVm.JDK_ROOT,
ForStandardToolsJarVm.MACINTOSH,
- ForUserDefinedToolsJar.INSTANCE,
- ForUnixHotSpotVm.INSTANCE);
+ ForUserDefinedToolsJar.INSTANCE);
/**
* Attempts the creation of an accessor for a specific JVM's attachment API.
@@ -922,28 +921,6 @@
}
}
}
-
- /**
- * An attachment provider using a custom protocol implementation for HotSpot on Unix.
- */
- enum ForUnixHotSpotVm implements AttachmentProvider {
-
- /**
- * The singleton instance.
- */
- INSTANCE;
-
- /**
- * {@inheritDoc}
- */
- public Accessor attempt() {
- try {
- return new Accessor.Simple.WithoutExternalAttachment(VirtualMachine.ForHotSpot.OnUnix.assertAvailability());
- } catch (Throwable ignored) {
- return Accessor.Unavailable.INSTANCE;
- }
- }
- }
/**
* A compound attachment provider that attempts the attachment by delegation to other providers. If
--- byte-buddy-agent/src/main/java/net/bytebuddy/agent/VirtualMachine.java.orig 2018-11-30 11:22:55.830341642 +0000
+++ byte-buddy-agent/src/main/java/net/bytebuddy/agent/VirtualMachine.java 2018-11-30 11:38:21.698438915 +0000
@@ -16,8 +16,6 @@
package net.bytebuddy.agent;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import org.newsclub.net.unix.AFUNIXSocket;
-import org.newsclub.net.unix.AFUNIXSocketAddress;
import java.io.File;
import java.io.IOException;
@@ -172,213 +170,5 @@
*/
protected abstract void write(byte[] buffer) throws IOException;
- /**
- * A virtual machine implementation for a HotSpot VM running on Unix.
- */
- public static class OnUnix extends ForHotSpot {
-
- /**
- * The default amount of attempts to connect.
- */
- private static final int DEFAULT_ATTEMPTS = 10;
-
- /**
- * The default pause between two attempts.
- */
- private static final long DEFAULT_PAUSE = 200;
-
- /**
- * The default socket timeout.
- */
- private static final long DEFAULT_TIMEOUT = 5000;
-
- /**
- * The temporary directory on Unix systems.
- */
- private static final String TEMPORARY_DIRECTORY = "/tmp";
-
- /**
- * The name prefix for a socket.
- */
- private static final String SOCKET_FILE_PREFIX = ".java_pid";
-
- /**
- * The name prefix for an attachment file indicator.
- */
- private static final String ATTACH_FILE_PREFIX = ".attach_pid";
-
- /**
- * The Unix socket to use for communication. The containing object is supposed to be an instance
- * of {@link AFUNIXSocket} which is however not set to avoid eager loading
- */
- private final Object socket;
-
- /**
- * The number of attempts to connect.
- */
- private final int attempts;
-
- /**
- * The time to pause between attempts.
- */
- private final long pause;
-
- /**
- * The socket timeout.
- */
- private final long timeout;
-
- /**
- * The time unit of the pause time.
- */
- private final TimeUnit timeUnit;
-
- /**
- * Creates a new VM implementation for a HotSpot VM running on Unix.
- *
- * @param processId The process id of the target VM.
- * @param socket The Unix socket to use for communication.
- * @param attempts The number of attempts to connect.
- * @param pause The pause time between two VMs.
- * @param timeout The socket timeout.
- * @param timeUnit The time unit of the pause time.
- */
- public OnUnix(String processId, Object socket, int attempts, long pause, long timeout, TimeUnit timeUnit) {
- super(processId);
- this.socket = socket;
- this.attempts = attempts;
- this.pause = pause;
- this.timeout = timeout;
- this.timeUnit = timeUnit;
- }
-
- /**
- * Asserts the availability of this virtual machine implementation. If the Unix socket library is missing or
- * if this VM does not support Unix socket communication, a {@link Throwable} is thrown.
- *
- * @return This virtual machine type.
- * @throws Throwable If this attachment method is not available.
- */
- public static Class<?> assertAvailability() throws Throwable {
- try {
- Class<?> moduleType = Class.forName("java.lang.Module");
- Method getModule = Class.class.getMethod("getModule"), canRead = moduleType.getMethod("canRead", moduleType);
- Object thisModule = getModule.invoke(OnUnix.class), otherModule = getModule.invoke(AFUNIXSocket.class);
- if (!(Boolean) canRead.invoke(thisModule, otherModule)) {
- moduleType.getMethod("addReads", moduleType).invoke(thisModule, otherModule);
- }
- return doAssertAvailability();
- } catch (ClassNotFoundException ignored) {
- return doAssertAvailability();
- }
- }
-
- /**
- * Asserts the availability of this virtual machine implementation.
- *
- * @return This virtual machine type.
- */
- private static Class<?> doAssertAvailability() {
- if (!AFUNIXSocket.isSupported()) {
- throw new IllegalStateException("POSIX sockets are not supported on the current system");
- } else if (!System.getProperty("java.vm.name").toLowerCase(Locale.US).contains("hotspot")) {
- throw new IllegalStateException("Cannot apply attachment on non-Hotspot compatible VM");
- } else {
- return OnUnix.class;
- }
- }
-
- /**
- * Attaches to the supplied VM process.
- *
- * @param processId The process id of the target VM.
- * @return An appropriate virtual machine implementation.
- * @throws IOException If an I/O exception occurs.
- */
- public static VirtualMachine attach(String processId) throws IOException {
- return new OnUnix(processId, AFUNIXSocket.newInstance(), DEFAULT_ATTEMPTS, DEFAULT_PAUSE, DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressFBWarnings(value = "DMI_HARDCODED_ABSOLUTE_FILENAME", justification = "This is a Unix-specific implementation")
- protected void connect() throws IOException {
- File socketFile = new File(TEMPORARY_DIRECTORY, SOCKET_FILE_PREFIX + processId);
- if (!socketFile.exists()) {
- String target = ATTACH_FILE_PREFIX + processId, path = "/proc/" + processId + "/cwd/" + target;
- File attachFile = new File(path);
- try {
- if (!attachFile.createNewFile() && !attachFile.isFile()) {
- throw new IllegalStateException("Could not create attach file: " + attachFile);
- }
- } catch (IOException ignored) {
- attachFile = new File(TEMPORARY_DIRECTORY, target);
- if (!attachFile.createNewFile() && !attachFile.isFile()) {
- throw new IllegalStateException("Could not create attach file: " + attachFile);
- }
- }
- try {
- // The HotSpot attachment API attempts to send the signal to all children of a process
- Process process = Runtime.getRuntime().exec("kill -3 " + processId);
- int attempts = this.attempts;
- boolean killed = false;
- do {
- try {
- if (process.exitValue() != 0) {
- throw new IllegalStateException("Error while sending signal to target VM: " + processId);
- }
- killed = true;
- break;
- } catch (IllegalThreadStateException ignored) {
- attempts -= 1;
- Thread.sleep(timeUnit.toMillis(pause));
- }
- } while (attempts > 0);
- if (!killed) {
- throw new IllegalStateException("Target VM did not respond to signal: " + processId);
- }
- attempts = this.attempts;
- while (attempts-- > 0 && !socketFile.exists()) {
- Thread.sleep(timeUnit.toMillis(pause));
- }
- if (!socketFile.exists()) {
- throw new IllegalStateException("Target VM did not respond: " + processId);
- }
- } catch (InterruptedException exception) {
- throw new IllegalStateException("Interrupted during wait for process", exception);
- } finally {
- if (!attachFile.delete()) {
- attachFile.deleteOnExit();
- }
- }
- }
- if (timeout != 0) {
- ((AFUNIXSocket) socket).setSoTimeout((int) timeUnit.toMillis(timeout));
- }
- ((AFUNIXSocket) socket).connect(new AFUNIXSocketAddress(socketFile));
- }
-
- /**
- * {@inheritDoc}
- */
- public int read(byte[] buffer) throws IOException {
- return ((AFUNIXSocket) this.socket).getInputStream().read(buffer);
- }
-
- /**
- * {@inheritDoc}
- */
- public void write(byte[] buffer) throws IOException {
- ((AFUNIXSocket) this.socket).getOutputStream().write(buffer);
- }
-
- /**
- * {@inheritDoc}
- */
- public void detach() throws IOException {
- ((AFUNIXSocket) this.socket).close();
- }
- }
}
}
--- byte-buddy-agent/src/test/java/net/bytebuddy/test/utility/UnixSocketRule.java 2018-11-22 17:18:25.000000000 +0000
+++ /dev/null 2018-10-26 11:27:39.627999956 +0100
@@ -1,48 +0,0 @@
-package net.bytebuddy.test.utility;
-
-import org.junit.rules.MethodRule;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.Statement;
-import org.newsclub.net.unix.AFUNIXSocket;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.util.logging.Logger;
-
-public class UnixSocketRule implements MethodRule {
-
- private final boolean enabled;
-
- public UnixSocketRule() {
- boolean enabled;
- try {
- Class.forName(AFUNIXSocket.class.getName(), true, UnixSocketRule.class.getClassLoader());
- enabled = true;
- } catch (Throwable ignored) {
- enabled = false;
- }
- this.enabled = enabled;
- }
-
- public Statement apply(Statement base, FrameworkMethod method, Object target) {
- return enabled || method.getAnnotation(Enforce.class) == null
- ? base
- : new NoOpStatement();
- }
-
- @Retention(RetentionPolicy.RUNTIME)
- @Target(ElementType.METHOD)
- public @interface Enforce {
-
- }
-
- private static class NoOpStatement extends Statement {
-
- public void evaluate() {
- Logger.getLogger("net.bytebuddy").warning("Ignoring Unix sockets on this machine");
- }
- }
-}
-
--- byte-buddy-agent/src/test/java/net/bytebuddy/agent/VirtualMachineForHotSpotTest.java 2018-11-22 17:18:25.000000000 +0000
+++ /dev/null 2018-10-26 11:27:39.627999956 +0100
@@ -1,116 +0,0 @@
-package net.bytebuddy.agent;
-
-import net.bytebuddy.test.utility.UnixSocketRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.MethodRule;
-import org.mockito.InOrder;
-
-import java.io.IOException;
-
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.spy;
-
-public class VirtualMachineForHotSpotTest {
-
- @Rule
- public MethodRule unixSocketRule = new UnixSocketRule();
-
- @Test
- @UnixSocketRule.Enforce
- public void testAttachment() throws Exception {
- VirtualMachine.ForHotSpot virtualMachine = spy(new PseudoMachine(
- "0".getBytes("UTF-8"),
- new byte[]{10}
- ));
- virtualMachine.loadAgent("foo", "bar");
- InOrder order = inOrder(virtualMachine);
- order.verify(virtualMachine).connect();
- order.verify(virtualMachine).write("1".getBytes("UTF-8"));
- order.verify(virtualMachine).write(new byte[1]);
- order.verify(virtualMachine).write("load".getBytes("UTF-8"));
- order.verify(virtualMachine).write(new byte[1]);
- order.verify(virtualMachine).write("instrument".getBytes("UTF-8"));
- order.verify(virtualMachine).write(new byte[1]);
- order.verify(virtualMachine).write(Boolean.FALSE.toString().getBytes("UTF-8"));
- order.verify(virtualMachine).write(new byte[1]);
- order.verify(virtualMachine).write("foo=bar".getBytes("UTF-8"));
- order.verify(virtualMachine).write(new byte[1]);
- }
-
- @Test
- @UnixSocketRule.Enforce
- public void testAttachmentWithoutArgument() throws Exception {
- VirtualMachine.ForHotSpot virtualMachine = spy(new PseudoMachine(
- "0".getBytes("UTF-8"),
- new byte[]{10}
- ));
- virtualMachine.loadAgent("foo", null);
- InOrder order = inOrder(virtualMachine);
- order.verify(virtualMachine).connect();
- order.verify(virtualMachine).write("1".getBytes("UTF-8"));
- order.verify(virtualMachine).write(new byte[1]);
- order.verify(virtualMachine).write("load".getBytes("UTF-8"));
- order.verify(virtualMachine).write(new byte[1]);
- order.verify(virtualMachine).write("instrument".getBytes("UTF-8"));
- order.verify(virtualMachine).write(new byte[1]);
- order.verify(virtualMachine).write(Boolean.FALSE.toString().getBytes("UTF-8"));
- order.verify(virtualMachine).write(new byte[1]);
- order.verify(virtualMachine).write("foo".getBytes("UTF-8"));
- order.verify(virtualMachine).write(new byte[1]);
- }
-
- @Test(expected = IOException.class)
- @UnixSocketRule.Enforce
- public void testAttachmentIncompatibleProtocol() throws Exception {
- new PseudoMachine(
- "1".getBytes("UTF-8"),
- "0".getBytes("UTF-8"),
- "1".getBytes("UTF-8"),
- new byte[]{10}
- ).loadAgent("foo", null);
- }
-
- @Test(expected = IllegalStateException.class)
- @UnixSocketRule.Enforce
- public void testAttachmentUnknownError() throws Exception {
- new PseudoMachine(
- "1".getBytes("UTF-8"),
- new byte[]{10},
- "foo".getBytes("UTF-8")
- ).loadAgent("foo", null);
- }
-
- private static class PseudoMachine extends VirtualMachine.ForHotSpot {
-
- private final byte[][] read;
-
- private int index;
-
- private PseudoMachine(byte[]... read) {
- super(null);
- this.read = read;
- }
-
- public void detach() {
- /* empty */
- }
-
- protected void connect() {
- /* empty */
- }
-
- protected int read(byte[] buffer) {
- if (index == read.length) {
- return -1;
- }
- byte[] read = this.read[index++];
- System.arraycopy(read, 0, buffer, 0, read.length);
- return read.length;
- }
-
- protected void write(byte[] buffer) {
- /* empty */
- }
- }
-}
\ No newline at end of file

View File

@ -1 +1 @@
SHA512 (byte-buddy-1.10.7.tar.gz) = 582b8a0a9504837ab37f724570741661421da2e58cad4d93663dffae6dab9ed74839616ffc8e8f406161b60f922a69f6d2b4fee6bdbfbc6346ce6c7a9abb6829
SHA512 (byte-buddy-1.10.16.tar.gz) = 45536700ccf7f38edfbd94cd02deb73539f8362718424539a6821418d0040e7716b6d79f42a6873965a6bcb18248d4e253a0312f260c099e7c5739539b40ae81