diff options
author | Evgeny Mandrikov <Godin@users.noreply.github.com> | 2016-08-16 04:06:56 +0200 |
---|---|---|
committer | Marc R. Hoffmann <hoffmann@mountainminds.com> | 2016-08-16 04:06:56 +0200 |
commit | 28a112ca6c6f46cd385f00aa932ec0e334e045a7 (patch) | |
tree | 9d92399e1a2e797a87d560e49fc092e0017a113d /org.jacoco.core.test/src/org/jacoco/core/test/validation/targets | |
parent | c6f2b6b7e887eb645b8aba928ff0134cfe66ec28 (diff) | |
download | jacoco-28a112ca6c6f46cd385f00aa932ec0e334e045a7.tar.gz |
Do not violate JVMS regarding initialization of final fields (#434)
Without this change instrumented classes can't pass checks
and cause IllegalAccessError starting from OpenJDK 9 EA b127
(see https://bugs.openjdk.java.net/browse/JDK-8157181).
Diffstat (limited to 'org.jacoco.core.test/src/org/jacoco/core/test/validation/targets')
-rw-r--r-- | org.jacoco.core.test/src/org/jacoco/core/test/validation/targets/BadCycleClass.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/org.jacoco.core.test/src/org/jacoco/core/test/validation/targets/BadCycleClass.java b/org.jacoco.core.test/src/org/jacoco/core/test/validation/targets/BadCycleClass.java new file mode 100644 index 00000000..44e40cd1 --- /dev/null +++ b/org.jacoco.core.test/src/org/jacoco/core/test/validation/targets/BadCycleClass.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2009, 2016 Mountainminds GmbH & Co. KG and Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Evgeny Mandrikov - initial API and implementation + * + *******************************************************************************/ +package org.jacoco.core.test.validation.targets; + +public class BadCycleClass { + + public static class Base { + static final Child b = new Child(); + + static { + b.someMethod(); + } + } + + public static class Child extends Base { + + static { + Stubs.nop("child clinit"); // $line-3$ + } + + public Child() { + Stubs.nop("child init"); // $line-1$ + } + + void someMethod() { + Stubs.nop("child someMethod"); // $line-2$ + } + + } + + public static void main(String[] args) { + new Child(); + } + +} |