Guava’s Preconditions
class is defined as:
public final class Preconditions {
private Preconditions() {}
private interface Impossible {}
// (static methods that are not using Impossible)
}
I understand that the unused private constructor prevents the class from being instantiated, but I’ve never seen an unused private interface before. It’s not a marker interface either, as there is no class that implements Impossible
. Does this interface have any purpose?
Guava's source code is mirrored from within Google, and some APIs are filtered out of the open-source release. Impossible
is used in some of those. (Presumably it should also be filtered out, but was missed.)