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

Add support for JDK 11 #663

Closed
Godin opened this Issue Mar 21, 2018 · 18 comments

Comments

@Godin
Copy link
Member

Godin commented Mar 21, 2018

Beside just increment of bytecode version JDK 11 might have real changes in bytecode: for example there might be addition of new entries into constant pool - as of today (21/03/18) JEP 309 is scheduled on JDK 11. And we should keep an eye on JEP 12 as it might change meaning of a minor segement of bytecode version. Also AFAIK JEP 181 some time ago was scheduled on 11 and earlier even on 10.

So we can't guarantee and hence support correct instrumentation of class files with bytecode version 55 until ASM library with support for this version not released.

❗️⚠️🚧🔥 TEXT BELOW IS IN PROCESS OF EDITING 🔥🚧⚠️❗️

However in order to allow collection of coverage for bytecode version lower than 55 when executed under JDK 11, instrumentation of only one class with bytecode version 55 will be enough - JDK class used by ModifiedSystemClassRuntime. As of today the only change in this class between JDK 10 GA and JDK 11 EA build 5 is

$ jmod extract --dir 10 openjdk-10/jmods/java.base.jmod
$ jmod extract --dir 11 openjdk-11-ea+5_linux-x64_bin/jmods/java.base.jmod

$ xxd 10/classes/java/lang/UnknownError.class > 10.hex
$ xxd 11/classes/java/lang/UnknownError.class > 11.hex

$ diff 10.hex 11.hex
1c1
< 0000000: cafe babe 0000 0036 001a 0a00 0400 160a  .......6........
---
> 0000000: cafe babe 0000 0037 001a 0a00 0400 160a  .......7........

So we can guarantee its safe instrumentation by checking its checksum. Or even stronger - by checking that all bytes are expected ones.

Change in class file between 9.0.4 and 10:

$ jmod extract --dir 9.0.4 openjdk-9.0.4/jmods/java.base.jmod
$ xxd 9.0.4/classes/java/lang/UnknownError.class > 9.hex
$ diff 9.0.4.hex 10.hex
1c1
< 0000000: cafe babe 0000 0035 001a 0a00 0400 160a  .......5........
---
> 0000000: cafe babe 0000 0036 001a 0a00 0400 160a  .......6........

While there is no change in source file between 8u152 and 9.0.4, changes in class file are more significant:

$ unzip jdk-8u152/jre/lib/rt.jar -d 8u152
$ javap -v -p 8u152/java/lang/UnknownError.class > 8u152.txt
$ javap -v -p 9.0.4/classes/java/lang/UnknownError.class > 9.0.4.txt
$ diff 8u152.txt 9.txt | tail -n 9
48a54,56
>       LocalVariableTable:
>         Start  Length  Slot  Name   Signature
>             0       5     0  this   Ljava/lang/UnknownError;
61a70,73
>       LocalVariableTable:
>         Start  Length  Slot  Name   Signature
>             0       6     0  this   Ljava/lang/UnknownError;
>             0       6     1     s   Ljava/lang/String;

https://bugs.openjdk.java.net/browse/JDK-8145188

$ jimage extract --dir=10-jre jre-10/lib/modules

$ javap -v -p 10-jre/java.base/java/lang/UnknownError.class > 10-jre.txt
$ javap -v -p 10/classes/java/lang/UnknownError.class > 10-jdk.txt

$ $ diff 10-jdk.txt 10-jre.txt | tail -25
49c40
<          1: invokespecial #1                  // Method java/lang/VirtualMachineError."<init>":()V
---
>          1: invokespecial #12                 // Method java/lang/VirtualMachineError."<init>":()V
51,56d41
<       LineNumberTable:
<         line 43: 0
<         line 44: 4
<       LocalVariableTable:
<         Start  Length  Slot  Name   Signature
<             0       5     0  this   Ljava/lang/UnknownError;
65c50
<          2: invokespecial #2                  // Method java/lang/VirtualMachineError."<init>":(Ljava/lang/String;)V
---
>          2: invokespecial #15                 // Method java/lang/VirtualMachineError."<init>":(Ljava/lang/String;)V
67,73d51
<       LineNumberTable:
<         line 53: 0
<         line 54: 5
<       LocalVariableTable:
<         Start  Length  Slot  Name   Signature
<             0       6     0  this   Ljava/lang/UnknownError;
<             0       6     1     s   Ljava/lang/String;
75d52
< SourceFile: "UnknownError.java"

