File tree Expand file tree Collapse file tree 2 files changed +61
-0
lines changed
org.jacoco.core.test.validation.java14/src/org/jacoco/core/test/validation/java14 Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Original file line number Diff line number Diff line change 1+ /*******************************************************************************
2+ * Copyright (c) 2009, 2020 Mountainminds GmbH & Co. KG and Contributors
3+ * This program and the accompanying materials are made available under
4+ * the terms of the Eclipse Public License 2.0 which is available at
5+ * http://www.eclipse.org/legal/epl-2.0
6+ *
7+ * SPDX-License-Identifier: EPL-2.0
8+ *
9+ * Contributors:
10+ * Evgeny Mandrikov - initial API and implementation
11+ *
12+ *******************************************************************************/
13+ package org .jacoco .core .test .validation .java14 ;
14+
15+ import org .jacoco .core .test .validation .ValidationTestBase ;
16+ import org .jacoco .core .test .validation .java14 .targets .InstanceofTarget ;
17+
18+ /**
19+ * Test of code coverage in {@link InstanceofTarget}.
20+ */
21+ public class InstanceofTest extends ValidationTestBase {
22+
23+ public InstanceofTest () {
24+ super (InstanceofTarget .class );
25+ }
26+
27+ }
Original file line number Diff line number Diff line change 1+ /*******************************************************************************
2+ * Copyright (c) 2009, 2020 Mountainminds GmbH & Co. KG and Contributors
3+ * This program and the accompanying materials are made available under
4+ * the terms of the Eclipse Public License 2.0 which is available at
5+ * http://www.eclipse.org/legal/epl-2.0
6+ *
7+ * SPDX-License-Identifier: EPL-2.0
8+ *
9+ * Contributors:
10+ * Evgeny Mandrikov - initial API and implementation
11+ *
12+ *******************************************************************************/
13+ package org .jacoco .core .test .validation .java14 .targets ;
14+
15+ import static org .jacoco .core .test .validation .targets .Stubs .nop ;
16+
17+ /**
18+ * This target exercises pattern matching for instanceof (JEP 305).
19+ */
20+ public class InstanceofTarget {
21+
22+ private static void ifInstanceof (Object e ) {
23+ /* See https://bugs.openjdk.java.net/browse/JDK-8237528 */
24+ if (e instanceof String s ) { // assertFullyCovered(1, 3)
25+ nop (s );
26+ }
27+ }
28+
29+ public static void main (String [] args ) {
30+ ifInstanceof (new Object ());
31+ ifInstanceof ("string" );
32+ }
33+
34+ }
You can’t perform that action at this time.
0 commit comments