On Jul 6, 2017, at 1:02 PM, Paul Sandoz <paul.san...@oracle.com> wrote: > > In terms of what we have today we could easily do: > > // lookup must have private access to the lookup class, which becomes the > “host” class > Class<?> defineAnonymousClass(byte[] data) > > is that ending gaining too much?
Sure, that's OK, or else an 'isAnonymous' optional argument. The difficult part here is specifying exactly what is a "host class". > That still leaves the possibility of another method in the future say: > > Class<?> defineClass(boolean isAnon, byte[] data, Object constant) > > That’s a little fuzzy since it’s not clear to me how the generated class > locates the constant (synthetic static final field of known name? substitute > the last entry in the CP if appropriately defined in the class bytes as > substitutable?). On Jul 6, 2017, at 1:12 PM, Remi Forax <fo...@univ-mlv.fr> wrote: > > Lookup.getConstant() with a private Lookup ? Exactly, an ad hoc API point like that. Would fit nicely with a BSM and CONSTANT_ConstantDynamic and ldc. Or a private static final and code in <clinit>. If you need several of them, a Map<String,Object> would be your friend. This doesn't need to be baked into the Lookup API, just a design pattern, supported nicely by a slightly different BSM. — John