@Godin Godin self-assigned this Mar 21, 2018

PascalSchumacher added a commit to PascalSchumacher/commons-lang that referenced this issue May 4, 2018

Switch from Cobertura to Jacoco, because Cobertura does not work on J…
…ava 9+. Cobertura-Maven-Plugin fails on Java 10+ even if execution is skipped.

Skip Jacoco on Java 11, because Jacoco does not support it yet (see: jacoco/jacoco#663).

PascalSchumacher added a commit to PascalSchumacher/commons-lang that referenced this issue May 10, 2018

Switch from Cobertura to Jacoco, because Cobertura does not work on J…
…ava 9+. Cobertura-Maven-Plugin fails on Java 10+ even if execution is skipped.

Skip Jacoco on Java 11, because Jacoco does not support it yet (see: jacoco/jacoco#663).

PascalSchumacher added a commit to PascalSchumacher/commons-lang that referenced this issue May 10, 2018

Travis: Switch from Cobertura to Jacoco, because Cobertura does not w…
…ork on Java 9+. Cobertura-Maven-Plugin fails on Java 10+ even if execution is skipped.

Skip Jacoco on Java 11, because Jacoco does not support it yet (see: jacoco/jacoco#663).

PascalSchumacher added a commit to PascalSchumacher/commons-lang that referenced this issue May 15, 2018

Travis: Switch from Cobertura to Jacoco, because Cobertura does not w…
…ork on Java 9+. Cobertura-Maven-Plugin fails on Java 10+ even if execution is skipped.

Skip Jacoco on Java 11, because Jacoco does not support it yet (see: jacoco/jacoco#663).

joel-costigliola added a commit to joel-costigliola/assertj-core that referenced this issue May 23, 2018

dannil added a commit to dannil/scb-java-client that referenced this issue May 30, 2018

Removed JDK 11 (for now)
JaCoCo doesn't support instrumenting on the bytecode format, see
jacoco/jacoco#663

Pr0methean added a commit to Pr0methean/BetterRandom that referenced this issue Jun 9, 2018

joschi added a commit to dropwizard/dropwizard that referenced this issue Jun 20, 2018

joschi added a commit to dropwizard/dropwizard that referenced this issue Jun 20, 2018

napstr added a commit to napstr/Magma that referenced this issue Jun 21, 2018

Fix and improve travis build script
- Use the new, native way to require jdk versions
- Use early access instead of jdk 11
- Disable tests on jdk 11 due to jacoco incompatibility, see jacoco/jacoco#663
- Run with both openjdk and oracle jdk
- Fix conflicting matrix and build stages configuration
- Allow fast finish
@ijuma

This comment has been minimized.

Copy link

ijuma commented Jul 5, 2018

A step towards this was taken by #706, which upgrades ASM to 6.2.

jonathanlermitage added a commit to jonathanlermitage/manon that referenced this issue Jul 31, 2018

@Tibor17

This comment has been minimized.

Copy link

Tibor17 commented Aug 11, 2018

I need to have this fix asap. Java11 will be released very soon.
processing of -javaagent failed

@Godin

This comment has been minimized.

Copy link
Member Author

Godin commented Aug 11, 2018

@Tibor17 this project is maintained by volunteers in their spare time. And sorry, but your "asap" is a zero motivation and value to us. And we perfectly aware that Java 11 will be released very soon. Feel free to test/use snapshot version which contains #719 and provide feedback - this will be far more valuable.

@Tibor17

This comment has been minimized.

Copy link

Tibor17 commented Aug 11, 2018

I had to skip unit tests in ASF Maven Surefire project due to Powermock and now I have to do the same with JaCoCo. I am also developing open source.

@Godin

This comment has been minimized.

Copy link
Member Author

Godin commented Aug 11, 2018

@Tibor17 and we also skip/tweak quite some Maven plugins as they don't work with Java 11 bytecode, and in past wasn't working with Java 9 and 10 bytecode, even months after their release. Same problem with testing JDK 12 EA.

Once again - why not use snapshot version? or just be a bit patient and let us finish work and do the release.

@Tibor17

This comment has been minimized.

Copy link

Tibor17 commented Aug 12, 2018

of curse I give you time to continue in 0.82. I understand that.
It's good that you track this issue. I only wanted to know if somebody works on it. This is for instance exactly the problem in Powermock and the owner is busy.

@Godin

This comment has been minimized.

Copy link
Member Author

Godin commented Aug 12, 2018

Then next time please explicitly ask what you wanted to ask instead of just dropping impolite IMO "asap". Thank you.

@Tibor17

This comment has been minimized.

Copy link

Tibor17 commented Aug 12, 2018

I will release version 2.22.1 but CI/jdk11 still fails. Therefore asap was important for me. I can keep Jacoco excluded for some time of curse.

@Godin

This comment has been minimized.

Copy link
Member Author

Godin commented Aug 12, 2018

You can also ASAP use snapshot version of JaCoCo and make you CI green!

@Tibor17

This comment has been minimized.

Copy link

Tibor17 commented Aug 12, 2018

I will try, thx ;-)

@Tibor17

This comment has been minimized.

Copy link

Tibor17 commented Aug 15, 2018

@marchof

This comment has been minimized.

Copy link
Member

marchof commented Aug 15, 2018

@Tibor17 So, does the SNAPSHOT version work for you? Any feedback helps us to move forward with an release.

@Tibor17

This comment has been minimized.

Copy link

Tibor17 commented Aug 15, 2018

@Godin Godin added this to Candidates in Current work items via automation Aug 15, 2018

@ijuma

This comment has been minimized.

Copy link

ijuma commented Aug 18, 2018

I successfully ran Kafka's client tests with Jacoco 0.8.2-SNAPSHOT and Java 11. They fail with Jacoco 0.8.1. Looking forward to the release of 0.8.2. :)

@cocorossello

This comment has been minimized.

Copy link

cocorossello commented Aug 19, 2018

Tested latest snapshot with jdk11 in our gradle build and tomee, looks good

simon04 pushed a commit to openstreetmap/josm that referenced this issue Aug 19, 2018

see #16047, see #16498 - update to jacoco 0.8.2.20180819 for Java 11 …
…compatibility. Keep it disabled for Java 12

See jacoco/jacoco#663

git-svn-id: https://josm.openstreetmap.de/svn/trunk@14171 0c6e7542-c601-0410-84e7-c038aed88b3b

@Godin Godin added this to the 0.8.2 milestone Aug 20, 2018

@Godin

This comment has been minimized.

Copy link
Member Author

Godin commented Aug 20, 2018

This ticket was created to find a way to use JaCoCo agent without ASM version that supports bytecode of classes in JDK 11 (ModifiedSystemClassRuntime). So I'm closing it, since now we use ASM with support for Java 11 ( #706 , #719 ) and Java 12 ( #725 , #738 ) versions of class-files, which allows not only usage of agent, but also instrumentation and analysis of such class-files.

@ijuma @cocorossello Thank you for testing and feedback! ❤️

We plan to release 0.8.2 this week.

@Godin Godin closed this Aug 20, 2018

Current work items automation moved this from Candidates to Done Aug 20, 2018

floscher pushed a commit to floscher/josm that referenced this issue Aug 20, 2018

see #16047, see #16498 - update to jacoco 0.8.2.20180819 for Java 11 …
…compatibility. Keep it disabled for Java 12

See jacoco/jacoco#663

git-svn-id: https://josm.openstreetmap.de/svn/trunk@14171 0c6e7542-c601-0410-84e7-c038aed88b3b
@Prasadambati

This comment was marked as off-topic.

Copy link

Prasadambati commented Sep 28, 2018

Where can i find rt.jat in java11 or is there any alternate provided for this?

@Prasadambati

This comment was marked as off-topic.

Copy link

Prasadambati commented Sep 28, 2018

And i cant able to find JRE also for the same?

@jacoco jacoco locked as resolved and limited conversation to collaborators Sep 28, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.