[Git][java-team/invokebinder][master] 7 commits: New upstream version 1.13
Jérôme Charaoui (@lavamind)
gitlab at salsa.debian.org
Sun Sep 3 23:22:41 BST 2023
Jérôme Charaoui pushed to branch master at Debian Java Maintainers / invokebinder
Commits:
033ae451 by Jérôme Charaoui at 2023-09-03T14:35:05-04:00
New upstream version 1.13
- - - - -
b0ef41ff by Jérôme Charaoui at 2023-09-03T14:35:11-04:00
Update upstream source from tag 'upstream/1.13'
Update to upstream version '1.13'
with Debian dir c5af94ecfab58fedf72f3a0661a608533574a3ed
- - - - -
c80603f6 by Jérôme Charaoui at 2023-09-03T14:40:02-04:00
d/patches: drop javadoc-related patch
It's not needed anymore, tha javadoc package now compiles fine without
it.
- - - - -
12dc386b by Jérôme Charaoui at 2023-09-03T14:41:02-04:00
d/control: bump Standards-Version, no changes needed
- - - - -
7117a05d by Jérôme Charaoui at 2023-09-03T14:49:17-04:00
fix jquery unbundling symlinks
- - - - -
4c5f19bb by Jérôme Charaoui at 2023-09-03T14:52:29-04:00
d/control: apply Multi-Arch hints
- - - - -
051b665a by Jérôme Charaoui at 2023-09-03T14:52:48-04:00
Update changelog for 1.13-1 release
- - - - -
9 changed files:
- + .github/workflows/maven.yml
- debian/changelog
- debian/control
- debian/libinvokebinder-java-doc.links
- − debian/patches/0001-skip-java-9-compilation.patch
- − debian/patches/series
- pom.xml
- src/main/java/com/headius/invokebinder/Binder.java
- src/main/java/com/headius/invokebinder/transform/Insert.java
Changes:
=====================================
.github/workflows/maven.yml
=====================================
@@ -0,0 +1,35 @@
+# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
+# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
+
+# This workflow uses actions that are not certified by GitHub.
+# They are provided by a third-party and are governed by
+# separate terms of service, privacy policy, and support
+# documentation.
+
+name: Java CI with Maven
+
+on:
+ push:
+ branches: [ "master" ]
+ pull_request:
+ branches: [ "master" ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout at v3
+ - name: Set up JDK 11
+ uses: actions/setup-java at v3
+ with:
+ java-version: '11'
+ distribution: 'temurin'
+ cache: maven
+ - name: Build with Maven
+ run: mvn -B package --file pom.xml
+
+ # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
+ - name: Update dependency graph
+ uses: advanced-security/maven-dependency-submission-action at 571e99aab1055c2e71a1e2309b9691de18d6b7d6
=====================================
debian/changelog
=====================================
@@ -1,3 +1,14 @@
+invokebinder (1.13-1) unstable; urgency=medium
+
+ * Team upload.
+ * New upstream version 1.13
+ * d/control: apply Multi-Arch hints
+ * d/control: bump Standards-Version, no changes needed
+ * d/patches: drop javadoc-related patch
+ * fix jquery library symlinks
+
+ -- Jérôme Charaoui <jerome at riseup.net> Sun, 03 Sep 2023 14:35:56 -0400
+
invokebinder (1.12-1) unstable; urgency=medium
* Team upload.
=====================================
debian/control
=====================================
@@ -13,7 +13,7 @@ Build-Depends-Indep:
junit4,
libmaven-bundle-plugin-java,
libmaven-javadoc-plugin-java,
-Standards-Version: 4.6.1
+Standards-Version: 4.6.2
Vcs-Git: https://salsa.debian.org/java-team/invokebinder.git
Vcs-Browser: https://salsa.debian.org/java-team/invokebinder
Homepage: https://github.com/headius/invokebinder
@@ -21,6 +21,7 @@ Rules-Requires-Root: no
Package: libinvokebinder-java
Architecture: all
+Multi-Arch: foreign
Depends:
${maven:Depends},
${misc:Depends},
@@ -41,6 +42,7 @@ Description: Java DSL for binding method handles
Package: libinvokebinder-java-doc
Architecture: all
+Multi-Arch: foreign
Section: doc
Depends:
libjs-jquery,
=====================================
debian/libinvokebinder-java-doc.links
=====================================
@@ -1,4 +1,4 @@
-/usr/share/javascript/jquery-ui/jquery-ui.min.js usr/share/doc/libinvokebinder-java/api/jquery/jquery-ui.min.js
-/usr/share/javascript/jquery-ui/themes/base/jquery-ui.min.css usr/share/doc/libinvokebinder-java/api/jquery/jquery-ui.min.css
+/usr/share/javascript/jquery-ui/jquery-ui.min.js usr/share/doc/libinvokebinder-java/api/script-dir/jquery-ui.min.js
+/usr/share/javascript/jquery-ui/themes/base/jquery-ui.min.css usr/share/doc/libinvokebinder-java/api/script-dir/jquery-ui.min.css
/usr/share/javascript/jquery/jquery.js usr/share/doc/libinvokebinder-java/api/jquery/external/jquery/jquery.js
-/usr/share/javascript/jquery/jquery.min.js usr/share/doc/libinvokebinder-java/api/jquery/jquery-3.6.0.min.js
+/usr/share/javascript/jquery/jquery.min.js usr/share/doc/libinvokebinder-java/api/script-dir/jquery-3.6.1.min.js
=====================================
debian/patches/0001-skip-java-9-compilation.patch deleted
=====================================
@@ -1,46 +0,0 @@
-From: =?utf-8?b?SsOpcsO0bWUgQ2hhcmFvdWk=?= <jerome at riseup.net>
-Date: Tue, 25 Oct 2022 19:55:13 -0400
-Subject: skip java 9 compilation
-
-The javadoc task fails without these changes.
-
-Forwaded: not-needed
----
- pom.xml | 9 ---------
- src/main/java/module-info.java | 6 ------
- 2 files changed, 15 deletions(-)
- delete mode 100644 src/main/java/module-info.java
-
-diff --git a/pom.xml b/pom.xml
-index 5fe677f..ff83596 100644
---- a/pom.xml
-+++ b/pom.xml
-@@ -67,15 +67,6 @@
- <executions>
- <execution>
- <id>default-compile</id>
-- <configuration>
-- <includes>
-- <include>module-info.java</include>
-- </includes>
-- <release>9</release>
-- </configuration>
-- </execution>
-- <execution>
-- <id>base-compile</id>
- <goals>
- <goal>compile</goal>
- </goals>
-diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java
-deleted file mode 100644
-index 288bd64..0000000
---- a/src/main/java/module-info.java
-+++ /dev/null
-@@ -1,6 +0,0 @@
--module com.headius.invokebinder {
-- requires java.base;
-- requires java.logging;
--
-- exports com.headius.invokebinder;
--}
-\ No newline at end of file
=====================================
debian/patches/series deleted
=====================================
@@ -1 +0,0 @@
-0001-skip-java-9-compilation.patch
=====================================
pom.xml
=====================================
@@ -3,7 +3,7 @@
<groupId>com.headius</groupId>
<artifactId>invokebinder</artifactId>
<packaging>bundle</packaging>
- <version>1.12</version>
+ <version>1.13</version>
<name>invokebinder</name>
<url>http://maven.apache.org</url>
@@ -74,6 +74,12 @@
<release>9</release>
</configuration>
</execution>
+ <execution>
+ <id>default-testCompile</id>
+ <configuration>
+ <release>9</release>
+ </configuration>
+ </execution>
<execution>
<id>base-compile</id>
<goals>
@@ -83,13 +89,11 @@
<excludes>
<exclude>module-info.java</exclude>
</excludes>
+ <source>8</source>
+ <target>8</target>
</configuration>
</execution>
</executions>
- <configuration>
- <source>1.7</source>
- <target>1.7</target>
- </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
=====================================
src/main/java/com/headius/invokebinder/Binder.java
=====================================
@@ -68,7 +68,7 @@ import java.util.logging.Logger;
*/
public class Binder {
- private final Logger logger = Logger.getLogger("Invoke Binder");
+ private static final Logger logger = Logger.getLogger("Invoke Binder");
private final List<Transform> transforms = new LinkedList<>();
private final List<MethodType> types = new LinkedList<>();
private final MethodType start;
@@ -488,6 +488,16 @@ public class Binder {
return new Binder(this, new Insert(type().parameterCount(), value));
}
+ /**
+ * Append to the argument list the given boolean values.
+ *
+ * @param values the value to append
+ * @return a new Binder
+ */
+ public Binder appendBooleans(boolean... values) {
+ return new Binder(this, new Insert(type().parameterCount(), values));
+ }
+
/**
* Append to the argument list the given byte value.
*
@@ -498,6 +508,16 @@ public class Binder {
return new Binder(this, new Insert(type().parameterCount(), value));
}
+ /**
+ * Append to the argument list the given byte values.
+ *
+ * @param values the values to append
+ * @return a new Binder
+ */
+ public Binder appendBytes(byte... values) {
+ return new Binder(this, new Insert(type().parameterCount(), values));
+ }
+
/**
* Append to the argument list the given short value.
*
@@ -508,6 +528,16 @@ public class Binder {
return new Binder(this, new Insert(type().parameterCount(), value));
}
+ /**
+ * Append to the argument list the given short values.
+ *
+ * @param values the values to append
+ * @return a new Binder
+ */
+ public Binder appendShorts(short... values) {
+ return new Binder(this, new Insert(type().parameterCount(), values));
+ }
+
/**
* Append to the argument list the given char value.
*
@@ -518,6 +548,16 @@ public class Binder {
return new Binder(this, new Insert(type().parameterCount(), value));
}
+ /**
+ * Append to the argument list the given char values.
+ *
+ * @param values the values to append
+ * @return a new Binder
+ */
+ public Binder appendChars(char... values) {
+ return new Binder(this, new Insert(type().parameterCount(), values));
+ }
+
/**
* Append to the argument list the given int value.
*
@@ -528,6 +568,16 @@ public class Binder {
return new Binder(this, new Insert(type().parameterCount(), value));
}
+ /**
+ * Append to the argument list the given int values.
+ *
+ * @param values the values to append
+ * @return a new Binder
+ */
+ public Binder appendInts(int... values) {
+ return new Binder(this, new Insert(type().parameterCount(), values));
+ }
+
/**
* Append to the argument list the given long value.
*
@@ -538,6 +588,16 @@ public class Binder {
return new Binder(this, new Insert(type().parameterCount(), value));
}
+ /**
+ * Append to the argument list the given long values.
+ *
+ * @param values the values to append
+ * @return a new Binder
+ */
+ public Binder appendLongs(long... values) {
+ return new Binder(this, new Insert(type().parameterCount(), values));
+ }
+
/**
* Append to the argument list the given float value.
*
@@ -548,6 +608,16 @@ public class Binder {
return new Binder(this, new Insert(type().parameterCount(), value));
}
+ /**
+ * Append to the argument list the given float values.
+ *
+ * @param values the values to append
+ * @return a new Binder
+ */
+ public Binder appendFloats(float... values) {
+ return new Binder(this, new Insert(type().parameterCount(), values));
+ }
+
/**
* Append to the argument list the given double value.
*
@@ -558,6 +628,16 @@ public class Binder {
return new Binder(this, new Insert(type().parameterCount(), value));
}
+ /**
+ * Append to the argument list the given double values.
+ *
+ * @param values the values to append
+ * @return a new Binder
+ */
+ public Binder appendDoubles(double... values) {
+ return new Binder(this, new Insert(type().parameterCount(), values));
+ }
+
/**
* Append to the argument list the given argument value(s).
*
@@ -568,6 +648,25 @@ public class Binder {
return new Binder(this, new Insert(type().parameterCount(), values));
}
+ /**
+ * Append to the argument list the given argument type(s) and value(s), provided as (Class, value) pairs of
+ * arguments.
+ *
+ * @param typesAndValues the value(s) to append
+ * @return a new Binder
+ */
+ public Binder appendWithTypes(Object... typesAndValues) {
+ Class[] types = new Class[typesAndValues.length / 2];
+ Object[] values = new Object[typesAndValues.length / 2];
+
+ for (int i = 0; i < typesAndValues.length; i++) {
+ if (i % 2 == 0) types[i / 2] = (Class) typesAndValues[i];
+ if (i % 2 == 1) values[i / 2] = typesAndValues[i];
+ }
+
+ return append(types, values);
+ }
+
/**
* Prepend to the argument list the given boolean value.
*
@@ -578,6 +677,16 @@ public class Binder {
return new Binder(this, new Insert(0, value));
}
+ /**
+ * Prepend to the argument list the given boolean values.
+ *
+ * @param values the values to prepend
+ * @return a new Binder
+ */
+ public Binder prependBooleans(boolean... values) {
+ return new Binder(this, new Insert(0, values));
+ }
+
/**
* Prepend to the argument list the given byte value.
*
@@ -588,6 +697,16 @@ public class Binder {
return new Binder(this, new Insert(0, value));
}
+ /**
+ * Prepend to the argument list the given byte values.
+ *
+ * @param values the values to prepend
+ * @return a new Binder
+ */
+ public Binder prependBytes(byte... values) {
+ return new Binder(this, new Insert(0, values));
+ }
+
/**
* Prepend to the argument list the given short value.
*
@@ -598,6 +717,16 @@ public class Binder {
return new Binder(this, new Insert(0, value));
}
+ /**
+ * Prepend to the argument list the given short values.
+ *
+ * @param values the values to prepend
+ * @return a new Binder
+ */
+ public Binder prependShorts(short... values) {
+ return new Binder(this, new Insert(0, values));
+ }
+
/**
* Prepend to the argument list the given char value.
*
@@ -608,6 +737,16 @@ public class Binder {
return new Binder(this, new Insert(0, value));
}
+ /**
+ * Prepend to the argument list the given char values.
+ *
+ * @param values the values to prepend
+ * @return a new Binder
+ */
+ public Binder prependChars(char... values) {
+ return new Binder(this, new Insert(0, values));
+ }
+
/**
* Prepend to the argument list the given int value.
*
@@ -618,6 +757,16 @@ public class Binder {
return new Binder(this, new Insert(0, value));
}
+ /**
+ * Prepend to the argument list the given int values.
+ *
+ * @param values the values to prepend
+ * @return a new Binder
+ */
+ public Binder prependInts(int... values) {
+ return new Binder(this, new Insert(0, values));
+ }
+
/**
* Prepend to the argument list the given long value.
*
@@ -628,6 +777,16 @@ public class Binder {
return new Binder(this, new Insert(0, value));
}
+ /**
+ * Prepend to the argument list the given long values.
+ *
+ * @param values the values to prepend
+ * @return a new Binder
+ */
+ public Binder prependLongs(long... values) {
+ return new Binder(this, new Insert(0, values));
+ }
+
/**
* Prepend to the argument list the given float value.
*
@@ -638,6 +797,16 @@ public class Binder {
return new Binder(this, new Insert(0, value));
}
+ /**
+ * Prepend to the argument list the given float values.
+ *
+ * @param values the values to prepend
+ * @return a new Binder
+ */
+ public Binder prependFloats(float... values) {
+ return new Binder(this, new Insert(0, values));
+ }
+
/**
* Prepend to the argument list the given double value.
*
@@ -648,6 +817,16 @@ public class Binder {
return new Binder(this, new Insert(0, value));
}
+ /**
+ * Prepend to the argument list the given double values.
+ *
+ * @param values the values to prepend
+ * @return a new Binder
+ */
+ public Binder prependDoubles(double... values) {
+ return new Binder(this, new Insert(0, values));
+ }
+
/**
* Prepend to the argument list the given argument value(s).
*
@@ -658,6 +837,25 @@ public class Binder {
return new Binder(this, new Insert(0, values));
}
+ /**
+ * Prepend to the argument list the given argument type(s) and value(s), provided as (Class, value) pairs of
+ * arguments.
+ *
+ * @param typesAndValues the value(s) to append
+ * @return a new Binder
+ */
+ public Binder prependWithTypes(Object... typesAndValues) {
+ Class[] types = new Class[typesAndValues.length / 2];
+ Object[] values = new Object[typesAndValues.length / 2];
+
+ for (int i = 0; i < typesAndValues.length; i++) {
+ if (i % 2 == 0) types[i / 2] = (Class) typesAndValues[i];
+ if (i % 2 == 1) values[i / 2] = typesAndValues[i];
+ }
+
+ return prepend(types, values);
+ }
+
/**
* Append to the argument list the given argument value with the specified type.
*
@@ -1195,6 +1393,14 @@ public class Binder {
return invoke(lookup.unreflect(method));
}
+ /**
+ * Same as {@link #invoke(MethodHandles.Lookup, Method method)} but using the default lookup for this
+ * binder.
+ */
+ public MethodHandle invoke(Method method) throws IllegalAccessException {
+ return invoke(lookup.unreflect(method));
+ }
+
/**
* Apply the chain of transforms and bind them to a static method specified
* using the end signature plus the given class and method. The method will
@@ -1219,6 +1425,18 @@ public class Binder {
}
}
+ /**
+ * Same as {@link #invokeQuiet(MethodHandles.Lookup, Method method)} but using the default lookup for this
+ * binder.
+ */
+ public MethodHandle invokeQuiet(Method method) {
+ try {
+ return invoke(lookup, method);
+ } catch (IllegalAccessException iae) {
+ throw new InvalidTransformException(iae);
+ }
+ }
+
/**
* Apply the chain of transforms and bind them to a static method specified
* using the end signature plus the given class and name. The method will
@@ -1239,6 +1457,14 @@ public class Binder {
return invoke(lookup.findStatic(target, name, type()));
}
+ /**
+ * Same as {@link #invokeStaticQuiet(MethodHandles.Lookup, Class, String)} but using the default lookup for this
+ * binder.
+ */
+ public MethodHandle invokeStatic(Class<?> target, String name) throws NoSuchMethodException, IllegalAccessException {
+ return invoke(lookup.findStatic(target, name, type()));
+ }
+
/**
* Apply the chain of transforms and bind them to a static method specified
* using the end signature plus the given class and name. The method will
@@ -1264,6 +1490,18 @@ public class Binder {
}
}
+ /**
+ * Same as {@link #invokeStaticQuiet(MethodHandles.Lookup, Class, String)} but using the default lookup for this
+ * binder.
+ */
+ public MethodHandle invokeStaticQuiet(Class<?> target, String name) {
+ try {
+ return invokeStatic(lookup, target, name);
+ } catch (IllegalAccessException | NoSuchMethodException e) {
+ throw new InvalidTransformException(e);
+ }
+ }
+
/**
* Apply the chain of transforms and bind them to a virtual method specified
* using the end signature plus the given class and name. The method will
@@ -1283,6 +1521,14 @@ public class Binder {
return invoke(lookup.findVirtual(type().parameterType(0), name, type().dropParameterTypes(0, 1)));
}
+ /**
+ * Same as {@link #invokeVirtual(MethodHandles.Lookup, String)} but using the default lookup for this
+ * binder.
+ */
+ public MethodHandle invokeVirtual(String name) throws NoSuchMethodException, IllegalAccessException {
+ return invoke(lookup.findVirtual(type().parameterType(0), name, type().dropParameterTypes(0, 1)));
+ }
+
/**
* Apply the chain of transforms and bind them to a virtual method specified
* using the end signature plus the given class and name. The method will
@@ -1307,6 +1553,18 @@ public class Binder {
}
}
+ /**
+ * Same as {@link #invokeVirtualQuiet(MethodHandles.Lookup, String)} but using the default lookup for this
+ * binder.
+ */
+ public MethodHandle invokeVirtualQuiet(String name) {
+ try {
+ return invokeVirtual(lookup, name);
+ } catch (IllegalAccessException | NoSuchMethodException e) {
+ throw new InvalidTransformException(e);
+ }
+ }
+
/**
* Apply the chain of transforms and bind them to a special method specified
* using the end signature plus the given class and name. The method will
@@ -1327,6 +1585,14 @@ public class Binder {
return invoke(lookup.findSpecial(type().parameterType(0), name, type().dropParameterTypes(0, 1), caller));
}
+ /**
+ * Same as {@link #invokeSpecial(MethodHandles.Lookup, String, Class<?>)} but using the default lookup for this
+ * binder.
+ */
+ public MethodHandle invokeSpecial(String name, Class<?> caller) throws NoSuchMethodException, IllegalAccessException {
+ return invoke(lookup.findSpecial(type().parameterType(0), name, type().dropParameterTypes(0, 1), caller));
+ }
+
/**
* Apply the chain of transforms and bind them to a special method specified
* using the end signature plus the given class and name. The method will
@@ -1352,6 +1618,18 @@ public class Binder {
}
}
+ /**
+ * Same as {@link #invokeSpecialQuiet(MethodHandles.Lookup, String, Class)} but using the default lookup for this
+ * binder.
+ */
+ public MethodHandle invokeSpecialQuiet(String name, Class<?> caller) {
+ try {
+ return invokeSpecial(lookup, name, caller);
+ } catch (IllegalAccessException | NoSuchMethodException e) {
+ throw new InvalidTransformException(e);
+ }
+ }
+
/**
* Apply the chain of transforms and bind them to a constructor specified
* using the end signature plus the given class. The constructor will
@@ -1371,6 +1649,14 @@ public class Binder {
return invoke(lookup.findConstructor(target, type().changeReturnType(void.class)));
}
+ /**
+ * Same as {@link #invokeConstructor(MethodHandles.Lookup, Class)} but using the default lookup for this
+ * binder.
+ */
+ public MethodHandle invokeConstructor(Class<?> target) throws NoSuchMethodException, IllegalAccessException {
+ return invoke(lookup.findConstructor(target, type().changeReturnType(void.class)));
+ }
+
/**
* Apply the chain of transforms and bind them to a constructor specified
* using the end signature plus the given class. The constructor will
@@ -1395,6 +1681,18 @@ public class Binder {
}
}
+ /**
+ * Same as {@link #invokeConstructorQuiet(MethodHandles.Lookup, Class)} but using the default lookup for this
+ * binder.
+ */
+ public MethodHandle invokeConstructorQuiet(Class<?> target) {
+ try {
+ return invokeConstructor(lookup, target);
+ } catch (IllegalAccessException | NoSuchMethodException e) {
+ throw new InvalidTransformException(e);
+ }
+ }
+
/**
* Apply the chain of transforms and bind them to an object field retrieval specified
* using the end signature plus the given class and name. The field must
@@ -1416,6 +1714,14 @@ public class Binder {
return invoke(lookup.findGetter(type().parameterType(0), name, type().returnType()));
}
+ /**
+ * Same as {@link #getField(MethodHandles.Lookup, String)} but using the default lookup for this
+ * binder.
+ */
+ public MethodHandle getField(String name) throws NoSuchFieldException, IllegalAccessException {
+ return invoke(lookup.findGetter(type().parameterType(0), name, type().returnType()));
+ }
+
/**
* Apply the chain of transforms and bind them to an object field retrieval specified
* using the end signature plus the given class and name. The field must
@@ -1440,6 +1746,18 @@ public class Binder {
}
}
+ /**
+ * Same as {@link #getFieldQuiet(MethodHandles.Lookup, String)} but using the default lookup for this
+ * binder.
+ */
+ public MethodHandle getFieldQuiet(String name) {
+ try {
+ return getField(lookup, name);
+ } catch (IllegalAccessException | NoSuchFieldException e) {
+ throw new InvalidTransformException(e);
+ }
+ }
+
/**
* Apply the chain of transforms and bind them to a static field retrieval specified
* using the end signature plus the given class and name. The field must
@@ -1460,6 +1778,14 @@ public class Binder {
return invoke(lookup.findStaticGetter(target, name, type().returnType()));
}
+ /**
+ * Same as {@link #getStatic(MethodHandles.Lookup, Class, String)} but using the default lookup for this
+ * binder.
+ */
+ public MethodHandle getStatic(Class<?> target, String name) throws NoSuchFieldException, IllegalAccessException {
+ return invoke(lookup.findStaticGetter(target, name, type().returnType()));
+ }
+
/**
* Apply the chain of transforms and bind them to a static field retrieval specified
* using the end signature plus the given class and name. The field must
@@ -1485,6 +1811,18 @@ public class Binder {
}
}
+ /**
+ * Same as {@link #getStaticQuiet(MethodHandles.Lookup, Class, String)} but using the default lookup for this
+ * binder.
+ */
+ public MethodHandle getStaticQuiet(Class<?> target, String name) {
+ try {
+ return getStatic(lookup, target, name);
+ } catch (IllegalAccessException | NoSuchFieldException e) {
+ throw new InvalidTransformException(e);
+ }
+ }
+
/**
* Apply the chain of transforms and bind them to an object field assignment specified
* using the end signature plus the given class and name. The end signature must take
@@ -1504,6 +1842,14 @@ public class Binder {
return invoke(lookup.findSetter(type().parameterType(0), name, type().parameterType(1)));
}
+ /**
+ * Same as {@link #setField(MethodHandles.Lookup, String)} but using the default lookup for this
+ * binder.
+ */
+ public MethodHandle setField(String name) throws NoSuchFieldException, IllegalAccessException {
+ return invoke(lookup.findSetter(type().parameterType(0), name, type().parameterType(1)));
+ }
+
/**
* Apply the chain of transforms and bind them to an object field assignment specified
* using the end signature plus the given class and name. The end signature must take
@@ -1528,6 +1874,18 @@ public class Binder {
}
}
+ /**
+ * Same as {@link #setFieldQuiet(MethodHandles.Lookup, String)} but using the default lookup for this
+ * binder.
+ */
+ public MethodHandle setFieldQuiet(String name) {
+ try {
+ return setField(lookup, name);
+ } catch (IllegalAccessException | NoSuchFieldException e) {
+ throw new InvalidTransformException(e);
+ }
+ }
+
/**
* Apply the chain of transforms and bind them to an object field assignment specified
* using the end signature plus the given class and name. The end signature must take
@@ -1548,6 +1906,14 @@ public class Binder {
return invoke(lookup.findStaticSetter(target, name, type().parameterType(0)));
}
+ /**
+ * Same as {@link #setStatic(MethodHandles.Lookup, Class, String)} but using the default lookup for this
+ * binder.
+ */
+ public MethodHandle setStatic(Class<?> target, String name) throws NoSuchFieldException, IllegalAccessException {
+ return invoke(lookup.findStaticSetter(target, name, type().parameterType(0)));
+ }
+
/**
* Apply the chain of transforms and bind them to an object field assignment specified
* using the end signature plus the given class and name. The end signature must take
@@ -1573,6 +1939,36 @@ public class Binder {
}
}
+ /**
+ * Same as {@link #setStaticQuiet(MethodHandles.Lookup, Class, String)} but using the default lookup for this
+ * binder.
+ */
+ public MethodHandle setStaticQuiet(Class<?> target, String name) {
+ try {
+ return setStatic(lookup, target, name);
+ } catch (IllegalAccessException | NoSuchFieldException e) {
+ throw new InvalidTransformException(e);
+ }
+ }
+
+
+ /**
+ * Construct a new array. The signature at the endpoint must return the array type and accept an integer length.
+ *
+ * @return a handle that constructs an array
+ */
+ public MethodHandle newArray() {
+ return invoke(MethodHandles.arrayConstructor(type().returnType()));
+ }
+
+ /**
+ * Get the length of an array. The signature must accept an array and return an integer length.
+ *
+ * @return a handle that gets the size of an array
+ */
+ public MethodHandle arrayLength() {
+ return invoke(MethodHandles.arrayLength(type().parameterType(0)));
+ }
/**
* Apply the chain of transforms and bind them to an array element set. The signature
=====================================
src/main/java/com/headius/invokebinder/transform/Insert.java
=====================================
@@ -19,6 +19,7 @@ import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.util.Arrays;
+import java.util.Collections;
/**
* An argument insertion transform.
@@ -47,48 +48,104 @@ public class Insert extends Transform {
this.types = new Class[]{boolean.class};
}
+ public Insert(int position, boolean... values) {
+ this.position = position;
+ this.values = new Object[values.length];
+ for (int i = 0; i < values.length; i++) this.values[i] = values[i];
+ this.types = Collections.nCopies(values.length, boolean.class).stream().toArray(Class[]::new);
+ }
+
public Insert(int position, byte value) {
this.position = position;
this.values = new Object[]{value};
this.types = new Class[]{byte.class};
}
+ public Insert(int position, byte... values) {
+ this.position = position;
+ this.values = new Object[values.length];
+ for (int i = 0; i < values.length; i++) this.values[i] = values[i];
+ this.types = Collections.nCopies(values.length, byte.class).stream().toArray(Class[]::new);
+ }
+
public Insert(int position, short value) {
this.position = position;
this.values = new Object[]{value};
this.types = new Class[]{short.class};
}
+ public Insert(int position, short... values) {
+ this.position = position;
+ this.values = new Object[values.length];
+ for (int i = 0; i < values.length; i++) this.values[i] = values[i];
+ this.types = Collections.nCopies(values.length, short.class).stream().toArray(Class[]::new);
+ }
+
public Insert(int position, char value) {
this.position = position;
this.values = new Object[]{value};
this.types = new Class[]{char.class};
}
+ public Insert(int position, char... values) {
+ this.position = position;
+ this.values = new Object[values.length];
+ for (int i = 0; i < values.length; i++) this.values[i] = values[i];
+ this.types = Collections.nCopies(values.length, char.class).stream().toArray(Class[]::new);
+ }
+
public Insert(int position, int value) {
this.position = position;
this.values = new Object[]{value};
this.types = new Class[]{int.class};
}
+ public Insert(int position, int... values) {
+ this.position = position;
+ this.values = new Object[values.length];
+ for (int i = 0; i < values.length; i++) this.values[i] = values[i];
+ this.types = Collections.nCopies(values.length, int.class).stream().toArray(Class[]::new);
+ }
+
public Insert(int position, long value) {
this.position = position;
this.values = new Object[]{value};
this.types = new Class[]{long.class};
}
+ public Insert(int position, long... values) {
+ this.position = position;
+ this.values = new Object[values.length];
+ for (int i = 0; i < values.length; i++) this.values[i] = values[i];
+ this.types = Collections.nCopies(values.length, long.class).stream().toArray(Class[]::new);
+ }
+
public Insert(int position, float value) {
this.position = position;
this.values = new Object[]{value};
this.types = new Class[]{float.class};
}
+ public Insert(int position, float... values) {
+ this.position = position;
+ this.values = new Object[values.length];
+ for (int i = 0; i < values.length; i++) this.values[i] = values[i];
+ this.types = Collections.nCopies(values.length, float.class).stream().toArray(Class[]::new);
+ }
+
public Insert(int position, double value) {
this.position = position;
this.values = new Object[]{value};
this.types = new Class[]{double.class};
}
+ public Insert(int position, double... values) {
+ this.position = position;
+ this.values = new Object[values.length];
+ for (int i = 0; i < values.length; i++) this.values[i] = values[i];
+ this.types = Collections.nCopies(values.length, double.class).stream().toArray(Class[]::new);
+ }
+
public Insert(int position, Class<?>[] types, Object... values) {
this.position = position;
this.values = values;
@@ -104,7 +161,7 @@ public class Insert extends Transform {
}
public String toString() {
- return "insert " + Arrays.toString(types()) + " at " + position;
+ return "insert " + Arrays.toString(types) + " at " + position;
}
public String toJava(MethodType incoming) {
@@ -130,12 +187,4 @@ public class Insert extends Transform {
return builder.toString();
}
-
- private Class<?>[] types() {
- Class<?>[] types = new Class<?>[values.length];
- for (int i = 0; i < types.length; i++) {
- types[i] = values[i].getClass();
- }
- return types;
- }
}
View it on GitLab: https://salsa.debian.org/java-team/invokebinder/-/compare/cdd4ccdee171fb86e15cf3b974459b0d38c30573...051b665a5edb3bd205afdaa52a9ddc6fac9a8212
--
View it on GitLab: https://salsa.debian.org/java-team/invokebinder/-/compare/cdd4ccdee171fb86e15cf3b974459b0d38c30573...051b665a5edb3bd205afdaa52a9ddc6fac9a8212
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20230903/634684c9/attachment.htm>
More information about the pkg-java-commits
mailing list