Library () { final InvocationHandler invocationHandler = Proxy.isProxyClass(myLibrary.getClass()) ? Proxy.getInvocationHandler(myLibrary) : null; final Library realLibrary = invocationHandler instanceof ModuleEditor.ProxyDelegateAccessor ? (Library)((ModuleEditor.ProxyDelegateAccessor)invocationHandler).getDelegate() : myLibrary; final Library source = realLibrary instanceof LibraryEx? ((LibraryEx)realLibrary).getSource() : null; return source != null ? source : myLibrary; }