From e7dec2fdb805d6ef6eae18bb03f83c923a68d3f2 Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Wed, 13 Mar 2024 22:15:59 +0100 Subject: [PATCH] Deprecate TypedListener for removal to make it strongly internal later --- .../common/org/eclipse/swt/custom/DefaultContent.java | 1 + .../common/org/eclipse/swt/custom/StyledTextListener.java | 1 + .../common/org/eclipse/swt/dnd/DNDListener.java | 2 +- .../Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java | 2 ++ .../Eclipse SWT/common/org/eclipse/swt/widgets/EventTable.java | 1 + .../common/org/eclipse/swt/widgets/TypedListener.java | 1 + .../Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java | 2 ++ .../Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java | 2 ++ 8 files changed, 11 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java index 29a526f2d4c..65e8baa412a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java @@ -749,6 +749,7 @@ public String getTextRange(int start, int length) { * */ @Override +@SuppressWarnings("removal") public void removeTextChangeListener(TextChangeListener listener){ if (listener == null) error(SWT.ERROR_NULL_ARGUMENT); for (int i = 0; i < textListeners.size(); i++) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextListener.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextListener.java index 293890e0a07..2e42c53029a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextListener.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextListener.java @@ -17,6 +17,7 @@ import org.eclipse.swt.internal.*; import org.eclipse.swt.widgets.*; +@SuppressWarnings("removal") class StyledTextListener extends TypedListener { StyledTextListener(SWTEventListener listener) { super(listener); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDListener.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDListener.java index c196d85b9ae..b30e59264bd 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDListener.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDListener.java @@ -16,7 +16,7 @@ import org.eclipse.swt.internal.*; import org.eclipse.swt.widgets.*; - +@SuppressWarnings("removal") class DNDListener extends TypedListener { Widget dndWidget; /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java index 5e900f424ec..18c25e65030 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java @@ -500,6 +500,7 @@ protected void addTypedListener (EventListener listener, int... eventTypes) { if (listener == null) { SWT.error(SWT.ERROR_NULL_ARGUMENT); } + @SuppressWarnings("removal") TypedListener typedListener = new TypedListener(listener); for (int eventType : eventTypes) { _addListener(eventType, typedListener); @@ -1028,6 +1029,7 @@ public Listener[] getListeners (int eventType) { * * @since 3.126 */ +@SuppressWarnings("removal") public Stream getTypedListeners (int eventType, Class listenerType) { return Arrays.stream(getListeners(eventType)) // .filter(TypedListener.class::isInstance).map(l -> ((TypedListener) l).eventListener) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/EventTable.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/EventTable.java index 4b33ec09df2..d315ac21262 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/EventTable.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/EventTable.java @@ -147,6 +147,7 @@ public void unhook (int eventType, Listener listener) { } } +@SuppressWarnings("removal") public void unhook (int eventType, EventListener listener) { if (types == null) return; for (int i=0; i Stream getTypedListeners (int eventType, Class listenerType) { return Arrays.stream(getListeners(eventType)) // .filter(TypedListener.class::isInstance).map(l -> ((TypedListener) l).eventListener) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java index 9cf32664216..22b279b32a2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java @@ -256,6 +256,7 @@ protected void addTypedListener (EventListener listener, int... eventTypes) { if (listener == null) { SWT.error(SWT.ERROR_NULL_ARGUMENT); } + @SuppressWarnings("removal") TypedListener typedListener = new TypedListener(listener); for (int eventType : eventTypes) { _addListener(eventType, typedListener); @@ -668,6 +669,7 @@ public Listener[] getListeners (int eventType) { * * @since 3.126 */ +@SuppressWarnings("removal") public Stream getTypedListeners (int eventType, Class listenerType) { return Arrays.stream(getListeners(eventType)) // .filter(TypedListener.class::isInstance).map(l -> ((TypedListener) l).eventListener)