aboutsummaryrefslogtreecommitdiffstats
path: root/org.jacoco.core.test.validation.java8/src/org/jacoco/core
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2019-05-19 22:01:33 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-05-19 22:01:33 -0700
commit8e37ff147009b16f4dd904bcc32714990e5cf22a (patch)
tree4378ac3ee1730f6cfbe0b9120f3d54e7570c86a0 /org.jacoco.core.test.validation.java8/src/org/jacoco/core
parent93068ff728a7916816e7bbf832b05c717a106c26 (diff)
parent0f0b5ebf8685e3b0544afa451e39e3fd3fbc304b (diff)
downloadplatform_external_jacoco-8e37ff147009b16f4dd904bcc32714990e5cf22a.tar.gz
platform_external_jacoco-8e37ff147009b16f4dd904bcc32714990e5cf22a.tar.bz2
platform_external_jacoco-8e37ff147009b16f4dd904bcc32714990e5cf22a.zip
am: 0f0b5ebf86 Change-Id: Ice1512bc21409270a58b7542bce06745db99af6c
Diffstat (limited to 'org.jacoco.core.test.validation.java8/src/org/jacoco/core')
-rw-r--r--org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/AnnotationOnLocalVariableTest.java27
-rw-r--r--org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/BadCycleInterfaceTest.java66
-rw-r--r--org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/BootstrapMethodReferenceTest.java128
-rw-r--r--org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/InterfaceDefaultMethodsTest.java26
-rw-r--r--org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/InterfaceOnlyDefaultMethodsTest.java26
-rw-r--r--org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/LambdaExpressionsTest.java26
-rw-r--r--org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/LambdaInInterfaceTest.java31
-rw-r--r--org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/AnnotationOnLocalVariableTarget.java40
-rw-r--r--org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/BadCycleInterfaceTarget.java50
-rw-r--r--org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/InterfaceDefaultMethodsTarget.java43
-rw-r--r--org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/InterfaceOnlyDefaultMethodsTarget.java40
-rw-r--r--org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/LambdaExpressionsTarget.java35
-rw-r--r--org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/LambdaInInterfaceTarget.java25
13 files changed, 563 insertions, 0 deletions
diff --git a/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/AnnotationOnLocalVariableTest.java b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/AnnotationOnLocalVariableTest.java
new file mode 100644
index 00000000..e3a3221d
--- /dev/null
+++ b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/AnnotationOnLocalVariableTest.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 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.java8;
+
+import org.jacoco.core.test.validation.ValidationTestBase;
+import org.jacoco.core.test.validation.java8.targets.AnnotationOnLocalVariableTarget;
+
+/**
+ * Test of ASM bug
+ * <a href="https://gitlab.ow2.org/asm/asm/issues/317815">#317815</a>
+ */
+public class AnnotationOnLocalVariableTest extends ValidationTestBase {
+
+ public AnnotationOnLocalVariableTest() {
+ super(AnnotationOnLocalVariableTarget.class);
+ }
+
+}
diff --git a/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/BadCycleInterfaceTest.java b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/BadCycleInterfaceTest.java
new file mode 100644
index 00000000..96896f67
--- /dev/null
+++ b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/BadCycleInterfaceTest.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 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.java8;
+
+import org.jacoco.core.test.validation.Source.Line;
+import org.jacoco.core.test.validation.ValidationTestBase;
+import org.jacoco.core.test.validation.java8.targets.BadCycleInterfaceTarget;
+import org.junit.Test;
+
+/**
+ * Test of "bad cycles" with interfaces.
+ */
+public class BadCycleInterfaceTest extends ValidationTestBase {
+
+ public BadCycleInterfaceTest() throws Exception {
+ super(BadCycleInterfaceTarget.class);
+ }
+
+ @Test
+ public void method_execution_sequence() throws Exception {
+ if (JAVA_VERSION.isBefore("1.8.0_152")) {
+ assertLogEvents("baseclinit", "childdefaultmethod", "childclinit",
+ "childstaticmethod");
+ } else {
+ assertLogEvents("childclinit", "childstaticmethod");
+ }
+ }
+
+ public void assertBaseClInit(final Line line) {
+ if (JAVA_VERSION.isBefore("1.8.0_152")) {
+ // Incorrect interpetation of JVMS 5.5 in JDK 8 causes a default
+ // method to be called before the static initializer of an interface
+ // (see JDK-8098557 and JDK-8164302):
+ assertFullyCovered(line);
+
+ } else {
+ // This shouldn't happen with JDK 9 (see also JDK-8043275)
+ // and starting with JDK 8u152 (see JDK-8167607):
+ assertEmpty(line);
+ }
+ }
+
+ public void assertChildDefault(final Line line) throws Exception {
+ if (JAVA_VERSION.isBefore("1.8.0_152")) {
+ // Incorrect interpetation of JVMS 5.5 in JDK 8 causes a default
+ // method to be called before the static initializer of an interface
+ // (see JDK-8098557 and JDK-8164302):
+ assertFullyCovered(line);
+
+ } else {
+ // This shouldn't happen with JDK 9 (see also JDK-8043275)
+ // and starting with JDK 8u152 (see JDK-8167607):
+ assertNotCovered(line);
+ }
+ }
+
+}
diff --git a/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/BootstrapMethodReferenceTest.java b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/BootstrapMethodReferenceTest.java
new file mode 100644
index 00000000..e723afa8
--- /dev/null
+++ b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/BootstrapMethodReferenceTest.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 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.java8;
+
+import static org.junit.Assert.assertEquals;
+
+import java.lang.invoke.CallSite;
+import java.lang.invoke.ConstantCallSite;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.lang.reflect.InvocationTargetException;
+
+import org.jacoco.core.instr.Instrumenter;
+import org.jacoco.core.runtime.IRuntime;
+import org.jacoco.core.runtime.RuntimeData;
+import org.jacoco.core.runtime.SystemPropertiesRuntime;
+import org.jacoco.core.test.TargetLoader;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.Handle;
+import org.objectweb.asm.Label;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+
+/**
+ * Test of ASM bug
+ * <a href="https://gitlab.ow2.org/asm/asm/issues/317748">#317748</a> that
+ * caused
+ * {@code java.lang.ClassFormatError: Short length on BootstrapMethods in class file}
+ * during instrumentation.
+ */
+public class BootstrapMethodReferenceTest {
+
+ private IRuntime runtime;
+ private Instrumenter instrumenter;
+
+ @Before
+ public void setup() throws Exception {
+ runtime = new SystemPropertiesRuntime();
+ instrumenter = new Instrumenter(runtime);
+ runtime.startup(new RuntimeData());
+ }
+
+ @After
+ public void teardown() {
+ runtime.shutdown();
+ }
+
+ @Test
+ public void test() throws Exception {
+ final String className = "Example";
+
+ final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
+ cw.visit(Opcodes.V1_7, Opcodes.ACC_PUBLIC, className, null,
+ "java/lang/Object", null);
+
+ final MethodVisitor mv = cw.visitMethod(
+ Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "run", "()I", null,
+ null);
+ mv.visitCode();
+ addCauseOfResizeInstructions(mv);
+ final MethodType methodType = MethodType.methodType(CallSite.class,
+ MethodHandles.Lookup.class, String.class, MethodType.class);
+ final Handle handle = new Handle(Opcodes.H_INVOKESTATIC,
+ this.getClass().getCanonicalName().replace('.', '/'),
+ "bootstrap", methodType.toMethodDescriptorString(), false);
+ mv.visitInvokeDynamicInsn("invoke", "()I", handle);
+ mv.visitInsn(Opcodes.IRETURN);
+ mv.visitMaxs(1, 0);
+ mv.visitEnd();
+
+ cw.visitEnd();
+
+ final byte[] original = cw.toByteArray();
+ assertEquals(42, run(className, original));
+
+ final byte[] instrumented = instrumenter.instrument(original,
+ className);
+ assertEquals(42, run(className, instrumented));
+ }
+
+ private static int run(final String className, final byte[] bytes)
+ throws ClassNotFoundException, NoSuchMethodException,
+ InvocationTargetException, IllegalAccessException {
+ final Integer result = (Integer) new TargetLoader()
+ .add(className, bytes).getMethod("run").invoke(null);
+ return result.intValue();
+ }
+
+ /**
+ * Adds code that triggers usage of
+ * {@link org.objectweb.asm.MethodWriter#COMPUTE_INSERTED_FRAMES} during
+ * instrumentation.
+ */
+ private static void addCauseOfResizeInstructions(final MethodVisitor mv) {
+ mv.visitInsn(Opcodes.ICONST_0);
+ mv.visitInsn(Opcodes.ICONST_1);
+ final Label target = new Label();
+ mv.visitJumpInsn(Opcodes.IFLE, target);
+ for (int i = 0; i < Short.MAX_VALUE; i++) {
+ mv.visitInsn(Opcodes.NOP);
+ }
+ mv.visitLabel(target);
+ }
+
+ public static CallSite bootstrap(final MethodHandles.Lookup caller,
+ final String name, final MethodType type) throws Exception {
+ return new ConstantCallSite(
+ caller.findStatic(BootstrapMethodReferenceTest.class,
+ "callTarget", MethodType.methodType(int.class)));
+ }
+
+ public static int callTarget() {
+ return 42;
+ }
+
+}
diff --git a/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/InterfaceDefaultMethodsTest.java b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/InterfaceDefaultMethodsTest.java
new file mode 100644
index 00000000..b047ceb8
--- /dev/null
+++ b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/InterfaceDefaultMethodsTest.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 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:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.test.validation.java8;
+
+import org.jacoco.core.test.validation.ValidationTestBase;
+import org.jacoco.core.test.validation.java8.targets.InterfaceDefaultMethodsTarget;
+
+/**
+ * Tests of static initializer and default methods in interfaces.
+ */
+public class InterfaceDefaultMethodsTest extends ValidationTestBase {
+
+ public InterfaceDefaultMethodsTest() {
+ super(InterfaceDefaultMethodsTarget.class);
+ }
+
+}
diff --git a/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/InterfaceOnlyDefaultMethodsTest.java b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/InterfaceOnlyDefaultMethodsTest.java
new file mode 100644
index 00000000..6915ec9f
--- /dev/null
+++ b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/InterfaceOnlyDefaultMethodsTest.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 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.java8;
+
+import org.jacoco.core.test.validation.ValidationTestBase;
+import org.jacoco.core.test.validation.java8.targets.InterfaceOnlyDefaultMethodsTarget;
+
+/**
+ * Tests of default methods in interfaces.
+ */
+public class InterfaceOnlyDefaultMethodsTest extends ValidationTestBase {
+
+ public InterfaceOnlyDefaultMethodsTest() {
+ super(InterfaceOnlyDefaultMethodsTarget.class);
+ }
+
+}
diff --git a/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/LambdaExpressionsTest.java b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/LambdaExpressionsTest.java
new file mode 100644
index 00000000..1128f701
--- /dev/null
+++ b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/LambdaExpressionsTest.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 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:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.test.validation.java8;
+
+import org.jacoco.core.test.validation.ValidationTestBase;
+import org.jacoco.core.test.validation.java8.targets.LambdaExpressionsTarget;
+
+/**
+ * Tests for different lambda expressions.
+ */
+public class LambdaExpressionsTest extends ValidationTestBase {
+
+ public LambdaExpressionsTest() {
+ super(LambdaExpressionsTarget.class);
+ }
+
+}
diff --git a/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/LambdaInInterfaceTest.java b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/LambdaInInterfaceTest.java
new file mode 100644
index 00000000..9e242400
--- /dev/null
+++ b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/LambdaInInterfaceTest.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 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:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.test.validation.java8;
+
+import org.jacoco.core.test.validation.ValidationTestBase;
+import org.jacoco.core.test.validation.java8.targets.LambdaInInterfaceTarget;
+
+/**
+ * Tests a constant with a lambda value in an interface.
+ */
+public class LambdaInInterfaceTest extends ValidationTestBase {
+
+ public LambdaInInterfaceTest() {
+ super(LambdaInInterfaceTarget.class);
+ }
+
+ @Override
+ protected void run(final Class<?> targetClass) throws Exception {
+ ((Runnable) targetClass.getField("RUN").get(null)).run();
+ }
+
+}
diff --git a/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/AnnotationOnLocalVariableTarget.java b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/AnnotationOnLocalVariableTarget.java
new file mode 100644
index 00000000..976825b7
--- /dev/null
+++ b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/AnnotationOnLocalVariableTarget.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 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.java8.targets;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This test target contains annotation on local variable.
+ */
+public class AnnotationOnLocalVariableTarget {
+
+ @Documented
+ @Retention(RetentionPolicy.CLASS)
+ @Target(ElementType.TYPE_USE)
+ @interface NonNull {
+ }
+
+ private static Object legacy() {
+ return new Object();
+ }
+
+ public static void main(String[] args) {
+ @NonNull
+ Object o = legacy(); // assertFullyCovered()
+ }
+
+}
diff --git a/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/BadCycleInterfaceTarget.java b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/BadCycleInterfaceTarget.java
new file mode 100644
index 00000000..24515a0b
--- /dev/null
+++ b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/BadCycleInterfaceTarget.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 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.java8.targets;
+
+import org.jacoco.core.test.validation.targets.Stubs;
+
+public class BadCycleInterfaceTarget {
+
+ public interface Base {
+ static final Object BASE_CONST = new Child() {
+ {
+ Stubs.logEvent("baseclinit"); // assertBaseClInit()
+ }
+ }.childDefaultMethod();
+
+ default void baseDefaultMethod() {
+ }
+ }
+
+ public interface Child extends Base {
+ static final Object CHILD_CONST = new Object() {
+ {
+ Stubs.logEvent("childclinit"); // assertFullyCovered()
+ }
+ };
+
+ default Object childDefaultMethod() {
+ Stubs.logEvent("childdefaultmethod"); // assertChildDefault()
+ return null;
+ }
+
+ static void childStaticMethod() {
+ Stubs.logEvent("childstaticmethod"); // assertFullyCovered()
+ }
+ }
+
+ public static void main(String[] args) {
+ Child.childStaticMethod();
+ }
+
+}
diff --git a/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/InterfaceDefaultMethodsTarget.java b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/InterfaceDefaultMethodsTarget.java
new file mode 100644
index 00000000..6b44830e
--- /dev/null
+++ b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/InterfaceDefaultMethodsTarget.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 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:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.test.validation.java8.targets;
+
+import static org.jacoco.core.test.validation.targets.Stubs.i1;
+
+/**
+ * This test target is an interface with a class initializer and default
+ * methods.
+ */
+public interface InterfaceDefaultMethodsTarget {
+
+ public static final int CONST = i1(); // assertFullyCovered()
+
+ default void m1() {
+ return; // assertFullyCovered()
+ }
+
+ default void m2() {
+ return; // assertNotCovered()
+ }
+
+ public class Impl implements InterfaceDefaultMethodsTarget {
+
+ public Impl() {
+ m1();
+ }
+ }
+
+ public static void main(String[] args) {
+ new Impl();
+ }
+
+}
diff --git a/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/InterfaceOnlyDefaultMethodsTarget.java b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/InterfaceOnlyDefaultMethodsTarget.java
new file mode 100644
index 00000000..bd50d433
--- /dev/null
+++ b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/InterfaceOnlyDefaultMethodsTarget.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 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.java8.targets;
+
+/**
+ * This test target is an interface with only default methods.
+ */
+public interface InterfaceOnlyDefaultMethodsTarget {
+
+ /* no <clinit>, only default methods: */
+
+ default void m1() {
+ return; // assertFullyCovered()
+ }
+
+ default void m2() {
+ return; // assertNotCovered()
+ }
+
+ public class Impl implements InterfaceOnlyDefaultMethodsTarget {
+
+ public Impl() {
+ m1();
+ }
+ }
+
+ public static void main(String[] args) {
+ new Impl();
+ }
+
+}
diff --git a/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/LambdaExpressionsTarget.java b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/LambdaExpressionsTarget.java
new file mode 100644
index 00000000..719237f5
--- /dev/null
+++ b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/LambdaExpressionsTarget.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 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:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.test.validation.java8.targets;
+
+import static org.jacoco.core.test.validation.targets.Stubs.exec;
+import static org.jacoco.core.test.validation.targets.Stubs.noexec;
+import static org.jacoco.core.test.validation.targets.Stubs.nop;
+
+/**
+ * This test target contains different lambda expressions.
+ */
+public class LambdaExpressionsTarget {
+
+ public static void main(String[] args) {
+
+ exec(() -> {
+ nop(); // assertFullyCovered()
+ });
+
+ noexec(() -> {
+ nop(); // assertNotCovered()
+ });
+
+ }
+
+}
diff --git a/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/LambdaInInterfaceTarget.java b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/LambdaInInterfaceTarget.java
new file mode 100644
index 00000000..0bafd437
--- /dev/null
+++ b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/targets/LambdaInInterfaceTarget.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2019 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:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.test.validation.java8.targets;
+
+import static org.jacoco.core.test.validation.targets.Stubs.nop;
+
+/**
+ * This test target builds a constant with a lambda value in an interface.
+ */
+public interface LambdaInInterfaceTarget {
+
+ public static final Runnable RUN = () -> {
+ nop(); // assertFullyCovered()
+ };
+
+}