Heads-up: Incompatibility between JaCoCo 0.8.3+ and NetBeans 10.0+

26 views
Skip to first unread message

Andreas Sewe

unread,
Jan 15, 2020, 4:05:40 AM1/15/20
to JaCoCo and EclEmma Users
Hi JaCoCo developers,

I just to give you a heads-up about an interesting bug [1] I just filled
with Apache NetBeans; it causes a SecurityException in premain on
NetBeans 10.0 or later with JaCoCo 0.9.3 or later when running on Java 8.

Apparently, JaCoCo's check whether to redefine java.lang.Module [2]
causes an empty dummy java.lang.Module from the org-netbeans-bootstrap
NetBeans module to be loaded, which results in the SecurityException.

As I am unsure whether the problem is with NetBeans or JaCoCo (I don't
know the purpose of shipping a dummy java.lang.Module, for example),
this mail is meant as a heads-up to you, the JaCoCo developers.

Maybe it would be worth getting in touch with the NetBeans developers
(d...@netbeans.apache.org [3] seems to be pretty active) and coordinate a
fix or devise a workaround. From the outside, it's unfortunately really
hard to tell which project to even file the bug with.

Hope this helps.

Best wishes,

Andreas

[1] <https://issues.apache.org/jira/browse/NETBEANS-3698>
[2]
<https://github.com/jacoco/jacoco/blob/v0.8.5/org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/PreMain.java#L61>
[3] <https://netbeans.apache.org/community/mailing-lists.html#dev>

--
Dr. Andreas Sewe | se...@cqse.eu | +49 152 56342856
CQSE GmbH | Centa-Hafenbraedl-Strasse 59 | 81249 Muenchen | www.cqse.eu
Amtsgericht Muenchen | HRB 177678 | GF: F. Deissenboeck, M. Feilkas

signature.asc

Evgeny Mandrikov

unread,
Jan 15, 2020, 4:48:59 AM1/15/20
to JaCoCo and EclEmma Users
Hi Andreas,

Thank you for letting us know!
This relates to https://github.com/jacoco/jacoco/pull/829 , which indeed was implemented in JaCoCo version 0.8.3.
So the workaround, as you already probably guessed - is to use JaCoCo version 0.8.2.
Currently I investigate another report related to the same change ( https://groups.google.com/d/msg/jacoco/0L3PBkNMEgQ/68-WTRGQAQAJ ), so will do my best to have a deeper look at yours.


Regards,
Evgeny

Andreas Sewe

unread,
Jan 15, 2020, 5:15:49 AM1/15/20
to jac...@googlegroups.com
Hi Evgeny,

> Thank you for letting us know!

you're welcome. And thanks for being always super-responsive. I wish all
OSS projects were like that.

> This relates to https://github.com/jacoco/jacoco/pull/829 , which indeed
> was implemented in JaCoCo version 0.8.3.
> So the workaround, as you already probably guessed - is to use JaCoCo
> version 0.8.2.
> Currently I investigate another report related to the same change (
> https://groups.google.com/d/msg/jacoco/0L3PBkNMEgQ/68-WTRGQAQAJ ), so
> will do my best to have a deeper look at yours.

In case you haven't see it already, my NetBeans bug report contains a
minimal Maven project with which you can reproduce the issue; it just
puts the problematic NetBeans module (NetBeans module != Java module) on
the classpath and launches Surefire with the JaCoCo agent.

Best wishes,

Andreas
signature.asc

Evgeny Mandrikov

unread,
Jan 17, 2020, 5:45:01 PM1/17/20
to JaCoCo and EclEmma Users
Hi Andreas,

On Wednesday, January 15, 2020 at 11:15:49 AM UTC+1, Andreas Sewe wrote:
you're welcome. And thanks for being always super-responsive. I wish all 
OSS projects were like that. 

First of all thank you for these warm words!

Maybe we can replace

try {
    Class.forName("java.lang.Module");
} catch (final ClassNotFoundException e)

by

try {
    Instrumentation.class.getMethod("redefineModule");
} catch (final NoSuchMethodException e) {

However
dummy java.lang.Module was added to NetBeans by commit https://github.com/apache/netbeans/commit/4325e6ca3600c7234072df38ce50ff8c69172343
and causes the same

java.lang.SecurityException: Prohibited package name: java.lang

on JVM 8 for example for

org.netbeans.NbInstrumentation.class.getMethods()

I strongly believe that org.netbeans.NbInstrumentation should not implement java.lang.instrument.Instrumentation
and this will allow to remove dummy java.lang.Module

Marc, WDYT?


Regards,
Evgeny

Marc Hoffmann

unread,
Jan 19, 2020, 2:42:00 PM1/19/20
to jac...@googlegroups.com
Hi Evgeny,

if I understand the bug report and the commit correctly this is a problem with some test suite for NetBeans, not with NetBeans itself.

I don’t think we can reliably support scenarios where people add their own versions of JDK classes in the class path. This has to be fixed in the NetBeans test suite.

Cheers,
-marc




--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/8f5c5b96-c8f3-491b-9938-bde0a036ab69%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages