Remove unnecessary F0, F1 and Maybe

`F0`, `F1` and `Maybe` have become useless since Java 8 introduced
`Supplier`, `Function` and `Optional` in the default Java 8 standard
library.

Therefore, they are not necessary anymore. This change is required to
change some Zinc's and sbt APIs. They are not widely used, so the
changes will be small.
This commit is contained in:
jvican
2017-07-14 15:56:34 +02:00
parent fe7743878f
commit 18a73db57d
6 changed files with 45 additions and 108 deletions
@@ -1,9 +0,0 @@
/* sbt -- Simple Build Tool
* Copyright 2009 Mark Harrah
*/
package xsbti;
public interface F0<T>
{
T apply();
}
@@ -1,6 +0,0 @@
package xsbti;
public interface F1<A1, R>
{
R apply(A1 a1);
}
@@ -3,11 +3,12 @@
*/
package xsbti;
public interface Logger
{
void error(F0<String> msg);
void warn(F0<String> msg);
void info(F0<String> msg);
void debug(F0<String> msg);
void trace(F0<Throwable> exception);
import java.util.function.Supplier;
public interface Logger {
void error(Supplier<String> msg);
void warn(Supplier<String> msg);
void info(Supplier<String> msg);
void debug(Supplier<String> msg);
void trace(Supplier<Throwable> exception);
}
@@ -1,48 +0,0 @@
/* sbt -- Simple Build Tool
* Copyright 2008, 2009, 2010 Mark Harrah
*/
package xsbti;
/** Intended as a lightweight carrier for scala.Option. */
public abstract class Maybe<t> {
private Maybe() {}
@SuppressWarnings("unchecked")
public static <s> Maybe<s> nothing() { return (Maybe<s>) Nothing.INSTANCE; }
public static <s> Maybe<s> just(final s v) { return new Just<s>(v); }
public static final class Just<s> extends Maybe<s> {
private final s v;
public Just(final s v) { this.v = v; }
public s value() { return v; }
public boolean isDefined() { return true; }
public s get() { return v; }
public int hashCode() { return 17 + (v == null ? 0 : v.hashCode()); }
public String toString() { return "Maybe.just(" + v + ")"; }
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof Just<?>)) return false;
final Just<?> that = (Just<?>) o;
return v == null ? that.v == null : v.equals(that.v);
}
}
public static final class Nothing extends Maybe<Object> {
public static final Nothing INSTANCE = new Nothing();
private Nothing() { }
public boolean isDefined() { return false; }
public Object get() { throw new UnsupportedOperationException("nothing.get"); }
public int hashCode() { return 1; }
public String toString() { return "Maybe.nothing()"; }
public boolean equals(Object o) { return this == o || o != null && o instanceof Nothing; }
}
public final boolean isEmpty() { return !isDefined(); }
public abstract boolean isDefined();
public abstract t get();
}