Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
melix committed Feb 28, 2021
1 parent 0b1d5ed commit e06696a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.openjdk.jmh.generators.reflection.RFGeneratorSource;
import org.openjdk.jmh.util.FileUtils;

import javax.inject.Inject;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
Expand All @@ -36,7 +35,6 @@
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;

import static org.openjdk.jmh.generators.bytecode.JmhBytecodeGenerator.DEFAULT_GENERATOR_TYPE;
import static org.openjdk.jmh.generators.bytecode.JmhBytecodeGenerator.GENERATOR_TYPE_ASM;
Expand All @@ -57,8 +55,8 @@ public void execute() {
generatorType = DEFAULT_GENERATOR_TYPE;
}

Set<File> classpath = (Set<File>) params.getClasspath().getFiles();
Set<File> compiledBytecodeDirectories = (Set<File>) params.getClassesDirsToProcess().getFiles();
Set<File> classpath = params.getClasspath().getFiles();
Set<File> compiledBytecodeDirectories = params.getClassesDirsToProcess().getFiles();
Set<File> allFiles = new HashSet<>();
allFiles.addAll(classpath);
allFiles.addAll(compiledBytecodeDirectories);
Expand Down
9 changes: 3 additions & 6 deletions src/main/java/me/champeau/jmh/ParameterConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
*/
package me.champeau.jmh;

import groovy.lang.Binding;
import org.gradle.api.file.RegularFileProperty;
import org.gradle.api.provider.ListProperty;
import org.gradle.api.provider.MapProperty;
import org.gradle.api.provider.Provider;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -76,7 +74,7 @@ private static <T> void addOption(List<String> options, ListProperty<T> values,

private static <T> void addOption(List<String> options, final ListProperty<T> values, String option, final String separator) {
if (values.isPresent()) {
List<T> list = (List<T>) values.get();
List<T> list = values.get();
if (!list.isEmpty()) {
if (!option.isEmpty()) {
options.add("-" + option);
Expand All @@ -92,7 +90,7 @@ private static <T> void addOption(List<String> options, final ListProperty<T> va

private static <T> void addRepeatableOption(List<String> options, ListProperty<T> values, String option) {
if (values.isPresent()) {
List<T> listOfValues = (List<T>) values.get();
List<T> listOfValues = values.get();
for (Object value : listOfValues) {
options.add("-" + option);
options.add(String.valueOf(value));
Expand Down Expand Up @@ -124,10 +122,9 @@ private static void addFileOption(List<String> options, RegularFileProperty f, S

}

@SuppressWarnings("unchecked")
private static void addMapOption(List<String> options, MapProperty<String, ListProperty<String>> params, String option) {
if (params.isPresent()) {
Map<String, ListProperty<String>> map = (Map<String, ListProperty<String>>) params.get();
Map<String, ListProperty<String>> map = params.get();
map.forEach((key, listProperty) -> {
List<String> value = listProperty.get();
for (String str : value) {
Expand Down

0 comments on commit e06696a

Please sign in to comment.