Support for JDK 1.8.0 #74

Closed
szegedi opened this Issue Jan 17, 2013 · 63 comments

Comments

Projects
None yet

szegedi commented Jan 17, 2013

Status Overview

Latest snapshot build: Snapshot Repository

[x] ASM5: Release Required

We need a new ASM version which supports class file version 52.0. ASM 5.0_BETA is released to Maven central repo.

[x] Adjust JaCoCo to new ASM APIs: Done

JaCoCo needs to be adjusted to ASM5 APIs. This has been done on a experimental branch.

[x] Select proper runtime implementation: Done

The ModifiedSystemClassRuntime does not work any more with JRE 8. So an alternative Runtime has to be selected. The UrlStreamHandlerRuntime seems to do the job.

[x] Maven JavaDoc: Workaround

With JDK 8 JavaDoc generated by Maven fails to compile due to Lint checks. As a workaround we can disable this check for the Maven plugin.

[x] Invalid Line Numbers: Fixed with JDK Build 103

The JDK 8 compiler missed line number information in certain cases which makes our integration tests fail (and also leads to wrong line coverage results).

Owner

marchof commented Jan 29, 2013

Java 8 is not yet supported by ASM, see feature request http://forge.ow2.org/tracker/index.php?func=detail&aid=316375&group_id=23&atid=350023

The other problem is that ModifiedSystemClassRuntime() is not working any more.

I might be mistaken, but IIRC ASM is now included as part of Java 8 (since Nashorn went in).

Owner

marchof commented May 22, 2013

@karianna Do you have any background information or links? Is it public API and compatible with ASM 4.1?

szegedi commented May 22, 2013

Well, ASM is embedded as a package-renamed "jdk.internal.org.objectweb.asm" version. It's not really useful to rely on its presence like that. It was actually not Nashorn that triggered the embedding - JDK8 has other needs for runtime code generators (e.g. lambda forms).

