> And also, methods and fields can be obfuscated while strings cannot.
> So being able to call getName() on a Field has a big security advantage
> over using raw reflection.
> > And also, methods and fields can be obfuscated while strings cannot.
> > So being able to call getName() on a Field has a big security advantage
[quoted text clipped - 4 lines]
> I don't think that it would permit more thorough obfuscation that is currently
> possible.
Certainly, this would be the case initially. Eventually, though, it
would gain its own bytecode mechanisms, much like class literals.
> BTW, the syntax you propose would not work for [...]
There are certainly many things wrong with the syntax. Certainly they
could be solved, though. It will be a challenge to find something
sensible that is usable for overloaded methods/constructors, though. Is
that what you meant to say?

Signature
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
Chris Uppal - 11 Jan 2006 11:54 GMT
> > Since this feature -- if it were added -- would certainly be
> > implemented by the compiler generating traditional (string-based)
[quoted text clipped - 3 lines]
> Certainly, this would be the case initially. Eventually, though, it
> would gain its own bytecode mechanisms, much like class literals.
Maybe... I assume you mean that the ldc instruction could be extended (again)
to accept the index of a Methodfef_Info, Fieldref_Info, or Interfaceref_info.
I don't think it could possibly be worth the JVM changes myself (but then I
think Sun were stupid to make JVM changes for class literals).
> > BTW, the syntax you propose would not work for [...]
>
> There are certainly many things wrong with the syntax. Certainly they
> could be solved, though. It will be a challenge to find something
> sensible that is usable for overloaded methods/constructors, though. Is
> that what you meant to say?
No. I agree that it would be a challenge to create a syntax which would
distinguish between overloaded members (especially members overloaded only on
[return-]type ;-). But in fact all I had in mind was that the proposed syntax
(just drop the (...) bit to get the "method" without calling it) would not work
for fields (obviously) or constructors.
Incidentally, another problem that would have to be sorted out is what
expressions like
Method m = "a string".notifyAll;
(using the OP's syntax) would mean. Would they be permitted or not ? Would
the compiler be required to recognise that String didn't override notifyAll()
and convert the reference into a reference to the method object for
Object.notifyAll() ? Or would it be required to follow the pattern established
by method invocation where the compiler is required to generate code referring
to String.notifyAll() (as described in the binary compatibility stuff). Does
the fact that Object.notifyAll() is declared final affect this issue ? Not
questions that are impossible to answer, but questions that would have to /be/
answered...
-- chris
ricky.clarkson@gmail.com - 13 Jan 2006 01:01 GMT
I'll freely admit that I haven't read much of the above, so here's an
uneducated gut reaction:
A PropertyChangeEvent should refer to a Property. A Field is not a
Property.
Java would need some form of property syntax/annotation for this to be
possible sensibly.
It might be possible to statically do something like this with Java as
it is, using the apt tool.