Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Java 15 #1025

Merged
merged 9 commits into from
Dec 23, 2020
Merged

Fix Java 15 #1025

merged 9 commits into from
Dec 23, 2020

Commits on Nov 20, 2020

  1. Implement proof of concept Java 15 fix

    - Implemented a proof of concept fix for the incompatibility with Java 15. This incompatibility was caused by the fact that the lambda generated in the NMS.NetworkManager is a hidden class in J15. Starting in Java 15, final fields in hidden classes can no longer be modified regardless of the 'accessible' flag. (see https://openjdk.java.net/jeps/371 "Using a hidden class", point 3). To circumvent this issue, this proof of concept fix retrieves the data from the existing fields in the hidden class (a runnable or a callable) other than the packet. It then retrieves the constructor of the hidden class and instantiates it using the previously-retrieved data and the modified packet instance (this code is only used if the packet instance changed).
    PimvanderLoos committed Nov 20, 2020
    Configuration menu
    Copy the full SHA
    ab46e57 View commit details
    Browse the repository at this point in the history

Commits on Nov 28, 2020

  1. Fix patch breaking on Tuinity

    - Fixed the patch breaking on Tuinity (and maybe Paper?) because its generated Runnable had a different number of variables, causing an exception when trying to instantiate a new instance with an incorrect number of variables. This update changes it so that it can use any number / order of variables. The variable of the same type as the packet will be replaced by the changed packet (this applies to all variables of this type, but there's only ever 1).
    PimvanderLoos committed Nov 28, 2020
    Configuration menu
    Copy the full SHA
    ee2567d View commit details
    Browse the repository at this point in the history

Commits on Nov 30, 2020

  1. Reduce reflection lookups to improve performance

    - Introduced a new ObjectReconstructor class that does all the fields/constructor discovering/accessing etc. The Runnable and Callable methods each get one instance of this class so that we can avoid having to get the fields/constructors and set them accessible every time we want to replace a packet.
    PimvanderLoos committed Nov 30, 2020
    Configuration menu
    Copy the full SHA
    e7b5d98 View commit details
    Browse the repository at this point in the history
  2. Remove unused import

    PimvanderLoos committed Nov 30, 2020
    Configuration menu
    Copy the full SHA
    bd6426e View commit details
    Browse the repository at this point in the history

Commits on Dec 4, 2020

  1. Add hardcoded support for LazyRunnable

    - Added hardcoded support for Netty's LazyRunnable as used by Tuinity by adding a specific ObjectReconstructor field for it.
    PimvanderLoos committed Dec 4, 2020
    Configuration menu
    Copy the full SHA
    7b977d3 View commit details
    Browse the repository at this point in the history
  2. Do not use ObjectReconstructor on Java < 15

    - The new ObjectReconstructor method for changing the packet in a schedule packet message is now only used on java 15+. All older versions of Java will use the old method of modifying the packet using reflection, as that is simpler. Inspired by @mikroskeem's efforts towards this PR.
    PimvanderLoos committed Dec 4, 2020
    Configuration menu
    Copy the full SHA
    2db7b2d View commit details
    Browse the repository at this point in the history
  3. Update formatting

    PimvanderLoos committed Dec 4, 2020
    Configuration menu
    Copy the full SHA
    e644503 View commit details
    Browse the repository at this point in the history

Commits on Dec 5, 2020

  1. Use map to store ObjectReconstructors

    - Switched to using a ConcurrentHashmap for storing the different ObjectReconstructors instead of hardcoding the supported classes.
    PimvanderLoos committed Dec 5, 2020
    Configuration menu
    Copy the full SHA
    867dd0a View commit details
    Browse the repository at this point in the history

Commits on Dec 7, 2020

  1. Use Class#isHidden to determine method to update packet

    This fixes the assumption that target class is always a lambda, while it
    might not be, thus causing ObjectReconstructor to fail.
    mikroskeem authored and PimvanderLoos committed Dec 7, 2020
    Configuration menu
    Copy the full SHA
    11d7fb6 View commit details
    Browse the repository at this point in the history