For IntelliJ IDEA and
Android Studio


/** * Return a generated implementation of {@link T} that delegates all method calls * to the instance returned by the given {@link Provider}. That instance is not * retrieved until the first time a method is called, after which the returned * instance is cached and reused forever. * * The provider's {@link ClassLoader} is used to load the generated class. */ public static <T> T newCachingProviderProxy(Class<T> type, Provider<T> provider) { return newProxy(type, MethodHandleInvoker.caching(provider)); } }
private void handleCompletion() { for(ThrowingRunnable<?> handler : completionHandlers) { try { handler.runThrows(); } catch(Throwable e) { handleFailure(e); } } } }
/** * Add or use an object to this usage collection. * @param object the object to add or use. */ public void use(E object) { if(!containsKey(object)) { put(object, new Index()); } else { get(object).change(+1); } }
/** * Allocate an additional usage space for an object. * @param object the object to allocate an additional space for. */ public void allocate(E object) { if(containsValue(object)) { get(object).change(-1); } }
@Override default Object[] toArray() { final E value = orElse(null); return value == null ? ArrayUtils.zeroObjects() : new Object[] {value}; }
/** * Return a formatted stack trace */ @Override public String toString() { return ExceptionUtils.formatStackTrace(trace(), skipTest()); }
/** * Return a generated implementation of {@link T} that delegates all method calls * to the instance returned by the given {@link Provider}. The provider is called * for every method invocation. * * The provider's {@link ClassLoader} is used to load the generated class. */ public static <T> T newProviderProxy(Class<T> type, Provider<T> provider) { return newProxy(type, MethodHandleInvoker.dynamic(provider)); }