Summary
shortenFullyQualifiedTypes shortens a fully-qualified reference into the simple name of a type declared in the same compilation unit. The result does not compile.
Reproducer
spotless-gradle-plugin 8.10.1, with shortenFullyQualifiedTypes as one of the steps:
Test example 1:
import java.lang.management.BufferPoolMXBean;
import java.util.List;
public class ClassA
{
public void methodA()
{
final List<BufferPoolMXBean> pools = java.lang.management.ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class);
}
}
Actual behavior of example 1:
Type java.lang.management.ManagementFactory used in code is not shortened.
Test example 2:
public class classB {
final List<CustomTypeProperty> connectionProps = List.of(new CustomTypeProperty().name("host")
.type(pkg.models.CustomTypeProperty.TypeEnum.STRING));
}
Actual behavior of example 2:
Type pkg.models.CustomTypeProperty used in code is not shortened.
Expected behavior
All FQT should be shortened.
FYI @maxandersen
Summary
shortenFullyQualifiedTypesshortens a fully-qualified reference into the simple name of a type declared in the same compilation unit. The result does not compile.Reproducer
spotless-gradle-plugin8.10.1, withshortenFullyQualifiedTypesas one of the steps:Test example 1:
Actual behavior of example 1:
Type
java.lang.management.ManagementFactoryused in code is not shortened.Test example 2:
Actual behavior of example 2:
Type
pkg.models.CustomTypePropertyused in code is not shortened.Expected behavior
All FQT should be shortened.
FYI @maxandersen