diff options
Diffstat (limited to 'tests/bugs198/github_68/Application.java')
-rw-r--r-- | tests/bugs198/github_68/Application.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/bugs198/github_68/Application.java b/tests/bugs198/github_68/Application.java new file mode 100644 index 000000000..47eeaa4f4 --- /dev/null +++ b/tests/bugs198/github_68/Application.java @@ -0,0 +1,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"); + } +} |