<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Scovetta Labs &#187; programming</title>
	<atom:link href="http://scovettalabs.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://scovettalabs.com</link>
	<description>Application Security, Vulnerabilities, Secure Development, and more...</description>
	<lastBuildDate>Tue, 06 Jan 2009 17:28:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Accessing Private Methods in Java</title>
		<link>http://scovettalabs.com/2008/02/18/accessing-private-methods-in-java/</link>
		<comments>http://scovettalabs.com/2008/02/18/accessing-private-methods-in-java/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 05:16:56 +0000</pubDate>
		<dc:creator>Scovetta</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://scovettalabs.com/2008/02/18/accessing-private-methods-in-java/</guid>
		<description><![CDATA[In every introductory Java programming class (and probably every tutorial or book), students are taught that private fields and methods can only be accessed by methods of the same class. Though this would seem to be a security control, using private visibility can be easily overridden, as shown below:



import java.lang.reflect.*;
class A {
  private void [...]]]></description>
			<content:encoded><![CDATA[<p>In every introductory Java programming class (and probably every tutorial or book), students are taught that <strong>private</strong> fields and methods can only be accessed by methods of the same class. Though this would seem to be a security control, using private visibility can be easily overridden, as shown below:</p>
<pre>
<pre name="code" class="php">

import java.lang.reflect.*;
class A {
  private void f() {
    System.out.println(&quot;Running A.f()&quot;);
  }
}

public class Main {
  public static void main(String[] args) throws Exception {
    Class a = new A().getClass();
    Method m = a.getDeclaredMethod(&quot;f&quot;, null);
    m.setAccessible(true);
    m.invoke(new A(), null);
  }
}
</pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://scovettalabs.com/2008/02/18/accessing-private-methods-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

