| 1 | /* |
| 2 | * Copyright 2015-2024 the original author or authors. |
| 3 | * |
| 4 | * All rights reserved. This program and the accompanying materials are |
| 5 | * made available under the terms of the Eclipse Public License v2.0 which |
| 6 | * accompanies this distribution and is available at |
| 7 | * |
| 8 | * https://www.eclipse.org/legal/epl-v20.html |
| 9 | */ |
| 10 | |
| 11 | package org.junit.jupiter.api.extension; |
| 12 | |
| 13 | import static org.apiguardian.api.API.Status.STABLE; |
| 14 | |
| 15 | import org.apiguardian.api.API; |
| 16 | |
| 17 | /** |
| 18 | * Marker interface for all extensions. |
| 19 | * |
| 20 | * <p>An {@code Extension} can be registered <em>declaratively</em> via |
| 21 | * {@link ExtendWith @ExtendWith}, <em>programmatically</em> via |
| 22 | * {@link RegisterExtension @RegisterExtension}, or <em>automatically</em> via |
| 23 | * the {@link java.util.ServiceLoader} mechanism. For details on the latter, |
| 24 | * consult the User Guide. |
| 25 | * |
| 26 | * <h2>Constructor Requirements</h2> |
| 27 | * |
| 28 | * <p>Extension implementations must have a <em>default constructor</em> if |
| 29 | * registered via {@code @ExtendWith} or the {@code ServiceLoader}. When |
| 30 | * registered via {@code @ExtendWith} the default constructor is not required |
| 31 | * to be {@code public}. When registered via the {@code ServiceLoader} the |
| 32 | * default constructor must be {@code public}. When registered via |
| 33 | * {@code @RegisterExtension} the extension's constructors typically must be |
| 34 | * {@code public} unless the extension provides {@code static} factory methods |
| 35 | * or a builder API as an alternative to constructors. |
| 36 | * |
| 37 | * @since 5.0 |
| 38 | */ |
| 39 | @API(status = STABLE, since = "5.0") |
| 40 | public interface Extension { |
| 41 | } |