Re: Class Viewer, and "volatile" methods.
Andreas Leitgeb wrote:
Mike Schilling <mscottschilling@hotmail.com> wrote:
Object o;
String s;
Object o2 = (Object)s;
int i = o2.compareTo(o);
That wouldn't work in any version of Java, since Object
has no method compareTo at all.
Damn, you're right, I was thinking of clone(). Never mind.
In general, the compiler won't let Java code explicitly call
synthetic methods (e.g, it can't call the oddly named methods used
to access private members of enclosing classes.) Perhaps the use
of
the BRIDGE flag is that it indicates synthetic methods that *can*
be
called under some circumstances.
I guess, you're right here :-)
How would the Java platform prevent abuse of those synthetic
methods,
when the bytecode is not generated by a javac? It obviously doesn't
prohibit calls to such methods entirely, but how can it tell legit
internal uses from crafted bytecodes?
As far as I know, it can't. The compiler could randomize the names of
the inner class accessors to make them more difficult to call, but as
far as I know it doesn't. At any rate, inner class accessors aren't
public, so they only create potential security holes within their
package.