[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cross-project-issues-dev] Java 9 Readiness


On Tue, Mar 14, 2017 at 10:08 PM Ed Willink <ed@xxxxxxxxxxxxx> wrote:
@Dani: I've clarified my confusions in the wiki and added a new table
for Orbit utility; ASM bombs on Java 9 classes.

Prior to passing class bytes to ASM as a temporary workaround you can change them, so that ASM will believe that it is V1_8. We use this trick in JaCoCo -ÂseeÂhttps://github.com/jacoco/jacoco/blob/v0.7.9/org.jacoco.core/src/org/jacoco/core/internal/Java9Support.java#L101
This is safe, because Java 9 does not introduce any new instructions.
Version can be restored after bytecode generation/modification - see https://github.com/jacoco/jacoco/blob/v0.7.9/org.jacoco.core/src/org/jacoco/core/internal/Java9Support.java#L112

This way even bytes of module-info.class can be passed to ClassReader. This does not bring much value without implementation of custom encoder/decoder for new attribute Module that is otherwise simply ignored. Also not sure how this works in respect to reading/writing of new Constant Pool entries - we haven't experimented with this, because module-info.class is not used and will not be used by JaCoCo. And AFAIK format of this new entities was (maybe even still) very unstable.