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

The BytecodeReadingParanamer throws an Exception in Java8 when the class contains lambda expressions #17

Closed
stephanebastian opened this issue Oct 21, 2014 · 9 comments

Comments

@stephanebastian
Copy link

Hello,
I just came across this issue where the BytecodeReadingParanamer throws an ArrayIndexOutOfBoundsException in Java8 when the class contains lambda expressions.

Here is an excerpt of the stack trace:

java.lang.ArrayIndexOutOfBoundsException: 28263
at com.thoughtworks.paranamer.BytecodeReadingParanamer$ClassReader.accept(BytecodeReadingParanamer.java:563)
at com.thoughtworks.paranamer.BytecodeReadingParanamer$ClassReader.access$200(BytecodeReadingParanamer.java:338)
at com.thoughtworks.paranamer.BytecodeReadingParanamer.lookupParameterNames(BytecodeReadingParanamer.java:103)

@nartamonov
Copy link

This bug also affects JBehave, see http://jira.codehaus.org/browse/JBEHAVE-1069

@electrum
Copy link

Any plans to fix this?

@garcia-jj
Copy link
Collaborator

If you are running your code under Java 8, you don't need paranamer. You need just to compile your code with -parameters. In your code you can use: Method.getParameters().

@electrum
Copy link

There are libraries using paranamer that run on older JDKs but read classes from Java 8. Also, the fact that Java 8 made the flag a non-default option means you still need a fallback :(

@garcia-jj
Copy link
Collaborator

Hmm, now I see. I fixed the code today, but I need to write more tests to check if the change works with codes compiled with JDK prior Java 8. Soon I will send a pull request.

@muminc
Copy link
Contributor

muminc commented Apr 22, 2015

This bug also affects Orika-mapper, see orika-mapper/orika#60

@garcia-jj
Copy link
Collaborator

I fixed the code at pull request #20, waiting for @paul-hammant review.

paul-hammant added a commit that referenced this issue May 9, 2015
Closes #17. Added constant pool tags to work with Java 8 Lambdas.
@paul-hammant
Copy link
Owner

The PR is in. There's a failure with QDoxParanamerTestCase though. I need to work though that. I deeply suspect I messed up the merging of Robert Scholte's QDox 2 change. Aside from that I need to change the POM to no longer refer to Codehaus - though I have to copy - https://github.com/SeleniumHQ/fluent-selenium/blob/master/java/pom.xml I'll explain more if you hit me up in email.

@rfscholte
Copy link
Collaborator

IIRC the root cause of the failing test has to do with the change in QDox2 where a constructor is now a Constructor (like in java.lang.reflect) instead of a special kind of Method. The order of parsing methods+constructors has changed due to this. Hopefully this a good clue to get it fixed in Paranamer.

lgo added a commit to lgo/incubator-pinot that referenced this issue Sep 16, 2020
Before on paranamer 2.6, there was an incompatibility with certain JDK 8
features as mentioned in paul-hammant/paranamer#17.
This seemed to happen in particular because of the use of a particular Spark
version (2.4.4 on scala 2.12).
xiangfu0 pushed a commit to apache/pinot that referenced this issue Sep 16, 2020
Before on paranamer 2.6, there was an incompatibility with certain JDK 8
features as mentioned in paul-hammant/paranamer#17.
This seemed to happen in particular because of the use of a particular Spark
version (2.4.4 on scala 2.12).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants