Skip to content

fiwka/safeclassdefiner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SafeClassDefiner

Class definer for Java 9+ without using Unsafe.

Why not Unsafe?

Unsafe is slightly faster, but from the name we can understand that it is insecure and can be removed at any time.

Why not MethodHandles.Lookup?

SafeClassDefiner not restricted.

Benchmark results on my computer

JMH Benchmark

Example usage

ClassDefiner classDefiner = ClassDefiner.createSafeClassDefiner();
classDefiner.defineClass(myBytes, classLoader);
classDefiner.defineHiddenClass(myBytes, true, classLoader);

Dependencies

ASM (9.2) for generating empty classes.

Test dependencies

JUnit (5.8.2)

About

Class definer for Java 9+ without using Unsafe.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages