When I wrap a collection to be read-only or synchronized, why can I call any of the collection methods via reflection without getting an IllegalAccessException?
Location: http://www.jguru.com/faq/view.jsp?EID=304724 Created: Jan 17, 2001 Modified: 2001-01-17 05:30:21.271 Author: John Zukowski (http://www.jguru.com/guru/viewbio.jsp?EID=7) Question originally posed by Brandon Wiley (http://www.jguru.com/guru/viewbio.jsp?EID=304445 When you wrap a collection through the static methods of the Collections class, this creates an instance of a package-private (default access) class. Because you don’t have access to these classes, you can’t call their methods via reflection (though you can call their methods directly through the appropriate interface).