diff --git a/src/main/java/org/codehaus/mojo/exec/ExecMojo.java b/src/main/java/org/codehaus/mojo/exec/ExecMojo.java index 7bc45514..76450313 100644 --- a/src/main/java/org/codehaus/mojo/exec/ExecMojo.java +++ b/src/main/java/org/codehaus/mojo/exec/ExecMojo.java @@ -38,6 +38,7 @@ import java.util.Properties; import java.util.Set; import java.util.TreeSet; +import java.util.function.Consumer; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; import java.util.jar.Manifest; @@ -434,7 +435,7 @@ else if (useMavenLogger) getLog().debug("Will redirect program output to Maven logger"); final String parentThreadName = Thread.currentThread().getName(); final String logSuffix = "[" + parentThreadName + "] "; - Invokable mavenOutRedirect = new Invokable() + Consumer mavenOutRedirect = new Consumer() { @Override @@ -450,7 +451,7 @@ public void accept(String logMessage) } } }; - Invokable mavenErrRedirect = new Invokable() + Consumer mavenErrRedirect = new Consumer() { @Override diff --git a/src/main/java/org/codehaus/mojo/exec/Invokable.java b/src/main/java/org/codehaus/mojo/exec/Invokable.java deleted file mode 100644 index 466fd4b2..00000000 --- a/src/main/java/org/codehaus/mojo/exec/Invokable.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.codehaus.mojo.exec; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * A simple Java 7 pseudo-class based on the Java 8 {@code Consumer} class. Can and should be - * deleted once this project moves to a minimum execution environment of Java 8+. - * - * @param - The type of object that will be acted upon. - * @since 3.0.0 - */ -interface Invokable { - - /** - * Takes some object and acts upon it. - * - * @param object - The object that will be taken - */ - void accept(T object); -} diff --git a/src/main/java/org/codehaus/mojo/exec/LineRedirectOutputStream.java b/src/main/java/org/codehaus/mojo/exec/LineRedirectOutputStream.java index 4cfc52f3..60cd2fba 100644 --- a/src/main/java/org/codehaus/mojo/exec/LineRedirectOutputStream.java +++ b/src/main/java/org/codehaus/mojo/exec/LineRedirectOutputStream.java @@ -20,10 +20,11 @@ */ import java.io.OutputStream; +import java.util.function.Consumer; /** * An output stream that captures one line of output at a time, and then - * redirects that line to some {@link Invokable} to act upon as it pleases. This + * redirects that line to some {@link Consumer} to act upon as it pleases. This * class is not thread safe and expects to have only one active writer consuming * it at any given time. * @@ -32,9 +33,9 @@ class LineRedirectOutputStream extends OutputStream { private StringBuilder currentLine = new StringBuilder(); - private final Invokable linePrinter; + private final Consumer linePrinter; - public LineRedirectOutputStream(Invokable linePrinter) { + public LineRedirectOutputStream(Consumer linePrinter) { this.linePrinter = linePrinter; }