ProtocolLib

3M Downloads

Future proofing ProtocolLib for Java 11+ (replacing cglib with ByteBuddy?)

oddlama opened this issue ยท 0 comments

commented

I've recently noticed several bug reports regarding Illegal reflective access in com.comphenix.net.sf.cglib.core.ReflectUtils triggered through ProtocolLib on various sites ([1], [2], [3], [4]). While this is currently just a warning, this has the potential to become a bigger problem in the future. Quoting the warning message:

WARNING: All illegal access operations will be denied in a future release

This is due to stricter reflection rules in Java 9 and above, and I'm not sure to what extent this limits ProtocolLib's functionality today. A comment from the repo owner on a related issue from May 2019 suggests that this will not be worked on before Minecraft switches to a newer java version.

Nonetheless, we can already see a considerably large increase in Java 9+ adoption for Minecraft in the past 6 months, so this is bound to become a problem in the (near) future:

Date Java 8 Java 9+ Reference
Feb 2020 96.8% 1.0% bStats.org
Aug 2020 84.7% 15.3% bStats.org

The actual bug (cglib)

The actual bug is in a dependency of ProtocolLib, specifically in cglib, which is just shaded into com.comphenix.net.sf.cglib.
I've found this related open issue in cglib from August 2018, as well as a second and a third one. The problem is now known for over two years, but nothing has happened.

Apparently there is no ongoing development to cglib (last commit was 13 months ago), which is concerning. On multiple occasions I've read the suggestion to switch to Byte Buddy instead for newer java versions, so maybe @dmulloy2 might consider doing that.

Anyway, just wanted to raise awareness of this issue, before it becomes an actual problem and a solution might be rushed.