import java.lang.reflect.Method; public class InfiniteMirror { public static void main(String args[]) throws Exception { Method m = Method.class.getMethod( "invoke", Object.class, Object[].class ); Object[] a = { m, null }; a[1] = a; m.invoke(m, a); } }Oh my...
This is not a bug by any mean, but out of curiosity, I looked into the database to see if there's anything like it. There is (ID 4185411), since it was a bug back when this would crash the JVM (!!!).
WORK AROUND: Never, ever, write code that is as stupid as this in any real project.
No comments:
Post a Comment