[Git][java-team/invokebinder][master] 5 commits: Removed the -java-doc package
Emmanuel Bourg (@ebourg)
gitlab at salsa.debian.org
Mon Oct 28 09:49:51 GMT 2024
Emmanuel Bourg pushed to branch master at Debian Java Maintainers / invokebinder
Commits:
7cd4758d by Emmanuel Bourg at 2024-10-28T10:45:27+01:00
Removed the -java-doc package
- - - - -
c9f708e5 by Emmanuel Bourg at 2024-10-28T10:45:32+01:00
Standards-Version updated to 4.7.0
- - - - -
aa99df19 by Emmanuel Bourg at 2024-10-28T10:46:35+01:00
New upstream version 1.14
- - - - -
51b044b2 by Emmanuel Bourg at 2024-10-28T10:46:35+01:00
Update upstream source from tag 'upstream/1.14'
Update to upstream version '1.14'
with Debian dir 5dc682a657bfa610b8ab47204127f7208edb6c39
- - - - -
9bb2fa7c by Emmanuel Bourg at 2024-10-28T10:49:22+01:00
New upstream release (1.14)
- - - - -
9 changed files:
- debian/changelog
- debian/control
- − debian/libinvokebinder-java-doc.doc-base.api
- − debian/libinvokebinder-java-doc.install
- − debian/libinvokebinder-java-doc.links
- pom.xml
- src/main/java/com/headius/invokebinder/Binder.java
- src/main/java/com/headius/invokebinder/transform/Collect.java
- src/test/java/com/headius/invokebinder/BinderTest.java
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,12 @@
+invokebinder (1.14-1) unstable; urgency=medium
+
+ * Team upload.
+ * New upstream release
+ * Removed the -java-doc package
+ * Standards-Version updated to 4.7.0
+
+ -- Emmanuel Bourg <ebourg at apache.org> Mon, 28 Oct 2024 10:47:04 +0100
+
invokebinder (1.13-2) UNRELEASED; urgency=medium
* Use https URL in copyright file and update dates.
=====================================
debian/control
=====================================
@@ -9,11 +9,9 @@ Build-Depends:
default-jdk,
maven-debian-helper,
Build-Depends-Indep:
- default-jdk-doc,
junit4,
libmaven-bundle-plugin-java,
- libmaven-javadoc-plugin-java,
-Standards-Version: 4.6.2
+Standards-Version: 4.7.0
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
@@ -26,7 +24,6 @@ Depends:
${maven:Depends},
${misc:Depends},
Suggests:
- libinvokebinder-java-doc,
${maven:OptionalDepends},
Description: Java DSL for binding method handles
This Java library hopes to provide a more friendly DSL for binding
@@ -39,30 +36,3 @@ Description: Java DSL for binding method handles
Along the way the transformations are pushed onto a
stack and eventually applied in reverse order, as the standard API
demands.
-
-Package: libinvokebinder-java-doc
-Architecture: all
-Multi-Arch: foreign
-Section: doc
-Depends:
- libjs-jquery,
- libjs-jquery-ui,
- ${misc:Depends},
-Recommends:
- ${maven:DocDepends},
- ${maven:DocOptionalDepends},
-Suggests:
- libinvokebinder-java,
-Description: Documentation for invokebinder
- This Java library hopes to provide a more friendly DSL for binding
- method handles.
- .
- Unlike the normal MethodHandle API, handles are bound forward
- from a source MethodType and eventually adapted to a final target
- MethodHandle.
- .
- Along the way the transformations are pushed onto a
- stack and eventually applied in reverse order, as the standard API
- demands.
- .
- This package contains the API documentation of libinvokebinder-java.
=====================================
debian/libinvokebinder-java-doc.doc-base.api deleted
=====================================
@@ -1,10 +0,0 @@
-Document: libinvokebinder-java
-Title: API Javadoc for invokebinder
-Author: invokebinder developers
-Abstract: This is the API Javadoc provided for the
- libinvokebinder-java library.
-Section: Programming
-
-Format: HTML
-Index: /usr/share/doc/libinvokebinder-java/api/index.html
-Files: /usr/share/doc/libinvokebinder-java/api/*
=====================================
debian/libinvokebinder-java-doc.install deleted
=====================================
@@ -1 +0,0 @@
-target/apidocs/* usr/share/doc/libinvokebinder-java/api
=====================================
debian/libinvokebinder-java-doc.links deleted
=====================================
@@ -1,4 +0,0 @@
-/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/script-dir/jquery-3.6.1.min.js
=====================================
pom.xml
=====================================
@@ -3,7 +3,7 @@
<groupId>com.headius</groupId>
<artifactId>invokebinder</artifactId>
<packaging>bundle</packaging>
- <version>1.13</version>
+ <version>1.14</version>
<name>invokebinder</name>
<url>http://maven.apache.org</url>
=====================================
src/main/java/com/headius/invokebinder/Binder.java
=====================================
@@ -1586,7 +1586,7 @@ public class Binder {
}
/**
- * Same as {@link #invokeSpecial(MethodHandles.Lookup, String, Class<?>)} but using the default lookup for this
+ * 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 {
=====================================
src/main/java/com/headius/invokebinder/transform/Collect.java
=====================================
@@ -16,13 +16,14 @@
package com.headius.invokebinder.transform;
import com.headius.invokebinder.Binder;
+import com.headius.invokebinder.Util;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
/**
- * An argument-boxing transform with a fixed incoming size.
+ * A filter that takes multiple arguments and replaces them with zero or one argument of a new type.
*
* Equivalent call: MethodHandle.asCollector(Class, int) or MethodHandles.collectArguments
*/
@@ -31,61 +32,68 @@ public class Collect extends Transform {
private final MethodType source;
private final int index;
private final int count;
- private final Class<?> arrayType;
+ private final Class<?> resultType;
private final MethodHandle collector;
- public Collect(MethodType source, int index, Class<?> arrayType) {
+ public Collect(MethodType source, int index, Class<?> resultType) {
this.source = source;
this.index = index;
this.count = source.parameterCount() - index;
- this.arrayType = arrayType;
+ this.resultType = resultType;
this.collector = null;
}
- public Collect(MethodType source, int index, Class<?> arrayType, MethodHandle collector) {
+ public Collect(MethodType source, int index, Class<?> resultType, MethodHandle collector) {
this.source = source;
this.index = index;
this.count = source.parameterCount() - index;
- this.arrayType = arrayType;
+ this.resultType = resultType;
this.collector = collector;
}
- public Collect(MethodType source, int index, int count, Class<?> arrayType) {
+ public Collect(MethodType source, int index, int count, Class<?> resultType) {
this.source = source;
this.index = index;
this.count = count;
- this.arrayType = arrayType;
+ this.resultType = resultType;
this.collector = null;
}
- public Collect(MethodType source, int index, int count, Class<?> arrayType, MethodHandle collector) {
+ public Collect(MethodType source, int index, int count, Class<?> resultType, MethodHandle collector) {
this.source = source;
this.index = index;
this.count = count;
- this.arrayType = arrayType;
+ this.resultType = resultType;
this.collector = collector;
}
public MethodHandle up(MethodHandle target) {
- if (onlyTail()) {
- // fast path for tail args
- if (collector == null) {
- return target.asCollector(arrayType, count);
+ if (collector == null) {
+ if (Util.isJava9()) {
+ // Java 9 can collect a subset of non-tail arguments
+ return target.asCollector(index, resultType, count);
+ } else {
+ if (onlyTail()) {
+ // tail arguments can be array-collected on all Java versions
+ return target.asCollector(resultType, count);
+ } else {
+ // non-tail arguments must be permuted prior to Java 9
+ Permutes permutes = buildPermutes(source, target.type());
+
+ Binder binder = preparePermuteBinder(permutes);
+ return binder.invoke(target);
+ }
}
-
- return MethodHandles.collectArguments(target, index, collector);
} else {
- Permutes permutes = buildPermutes(source, target.type());
-
- Binder binder = preparePermuteBinder(permutes);
- return binder.invoke(target);
+ // custom collector always collects only as many args as it accepts
+ return MethodHandles.collectArguments(target, index, collector);
}
}
private Binder preparePermuteBinder(Permutes permutes) {
return Binder.from(source)
.permute(permutes.movePermute)
- .collect(source.parameterCount() - count, arrayType, collector)
+ .collect(source.parameterCount() - count, resultType)
.permute(permutes.moveBackPermute);
}
@@ -94,20 +102,31 @@ public class Collect extends Transform {
return type
.dropParameterTypes(index, index + count)
- .insertParameterTypes(index, arrayType);
+ .insertParameterTypes(index, resultType);
}
private void assertTypesAreCompatible() {
- Class<?> componentType = arrayType.getComponentType();
- for (int i = index; i < index + count; i++) {
- Class<?> in = source.parameterType(i);
- assert in.isAssignableFrom(componentType)
- : "incoming type " + in.getName() + " not compatible with " + componentType.getName() + "[]";
+ if (collector == null) {
+ // default array collector
+ assert resultType.isArray() : "no collector provided but target type is not array";
+ Class<?> componentType = resultType.getComponentType();
+ for (int i = index; i < index + count; i++) {
+ Class<?> in = source.parameterType(i);
+ assert in.isAssignableFrom(componentType)
+ : "incoming type " + in.getName() + " not compatible with " + componentType.getName() + "[]";
+ }
+ } else {
+ for (int i = 0; i < count; i++) {
+ Class<?> in = source.parameterType(index + i);
+ Class<?> out = collector.type().parameterType(i);
+ assert in.isAssignableFrom(out) : "incoming type " + in.getName() + " not compatible with " + out;
+ }
+ assert collector.type().returnType().isAssignableFrom(resultType);
}
}
public String toString() {
- return "collect at " + index + " into " + arrayType.getName();
+ return "collect at " + index + " into " + resultType.getName();
}
public String toJava(MethodType incoming) {
@@ -115,7 +134,7 @@ public class Collect extends Transform {
if (onlyTail()) {
if (collector == null) {
builder.append("handle = handle.asCollector(");
- buildClassArgument(builder, arrayType);
+ buildClassArgument(builder, resultType);
builder
.append(", ")
.append(count)
@@ -128,7 +147,7 @@ public class Collect extends Transform {
.append(count)
.append(", ");
- buildClassArgument(builder, arrayType);
+ buildClassArgument(builder, resultType);
builder.append(");");
}
=====================================
src/test/java/com/headius/invokebinder/BinderTest.java
=====================================
@@ -378,7 +378,7 @@ public class BinderTest {
.invoke(Subjects.StringIntegersStringHandle);
assertEquals(methodType(String.class, String.class, Integer.class, Integer.class, Integer.class, String.class), handle2.type());
- assertEquals("[foo, [1, 2, 3], bar]", (String)handle2.invokeExact("foo", new Integer(1), new Integer(2), new Integer(3), "bar"));
+ assertEquals("[foo, [1, 2, 3], bar]", (String)handle2.invokeExact("foo", Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3), "bar"));
}
public static String[] newStringArray(String s1, String s2) {
View it on GitLab: https://salsa.debian.org/java-team/invokebinder/-/compare/da93a35982b9ab5c4fcbf40f1418ddddf534bd10...9bb2fa7cbcad7b345d496dfcde6709358dc10105
--
View it on GitLab: https://salsa.debian.org/java-team/invokebinder/-/compare/da93a35982b9ab5c4fcbf40f1418ddddf534bd10...9bb2fa7cbcad7b345d496dfcde6709358dc10105
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/20241028/64d3e147/attachment.htm>
More information about the pkg-java-commits
mailing list