Resource Java Reflect Library

Discussion in 'Spigot Plugin Development' started by Remceau, Jun 27, 2018.

  1. Java Reflect Library
    The Java reflection API is bad. It copies arrays all the times and caches nothing. This library is a layer built on top of the default reflection API and adds some performance changes. Another feature of the library is that it changes all exceptions into ReflectException, a class extending RuntimeException. You can choose yourself if you want to handle the exceptions or let the program crash.

    • High-performance reflection operations: this library uses caching to get as high performance as possible. Not only caches it all arrays that would be cloned every time, it also caches methods and fields linked to names, so members that are commonly used will get an even bigger performance boost.
    • Easy to use interface: a big problem with Java's reflection API, is that it is hard to use, or at least harder then it should be. You have to get the class, then the members, then set the accessibility, and only then you can invoke/change them. This makes for a lot of unnecessary code. The Reflect library does this all for you. The library also removes the need to get methods and constructors by the type of the arguments. The library automatically gets the first possible member that accept the arguments.

    • The library is built and compiled using Java 8. For this reason, it is needed that you have Java version 8 or higher to use this library successfully.
    • The library is released under the Unlicense, meaning that you can do anything with the code you want. However, if you make changes, use the library in your project or redistribute it, it would be a good deed to include a link to this GitHub page, so everyone will know that it is free public domain software.
    • All source code is available on GitHub. In the near feature, the GitHub project will also include a wiki and guide on how to use the library. (I am currently working on it)

    • v1.0.0 - First release of Reflect API. This is not added to the GitHub page
    • v1.1.0 - Added support to directly create ReflectObject instances for objects. Added GitHub project for the library.

    #1 Remceau, Jun 27, 2018
    Last edited: Jun 27, 2018
  2. Why not just upload it to Github or something?
  3. Well, it is 1:52 in the middle of the night at the moment. I will probably upload to github, add precompiled sources and that kind of stuff tomorrow morning.
  4. Released version 1.1.0 and changed the entire post. It was 1:52 in the middle of the night when I made that first post, so it was a (little) crappy. It should now be way better. If you want to suggest any features, feel free to create issues on GitHub.

    Added link to GitHub wiki. The first two pages are complete. Still working on another two
    #4 Remceau, Jun 27, 2018
    Last edited: Jun 27, 2018