reflect
Introduction: a Java library for succinct reflection and unrestricted access
Tags:
reflect is a Java library whose purpose is unfettering, condensing and streamlining reflection by providing for most common reflective operations (and more) powerful methods that don't obey access limitations or declare checked exceptions (unlike every standard reflective method ever).
See the actions for Java distribution support information.
dependencies {
implementation("net.auoeke:reflect:6.+")
}
A brief summary
Accessorreads, mutates and copies fields.Classesloads and deals with classes. It can also change object types likereinterpret_castin C++.ClassDefinerdefines classes.ConstantPoolis a proxy for the JDK's internalConstantPoolthat reads constant pools.Constructorsfinds constructors and instantiates classes.EnumConstructoradds enumeration constants with safety handling.Fieldsenumerates class fields directly and withoutFieldcopying, security checks and filters.Flagsprovides utilities for dealing with flags (including particularly Java flags).Invokeris a static proxy forIMPL_LOOKUP(which has unrestricted privileges) and contains other method handle utilities.JavaLangAccessprovides partial access to the JDK'sJavaLangAccess.Methodsenumerates and finds class methods.Modulesgets and opens modules.Pointeris a (primarily) field reference that is similar toFieldbut without access restrictions and for use with frequently accessed fields.ReflectprovidesInstrumentationaccess.StackFramesassists in getting stack frames and callers and supportsStackWalkerand the traditionalStackTraceElement[].Typesdeals withClasses in many ways including type conversion.
Developing
Use uncheck for IntelliJ IDEA in order to suppress checked exception warnings.
Relevant tests are in the main test classes; everything else is irrelevant.
