提交 5b4ace14 编写于 作者: D dxu

8016592: Clean-up Javac Overrides Warnings In javax/management/NotificationBroadcasterSupport.java

Summary: Add hashCode() methods to ListenerInfo and WildcardListenerInfo classes
Reviewed-by: dfuchs, alanb, sjiang, chegar
上级 756acad1
/* /*
* Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -27,6 +27,7 @@ package javax.management; ...@@ -27,6 +27,7 @@ package javax.management;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
...@@ -288,6 +289,7 @@ public class NotificationBroadcasterSupport implements NotificationEmitter { ...@@ -288,6 +289,7 @@ public class NotificationBroadcasterSupport implements NotificationEmitter {
this.handback = handback; this.handback = handback;
} }
@Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (!(o instanceof ListenerInfo)) if (!(o instanceof ListenerInfo))
return false; return false;
...@@ -298,6 +300,11 @@ public class NotificationBroadcasterSupport implements NotificationEmitter { ...@@ -298,6 +300,11 @@ public class NotificationBroadcasterSupport implements NotificationEmitter {
return (li.listener == listener && li.filter == filter return (li.listener == listener && li.filter == filter
&& li.handback == handback); && li.handback == handback);
} }
@Override
public int hashCode() {
return Objects.hashCode(listener);
}
} }
private static class WildcardListenerInfo extends ListenerInfo { private static class WildcardListenerInfo extends ListenerInfo {
...@@ -305,10 +312,16 @@ public class NotificationBroadcasterSupport implements NotificationEmitter { ...@@ -305,10 +312,16 @@ public class NotificationBroadcasterSupport implements NotificationEmitter {
super(listener, null, null); super(listener, null, null);
} }
@Override
public boolean equals(Object o) { public boolean equals(Object o) {
assert (!(o instanceof WildcardListenerInfo)); assert (!(o instanceof WildcardListenerInfo));
return o.equals(this); return o.equals(this);
} }
@Override
public int hashCode() {
return super.hashCode();
}
} }
private List<ListenerInfo> listenerList = private List<ListenerInfo> listenerList =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册