Skip to content
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 Java8 parameters #1084

Closed
wants to merge 10 commits into from

Conversation

cbxp
Copy link
Contributor

@cbxp cbxp commented Jan 9, 2017

Instead of slow additional enhancement in LocalvariablesNamesEnhancer.

Java 7 is still supported, but when running on Java 8, there will be less enhancement because Java 8 standard Method.getParameters() will be used to get parameter names.

Later, if we drop support for Java 7 in some next release, we can just delete LocalvariablesNamesEnhancerJava7 class.

LocalvariablesNamesEnhancerJava7 is just a copy of old LocalvariablesNamesEnhancer. Plain LocalvariablesNamesEnhancer now has the signature enhancement code removed.

@asolntsev asolntsev requested a review from xael-fry January 9, 2017 18:51
@asolntsev asolntsev self-assigned this Jan 9, 2017
@asolntsev
Copy link
Contributor

@xael-fry I believe this is a good PR. It solves the issue #1043

Please review it.

Copy link
Member

@xael-fry xael-fry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please squash your changes in one commit.
We will create a new branch 1.5.x and to merge this PR in.
Seems like the test is also failing on 1.4.x branch. I will check it

// No import, so Java 7 will not break trying to load this class
java.lang.reflect.Parameter[] parameters = method.getParameters();
String[] names = new String[parameters.length];
for (int i = 0; i < parameters.length; i++) names[i] = parameters[i].getName();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use inline delclaration for for

@cbxp
Copy link
Contributor Author

cbxp commented Jan 10, 2017 via email

@xael-fry
Copy link
Member

Sorry my bad. so we will merge in 1.4.x after remarks fixes

@cbxp cbxp force-pushed the java8-parameters branch from 5c5b4e5 to 812412f Compare January 10, 2017 08:17
@cbxp
Copy link
Contributor Author

cbxp commented Jan 10, 2017

I have fixed the for loop as was requested, and also squashed some commits, but not all.

Squashing many changes with their own reasoning (commit messages) into a single big commit usually a not good idea, as it is quite hard or impossible to understand later the reasoning behind particular changes.

Hopefully these 3 remaining commits are ok.

@cbxp
Copy link
Contributor Author

cbxp commented Jan 10, 2017

The build seems to be failing in 1.4.x already...

@dejan2609
Copy link
Contributor

The build seems to be failing in 1.4.x already...

Indeed, see here for more details (solution proposed by @asolntsev):

@@ -1,7 +1,7 @@
sudo: required
language: java
jdk:
- openjdk7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you keep openjdk7 to be sure 1.4.x still compile with 1.7?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we cannot build play... It would be nice to build with Java 8, but run with Java 7, but I don't know how to do that with travis

@asolntsev
Copy link
Contributor

@xael-fry @angryziber @cbxp it's possible

jdk:
  - oraclejdk8
  - openjdk7
addons:
  apt:
    packages:
      - oracle-java8-installer

script:
  - jdk_switcher use oraclejdk8
  - # do stuff with Java 8
  - jdk_switcher use oraclejdk7
  - # do stuff with Java 7

See for more details: https://docs.travis-ci.com/user/languages/java/

@xael-fry
Copy link
Member

xael-fry commented Jan 16, 2017

But after thinking about it, it we cannot compile it with JDK 7 we will not merge it in 1.4.x. but in a new branch 1.5.x.
If we decide to drop all support of JDK7 in 1.5.x , we can merged this PR without modification

@angryziber
Copy link
Contributor

Dropped Java 7 support - now this can be merged to the newly created master branch for the upcoming 1.5.x release series

angryziber and others added 4 commits February 3, 2017 14:27
And read java8 parameter names first before falling back to ehnhancer-generated fields for older Java.
…ameter names fields. This class can be dropped when we drop Java 7 support.

Plain LocalvariablesNamesEnhancer will not do it anymore, because parameter names are available using standard API in Java 8.
Build of Play now requires Java 8, but will still run with Java 7.
…thod parameter names and considerably reduce enhancing
@asolntsev
Copy link
Contributor

merged to master branch

@asolntsev asolntsev closed this Feb 3, 2017
@asolntsev asolntsev deleted the java8-parameters branch February 3, 2017 22:27
@xael-fry
Copy link
Member

xael-fry commented Feb 6, 2017

All travis tests of this PR fails, reset master

@angryziber
Copy link
Contributor

angryziber commented Feb 6, 2017 via email

@angryziber
Copy link
Contributor

@xael-fry can you please reopen this PR because it was removed from master?

@asolntsev asolntsev reopened this Feb 6, 2017
@xael-fry
Copy link
Member

xael-fry commented Feb 7, 2017

will be handle in #1099

@xael-fry xael-fry closed this Feb 7, 2017
@angryziber
Copy link
Contributor

angryziber commented Feb 7, 2017 via email

@xael-fry
Copy link
Member

xael-fry commented Feb 7, 2017

@angryziber just look at #1099, I rebase your PR and merged it in master.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants