mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix quadratic extension registration
This commit is contained in:
+5
-5
@@ -117,6 +117,11 @@ public final class ExtensionPointImpl<T> implements ExtensionPoint<T> {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (getExtensionIndex(extension) != -1) {
|
||||
LOG.error("Extension was already added: " + extension);
|
||||
return;
|
||||
}
|
||||
|
||||
registerExtension(extension, adapter, index, true);
|
||||
}
|
||||
else {
|
||||
@@ -126,11 +131,6 @@ public final class ExtensionPointImpl<T> implements ExtensionPoint<T> {
|
||||
}
|
||||
|
||||
private void registerExtension(@NotNull T extension, @NotNull ExtensionComponentAdapter adapter, int index, boolean runNotifications) {
|
||||
if (getExtensionIndex(extension) != -1) {
|
||||
LOG.error("Extension was already added: " + extension);
|
||||
return;
|
||||
}
|
||||
|
||||
Class<T> extensionClass = getExtensionClass();
|
||||
if (!extensionClass.isInstance(extension)) {
|
||||
LOG.error("Extension " + extension.getClass() + " does not implement " + extensionClass);
|
||||
|
||||
Reference in New Issue
Block a user