Make fields final

Closes gh-33537
This commit is contained in:
Moritz Halbritter
2022-12-16 14:28:44 +01:00
parent 216d15997a
commit 725337f976
285 changed files with 445 additions and 437 deletions

View File

@@ -71,7 +71,7 @@ public class ImagePackager extends Packager {
*/
private static class DelegatingJarWriter extends AbstractJarWriter {
private BiConsumer<ZipEntry, EntryWriter> exporter;
private final BiConsumer<ZipEntry, EntryWriter> exporter;
DelegatingJarWriter(BiConsumer<ZipEntry, EntryWriter> exporter) {
this.exporter = exporter;

View File

@@ -31,7 +31,7 @@ import org.springframework.util.StringUtils;
*/
public class JavaExecutable {
private File file;
private final File file;
public JavaExecutable() {
String javaHome = System.getProperty("java.home");

View File

@@ -37,7 +37,7 @@ public class RunProcess {
private static final long JUST_ENDED_LIMIT = 500;
private File workingDirectory;
private final File workingDirectory;
private final String[] command;

View File

@@ -722,9 +722,9 @@ abstract class AbstractPackagerTests<P extends Packager> {
private static final Layer DEFAULT_LAYER = new Layer("default");
private Set<Layer> layers = new LinkedHashSet<>();
private final Set<Layer> layers = new LinkedHashSet<>();
private Map<String, Layer> libraries = new HashMap<>();
private final Map<String, Layer> libraries = new HashMap<>();
TestLayers() {
this.layers.add(DEFAULT_LAYER);

View File

@@ -30,7 +30,7 @@ import static org.mockito.Mockito.mock;
*/
class ImplicitLayerResolverTests {
private Layers layers = Layers.IMPLICIT;
private final Layers layers = Layers.IMPLICIT;
@Test
void iteratorReturnsLayers() {

View File

@@ -60,7 +60,7 @@ class SizeCalculatingEntryWriterTests {
private static class TestEntryWriter implements EntryWriter {
private byte[] bytes;
private final byte[] bytes;
TestEntryWriter(int size) {
this.bytes = new byte[size];