Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate TypedListener for removal to make it strongly internal later #1616

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ public String getTextRange(int start, int length) {
* </ul>
*/
@Override
@SuppressWarnings("removal")
public void removeTextChangeListener(TextChangeListener listener){
if (listener == null) error(SWT.ERROR_NULL_ARGUMENT);
for (int i = 0; i < textListeners.size(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.eclipse.swt.internal.*;
import org.eclipse.swt.widgets.*;


@SuppressWarnings("removal")
class DNDListener extends TypedListener {
Widget dndWidget;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -1028,6 +1029,7 @@ public Listener[] getListeners (int eventType) {
*
* @since 3.126
*/
@SuppressWarnings("removal")
public <L extends EventListener> Stream<L> getTypedListeners (int eventType, Class<L> listenerType) {
return Arrays.stream(getListeners(eventType)) //
.filter(TypedListener.class::isInstance).map(l -> ((TypedListener) l).eventListener)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<types.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@
* @noreference This class is not intended to be referenced by clients.
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
* @deprecated This class will become 'strongly' internal. For custom widgets
* {@link Widget#addTypedListener(EventListener, int...)},
* {@link Widget#getTypedListeners(int, Class)} or
* {@link Widget#removeTypedListener(int, EventListener)} can
* probably be used instead.
*/
@Deprecated(forRemoval = true, since = "3.129.0 (removal in 2027-03 or later)")
public class TypedListener implements Listener {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,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);
Expand Down Expand Up @@ -730,6 +731,7 @@ public Listener[] getListeners (int eventType) {
*
* @since 3.126
*/
@SuppressWarnings("removal")
public <L extends EventListener> Stream<L> getTypedListeners (int eventType, Class<L> listenerType) {
return Arrays.stream(getListeners(eventType)) //
.filter(TypedListener.class::isInstance).map(l -> ((TypedListener) l).eventListener)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -668,6 +669,7 @@ public Listener[] getListeners (int eventType) {
*
* @since 3.126
*/
@SuppressWarnings("removal")
public <L extends EventListener> Stream<L> getTypedListeners (int eventType, Class<L> listenerType) {
return Arrays.stream(getListeners(eventType)) //
.filter(TypedListener.class::isInstance).map(l -> ((TypedListener) l).eventListener)
Expand Down
Loading