aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs198/github_68/Application.java
blob: 47eeaa4f46275176a0f8b04cf03162ed6f3b3cf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import java.lang.invoke.ConstantBootstraps;
import java.util.concurrent.Callable;

public class Application {
  public static void main(String[] args) throws Exception {
    Callable<?> first = new CondyCallable();
    Callable<?> second = new CondyCallable();
    if (!(first.call() == second.call()))
      throw new RuntimeException("Non-identical ConstantDynamic values (should never happen)");
  }

  /**
   * Class {@link CondyCallable} dispatches to this constructor via {@link ConstantBootstraps#invoke}
   * in order to initialise a dynamic constant value. The constructor should be executed exactly once,
   * no matter how many times {@link CondyCallable#call} is called.
   */
  public Application() {
    System.out.println("Sample instance created");
  }
}