Intrinsify j.l.i.ConstantBootstraps?

Johannes Kuhn info at
Sat Sep 21 23:16:33 UTC 2019


just watched Brian Goetz' talk "Java Language Futures: 2019 Edition"
where he said the best kind of feedback is telling you things you didn't
know. I think this might be worth a shot.

I recently discovered that instead of using Lookup.findVarHandle(...) in
a static block; surrounded with try-catch, I could write

private static final VarHandle FOO = ConstantBootstraps.fieldVarHandle(
MethodHandles.lookup(), "foo", VarHandle.class, Test.class, int.class);

The downside is the mention of VarHandle.class in the arguments, but
this downside is more than acceptable because it removes a static block
with a try-catch.

I now wonder if it might be a good idea to intrinsify the methods in

I did a search on GitHub and found only one such use: in the JDK itself[1].

I hope to maybe start an interesting discussion about this.

For example, MethodHandles.lookup() is not a constant, but I like the
idea to pass it as explicit argument to an intrinsified ldc() method
from JEP 303.


More information about the amber-spec-observers mailing list