Skip to content

Releases: OxideWaveLength/Java-BetterReflection

1.3.2 ClassFinder Fixes

Choose a tag to compare

@OxideWaveLength OxideWaveLength released this 09 Mar 21:14

Fixed IdeClassFinder trying to iterate over null files
Fixed JarClassFinder's recursive search

HOTFIX: getCurrentJarFile(BetterReflectionClass)

Choose a tag to compare

@OxideWaveLength OxideWaveLength released this 30 Oct 04:52

Hotfix for BetterReflectionUtils#getCurrentJarFile(BetterReflectionClass), which now uses the given class parameter to determine whether it's running from Jar file or not.

1.3 Updated ClassFinder

Choose a tag to compare

@OxideWaveLength OxideWaveLength released this 30 Oct 00:32

ClassFinders:
Added an option to set the JarFile
Added an option to set the ClassLoader

This is useful when working with jar files loaded as modules. For example, Spigot plugins.

Fixed an issue where the IdeClassFinder wouldn't correctly find classes if the base package is empty.

Fixed UpToDate check, this will no longer say an update is available when the current version matches upstream.

1.2 - Added Dumpers

Choose a tag to compare

@OxideWaveLength OxideWaveLength released this 02 Mar 11:15

Additions

Created Dumper classes that are used to easily dump a Class, Constructor, Field or Method.

Fixes

Fixed missing generic in BetterReflectionClass#isAssignableFrom(BetterReflectionClass) method

Deprecation

Deprecated BetterReflectionUtils#dumpMethodHeader() and BetterReflectionUtils#generateMethodHeader()

1.1 - [API Change] Added generics, ClassFinder and Enums

Choose a tag to compare

@OxideWaveLength OxideWaveLength released this 27 Feb 15:23

API Change:
The BetterReflectionClass now uses generics to assign a class type

Enums:
Added support for enum classes through the EnumBetterReflectionClass, with the following methods

  • #getEnumConstants()
  • contains(String)
  • getIfPresent(String)
  • getOrNull(String)
  • getOrDefault(String, T)
  • toString(String)
  • toString()

Added a ClassFinder: find and iterate through a java program's classes (both IDE runtime and packed jar)
This class deprecates BetterReflectionUtils#getClassesInPackage(String)

Added unit tests for the ClassFinder class

1.0 - [BREAKING] Package rename and maven central

Choose a tag to compare

@OxideWaveLength OxideWaveLength released this 05 Feb 04:30

The package has been renamed from me.wavelength.betterreflection to top.wavelength.betterreflection in order to be coherent with the domain used for Maven Central, where the library can now be found as follows

<dependency>
	<groupId>top.wavelength</groupId>
	<artifactId>Java-BetterReflection</artifactId>
	<version>1.0</version>
</dependency>

0.7 - Fixed possible NPEs when detecting Jar File

Choose a tag to compare

@OxideWaveLength OxideWaveLength released this 23 Jan 01:27

There were some issues with the utility methods to retrieve the current jar file. They would sometimes return the incorrect value or throw exceptions. This release addresses such problems

0.6 - Caching class names

Choose a tag to compare

@OxideWaveLength OxideWaveLength released this 28 Aug 02:01

Now caching the various class names rather than retrieving them every time (it can make a big difference)
Fixed BetterReflectionClass#getSuperClass()

Commit: 1598623

0.5 - Fixed primitives

Choose a tag to compare

@OxideWaveLength OxideWaveLength released this 21 Aug 17:59

Made it so BetterReflection#PRIMITIVES are loaded in the static initialization of the class, removing the need to normally initialize the class at least once before being able to use them
Added some primitives to the map (short, byte and void)
BetterReflectionClass#getArrayClassIf(boolean), if the boolean passed in is true the class returned will be the same as #getArrayClass(), otherwise it will be the same as #getClasz()

0.4

0.4

Choose a tag to compare

@OxideWaveLength OxideWaveLength released this 04 Jun 23:54

These release notes come from this commit
BetterReflection:

  • Added an int Pattern
  • Added some primitives to the primitives map
  • Added the method #getBetterReflectionClasses(), which will return a copy of the betterReflectionClasses list
  • Added #getVersion(), which will return a hard-coded value that will be changed on each version
  • Added #getLatestVersion(), which will query GitHub and return the latest version as a String
  • Added #isUpToDate(), which will call #getLatestVersion() and #getVersion() to check if the current version is up to date
  • Added #versionToInts(String), which will convert a String (e.g. "0.4") to an array of integers (such as { 0, 4 })
  • Replaced the betterReflectionClasses CopyOnWriteArrayList with a simple synchronized ArrayList

BetterReflectionClass:

  • Added the #forName() method, this will simply return #BetterReflectionClass(String) but return null if a ClassNotFoundException is to be thrown.
  • #getName() - returns the class' name
  • #getSimpleName() - returns the class' simple name
  • #getCanonicalName() - returns the class' canonical name
  • #getTypeName() - returns the class' type name
  • Replaced BetterReflectionUtils#getClasses to BetterReflectionUtils#getTypes (renamed)

BetterReflectionUtils:

  • Added a public static final File that holds the current jar file the program is being run from
  • Added the method #getCurrentJarFile() which returns the current jar file the program is being run from (not cached, will be retrieved every time)
  • Added the method #getCurrentJar() which returns the current jar File wrapped in a JarFile class
  • Added the method #isRunningFromJar() which returns true if the program is running off of a jar, false if it's running in an IDE
  • Added #getJavaVersion(), which will return the current java version as int
  • Added #setFinal(Field field, boolean final), which will set a field to the desired final state (works in Java 12+ too but that'd require some additional JVM arguments)
  • Fixed the class' content being pasted twice
  • Renamed #getClasses(String) -> #getClassesInPackage(String), which returns a list of classes in the current package and now works both when running in an IDE and off of a jar, if the jar is still present
  • Renamed #getClassByNameStart(String, String) -> #getClassesFromNameBeginning(String, String) (now works when running off a jar too)
  • Removed #findClasses(File, String)

Tests:

  • Now using nanoseconds instead of milliseconds
  • Removed Timer class

Now also including sources in jar file, this way the javadocs will be accessible when using a good IDE.