[1708] in java-interest

home help back first fref pref prev next nref lref last post

Re: Final classes for safety or speed?

daemon@ATHENA.MIT.EDU (Arthur van Hoff)
Thu Sep 14 22:28:47 1995

Date: Thu, 14 Sep 1995 16:24:31 -0800 (PDT)
From: Arthur van Hoff <Arthur.Vanhoff@Eng.Sun.COM>
Reply-To: Arthur van Hoff <Arthur.Vanhoff@Eng.Sun.COM>
To: Pat Niemeyer <pat@icon-stl.net>
Cc: java-interest@java.Eng.Sun.COM



Hi Pat,

> Are the many final classes in the core java packages final for security
> reasons or simply to make it possible for them to be optimized/inlined?

Some classes are final for performance reasons (ie class String). If you
compile your code with -O the compiler will actually inline entire methods.
Note that you can't compile applets with -O because optimized classes usually
violate some security constraints that the verifier will catch. 

Some classes, like class java.net.URL, are final because of security reasons. 

> Are there any circumstances under which a maliciously subclassed base class
> could take advantage of having its methods invoked by a more priviledged
> class?  Would it be able to get around the namespace partitioning and make
> static references to things it otherwise couldn't see?

I hope not!

Have fun,

	Arthur van Hoff
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post