blob: 941f3dd1b30bb3b2c01f95f528d00c1124da2f65 [file] [log] [blame]
package com.facebook.buck.example;
import java.util.Set;
public final class A<T> {
// A field that defines a constant, but which is private and should be missing.
private final static String HIDDEN = "yo";
// But we do expect this constant to contain the value of "HIDDEN".
public final static String VISIBLE = HIDDEN + " another literal ";
// We expect LOCK, but no constant value declaration.
public static final Object LOCK = new Object();
// A constant. Because the value of LOCK.toString() is calculated at runtime, the value is
// omitted.
public final static String VISIBLE_BUT_WEIRD = HIDDEN + LOCK.toString();
public void doSomething(String... args) {
}
public void foo(Object... foos) {
}
public void foo(Object[] foo, Object... foos) {
}
// Weird classes defined in methods should not leak out into the ABI.
public Runnable getThing() {
class Example implements Runnable {
public long LONG_NUMBER = Long.MAX_VALUE;
@Override
public void run() { }
}
return new Example();
}
// Ensure that we can nest generics.
Set<Set<String>> someStrings;
// And that we correctly report generics when solely defined on the method.
<X> X getThing(T value) { return null; }
// A constant, out of order from the others, that should have the value included.
protected final static int MAGIC = 42;
// We should keep the deprecated annotation.
@Deprecated
protected T doSomethingElse() {
System.out.println('c'); return null;
}
// There's some debate about whether to include overridden methods from parent classes.
// Include them for for now.
@Override public String toString() { return super.toString() + "42"; }
// A nested inner class
private static class Inner {
public static final int MEANING_OF_LIFE = 42;
public String getFoo() { return "foo"; }
}
public Inner getInner() { return new Inner(); }
// Demonstrate nesting to an arbitrary depth
public static class Outer {
public class InstanceOuter {
Outer getOuter() { return Outer.this; }
}
Outer getOuter() { return new Outer(); }
}
}