资 源 简 介
This small utility can be used at runtime to remove unneccessary references to immutable objects from memory.
this works by cutting them into their components and rearranging them to create an object that looks like the original, but all redundancies are removed.
For example
List intern = deepInterner.intern(ImmutableList.of(-1234, -1234));//this will only work with a DEEP interner assertTrue(intern.get(0) == intern.get(1));
This Project uses guava-libraries as a dependency.
To detect if an object is immutable, it relies on
a recursive checker for truly immutable objects (most safe way)
a rough list of known JDK immutables (tbd)
a list of provided @Immutable annotations
the ImmutableXXXX collections in the guava-libraries
please bear in mind this is the first draft and you should not use this code in a mission-critical application.