Hello,
Considering this deprecated interface:
/**
* @deprecated use ModifierExListener instead
*/
@Deprecated
@FunctionalInterface
public interface ModifierListener {
void modifiersChanged(int modifiers);
}
I believe this usage should not trigger an issue:
/** @deprecated replaced by {@link #modifierExListeners} */
@Deprecated
private final List<ModifierListener> modifierListeners = new CopyOnWriteArrayList<>();
Because the field is itself deprecated. This is how Eclipse allows us to silence deprecated warnings when the situation is under control :)
Also it seems that @SuppressWarnings("deprecation") is not taken into account (at least at method level)?
@Override
@SuppressWarnings("deprecation")
public void eventDispatched(AWTEvent e) {
KeyEvent ke = (KeyEvent) e;
// check if ctrl, alt, shift modifiers are changed
int modif = ke.getModifiers();
if (previousModifiers != modif) {
for (ModifierListener m: modifierListeners) { // << SQ issue
m.modifiersChanged(modif);
}
}
Tested with SQ 6.4 / SonarJava 4.11.0.10660.
Vincent