Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This used to be the right way to create dynamic proxies. Why one would do this is another discussion. For completeness here's a link to the usage in Spring: https://github.com/spring-projects/spring-framework/search?q...


The Spring code is still fine. You didn't quote the entire advisory:

> If existing code is using Proxy.getProxyClass and the Constructor.newInstance method to create a proxy instance, it will fail with IllegalAccessException if the caller is not in the same runtime package as the non-public proxy interface. For such code, it requires a source change to either (1) call Constructor.setAccessible to set the accessible flag to true, or (2) use the Proxy.newProxyInstance convenience method.

To end up in that specific condition is fairly difficult and usually means something is wrong with the code to begin with. It's still a very easy fix in any event (adding in 1 extra line of code before the call).




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: