-
I'm encountering a very special issue where I encounter an Within the StackTrace is also a I'm using Caffeine as follows: The class itself is loaded within a void method in another class (Where it also gets the Note that the above class is in a separate module that inherits/includes the core module which contains the Caffeine library. I do shade in the library using relocations with the Maven Shade plugin. I'm completely out of ideas what could be the cause here. The Cache worked fine before, until I decided to change the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
I suspect that some form of dead code elimination is pruning the class files. I see that you enabled Caffeine code generates the different cache and entry types in order to minimize the memory footprint. There are many configuration options which require different fields, so instead of paying for the worst case we use the optimized class forms. In most environments this is ideal because while it adds some bloat to the jar for deploying the artifact, unloaded classes have no runtime penalty. When the cache is built it uses reflection to load the particular implementation type. The reflective load is a one-time cost and cached by the JVM so that it is very cheap. However this means that ahead-of-time compilation tools must whitelist the appropriate classes as they cannot be statically determined. |
Beta Was this translation helpful? Give feedback.
I suspect that some form of dead code elimination is pruning the class files. I see that you enabled
minimizeJar
which probably does this, and requires using filters to retain classes it might otherwise prune. I don't know how this feature works, but generally the idea would be to inspect the byte code to compute the class dependency graph. If any class is looked up by reflection then it would be lost and fail at runtime, like you observed. Can you try (1) disabling minimizeJar and if that works, then try (2) enabling with an appropriate filter?Caffeine code generates the different cache and entry types in order to minimize the memory footprint. There are many configuration options which…