Add Proxy support.
From-SVN: r57635
This commit is contained in:
committed by
Anthony Green
parent
ccf7aef428
commit
d3cc3f10da
@@ -0,0 +1,34 @@
|
||||
import java.lang.reflect.*;
|
||||
import java.net.*;
|
||||
|
||||
public class TestProxy
|
||||
{
|
||||
public class MyInvocationHandler implements InvocationHandler
|
||||
{
|
||||
public Object invoke (Object proxy,
|
||||
Method method,
|
||||
Object[] args)
|
||||
throws Throwable
|
||||
{
|
||||
System.out.println (args[0]);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main (String[] args)
|
||||
{
|
||||
try {
|
||||
InvocationHandler ih = new MyInvocationHandler();
|
||||
|
||||
SocketOptions c = (SocketOptions)
|
||||
Proxy.newProxyInstance (SocketOptions.class.getClassLoader(),
|
||||
new Class[]{SocketOptions.class},
|
||||
ih);
|
||||
|
||||
c.getOption (555);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
555
|
||||
@@ -0,0 +1,11 @@
|
||||
public class utf8concat
|
||||
{
|
||||
private static String s;
|
||||
|
||||
public static void main (String[] args)
|
||||
{
|
||||
// This causes a crash at runtime because the compiler is
|
||||
// producing an invalid UTF-8 string literal.
|
||||
s = "abc" + (char)183;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user