FWIW, it's irrelevant; what we need is ASM that recognizes the 52.0 as a valid class file version, but unfortunately that alone won't be enough to make JaCoCo work with a Java 8 runtime :-(

+1 on what +szegedi said (he's at the forefront of all of this)

Owner

marchof commented Jul 7, 2013

Some testing with ASM 5-alpha. It turned out that they changed the way how implicit stackmap frames are handled. JaCoCo needs to be adjusted to the new behaviour:

http://forge.ow2.org/tracker/?group_id=23&atid=100023&func=detail&aid=316360

Owner

marchof commented Jul 14, 2013

Owner

marchof commented Jul 18, 2013

Compiler issue with line numbers has been reported to Oracle, bug number is 9005197 (http://bugs.sun.com) -- not yet acknowledged.

Owner

marchof commented Jul 18, 2013

My current Java 8 experiments are now available in branch experimental-java8. There is also a first preview build.

Warning: This build depends on a not yet released version of ASM. Therefore all Maven goals will not yet work unless you build ASM on your own and publish it in a local repo. The JaCoCo agent and the Ant tasks should be usable though.

Hi Marc,

We're tracking this as part of Adopt OpenJDK -
https://java.net/projects/adoptopenjdk/pages/TestingJava8 - thanks for
looking into this!

Cheers,
Martijn

On 18 July 2013 20:12, Marc R. Hoffmann notifications@github.com wrote:

My current Java 8 experiments are now available in branch
experimental-java8https://github.com/jacoco/jacoco/tree/experimental-java8.
There is also a first preview buildhttp://download.eclipselab.org/jacoco/preview/jacoco-0.6.4.201307180853.zip
.

Warning: This build depends on a not yet released version of ASM.
Therefore all Maven goals will not yet work unless you build ASM on your
own and publish it in a local repo. The JaCoCo agent and the Ant tasks
should be usable though.


Reply to this email directly or view it on GitHubhttps://github.com/jacoco/jacoco/issues/74#issuecomment-21207105
.

Owner

marchof commented Jul 18, 2013

Thanks Martijn! We also have an issue with JDK8 itself but I didn't manage to report issue. My email to compiler-dev didn't get published on the list, my bug report 9005197 hasn't been acknowledged :-(

Can you send me the details? I can post on your behalf.

Cheers,
Martijn

On 18 July 2013 22:01, Marc R. Hoffmann notifications@github.com wrote:

Thanks Martijn! We also have an issue with JDK8 itself but I didn't manage
to report issue. My email to compiler-dev didn't get published on the list,
my bug report 9005197 hasn't been acknowledged :-(


Reply to this email directly or view it on GitHubhttps://github.com/jacoco/jacoco/issues/74#issuecomment-21214633
.

Owner

marchof commented Jul 19, 2013

Bugreport for JDK8 compiler: https://gist.github.com/marchof/6036631

Thanks Marc, that's a really great report - I've passed it onto the compiler dev team and am also chasing down why the bug is not public. Will keep you posted!

Owner

marchof commented Jul 21, 2013

@karianna Thanks for your support!

marchof was assigned Sep 15, 2013

vertti commented Dec 16, 2013

Getting Caused by: java.lang.NoSuchFieldException: $jacocoAccess at java.lang.Class.getField(Class.java:1686) at org.jacoco.agent.rt.internal_6effb9e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:136) ... 9 more

Example of failing build with Travis-CI, oraclejdk8 and jacoco. https://travis-ci.org/NitorCreations/matchers/jobs/15489611

Owner

marchof commented Dec 16, 2013

@vertti Make sure you use the JaCoCo preview build linked above (not yet available from a maven repo).

Hi!

Do you have in mind a release date for JDK 8 support? I'm not asking for the exact hour and minute :)

Thank you!

Owner

marchof commented Jan 16, 2014

@silviu-burcea We primarly depend on the release of ASM5. And ASM5 depends on the finalization of the JVM spec...

cowwoc commented Jan 16, 2014

Jdk8 is feature frozen for a couple of months now. I think ASM5 beta
already covers what will end up being final.
On Jan 16, 2014 7:24 AM, "Marc R. Hoffmann" notifications@github.com
wrote:

@silviu-burcea https://github.com/silviu-burcea We primarly depend on
the release of ASM5. And ASM5 depends on the finalization of the JVM spec...


Reply to this email directly or view it on GitHubhttps://github.com/jacoco/jacoco/issues/74#issuecomment-32464442
.

Owner

marchof commented Jan 16, 2014

@cowwoc I know. But as we have quite a few downstream users who use JaCoCo as an API (see http://www.eclemma.org/jacoco/trunk/doc/integrations.html) we decided not to depend on a beta version. This would force all of the downstream users also to rely on a beta.

To help us out here you could contact the ASM team to check what their release plan looks like.

Owner

marchof commented Jan 16, 2014

See http://mail.ow2.org/wws/arc/asm/2013-11/msg00005.html

Now about the release of ASM5, the original planning was to release ASM5, roughly at the same time as the jdk8 (2014-03-17).

cowwoc commented Jan 16, 2014

I guess we'll wait :) Thanks for the clarification.

mysticfall referenced this issue in mysticfall/pivot4j Feb 13, 2014

Closed

Build fails on JDK 8 due to Jacoco library. #125

Owner

marchof commented Feb 27, 2014

@lanefeltis The JaCoCo gradle plugin is not maintained here and we have no experience with gradle. maybe you ask this question at the Gradle project?

ASM 5-BETA should be fine, I don't give a crap if me, a downstream user, depends on a BETA, maybe just call the jacoco release a BETA if you're scared. As others have said, it appears that the 5.0-BETA will be the same as the final 5.0 release, and they are simply waiting. Of course, it would be nice if they did not wait for java 8. Cascaded delays of people waiting around for essentially nothing is annoying.

Java 8 will not change between now and 2 weeks from now when it is released unless it is delayed due to a show-stopper bug. There is essentially no risk for jacoco, or asm, to release now, since there WILL BE TIME to adjust to any changes introduced by a delay to java 8, as they will make such a change and freeze for a few weeks.

In fact, this is doing a dis-service to the Java 8 release, forcing users to wait before they can test it. The entire reason that Java 8 is not out TODAY is because it is frozen so that we can test it. ASM and Jacoco (and maven, and many others) 'waiting' is exactly the opposite of what should be happening right now.

cowwoc commented Mar 4, 2014

+1000 for @scottcarey's comment. The entire point of the JDK release process is for you to release JDK8-supporting libraries as soon as the JDK is feature frozen. This has been the case for many months now and yet jacoco and others have been sitting on their hands. This is precisely why we only discover problems with the JDK after the release (when it's too late to fix) because people keep on sitting on their hands.

If users could realistically test JDK8 before it was out then we'd be able to catch these bugs and correct them before the official release.

Owner

marchof commented Mar 4, 2014

Unfortunately ASM5 BETA is not feature complete for Java 8.

But I understand that there is a strong demand in the community for a complete tool stack for Java 8. I like @scottcarey 's idea to also release e.g. a JaCoCo 0.7.0-BETA stream. I'll discuss this here at JaCoCo.

cowwoc commented Mar 4, 2014

@marchof Out of curiosity, what features are missing? Is this documented anywhere?

Owner

marchof commented Mar 4, 2014

@cowwoc invokespecial and invokestatic on interfaces, required e.g. for default methods

I like the idea of 0.7.0-BETA. Go for it!

Owner

marchof commented Mar 7, 2014

I created a new branch which is based on the latest JaCoCo release 0.6.5 but with (partial) Java 8 support: https://github.com/jacoco/jacoco/tree/0.7.0-BETA
You can find a download link at the top. Please help us to test this so we can release it!

Do you release any maven beta/snapshot version?

Owner

marchof commented Mar 7, 2014

@silviu-burcea I'm just checking with our release manager @Godin. Stay tuned.

trautonen referenced this issue in trautonen/coveralls-maven-plugin Mar 8, 2014

Open

fails to parse cobertura xml #32

Owner

marchof commented Mar 9, 2014

Hi @silviu-burcea, @cowwoc, @scottcarey and @karianna,

thanks to @Godin we now have 0.7.0-beta snapshot builds. Can you please test the snapshot builds and provide feedback? If the 0.7.0-beta branch works for you we do a beta release soon.

Hi @marchof ,

I will test it asap. Thank you for the snapshot 👍

fchopard commented Mar 9, 2014

Hi,
Just tested the snapshot and it seems to work fine.

Test #1: use on a large project (> 100,000 LOC) that is compiled with JDK 8 but with target of Java 7. Compiled, tested, generated html reports. Works fine. So at minimum, this doesn't seem to introduce a regression.

Next up, compile with target Java 8, which will be in the new bytecode version.

Test 2: on a smaller project (the large one doesn't work with Java 8 due to other libraries that bundle old ASM versions), compile with Java 8 to target Java 8 bytecode.
This works with 0.7-BETA

Test 3: Add Java 8 code that covers the two biggest features: default methods and lambdas.

This works too!

 public static int lambdaTest() {
    ArrayList<String> stuff = new ArrayList<>();
    stuff.add("foo");
    stuff.add("bar");
    stuff.add("baz");
    stuff.forEach(s ->
      System.out.println(s));

    return stuff.stream().mapToInt(s ->
      s.length()).sum();
  }

  public static interface Defender {
    default int countDefault(Collection c) { return c.size(); }
  }

  public static int defenderTest() {
    Defender d = new Defender() {};
    return d.countDefault(new ArrayList<String>());
  }

Jacoco 0.7-BETA reported 100% coverage above when both lambdaTest and DefenderTest. The one line that was reported as "uncovered" was public static interface Defender {. but the default method definition and bits inside the lambda were 100% covered.

ASM may not be complete for all Java 8 features, but for whatever Jacoco needs it for, it appears to be working fine.

Using Jacoco 0.6.5.201403032054, both the tests above that compile to Java 8 bytecode fail with:

java.lang.RuntimeException: Class java/util/UUID could not be instrumented.
    at org.jacoco.agent.rt.internal_6474ae9.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:139)
    at org.jacoco.agent.rt.internal_6474ae9.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:100)
    at org.jacoco.agent.rt.internal_6474ae9.PreMain.createRuntime(PreMain.java:55)
    at org.jacoco.agent.rt.internal_6474ae9.PreMain.premain(PreMain.java:47)
    ... 6 more
Caused by: java.lang.NoSuchFieldException: $jacocoAccess
    at java.lang.Class.getField(Class.java:1690)
    at org.jacoco.agent.rt.internal_6474ae9.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:137)
Contributor

muminc commented Mar 10, 2014

Took and existing project which was using Jacoco 0.6.4 ( it uses jacoco:check goal to enforce classes had minimum of 70% line and branch coverage.)

First Test:

Upgrade the Jacoco version to 0.7.0-beta
Expected: Build to still pass and Jacoco acknowledge coverages checks have been met.

Second Test

Upgrade the Jacoco version to 0.7.0-beta, place @ignore on few unit tests.
Expected: jacoco:check should fail build - some classes don't meet minimum code coverage.

Results

Using Java 7 update 51

First Test Result : Build Passes
Second Test Result : check goal correctly fails build.

Using Java 8 b132

First Test Result : Build Passed.
Second Test Result : check goal correctly fails build.

0.7.0-beta looks good to me ! 👍

cowwoc commented Mar 17, 2014

ASM 5.0 is out: http://mail.ow2.org/wws/arc/asm/2014-03/msg00012.html

Time to release a non-SNAPSHOT version of Jacoco with JDK 1.8 support?

Owner

marchof commented Mar 17, 2014

@cowwoc Thanks for the hint! I immediately updated to ASM 5.0 -- and failed. Looks like the release is broken :-((( Here is my bug report:

http://forge.ow2.org/tracker/index.php?func=detail&aid=317123&group_id=23&atid=100023

Owner

marchof commented Mar 17, 2014

@Godin @mfriedenhagen Only asm-all is broken. asm-debug-all seems to work. I like the debug version better anyways, as we will get better stack traces in case of error. So what should be do?

cowwoc commented Mar 17, 2014

+1 I also prefer the debug version.

marchof referenced this issue Mar 17, 2014

Merged

Upgrade to ASM5 #199

Owner

marchof commented Mar 17, 2014

Added separate pull request #199 for ASM5 upgrade on master

Member

Godin commented Mar 17, 2014

@marchof Do you know other differences between "asm-all" and "asm-debug-all"? Except availability of debug information and size, which is 235K vs 371K according to http://search.maven.org/

BTW I suppose that both "asm-all" and "asm-debug-all" - are just repackaged collections of all other artifacts and "asm-all" was broken during this. So another option for us - is to repackage on our own.

I'm ready to go with "asm-debug-all", if you confident in it after finding breakage in "asm-all".

Owner

marchof commented Mar 17, 2014

There are different 'optimizations' in asm-all, like removing generic signature information. I don't like those anyways. I could remove some casts as we now have the signatures back.

Owner

marchof commented Mar 17, 2014

@Godin Our distribution size increased by 200k as we package ASM in some JARs. For me this is ok.

Member

mfriedenhagen commented Mar 18, 2014

Debug-Version sounds reasonable, getting rid of casts is good.

Regards

Mirko

Sent from my mobile
On Mar 18, 2014 12:34 AM, "Marc R. Hoffmann" notifications@github.com
wrote:

@Godin https://github.com/Godin Our distribution size increased by 200k
as we package ASM in some JARs. For me this is ok.


Reply to this email directly or view it on GitHubhttps://github.com/jacoco/jacoco/issues/74#issuecomment-37884099
.

Godin added this to the 0.7.0 milestone Mar 19, 2014

Godin closed this Mar 19, 2014

Member

Godin commented Mar 19, 2014

JaCoCo 0.7.0 with support of Java 8 has been released.

Congrats guys!

mritun commented Mar 19, 2014

Thank you!

eskatos commented Mar 21, 2014

\o/
Thank you!

sinwe commented Mar 24, 2014

I can't find it in maven central repo. Is it published and propagated already?

Member

Godin commented Mar 24, 2014

@sinwe yes it is - see version "0.7.0.201403182114" http://central.maven.org/maven2/org/jacoco/org.jacoco.core/

sinwe commented Mar 24, 2014

Thanks for your clarification, I thought the release version was 0.7.0
without any suffix.

Cheers,
Winarto
On Mar 24, 2014 5:33 PM, "Evgeny Mandrikov" notifications@github.com
wrote:

@sinwe https://github.com/sinwe yes it is - see version
"0.7.0.201403182114"
http://central.maven.org/maven2/org/jacoco/org.jacoco.core/

Reply to this email directly or view it on GitHubhttps://github.com/jacoco/jacoco/issues/74#issuecomment-38425107
.

Member

Godin commented Mar 24, 2014

@sinwe just FYI we have a pending discussion about removal of this suffix, but this wasn't done for this release.

fbiville referenced this issue in joel-costigliola/assertj-maven-parent-pom Mar 26, 2014

Merged

Upgrade to latest version of Jacoco #6

mritun commented Sep 12, 2014

+1, thank you!

Still not working... Are you guys going to ever fix this? (not being snarky - but really wondering?)

Member

Godin commented Aug 28, 2015

@cogmission Latest versions of JaCoCo do support Java 8. The first version with Java 8 support (0.7.0) has been released more than year ago. If you have a problem, then please start a discussion in Users Mailing List - see http://www.eclemma.org/jacoco/trunk/doc/support.html

Member

Godin commented Aug 28, 2015

@cogmission Answered there. For the record - seems completely unrelated to Java 8.

Godin locked and limited conversation to collaborators Aug 28, 2015

Godin unlocked this conversation Jan 11, 2017

Godin locked and limited conversation to collaborators Jan 11, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.