In my class, I need both an SLF4J Logger with the class as the parameter, as well as a simple class name. Both the logger and CLASS_NAME constants use MethodHandles.lookup(). I was wondering if it makes more sense/is more efficient to have something like this:
private static final Lookup lookup = MethodHandles.lookup();private static final Logger logger = LoggerFactory.getLogger(lookup.getClass());private static final String CLASS_NAME = lookup.lookupClass().getSimpleName();
Or just have MethodHandles.lookup() twice:
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().getClass());private static final String CLASS_NAME = MethodHandles.lookup().lookupClass().getSimpleName();