Flag missing with "requires java.base"?

Andrew Dinn adinn at redhat.com
Wed Aug 3 09:03:33 UTC 2016


On 02/08/16 18:12, Paul Benedict wrote:
> Correct me if wrong, but it seems there is no universal way to flag
> something as compiler/tool generated. My take away from Alex's comments
> is that ACC_SYNTHETIC is very much concerned with
> implicitness/explicitness... but why? I still don't understand why it
> *must* be concerned anything like that. I'd just like to state that
> definition sounds overloaded to me.

There is indeed no way to flag something as compiler/tool generated. The
thread I cited was about exactly that. AOP (you may or not remember what
that that tool did but it doesn't really matter) was flagging generated
methods as synthetic and the explanation I received when this led to
subsequent errors was that this was invalid; such flagging is the
prerogative of the compiler for its own narrowly defined (and, as Alex
was so keen to point out, quite well-defined) purposes. You may want
that flag to mean something else but it doesn't. You may argue that it
ought mean something else but that is not going to happen unless i) you
can arrive at a consensus that this meaning is better than the current
one and, crucially, ii) you can guarantee that changing javac and other
tools to adopt your new meaning is not going to cause legacy problems.

> Furthermore, I think the definition of ACC_MANDATED is overloaded too.
> If the JLS mandates a construct, it must be in the class file -- yet why
> does the means matter? I prose the flag should mean no more than a
> mandate. It's mandated so it must exist -- how it got there is
> irrelevant to me with regard to this flag.

As above?

> So doesn't anyone (Alex? Andrew?) find value in universally specifying
> something was generated? That's what I thought ACC_SYNTHETIC could be
> used for. If there is pushback on this idea, is there a universal way
> that I have neglected to see?

I am sure it /might/ be useful to be able to specify this but I have not
actually found a need for it myself. Rather than hijacking SYNTHETIC I
suggest it would be much better to introduce a new GENERATED
class/method attribute indicating that the relevant object was generated
by a bytecode transformer tool (possibly with associated data
identifying the tool and, perhaps, its version). In the case of a method
it would also be useful if the attribute could be used to record
modification of bytecode (or at least injection) by detailing specific
bytecode segments introduced by a tool. Of course, this would require
bytecode transformer tools to update such indices (underlying libraries
like ASM or Javassist might be able to help with that).

regards,


Andrew Dinn
-----------
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander


More information about the jigsaw-dev mailing list