Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ public abstract class AbstractJctCompiler<A extends AbstractJctCompiler<A>>
private boolean fixJvmModulePathMismatch;
private boolean inheritClassPath;
private boolean inheritModulePath;

@Deprecated(forRemoval = true, since = "0.6.0")
@SuppressWarnings("DeprecatedIsStillUsed")
private boolean inheritPlatformClassPath;

private boolean inheritSystemModulePath;
private LoggingMode fileManagerLoggingMode;
private AnnotationProcessorDiscovery annotationProcessorDiscovery;
Expand All @@ -87,6 +91,7 @@ public abstract class AbstractJctCompiler<A extends AbstractJctCompiler<A>>
*
* @param defaultName the printable default name to use for the compiler.
*/
@SuppressWarnings("removal")
protected AbstractJctCompiler(String defaultName) {
name = requireNonNull(defaultName, "name");
annotationProcessors = new ArrayList<>();
Expand Down Expand Up @@ -335,12 +340,16 @@ public A inheritModulePath(boolean inheritModulePath) {
return myself();
}

@Deprecated(forRemoval = true, since = "0.6.0")
@Override
@SuppressWarnings({"removal", "DeprecatedIsStillUsed"})
public boolean isInheritPlatformClassPath() {
return inheritPlatformClassPath;
}

@Deprecated(forRemoval = true, since = "0.6.0")
@Override
@SuppressWarnings({"removal", "DeprecatedIsStillUsed"})
public A inheritPlatformClassPath(boolean inheritPlatformClassPath) {
this.inheritPlatformClassPath = inheritPlatformClassPath;
return myself();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,15 @@ public interface JctCompiler<C extends JctCompiler<C, R>, R extends JctCompilati
boolean DEFAULT_INHERIT_MODULE_PATH = true;

/**
* Default setting for inclusion of the current platform class path ({@code true}).
* Default setting for inclusion of the current platform class path ({@code false}).
*
* @deprecated The platform class path has been mostly replaced by the use of system modules, so
* should not be used. This will be removed in v1.0.0, and has been changed to default to
* {@code false} as of v0.6.0
*/
boolean DEFAULT_INHERIT_PLATFORM_CLASS_PATH = true;
@Deprecated(forRemoval = true, since = "0.6.0")
@SuppressWarnings("DeprecatedIsStillUsed")
boolean DEFAULT_INHERIT_PLATFORM_CLASS_PATH = false;

/**
* Default setting for inclusion of the system module path ({@code true}).
Expand Down Expand Up @@ -727,7 +733,11 @@ default C target(SourceVersion target) {
* {@link #DEFAULT_INHERIT_PLATFORM_CLASS_PATH}.
*
* @return whether the platform class path is being inherited or not.
* @deprecated The platform class path has been mostly replaced by the use of system modules, so
* should not be used. This will be removed in v1.0.0.
*/
@Deprecated(forRemoval = true, since = "0.6.0")
@SuppressWarnings("DeprecatedIsStillUsed")
boolean isInheritPlatformClassPath();

/**
Expand All @@ -740,7 +750,10 @@ default C target(SourceVersion target) {
*
* @param inheritPlatformClassPath {@code true} to include it, or {@code false} to exclude it.
* @return this compiler object for further call chaining.
* @deprecated The platform class path has been mostly replaced by the use of system modules, so
* should not be used. This will be removed in v1.0.0.
*/
@Deprecated(forRemoval = true, since = "0.6.0")
C inheritPlatformClassPath(boolean inheritPlatformClassPath);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,12 @@ default ModuleContainerGroup getAnnotationProcessorModulePathGroup() {
*
* @return the location, or {@code null} if the location is not present in the file manager.
* @since 0.1.0
* @deprecated The platform class path has been mostly replaced by the use of system modules, so
* should not be used. This will be removed in v1.0.0.
*/
@Deprecated(forRemoval = true, since = "0.6.0")
@Nullable
@SuppressWarnings("DeprecatedIsStillUsed")
default PackageContainerGroup getPlatformClassPathGroup() {
return getPackageContainerGroup(StandardLocation.PLATFORM_CLASS_PATH);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@
*
* @author Ashley Scopes
* @since 0.0.1 (0.0.1-M7)
* @deprecated The platform class path has been mostly replaced by the use of system modules, so
* should not be used. This will be removed in v1.0.0.
*/
@API(since = "0.0.1", status = Status.STABLE)
public final class JctFileManagerJvmPlatformClassPathConfigurer implements
JctFileManagerConfigurer {
@Deprecated(forRemoval = true, since = "0.6.0")
@SuppressWarnings("DeprecatedIsStillUsed")
public final class JctFileManagerJvmPlatformClassPathConfigurer
implements JctFileManagerConfigurer {

private static final Logger LOGGER = LoggerFactory
.getLogger(JctFileManagerJvmPlatformClassPathConfigurer.class);
Expand All @@ -53,6 +57,7 @@ public JctFileManagerJvmPlatformClassPathConfigurer(JctCompiler<?, ?> compiler)
}

@Override
@SuppressWarnings("removal")
public JctFileManager configure(JctFileManager fileManager) {
LOGGER.debug("Configuring JVM platform class path");

Expand All @@ -69,6 +74,7 @@ public JctFileManager configure(JctFileManager fileManager) {
}

@Override
@SuppressWarnings("removal")
public boolean isEnabled() {
return compiler.isInheritPlatformClassPath();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public JctFileManager createFileManager(Workspace workspace) {
* @return the chain to use.
*/
@VisibleForTestingOnly
@SuppressWarnings("removal")
public JctFileManagerConfigurerChain createConfigurerChain(Workspace workspace) {
// The order here is important. Do not adjust it without testing extensively first!
return new JctFileManagerConfigurerChain()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,18 @@ public static List<Path> currentModulePathLocations() {
*
* @return a list across the paths.
*/
@Deprecated(forRemoval = true, since = "0.6.0")
@SuppressWarnings("DeprecatedIsStillUsed")
public static List<Path> currentPlatformClassPathLocations() {
var mxBean = ManagementFactory.getRuntimeMXBean();

if (mxBean.isBootClassPathSupported()) {
LOGGER.trace("Platform (boot) classpath is supported on this JVM, so will be inspected");
LOGGER.warn(
"Warning: platform (boot) class path locations were found on this JVM, but this "
+ "feature is deprecated for removal in v1.0.0 of the java-compiler-testing API. "
+ "Consider disabling platform classpath discovery explicitly to prevent tests "
+ "having differing behaviour for v1.0.0."
);
return createPaths(mxBean.getBootClassPath());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,11 @@ default void addAnnotationProcessorPathModule(String moduleName, Path path) {
* @throws IllegalArgumentException if the path does not exist.
* @see #addPackage(Location, Path)
* @see #createPlatformClassPathPackage()
* @deprecated The platform class path has been mostly replaced by the use of system modules, so
* should not be used. This will be removed in v1.0.0.
*/
@Deprecated(forRemoval = true, since = "0.6.0")
@SuppressWarnings("DeprecatedIsStillUsed")
default void addPlatformClassPathPackage(Path path) {
addPackage(StandardLocation.PLATFORM_CLASS_PATH, path);
}
Expand Down Expand Up @@ -756,7 +760,11 @@ default ManagedDirectory createAnnotationProcessorPathModule(String moduleName)
* @return the created test directory.
* @see #createPackage(Location)
* @see #addPlatformClassPathPackage(Path)
* @deprecated The platform class path has been mostly replaced by the use of system modules, so
* should not be used. This will be removed in v1.0.0.
*/
@Deprecated(forRemoval = true, since = "0.6.0")
@SuppressWarnings("DeprecatedIsStillUsed")
default ManagedDirectory createPlatformClassPathPackage() {
return createPackage(StandardLocation.PLATFORM_CLASS_PATH);
}
Expand Down Expand Up @@ -850,7 +858,7 @@ default List<? extends PathRoot> getClassOutputModule(String moduleName) {
* Get the module path roots for {@link StandardLocation#CLASS_OUTPUT class outputs}.
*
* @return the roots in a map of module names to lists of roots, or an empty map if none were
* found.
* found.
* @since 0.1.0
*/
default Map<String, List<? extends PathRoot>> getClassOutputModules() {
Expand Down Expand Up @@ -884,7 +892,7 @@ default List<? extends PathRoot> getSourceOutputModule(String moduleName) {
* Get the module path roots for {@link StandardLocation#SOURCE_OUTPUT source outputs}.
*
* @return the roots in a map of module names to lists of roots, or an empty map if none were
* found.
* found.
* @since 0.1.0
*/
default Map<String, List<? extends PathRoot>> getSourceOutputModules() {
Expand Down Expand Up @@ -939,7 +947,7 @@ default List<? extends PathRoot> getAnnotationProcessorPathModule(String moduleN
* {@link StandardLocation#ANNOTATION_PROCESSOR_MODULE_PATH annotation processor module path}.
*
* @return the roots in a map of module names to lists of roots, or an empty map if none were
* found.
* found.
* @since 0.1.0
*/
default Map<String, List<? extends PathRoot>> getAnnotationProcessorPathModules() {
Expand Down Expand Up @@ -985,7 +993,7 @@ default List<? extends PathRoot> getNativeHeaderOutputModule(String moduleName)
* {@link StandardLocation#NATIVE_HEADER_OUTPUT native header outputs}.
*
* @return the roots in a map of module names to lists of roots, or an empty map if none were
* found.
* found.
* @since 0.1.0
*/
default Map<String, List<? extends PathRoot>> getNativeHeaderOutputModules() {
Expand All @@ -1008,7 +1016,7 @@ default List<? extends PathRoot> getSourcePathModule(String moduleName) {
* {@link StandardLocation#MODULE_SOURCE_PATH module source paths}.
*
* @return the roots in a map of module names to lists of roots, or an empty map if none were
* found.
* found.
* @since 0.1.0
*/
default Map<String, List<? extends PathRoot>> getSourcePathModules() {
Expand All @@ -1031,7 +1039,7 @@ default List<? extends PathRoot> getUpgradeModulePathModule(String moduleName) {
* {@link StandardLocation#UPGRADE_MODULE_PATH upgrade module paths}.
*
* @return the roots in a map of module names to lists of roots, or an empty map if none were
* found.
* found.
* @since 0.1.0
*/
default Map<String, List<? extends PathRoot>> getUpgradeModulePathModules() {
Expand All @@ -1053,7 +1061,7 @@ default List<? extends PathRoot> getSystemModulePathModule(String moduleName) {
* Get the module path roots for the {@link StandardLocation#SYSTEM_MODULES system modules}.
*
* @return the roots in a map of module names to lists of roots, or an empty map if none were
* found.
* found.
* @since 0.1.0
*/
default Map<String, List<? extends PathRoot>> getSystemModulePathModules() {
Expand All @@ -1075,7 +1083,7 @@ default List<? extends PathRoot> getModulePathModule(String moduleName) {
* Get the module path roots for the {@link StandardLocation#MODULE_PATH module paths}.
*
* @return the roots in a map of module names to lists of roots, or an empty map if none were
* found.
* found.
* @since 0.1.0
*/
default Map<String, List<? extends PathRoot>> getModulePathModules() {
Expand All @@ -1098,7 +1106,7 @@ default List<? extends PathRoot> getPatchModulePathModule(String moduleName) {
* {@link StandardLocation#PATCH_MODULE_PATH patch module paths}.
*
* @return the roots in a map of module names to lists of roots, or an empty map if none were
* found.
* found.
* @since 0.1.0
*/
default Map<String, List<? extends PathRoot>> getPatchModulePathModules() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ void constructorInitialisesInheritModulePathToDefaultValue() {

@DisplayName("constructor initialises inheritPlatformClassPath to default value")
@Test
@SuppressWarnings("removal")
void constructorInitialisesInheritPlatformClassPathToDefaultValue() {
// Then
assertThatCompilerField("inheritPlatformClassPath")
Expand Down Expand Up @@ -1292,6 +1293,7 @@ void inheritModulePathReturnsTheCompiler() {
@DisplayName(".isInheritPlatformClassPath() returns the expected values")
@ValueSource(booleans = {true, false})
@ParameterizedTest(name = "for inheritPlatformClassPath = {0}")
@SuppressWarnings("removal")
void isInheritPlatformClassPathReturnsExpectedValue(boolean expected) {
// Given
setFieldOnCompiler("inheritPlatformClassPath", expected);
Expand All @@ -1307,6 +1309,7 @@ class InheritPlatformClassPathTests {
@DisplayName(".inheritPlatformClassPath(...) sets the expected values")
@ValueSource(booleans = {true, false})
@ParameterizedTest(name = "for inheritPlatformClassPath = {0}")
@SuppressWarnings("removal")
void inheritPlatformClassPathSetsExpectedValue(boolean expected) {
// When
compiler.inheritPlatformClassPath(expected);
Expand All @@ -1317,6 +1320,7 @@ void inheritPlatformClassPathSetsExpectedValue(boolean expected) {

@DisplayName(".inheritPlatformClassPath(...) returns the compiler")
@Test
@SuppressWarnings("removal")
void inheritPlatformClassPathReturnsTheCompiler() {
// When
var result = compiler.inheritPlatformClassPath(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ void getAnnotationProcessorModulePathGroupMakesTheExpectedCall(ModuleContainerGr
@DisplayName(".getPlatformClassPathGroup() makes the expected call")
@MethodSource("outputContainerGroupResults")
@ParameterizedTest(name = "when internal getter returns {0}")
@SuppressWarnings("removal")
void getPlatformClassPathGroupMakesTheExpectedCall(PackageContainerGroup expected) {
// Given
when(fileManager.getPlatformClassPathGroup()).thenCallRealMethod();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
*/
@DisplayName("JctFileManagerJvmPlatformClassPathConfigurer tests")
@ExtendWith(MockitoExtension.class)
@SuppressWarnings("removal")
class JctFileManagerJvmPlatformClassPathConfigurerTest {

@Mock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ void createdFileManagersAreTransformedByTheConfigurerChain() {

@DisplayName("The configurer chain uses the expected configurers")
@Test
@SuppressWarnings("removal")
void createdFileManagersAreReturnedAsTheResultFromTheConfigurerChain() {
// When
var configurerChain = factory.createConfigurerChain(workspace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ void currentModulePathLocationsReturnsTheClassPathLocationsThatExist() throws IO

@DisplayName("currentPlatformClassPathLocations() returns the class path locations that exist")
@Test
@SuppressWarnings("removal")
void currentPlatformClassPathLocationsReturnsTheClassPathLocationsThatExist() throws IOException {
// Given
try (
Expand All @@ -163,6 +164,7 @@ void currentPlatformClassPathLocationsReturnsTheClassPathLocationsThatExist() th

@DisplayName("currentPlatformClassPathLocations() returns empty when boot path not supported")
@Test
@SuppressWarnings("removal")
void currentPlatformClassPathLocationsReturnsEmptyWhenBootPathNotSupported() {
// Given
try (var mx = new MockedMxBean<>(ManagementFactory::getRuntimeMXBean, RuntimeMXBean.class)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ void addAnnotationProcessorPathModuleCallsAddModule() {

@DisplayName(".addPlatformClassPathPackage(Path) calls addPackage(PLATFORM_CLASS_PATH, Path)")
@Test
@SuppressWarnings("removal")
void addPlatformClassPathPackageCallsAddPackage() {
// Given
doCallRealMethod().when(workspace).addPlatformClassPathPackage(any());
Expand Down Expand Up @@ -470,6 +471,7 @@ void createAnnotationProcessorPathModuleCallsCreateModule() {

@DisplayName(".createPlatformClassPathPackage() calls createPackage(PLATFORM_CLASS_PATH)")
@Test
@SuppressWarnings("removal")
void createPlatformClassPathPackageCallsCreatePackage() {
// Given
doCallRealMethod().when(workspace).createPlatformClassPathPackage();
Expand Down