8169518: Suppress Deprecation warnings for deprecated Swing APIs
Reviewed-by: alexsch, ssadetsky
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTextFieldFormattedUI.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTextFieldFormattedUI.java Mon Nov 14 09:59:36 2016 -0800
@@ -55,6 +55,7 @@
super.uninstallListeners();
}
+ @SuppressWarnings("deprecation")
public void mouseClicked(final MouseEvent e) {
if (e.getClickCount() != 1) return;
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibleText.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibleText.java Mon Nov 14 09:59:36 2016 -0800
@@ -293,6 +293,7 @@
}, c);
}
+ @SuppressWarnings("deprecation")
static int[] getVisibleCharacterRange(final Accessible a) {
final Accessible sa = CAccessible.getSwingAccessible(a);
if (!(sa instanceof JTextComponent)) return null;
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java Mon Nov 14 09:59:36 2016 -0800
@@ -214,6 +214,7 @@
this.setDefaultDragImage();
}
+ @SuppressWarnings("deprecation")
private void setDefaultDragImage(JTextComponent component) {
DragGestureEvent trigger = getTrigger();
int selectionStart = component.getSelectionStart();
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifTextUI.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifTextUI.java Mon Nov 14 09:59:36 2016 -0800
@@ -124,6 +124,7 @@
* @param g the graphics context
* @see #damage
*/
+ @SuppressWarnings("deprecation")
public void paint(Graphics g) {
if(isVisible()) {
try {
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsTextFieldUI.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsTextFieldUI.java Mon Nov 14 09:59:36 2016 -0800
@@ -132,6 +132,7 @@
this.r = r;
}
+ @SuppressWarnings("deprecation")
public void run() {
JTextField field = (JTextField) getComponent();
if (field != null) {
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsTextUI.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsTextUI.java Mon Nov 14 09:59:36 2016 -0800
@@ -93,6 +93,7 @@
* @param bounds the bounding box for the highlight
* @param c the editor
*/
+ @SuppressWarnings("deprecation")
public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c) {
Rectangle alloc = bounds.getBounds();
try {
--- a/jdk/src/java.desktop/share/classes/javax/swing/JEditorPane.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JEditorPane.java Mon Nov 14 09:59:36 2016 -0800
@@ -825,6 +825,7 @@
*
* @param reference the named location to scroll to
*/
+ @SuppressWarnings("deprecation")
public void scrollToReference(String reference) {
Document d = getDocument();
if (d instanceof HTMLDocument) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java Mon Nov 14 09:59:36 2016 -0800
@@ -1309,6 +1309,7 @@
* @see javax.swing.text.View#getToolTipText
* @since 1.4
*/
+ @SuppressWarnings("deprecation")
public String getToolTipText(JTextComponent t, Point pt) {
if (!painted) {
return null;
@@ -2264,6 +2265,7 @@
* <li>the press event is located over a selection
* </ul>
*/
+ @SuppressWarnings("deprecation")
protected boolean isDragPossible(MouseEvent e) {
JTextComponent c = (JTextComponent)e.getSource();
if (c.isEnabled()) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiTextUI.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiTextUI.java Mon Nov 14 09:59:36 2016 -0800
@@ -85,6 +85,7 @@
* the UI obtained from the default <code>LookAndFeel</code>
* @since 1.4
*/
+ @SuppressWarnings("deprecation")
public String getToolTipText(JTextComponent a, Point b) {
String returnValue =
((TextUI) (uis.elementAt(0))).getToolTipText(a,b);
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java Mon Nov 14 09:59:36 2016 -0800
@@ -304,6 +304,7 @@
*
* @param e the mouse event
*/
+ @SuppressWarnings("deprecation")
protected void positionCaret(MouseEvent e) {
Point pt = new Point(e.getX(), e.getY());
Position.Bias[] biasRet = new Position.Bias[1];
@@ -323,6 +324,7 @@
*
* @param e the mouse event
*/
+ @SuppressWarnings("deprecation")
protected void moveCaret(MouseEvent e) {
Point pt = new Point(e.getX(), e.getY());
Position.Bias[] biasRet = new Position.Bias[1];
@@ -615,6 +617,7 @@
* @param g the graphics context
* @see #damage
*/
+ @SuppressWarnings("deprecation")
public void paint(Graphics g) {
if(isVisible()) {
try {
@@ -959,6 +962,7 @@
* @see #isActive
* @see Caret#setVisible
*/
+ @SuppressWarnings("deprecation")
public void setVisible(boolean e) {
// focus lost notification can come in later after the
// caret has been deinstalled, in which case the component
@@ -1301,6 +1305,7 @@
* event thread so that calling <code>modelToView</code>
* is safe.
*/
+ @SuppressWarnings("deprecation")
void repaintNewCaret() {
if (component != null) {
TextUI mapper = component.getUI();
@@ -1664,6 +1669,7 @@
*
* @param e the action event
*/
+ @SuppressWarnings("deprecation")
public void actionPerformed(ActionEvent e) {
if (width == 0 || height == 0) {
// setVisible(true) will cause a scroll, only do this if the
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java Mon Nov 14 09:59:36 2016 -0800
@@ -1429,6 +1429,7 @@
}
/** The operation to perform when this action is triggered. */
+ @SuppressWarnings("deprecation")
public void actionPerformed(ActionEvent e) {
JTextComponent target = getTextComponent(e);
if (target != null) {
@@ -1542,6 +1543,7 @@
* Returns adjustsed {@code y} position that indicates the location to scroll to
* after selecting <code>index</code>.
*/
+ @SuppressWarnings("deprecation")
private int getAdjustedY(JTextComponent text, Rectangle visible, int index) {
int result = visible.y;
@@ -1589,6 +1591,7 @@
}
/** The operation to perform when this action is triggered. */
+ @SuppressWarnings("deprecation")
public void actionPerformed(ActionEvent e) {
JTextComponent target = getTextComponent(e);
if (target != null) {
@@ -1672,6 +1675,7 @@
}
/** The operation to perform when this action is triggered. */
+ @SuppressWarnings("deprecation")
public void actionPerformed(ActionEvent e) {
JTextComponent target = getTextComponent(e);
if (target != null) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultHighlighter.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultHighlighter.java Mon Nov 14 09:59:36 2016 -0800
@@ -405,6 +405,7 @@
* @param bounds the bounding box for the highlight
* @param c the editor
*/
+ @SuppressWarnings("deprecation")
public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c) {
Rectangle alloc = bounds.getBounds();
try {
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/FieldView.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/FieldView.java Mon Nov 14 09:59:36 2016 -0800
@@ -205,6 +205,7 @@
* that is returned, although there is no guarantee.
* The parent may choose to resize or break the view.
*/
+ @SuppressWarnings("deprecation")
public float getPreferredSpan(int axis) {
switch (axis) {
case View.X_AXIS:
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java Mon Nov 14 09:59:36 2016 -0800
@@ -785,6 +785,7 @@
* @param p the point to calculate a drop location for
* @return the drop location, or <code>null</code>
*/
+ @SuppressWarnings("deprecation")
DropLocation dropLocationForPoint(Point p) {
Position.Bias[] bias = new Position.Bias[1];
int index = getUI().viewToModel(this, p, bias);
@@ -1959,6 +1960,7 @@
* @see javax.swing.plaf.TextUI#getToolTipText
* @see javax.swing.ToolTipManager#registerComponent
*/
+ @SuppressWarnings("deprecation")
public String getToolTipText(MouseEvent event) {
String retValue = super.getToolTipText(event);
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java Mon Nov 14 09:59:36 2016 -0800
@@ -178,6 +178,7 @@
* @return the location in the model that represents the
* next location visual position
*/
+ @SuppressWarnings("deprecation")
protected int getNextNorthSouthVisualPositionFrom(int pos, Position.Bias b,
Shape a, int direction,
Position.Bias[] biasRet)
@@ -252,6 +253,7 @@
// NOTE: This will not properly work if ParagraphView contains
// other ParagraphViews. It won't raise, but this does not message
// the children views with getNextVisualPositionFrom.
+ @SuppressWarnings("deprecation")
protected int getClosestPositionTo(int pos, Position.Bias b, Shape a,
int direction, Position.Bias[] biasRet,
int rowIndex, int x)
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/PasswordView.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/PasswordView.java Mon Nov 14 09:59:36 2016 -0800
@@ -84,6 +84,7 @@
return drawUnselectedTextImpl(g, x, y, p0, p1, true);
}
+ @SuppressWarnings("deprecation")
private float drawUnselectedTextImpl(Graphics g, float x, float y,
int p0, int p1,
boolean useFPAPI)
@@ -152,6 +153,7 @@
return drawSelectedTextImpl(g, x, y, p0, p1, true);
}
+ @SuppressWarnings("deprecation")
private float drawSelectedTextImpl(Graphics g, float x, float y,
int p0, int p1,
boolean useFPAPI)
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/PlainView.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/PlainView.java Mon Nov 14 09:59:36 2016 -0800
@@ -471,6 +471,7 @@
* represent a valid location in the associated document
* @see View#modelToView
*/
+ @SuppressWarnings("deprecation")
public Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException {
// line coordinates
Document doc = getDocument();
@@ -798,6 +799,7 @@
* the given element. It is assumed that the font
* and font metrics are up-to-date.
*/
+ @SuppressWarnings("deprecation")
private int getLineWidth(Element line) {
if (line == null) {
return 0;
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/Utilities.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/Utilities.java Mon Nov 14 09:59:36 2016 -0800
@@ -672,6 +672,7 @@
* a value of -1 will be returned.
* @exception BadLocationException if the offset is out of range
*/
+ @SuppressWarnings("deprecation")
public static final int getRowStart(JTextComponent c, int offs) throws BadLocationException {
Rectangle r = c.modelToView(offs);
if (r == null) {
@@ -702,6 +703,7 @@
* a value of -1 will be returned.
* @exception BadLocationException if the offset is out of range
*/
+ @SuppressWarnings("deprecation")
public static final int getRowEnd(JTextComponent c, int offs) throws BadLocationException {
Rectangle2D r = c.modelToView2D(offs);
if (r == null) {
@@ -744,6 +746,7 @@
return getPositionAbove(c, offs, x, false);
}
+ @SuppressWarnings("deprecation")
static final int getPositionAbove(JTextComponent c, int offs, float x,
boolean useFPAPI) throws BadLocationException
{
@@ -818,6 +821,7 @@
return getPositionBelow(c, offs, x, false);
}
+ @SuppressWarnings("deprecation")
static final int getPositionBelow(JTextComponent c, int offs, float x,
boolean useFPAPI) throws BadLocationException
{
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/View.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/View.java Mon Nov 14 09:59:36 2016 -0800
@@ -501,6 +501,7 @@
* @exception IllegalArgumentException if <code>direction</code>
* doesn't have one of the legal values above
*/
+ @SuppressWarnings("deprecation")
public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a,
int direction, Position.Bias[] biasRet)
throws BadLocationException {
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/WrappedPlainView.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/WrappedPlainView.java Mon Nov 14 09:59:36 2016 -0800
@@ -352,6 +352,7 @@
* @param p1 the ending document location to use
* @return the break position
*/
+ @SuppressWarnings("deprecation")
protected int calculateBreakPosition(int p0, int p1) {
int p;
Segment segment = SegmentCache.getSharedSegment();
@@ -749,6 +750,7 @@
* valid location in the associated document
* @see View#modelToView
*/
+ @SuppressWarnings("deprecation")
public Shape modelToView(int pos, Shape a, Position.Bias b)
throws BadLocationException {
Rectangle alloc = a.getBounds();
@@ -793,6 +795,7 @@
* given point in the view
* @see View#viewToModel
*/
+ @SuppressWarnings("deprecation")
public int viewToModel(float fx, float fy, Shape a, Position.Bias[] bias) {
// PENDING(prinz) implement bias properly
bias[0] = Position.Bias.Forward;
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/AccessibleHTML.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/AccessibleHTML.java Mon Nov 14 09:59:36 2016 -0800
@@ -936,6 +936,7 @@
* @return the screen coordinates of the character's the bounding box,
* if index is invalid returns an empty rectangle.
*/
+ @SuppressWarnings("deprecation")
public Rectangle getCharacterBounds(int i) {
try {
return editor.getUI().modelToView(editor, i);
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java Mon Nov 14 09:59:36 2016 -0800
@@ -683,6 +683,7 @@
* @param e the mouse event
* @see MouseListener#mouseClicked
*/
+ @SuppressWarnings("deprecation")
public void mouseClicked(MouseEvent e) {
JEditorPane editor = (JEditorPane) e.getSource();
@@ -701,6 +702,7 @@
}
// track the moving of the mouse.
+ @SuppressWarnings("deprecation")
public void mouseMoved(MouseEvent e) {
JEditorPane editor = (JEditorPane) e.getSource();
if (!editor.isEnabled()) {
@@ -773,6 +775,7 @@
* Returns a string anchor if the passed in element has a
* USEMAP that contains the passed in location.
*/
+ @SuppressWarnings("deprecation")
private String getMapHREF(JEditorPane html, HTMLDocument hdoc,
Element elem, AttributeSet attr, int offset,
int x, int y) {
@@ -813,6 +816,7 @@
* the location <code>x</code>, <code>y</code>. <code>offset</code>
* gives the offset into the Document to check for.
*/
+ @SuppressWarnings("deprecation")
private boolean doesElementContainLocation(JEditorPane editor,
Element e, int offset,
int x, int y) {
--- a/jdk/src/java.desktop/share/classes/sun/swing/JLightweightFrame.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/swing/JLightweightFrame.java Mon Nov 14 09:59:36 2016 -0800
@@ -249,6 +249,7 @@
}
@Override
+ @SuppressWarnings("deprecation")
public void notifyDisplayChanged(final int scaleFactor) {
notifyDisplayChanged(scaleFactor, scaleFactor);
}
--- a/jdk/src/java.desktop/share/classes/sun/swing/text/TextComponentPrintable.java Mon Nov 14 09:03:07 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/swing/text/TextComponentPrintable.java Mon Nov 14 09:59:36 2016 -0800
@@ -753,6 +753,7 @@
* First step is to find yStart and yEnd for the every document position.
* Second step is to merge all intersected segments ( [yStart, yEnd] ).
*/
+ @SuppressWarnings("deprecation")
private void calculateRowsMetrics() {
final int documentLength = printShell.getDocument().getLength();
List<IntegerSegment> documentMetrics = new ArrayList<IntegerSegment>(LIST_SIZE);