Giter Club home page Giter Club logo

invokebinder's Introduction

Introduction

This 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.

Examples

Transformation calls can be chained. They are not applied until an eventual "invoke" is called with the target endpoint MethodHandle.

MethodHandle mh = Binder
   .from(String.class, String.class, String.class) // String w(String, String)
   .drop(1, String.class) // String x(String)
   .insert(0, 'hello') // String y(String, String)
   .cast(String.class, CharSequence.class, Object.class) // String z(CharSequence, Object)
   .invoke(someTargetHandle);

Status

This is currently under development. Not all transformations from the MethodHandle API are yet supported.

Contributors are welcome :)

invokebinder's People

Contributors

akbertram avatar dependabot[bot] avatar forax avatar headius avatar qmx avatar sakno avatar sanjaymsh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

invokebinder's Issues

Asertion in Varargs.assertTypesAreCompatible() is backwards

I believe the assertion in Varargs.assertTypesAreCompatible() should be:

assert componentType.isAssignableFrom(in)

Instead of:

assert in.isAssignableFrom(componentType)

Here is a test that shows the issue:

@Test
public void testVarargs()
        throws Throwable
{
    MethodHandle foo = Binder.from(MethodType.methodType(String.class, String.class))
            .varargs(0, Object[].class)
            .invokeStatic(lookup(), getClass(), "foo");
    Assert.assertEquals(foo.invokeWithArguments("value"), "value");
}

public static String foo(Object... args)
{
    return (String) args[0];
}

maven-javadoc-plugin should use Java 9

module-info.java requires Java 9 so the source should be specified as 9.

Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.1:jar (default-cli) on project invokebinder: MavenReportException: Error while generating Javadoc:
Exit code: 1 - /root/deb/invokebinder/src/main/java/module-info.java:1: error: modules are not supported in -source 8
module com.headius.invokebinder {
^
  (use -source 9 or higher to enable modules)

Command line was: /usr/lib/jvm/java-11-openjdk-amd64/bin/javadoc @options @packages @argfile

Travis-ci: build is failing on AMD64.

Hi,

I was just testing the build on travis-ci. But its failing with below error:
"
Worker information
0.16s0.01s0.00s0.01s
system_info
Build system information
0.02s0.01s0.64s0.23s0.05s0.00s0.04s0.00s0.01s0.01s0.01s0.01s0.01s0.00s0.00s0.02s0.00s0.01s0.36s0.00s0.00s0.00s0.01s0.00s0.10s0.01s0.85s0.00s0.00s6.03s0.00s2.93s0.00s2.56s
docker_mtu
resolvconf
install_jdk
Installing oraclejdk9
11.98s$ travis_apt_get_update
Installing APT Packages
0.42s$ sudo -E apt-get -yq --no-install-suggests --no-install-recommends $(travis_apt_get_options) install oracle-java9-installer
Reading package lists...
Building dependency tree...
Reading state information...
Package oracle-java9-installer is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'oracle-java9-installer' has no installation candidate
apt-get.diagnostics
apt-get install failed
The command "sudo -E apt-get -yq --no-install-suggests --no-install-recommends $(travis_apt_get_options) install oracle-java9-installer" failed and exited with 100 during .
Your build has been stopped.
"

Please have a look on this.

Thanks !!

OSGify invokebinder

Add maven-bundle-plugin to POM and allow to install and use invokebinder in OSGi environment

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.