boolean (@Nullable Icon icon, @NotNull Icon expected) { if (expected.equals(icon)) return true; if (icon instanceof CompositeIcon composite) { for (int i = 0; i < composite.getIconCount(); i++) { if (is(composite.getIcon(i), expected)) return true; } } if (icon instanceof DeferredIcon) { return false; // do not calculate complex icons at this point } if (icon instanceof RetrievableIcon retrievable) { if (retrievable.isComplex()) { return false; } if (is(retrievable.retrieveIcon(), expected)) { return true; } } return false; }