New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Java 8 lambdas #193

Merged
merged 13 commits into from Mar 23, 2015

Conversation

Projects
None yet
1 participant
@jponge
Member

jponge commented Oct 21, 2014

Implementation for #101

Function reference to FunctionalInterface
This supports the conversion of function references to Java 8 lambda materialized by functional
interfaces. This supports the following test case:

  # Gives 150
  list[1, 2, 3, 4, 5]:
    stream():
    map(|n| -> n * 10):
    reduce(0, |acc, next| -> acc + next)

@jponge jponge added this to the 2.0.0 milestone Oct 21, 2014

@jponge jponge added the feature label Oct 21, 2014

@jponge

This comment has been minimized.

Member

jponge commented Oct 21, 2014

Opening a pull-request for iterative community feedback.

The current implementation converts function references to functional interfaces instances. It remains vastly imperfect at the moment.

It is also possible that full Java 8 streams API compatibility won't be easily achieved.

@jponge jponge self-assigned this Oct 27, 2014

jponge added some commits Oct 27, 2014

asFunctionalInterface function sketch
We are reaching the limits of LambdaMetaFactory, it does too many checks on MethodHandles. It checks
that method handles are direct (no constant, gwt, etc) and public, which is quite annoying.
AdapterFabric-based asFunctionalInterface
This defeats the limitations of LambdaMetaFactory which is caller-sensitive. I also tried
sun.reflect.Reflection.getCallerClass() to hook the LambdaMetaFactory lookup into the caller class,
but I encountered errors.

I also tried to generalize to an all AdapterFabric-based implementation, but it would get
ClassNotFoundException when doing adaptation on parameters.

This implementation is a compromise:

- LambdaMetaFactory get the nod for argument adaptation, and
- AdapterFabric powers asFunctionalInterface to bypass caller-sensitive checks.
Merge branch 'master' into feature/java8-lambda
Conflicts:
	src/main/java/fr/insalyon/citi/golo/runtime/FunctionCallSupport.java
	src/main/java/fr/insalyon/citi/golo/runtime/MethodInvocationSupport.java
	src/main/java/gololang/Predefined.java
	src/test/java/fr/insalyon/citi/golo/compiler/CompileAndRunTest.java
	src/test/java/fr/insalyon/citi/golo/runtime/FunctionCallSupportTest.java
Merge branch 'master' into feature/java8-lambda
Conflicts:
	src/main/java/gololang/Predefined.java
Upgrading to ASM 5 / Java 8 bytecode
Fixing a few deprecations / warnings along the way.

jponge added a commit that referenced this pull request Mar 23, 2015

Merge pull request #193 from jponge/feature/java8-lambda
Support for Java 8 lambdas / functional interfaces

@jponge jponge merged commit df94acb into eclipse:master Mar 23, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jponge jponge deleted the jponge:feature/java8-lambda branch Mar 23, 2015

@jponge jponge removed their assignment Jun 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment