• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it possible to extend a final class? (With byte code engineering or whatever)

 
Robert Paris
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible in any way to extend a final class? Is there anything i can do to either extend it, or at least mask this?
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the following link:
class file format
and pay special attention to the access_flags member of the class description structure. If you'd mask (i.e. 'nand') away the ACC_FINAL (0x0010) bit, the class is assumed not to be final. If you 'or' in the ACC_PUBLIC (0x0001) bit, you've automagically turned it into a public class also.
Don't tell anyone I told you, because I don't hack never.
kind regards
 
Robert Paris
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, but how would this work at runtime? I don't want to change the rt.jat classes before runtime, because I want this to work with any VM and by just running my app (i.e. java myApp). So I can do runtime byte-code engineering, but if System's already defined by the bootstrap loader, can I grab that class def, "nand" the modifier, create a new class extending that, and actually have the VM accept that new class' definition?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic