FileDocCategorySizeDatePackage
DangerousNames.javaAPI DocExample1343Sun Dec 14 22:47:36 GMT 2003oreilly.hcj.proxies

DangerousNames

public class DangerousNames extends Object
Demonstrates a dangerous use of proxy names.

According to the JDK, the unqualified name of a proxy class is undefined so using it in code like this could cause you grief.

author
Robert Simmons jr. (kraythe)
version
$Revision: 1.2 $

Fields Summary
Constructors Summary
Methods Summary
public static final voidmain(java.lang.String[] args)
Run the demonstration.

param
args Command line arguments (ignored).

		SomeClass proxy = SomeClassFactory.getDynamicSomeClassProxy();
		System.out.println(proxy.getClass().getName());
		try {
			Class cl = Class.forName("$Proxy0");  // <== Dangerous!
			System.out.println(cl.getName());
		} catch (final ClassNotFoundException ex) {
			ex.printStackTrace();
		}