Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

another possible and portable way to instantiate a class #20

Open
GoogleCodeExporter opened this issue Apr 10, 2015 · 5 comments
Open

Comments

@GoogleCodeExporter
Copy link

If the original class is not final you can create a class that extends it, 
creating direct JVM byte-code, and loading the created class. Then creating an 
instance of the extended class will invoke the constructor of the extending 
class, but since the JVM code is generated calling the superconstructor can be 
skipped (simply not generating the code into the constructor that invokes 
super).

You may perhaps even create the extending class if the original class is final 
accessing the original class object already loaded and altering the "final" 
modifier using reflection.

Original issue reported on code.google.com by [email protected] on 16 Aug 2013 at 8:01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant