Skip to content

Commit 9f5746b

Browse files
committed
Fix few style issues
1 parent ccab357 commit 9f5746b

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

tests/tck-build-logic/src/main/java/org/graalvm/internal/tck/ContributionTask.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public abstract class ContributionTask extends DefaultTask {
3535
private static final String BUILD_FILE = "build.gradle";
3636
private static final String USER_CODE_FILTER_FILE = "user-code-filter.json";
3737
private static final String REQUIRED_DOCKER_IMAGES_FILE = "required-docker-images.txt";
38+
3839
@Inject
3940
protected abstract ExecOperations getExecOperations();
4041

@@ -324,9 +325,7 @@ private void updateAllowedPackages(List<String> allowedPackages, boolean isAlrea
324325
}
325326

326327
private void addTests(Path originalTestsLocation){
327-
Path destination = testsDirectory.resolve("src")
328-
.resolve("test")
329-
.resolve("java");
328+
Path destination = testsDirectory.resolve("src").resolve("test").resolve("java");
330329
Path allTests = originalTestsLocation.resolve(".");
331330

332331
ensureFileBelongsToProject(destination);
@@ -369,7 +368,7 @@ private void addDockerImages(List<String> images) throws IOException {
369368
Files.createFile(destination);
370369
}
371370

372-
for (var image : images) {
371+
for (String image : images) {
373372
writeToFile(destination, image.concat(System.lineSeparator()), StandardOpenOption.APPEND);
374373
}
375374
}
@@ -386,7 +385,6 @@ private void addUserCodeFilterFile(List<String> packages) throws IOException {
386385

387386
DefaultPrettyPrinter prettyPrinter = new DefaultPrettyPrinter();
388387
prettyPrinter.indentArraysWith(DefaultIndenter.SYSTEM_LINEFEED_INSTANCE);
389-
390388
objectMapper.writer(prettyPrinter).writeValue(testsDirectory.resolve(USER_CODE_FILTER_FILE).toFile(), Map.of("rules", filterFileRules));
391389
}
392390

@@ -427,7 +425,7 @@ private void addAgentConfigBlock() {
427425
InteractiveTaskUtils.printUserInfo("Configuring agent block in: " + BUILD_FILE);
428426

429427
if (!Files.exists(buildFilePath) || !Files.isRegularFile(buildFilePath)) {
430-
throw new RuntimeException("Cannot add additional dependencies to " + buildFilePath + ". Please check if a " + BUILD_FILE + " exists on that location.");
428+
throw new RuntimeException("Cannot add agent block to " + buildFilePath + ". Please check if a " + BUILD_FILE + " exists on that location.");
431429
}
432430

433431

@@ -474,37 +472,37 @@ private void removeEmptyConfigFiles() throws IOException {
474472
List<CONFIG_FILES> remainingFiles = new LinkedList<>(Arrays.asList(CONFIG_FILES.values()));
475473

476474
Path resourceConfigPath = metadataDirectory.resolve(CONFIG_FILES.RESOURCE.get());
477-
ResourceConfigModel resourceConfig = objectMapper.readValue(new File(resourceConfigPath.toUri()), new TypeReference<>() {});
475+
ResourceConfigModel resourceConfig = objectMapper.readValue(resourceConfigPath.toFile(), new TypeReference<>() {});
478476
if (resourceConfig.isEmpty()) {
479477
removeConfigFile(resourceConfigPath, CONFIG_FILES.RESOURCE, remainingFiles);
480478
}
481479

482480
Path serializationConfigPath = metadataDirectory.resolve(CONFIG_FILES.SERIALIZATION.get());
483-
SerializationConfigModel serializationConfig = objectMapper.readValue(new File(serializationConfigPath.toUri()), new TypeReference<>() {});
481+
SerializationConfigModel serializationConfig = objectMapper.readValue(serializationConfigPath.toFile(), new TypeReference<>() {});
484482
if (serializationConfig.isEmpty()) {
485483
removeConfigFile(serializationConfigPath, CONFIG_FILES.SERIALIZATION, remainingFiles);
486484
}
487485

488486
Path jniConfigPath = metadataDirectory.resolve(CONFIG_FILES.JNI.get());
489-
List<Object> jniConfig = objectMapper.readValue(new File(jniConfigPath.toUri()), new TypeReference<>() {});
487+
List<Object> jniConfig = objectMapper.readValue(jniConfigPath.toFile(), new TypeReference<>() {});
490488
if (jniConfig.isEmpty()) {
491489
removeConfigFile(jniConfigPath, CONFIG_FILES.JNI, remainingFiles);
492490
}
493491

494492
Path proxyConfigPath = metadataDirectory.resolve(CONFIG_FILES.PROXY.get());
495-
List<Object> proxyConfig = objectMapper.readValue(new File(proxyConfigPath.toUri()), new TypeReference<>() {});
493+
List<Object> proxyConfig = objectMapper.readValue(proxyConfigPath.toFile(), new TypeReference<>() {});
496494
if (proxyConfig.isEmpty()) {
497495
removeConfigFile(proxyConfigPath, CONFIG_FILES.PROXY, remainingFiles);
498496
}
499497

500498
Path reflectConfigPath = metadataDirectory.resolve(CONFIG_FILES.REFLECTION.get());
501-
List<Object> reflectConfig = objectMapper.readValue(new File(reflectConfigPath.toUri()), new TypeReference<>() {});
499+
List<Object> reflectConfig = objectMapper.readValue(reflectConfigPath.toFile(), new TypeReference<>() {});
502500
if (reflectConfig.isEmpty()) {
503501
removeConfigFile(reflectConfigPath, CONFIG_FILES.REFLECTION, remainingFiles);
504502
}
505503

506504
Path predefinedClassesConfigPath = metadataDirectory.resolve(CONFIG_FILES.PREDEFINED_CLASSES.get());
507-
List<PredefinedClassesConfigModel> predefinedClassesConfig = objectMapper.readValue(new File(predefinedClassesConfigPath.toUri()), new TypeReference<>() {});
505+
List<PredefinedClassesConfigModel> predefinedClassesConfig = objectMapper.readValue(predefinedClassesConfigPath.toFile(), new TypeReference<>() {});
508506
if (predefinedClassesConfig.size() == 1) {
509507
if (predefinedClassesConfig.get(0).isEmpty()) {
510508
removeConfigFile(predefinedClassesConfigPath, CONFIG_FILES.PREDEFINED_CLASSES, remainingFiles);
@@ -513,7 +511,7 @@ private void removeEmptyConfigFiles() throws IOException {
513511

514512
Path agentExtractedPredefinedClasses = metadataDirectory.resolve("agent-extracted-predefined-classes");
515513
if (Files.exists(agentExtractedPredefinedClasses)) {
516-
File[] extractedPredefinedClasses = new File(agentExtractedPredefinedClasses.toUri()).listFiles();
514+
File[] extractedPredefinedClasses = agentExtractedPredefinedClasses.toFile().listFiles();
517515
if (extractedPredefinedClasses == null || extractedPredefinedClasses.length == 0) {
518516
ensureFileBelongsToProject(agentExtractedPredefinedClasses);
519517

@@ -543,7 +541,6 @@ private void trimIndexFile(Path index, List<CONFIG_FILES> remainingFiles) throws
543541
InteractiveTaskUtils.printUserInfo("Removing sufficient entries from: " + index);
544542
DefaultPrettyPrinter prettyPrinter = new DefaultPrettyPrinter();
545543
prettyPrinter.indentArraysWith(DefaultIndenter.SYSTEM_LINEFEED_INSTANCE);
546-
547544
objectMapper.writer(prettyPrinter).writeValue(index.toFile(), remainingFiles.stream().map(CONFIG_FILES::get).toList());
548545
}
549546

0 commit comments

Comments
 (0)