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 ASM7_EXPERIMENTAL if system property is set #130

Merged
merged 1 commit into from Aug 8, 2018

Conversation

ijuma
Copy link
Contributor

@ijuma ijuma commented Aug 5, 2018

Full support for Java 11 bytecode requires ASM7_EXPERIMENTAL. The
approach used here is similar to byte-buddy's:

https://github.com/raphw/byte-buddy/blob/30c31ab403eedce386e28acc3e6aee2a7e2e0752/byte-buddy-dep/src/main/java/net/bytebuddy/utility/OpenedClassReader.java#L42

@ijuma
Copy link
Contributor Author

ijuma commented Aug 5, 2018

@sameb Would an approach like this one be considered? If so, I can add some unit tests.

@sameb
Copy link
Contributor

sameb commented Aug 6, 2018

how far off is a stable asm7? regardless, i think adding the ASM_API constant is a good idea, so if you want to submit a patch that just changes all the ASM6 refs to ASM_API and hard-code that to ASM6 for now, that'd be great. then we can followup with updating what the ASM_API refers to.

@raphw
Copy link
Member

raphw commented Aug 6, 2018

LGTM. ASM 7 is probably not released before late September when Java 11 is released.

@ijuma
Copy link
Contributor Author

ijuma commented Aug 7, 2018

I am happy to split this into two PRs. The argument for having an experimental mode (like byte-buddy) is that cgllib is used by testing libraries, build tools and widely used frameworks. Assuming that ASM sticks to their current model where the "experimental" tag is only removed after the respective Java version ships, people can only test their project with unreleased Java versions if cglib supports something like this. And if projects can't test against unreleased Java versions, bugs are only found too late.

This is going to be a recurring issue with the new Java release cadence.

@sameb
Copy link
Contributor

sameb commented Aug 7, 2018

I have some quibbles about the system property name, but the concept sounds fine to me. Happy to resolve naming issues in this PR or in a separate smaller one that just redoes the constant.

Naming concerns: "experimental" doesn't really seem to explain what this is doing. A lot of things could be experimental. Perhaps "experimantal_asm" or "experimental_asm7"? I can't imagine folks successfully keeping the var set over time, and we're going to have to ship new cglib anyway to update the constant, so including the asm version seems useful. WDYT?

@ijuma
Copy link
Contributor Author

ijuma commented Aug 7, 2018

Yes, I also thought that having a property for the specific ASM version may reflect what it does better. Assuming that there is no other use for experimental functionality.

@ijuma
Copy link
Contributor Author

ijuma commented Aug 7, 2018

PR that just makes the refactoring: #131

I'll update this one after that is merged.

Full support for Java 11 bytecode requires ASM7_EXPERIMENTAL.
@ijuma
Copy link
Contributor Author

ijuma commented Aug 8, 2018

Thanks for merging #131. Rebased, updated the system property and added a unit test.

@ijuma
Copy link
Contributor Author

ijuma commented Aug 8, 2018

I verified that EasyMock's tests pass with ASM7_EXPERIMENTAL enabled.

@sameb
Copy link
Contributor

sameb commented Aug 8, 2018

Could you update the PR to cache the value so it doesn't have to reread the system properties every time? That may make tests harder, but it's worth it I think.

@ijuma
Copy link
Contributor Author

ijuma commented Aug 8, 2018

@sameb we effectively do that via the Constants class, right?

@sameb
Copy link
Contributor

sameb commented Aug 8, 2018

Oh! Right! Sorry, my bad for misreading. Thanks for clarifying.

@sameb sameb merged commit 2c4d8da into cglib:master Aug 8, 2018
@ijuma
Copy link
Contributor Author

ijuma commented Aug 8, 2018

Thanks for the quick review!

@ijuma
Copy link
Contributor Author

ijuma commented Aug 18, 2018

@sameb any chance of getting a release with this change? Thanks.

@sameb
Copy link
Contributor

sameb commented Aug 18, 2018 via email

@ijuma
Copy link
Contributor Author

ijuma commented Aug 18, 2018

Thanks for replying quickly (while on vacation) and for the upcoming release! Enjoy your vacation. :)

@ijuma
Copy link
Contributor Author

ijuma commented Sep 5, 2018

@sameb Are you still planning to do a release soon? Thanks!

@sameb
Copy link
Contributor

sameb commented Sep 5, 2018

Yup, though I'm testing out a fix for a JDK11 quirk first. Turns out that JDK11 started writing bridge methods more frequently than before, which can mess up users who use Enhancer.getMethods & have interceptors that prefer matching non-bridge methods (to avoid accidentally triggering twice when bridging across signatures because of erasure). This is the cause of the failure @ google/guice#1199 (comment) -- the test wants to match non-bridge methods, but cglib is only returning bridge methods when compiled w/ JDK11. The fix is to explicitly avoid bridge methods in subclasses when the superclass has a non-bridge method with the exact same signature. I've written up the fix & am testing it across our corpus to ensure it works, and will commit & release after things are good.

@ijuma
Copy link
Contributor Author

ijuma commented Sep 5, 2018

Great, thanks for the update. Do you know if this change in behaviour is intentional? If not, it may be worth reporting it.

@sameb
Copy link
Contributor

sameb commented Sep 5, 2018

already asked those exact questions, and received confirmation that the changes were intentional & related to the following bugs / JEPS: https://bugs.openjdk.java.net/browse/JDK-8203488, https://bugs.openjdk.java.net/browse/JDK-8133247, http://openjdk.java.net/jeps/181

@ijuma
Copy link
Contributor Author

ijuma commented Sep 6, 2018

Perfect, thanks for the information!

@sameb
Copy link
Contributor

sameb commented Sep 6, 2018

FYI, just to give an update, my first pass at the fix didn't work -- there were some edge cases it failed on. I'm trying another approach now and will commit if it works.

@sameb
Copy link
Contributor

sameb commented Sep 10, 2018

released version 3.2.8, should show up on maven central in a couple of hours

@ijuma
Copy link
Contributor Author

ijuma commented Sep 10, 2018

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

3 participants