Java reflection framework and security
Posted
by Jijoy
on Stack Overflow
See other posts from Stack Overflow
or by Jijoy
Published on 2010-04-16T11:49:29Z
Indexed on
2010/04/16
11:53 UTC
Read the original article
Hit count: 200
java
|reflection
Hi , Assume I have a singleton class in an external lib to my application. But still I can create instances of that particular class using reflection. Like this
Class clas = Class.forName(Private.class.getName());
for(Constructor c : clas.getDeclaredConstructors()){
c.setAccessible(true);
Private p = (Private) c.newInstance();
System.out.println(p);
}
How can I restrict this ? .
Thanks J
© Stack Overflow or respective owner