Object (@NotNull WeakReference<Object> reference, int id) { Object weakTarget = reference.get(); if (weakTarget == null) { throw new IllegalStateException( "Weak reference to variable " + id + " expired. " + "Please use `Driver.withContext { }` for hard variable references." ); } return weakTarget; }