• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

got private variables :(

 
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all

By using reflection API we can access the private variable except inherited members.

then how can we protect the private member from the reflection API also.

regards
Chiru
 
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chiranjeevi Kanthraj wrote:Hi all

By using reflection API we can access the private variable except inherited members.

then how can we protect the private member from the reflection API also.

regards
Chiru


HI chiru .. im not having idea regarding this issue....
 
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chiranjeevi Kanthraj wrote:Hi all

By using reflection API we can access the private variable except inherited members.

then how can we protect the private member from the reflection API also.

regards
Chiru



Change the JVM security settings.
 
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Change the JVM security settings.



any links please.
 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi! Have a look at Sun's Security Guide (the last four bullets of 'General Security') and google for 'Security Manager' and 'security policy file'.
 
Sheriff
Posts: 22821
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chiranjeevi Kanthraj wrote:Hi all

By using reflection API we can access the private variable except inherited members.

then how can we protect the private member from the reflection API also.

regards
Chiru


Use Class.getSuperclass() in combination with Class.getDeclaredFields(), and loop until you've reached the end:
 
Marshal
Posts: 80230
424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More difficult a question than we expect on "beginners." Moving.
 
reply
    Bookmark Topic Watch Topic
  • New Topic