java8新特性方法引用::的调用关系是什么
this::configure 没有返回值,怎么作为参数传给方法的
package org.springframework.boot.build;
import java.util.ArrayList;
import java.util.List;
import org.gradle.api.Project;
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions;
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile;
class KotlinConventions {
void apply(Project project) {
project.getPlugins()
.withId("org.jetbrains.kotlin.jvm",
(plugin) -> project.getTasks().withType(KotlinCompile.class, this::configure));
}
private void configure(KotlinCompile compile) {
KotlinJvmOptions kotlinOptions = compile.getKotlinOptions();
kotlinOptions.setApiVersion("1.7");
kotlinOptions.setLanguageVersion("1.7");
kotlinOptions.setJvmTarget("17");
kotlinOptions.setAllWarningsAsErrors(true);
List<String> freeCompilerArgs = new ArrayList<>(compile.getKotlinOptions().getFreeCompilerArgs());
freeCompilerArgs.add("-Xsuppress-version-warnings");
compile.getKotlinOptions().setFreeCompilerArgs(freeCompilerArgs);
}
}
public class DefaultDomainObjectCollection<T> extends AbstractCollection<T> implements DomainObjectCollection<T>, WithEstimatedSize, WithMutationGuard {
.....
public <S extends T> DomainObjectCollection<S> withType(Class<S> type, Action<? super S> configureAction) {
this.assertMutable("withType(Class, Action)");
DomainObjectCollection<S> result = this.withType(type);
result.all(configureAction);
return result;
}
.....