Skip to content

Commit

Permalink
Deprecate TypedListener for removal to make it strongly internal later
Browse files Browse the repository at this point in the history
  • Loading branch information
HannesWell committed Nov 24, 2024
1 parent e6588c2 commit e7dec2f
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 1 deletion.
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 @@ -37,6 +37,7 @@
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
*/
@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

0 comments on commit e7dec2f

Please sign in to comment.