A dirt-ugly hack to modify private final fields in Java


We all use reflection from time to time. We may even tamper with visibility through Java’s Field.setAccessible() and similar methods. But this post here takes things to the extreme and shows how to modify private (static) final fields in Java. Think twice, when choosing this tool ;-)

http://zarnekow.blogspot.ch/2013/01/java-hacks-changing-final-fields.html

Tags: , , ,

Trackbacks / Pingbacks

  1. When All Else Fails: Using “the Unsafe” | Java, SQL and jOOQ. - February 18, 2014

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 1,628 other followers

%d bloggers like this: