提交 931dd633 编写于 作者: M mcherkas

8007295: Reduce number of warnings in awt classes

Reviewed-by: bae, anthony
上级 980bd25d
...@@ -277,7 +277,7 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access ...@@ -277,7 +277,7 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access
* @since 1.4 * @since 1.4
*/ */
public synchronized ItemListener[] getItemListeners() { public synchronized ItemListener[] getItemListeners() {
return (ItemListener[])(getListeners(ItemListener.class)); return getListeners(ItemListener.class);
} }
/** /**
......
...@@ -163,11 +163,11 @@ public class Cursor implements java.io.Serializable { ...@@ -163,11 +163,11 @@ public class Cursor implements java.io.Serializable {
* hashtable, filesystem dir prefix, filename, and properties for custom cursors support * hashtable, filesystem dir prefix, filename, and properties for custom cursors support
*/ */
private static final Hashtable systemCustomCursors = new Hashtable(1); private static final Hashtable<String,Cursor> systemCustomCursors = new Hashtable<>(1);
private static final String systemCustomCursorDirPrefix = initCursorDir(); private static final String systemCustomCursorDirPrefix = initCursorDir();
private static String initCursorDir() { private static String initCursorDir() {
String jhome = (String) java.security.AccessController.doPrivileged( String jhome = java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("java.home")); new sun.security.action.GetPropertyAction("java.home"));
return jhome + return jhome +
File.separator + "lib" + File.separator + "images" + File.separator + "lib" + File.separator + "images" +
...@@ -298,7 +298,7 @@ public class Cursor implements java.io.Serializable { ...@@ -298,7 +298,7 @@ public class Cursor implements java.io.Serializable {
static public Cursor getSystemCustomCursor(final String name) static public Cursor getSystemCustomCursor(final String name)
throws AWTException, HeadlessException { throws AWTException, HeadlessException {
GraphicsEnvironment.checkHeadless(); GraphicsEnvironment.checkHeadless();
Cursor cursor = (Cursor)systemCustomCursors.get(name); Cursor cursor = systemCustomCursors.get(name);
if (cursor == null) { if (cursor == null) {
synchronized(systemCustomCursors) { synchronized(systemCustomCursors) {
...@@ -319,11 +319,11 @@ public class Cursor implements java.io.Serializable { ...@@ -319,11 +319,11 @@ public class Cursor implements java.io.Serializable {
final String fileName = final String fileName =
systemCustomCursorProperties.getProperty(key); systemCustomCursorProperties.getProperty(key);
String localized = (String)systemCustomCursorProperties.getProperty(prefix + DotNameSuffix); String localized = systemCustomCursorProperties.getProperty(prefix + DotNameSuffix);
if (localized == null) localized = name; if (localized == null) localized = name;
String hotspot = (String)systemCustomCursorProperties.getProperty(prefix + DotHotspotSuffix); String hotspot = systemCustomCursorProperties.getProperty(prefix + DotHotspotSuffix);
if (hotspot == null) if (hotspot == null)
throw new AWTException("no hotspot property defined for cursor: " + name); throw new AWTException("no hotspot property defined for cursor: " + name);
...@@ -348,9 +348,9 @@ public class Cursor implements java.io.Serializable { ...@@ -348,9 +348,9 @@ public class Cursor implements java.io.Serializable {
final int fy = y; final int fy = y;
final String flocalized = localized; final String flocalized = localized;
cursor = (Cursor) java.security.AccessController.doPrivileged( cursor = java.security.AccessController.<Cursor>doPrivileged(
new java.security.PrivilegedExceptionAction() { new java.security.PrivilegedExceptionAction<Cursor>() {
public Object run() throws Exception { public Cursor run() throws Exception {
Toolkit toolkit = Toolkit.getDefaultToolkit(); Toolkit toolkit = Toolkit.getDefaultToolkit();
Image image = toolkit.getImage( Image image = toolkit.getImage(
systemCustomCursorDirPrefix + fileName); systemCustomCursorDirPrefix + fileName);
...@@ -447,8 +447,8 @@ public class Cursor implements java.io.Serializable { ...@@ -447,8 +447,8 @@ public class Cursor implements java.io.Serializable {
systemCustomCursorProperties = new Properties(); systemCustomCursorProperties = new Properties();
try { try {
AccessController.doPrivileged( AccessController.<Object>doPrivileged(
new java.security.PrivilegedExceptionAction() { new java.security.PrivilegedExceptionAction<Object>() {
public Object run() throws Exception { public Object run() throws Exception {
FileInputStream fis = null; FileInputStream fis = null;
try { try {
......
...@@ -171,7 +171,7 @@ public class EventQueue { ...@@ -171,7 +171,7 @@ public class EventQueue {
* The modifiers field of the current event, if the current event is an * The modifiers field of the current event, if the current event is an
* InputEvent or ActionEvent. * InputEvent or ActionEvent.
*/ */
private WeakReference currentEvent; private WeakReference<AWTEvent> currentEvent;
/* /*
* Non-zero if a thread is waiting in getNextEvent(int) for an event of * Non-zero if a thread is waiting in getNextEvent(int) for an event of
...@@ -809,7 +809,7 @@ public class EventQueue { ...@@ -809,7 +809,7 @@ public class EventQueue {
pushPopLock.lock(); pushPopLock.lock();
try { try {
return (Thread.currentThread() == dispatchThread) return (Thread.currentThread() == dispatchThread)
? ((AWTEvent)currentEvent.get()) ? currentEvent.get()
: null; : null;
} finally { } finally {
pushPopLock.unlock(); pushPopLock.unlock();
...@@ -1167,7 +1167,7 @@ public class EventQueue { ...@@ -1167,7 +1167,7 @@ public class EventQueue {
return; return;
} }
currentEvent = new WeakReference(e); currentEvent = new WeakReference<>(e);
// This series of 'instanceof' checks should be replaced with a // This series of 'instanceof' checks should be replaced with a
// polymorphic type (for example, an interface which declares a // polymorphic type (for example, an interface which declares a
......
...@@ -66,7 +66,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible { ...@@ -66,7 +66,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible {
AWTAccessor.setMenuAccessor( AWTAccessor.setMenuAccessor(
new AWTAccessor.MenuAccessor() { new AWTAccessor.MenuAccessor() {
public Vector getItems(Menu menu) { public Vector<MenuComponent> getItems(Menu menu) {
return menu.items; return menu.items;
} }
}); });
...@@ -78,7 +78,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible { ...@@ -78,7 +78,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible {
* @serial * @serial
* @see #countItems() * @see #countItems()
*/ */
Vector items = new Vector(); Vector<MenuComponent> items = new Vector<>();
/** /**
* This field indicates whether the menu has the * This field indicates whether the menu has the
...@@ -313,7 +313,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible { ...@@ -313,7 +313,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible {
} }
int nitems = getItemCount(); int nitems = getItemCount();
Vector tempItems = new Vector(); Vector<MenuItem> tempItems = new Vector<>();
/* Remove the item at index, nitems-index times /* Remove the item at index, nitems-index times
storing them in a temporary vector in the storing them in a temporary vector in the
...@@ -330,7 +330,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible { ...@@ -330,7 +330,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible {
already in the correct order in the temp vector. already in the correct order in the temp vector.
*/ */
for (int i = 0; i < tempItems.size() ; i++) { for (int i = 0; i < tempItems.size() ; i++) {
add((MenuItem)tempItems.elementAt(i)); add(tempItems.elementAt(i));
} }
} }
} }
...@@ -379,7 +379,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible { ...@@ -379,7 +379,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible {
} }
int nitems = getItemCount(); int nitems = getItemCount();
Vector tempItems = new Vector(); Vector<MenuItem> tempItems = new Vector<>();
/* Remove the item at index, nitems-index times /* Remove the item at index, nitems-index times
storing them in a temporary vector in the storing them in a temporary vector in the
...@@ -396,7 +396,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible { ...@@ -396,7 +396,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible {
already in the correct order in the temp vector. already in the correct order in the temp vector.
*/ */
for (int i = 0; i < tempItems.size() ; i++) { for (int i = 0; i < tempItems.size() ; i++) {
add((MenuItem)tempItems.elementAt(i)); add(tempItems.elementAt(i));
} }
} }
} }
...@@ -475,13 +475,13 @@ public class Menu extends MenuItem implements MenuContainer, Accessible { ...@@ -475,13 +475,13 @@ public class Menu extends MenuItem implements MenuContainer, Accessible {
return null; return null;
} }
synchronized Enumeration shortcuts() { synchronized Enumeration<MenuShortcut> shortcuts() {
Vector shortcuts = new Vector(); Vector<MenuShortcut> shortcuts = new Vector<>();
int nitems = getItemCount(); int nitems = getItemCount();
for (int i = 0 ; i < nitems ; i++) { for (int i = 0 ; i < nitems ; i++) {
MenuItem mi = getItem(i); MenuItem mi = getItem(i);
if (mi instanceof Menu) { if (mi instanceof Menu) {
Enumeration e = ((Menu)mi).shortcuts(); Enumeration<MenuShortcut> e = ((Menu)mi).shortcuts();
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
shortcuts.addElement(e.nextElement()); shortcuts.addElement(e.nextElement());
} }
......
...@@ -81,7 +81,7 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible ...@@ -81,7 +81,7 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible
return menuBar.helpMenu; return menuBar.helpMenu;
} }
public Vector getMenus(MenuBar menuBar) { public Vector<Menu> getMenus(MenuBar menuBar) {
return menuBar.menus; return menuBar.menus;
} }
}); });
...@@ -94,7 +94,7 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible ...@@ -94,7 +94,7 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible
* @serial * @serial
* @see #countMenus() * @see #countMenus()
*/ */
Vector menus = new Vector(); Vector<Menu> menus = new Vector<>();
/** /**
* This menu is a special menu dedicated to * This menu is a special menu dedicated to
...@@ -309,7 +309,7 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible ...@@ -309,7 +309,7 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible
* be called on the toolkit thread. * be called on the toolkit thread.
*/ */
final Menu getMenuImpl(int i) { final Menu getMenuImpl(int i) {
return (Menu)menus.elementAt(i); return menus.elementAt(i);
} }
/** /**
...@@ -321,10 +321,10 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible ...@@ -321,10 +321,10 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible
* @since JDK1.1 * @since JDK1.1
*/ */
public synchronized Enumeration<MenuShortcut> shortcuts() { public synchronized Enumeration<MenuShortcut> shortcuts() {
Vector shortcuts = new Vector(); Vector<MenuShortcut> shortcuts = new Vector<>();
int nmenus = getMenuCount(); int nmenus = getMenuCount();
for (int i = 0 ; i < nmenus ; i++) { for (int i = 0 ; i < nmenus ; i++) {
Enumeration e = getMenu(i).shortcuts(); Enumeration<MenuShortcut> e = getMenu(i).shortcuts();
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
shortcuts.addElement(e.nextElement()); shortcuts.addElement(e.nextElement());
} }
...@@ -438,7 +438,7 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible ...@@ -438,7 +438,7 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible
// HeadlessException will be thrown from MenuComponent's readObject // HeadlessException will be thrown from MenuComponent's readObject
s.defaultReadObject(); s.defaultReadObject();
for (int i = 0; i < menus.size(); i++) { for (int i = 0; i < menus.size(); i++) {
Menu m = (Menu)menus.elementAt(i); Menu m = menus.elementAt(i);
m.parent = this; m.parent = this;
} }
} }
......
...@@ -290,7 +290,7 @@ public abstract class MenuComponent implements java.io.Serializable { ...@@ -290,7 +290,7 @@ public abstract class MenuComponent implements java.io.Serializable {
public void setFont(Font f) { public void setFont(Font f) {
font = f; font = f;
//Fixed 6312943: NullPointerException in method MenuComponent.setFont(Font) //Fixed 6312943: NullPointerException in method MenuComponent.setFont(Font)
MenuComponentPeer peer = (MenuComponentPeer)this.peer; MenuComponentPeer peer = this.peer;
if (peer != null) { if (peer != null) {
peer.setFont(f); peer.setFont(f);
} }
...@@ -303,7 +303,7 @@ public abstract class MenuComponent implements java.io.Serializable { ...@@ -303,7 +303,7 @@ public abstract class MenuComponent implements java.io.Serializable {
*/ */
public void removeNotify() { public void removeNotify() {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
MenuComponentPeer p = (MenuComponentPeer)this.peer; MenuComponentPeer p = this.peer;
if (p != null) { if (p != null) {
Toolkit.getEventQueue().removeSourceEvents(this, true); Toolkit.getEventQueue().removeSourceEvents(this, true);
this.peer = null; this.peer = null;
......
...@@ -564,7 +564,7 @@ public class MenuItem extends MenuComponent implements Accessible { ...@@ -564,7 +564,7 @@ public class MenuItem extends MenuComponent implements Accessible {
* @since 1.4 * @since 1.4
*/ */
public synchronized ActionListener[] getActionListeners() { public synchronized ActionListener[] getActionListeners() {
return (ActionListener[])(getListeners(ActionListener.class)); return getListeners(ActionListener.class);
} }
/** /**
......
...@@ -92,7 +92,7 @@ public class RenderingHints ...@@ -92,7 +92,7 @@ public class RenderingHints
* {@code equals()} method. * {@code equals()} method.
*/ */
public abstract static class Key { public abstract static class Key {
private static HashMap identitymap = new HashMap(17); private static HashMap<Object,Object> identitymap = new HashMap<>(17);
private String getIdentity() { private String getIdentity() {
// Note that the identity string is dependent on 3 variables: // Note that the identity string is dependent on 3 variables:
...@@ -138,7 +138,7 @@ public class RenderingHints ...@@ -138,7 +138,7 @@ public class RenderingHints
} }
// Note: Use a weak reference to avoid holding on to extra // Note: Use a weak reference to avoid holding on to extra
// objects and classes after they should be unloaded. // objects and classes after they should be unloaded.
identitymap.put(identity, new WeakReference(k)); identitymap.put(identity, new WeakReference<Key>(k));
} }
private int privatekey; private int privatekey;
...@@ -195,7 +195,7 @@ public class RenderingHints ...@@ -195,7 +195,7 @@ public class RenderingHints
} }
} }
HashMap hintmap = new HashMap(7); HashMap<Object,Object> hintmap = new HashMap<>(7);
/** /**
* Antialiasing hint key. * Antialiasing hint key.
...@@ -1267,12 +1267,13 @@ public class RenderingHints ...@@ -1267,12 +1267,13 @@ public class RenderingHints
* object. * object.
* @return a clone of this instance. * @return a clone of this instance.
*/ */
@SuppressWarnings("unchecked")
public Object clone() { public Object clone() {
RenderingHints rh; RenderingHints rh;
try { try {
rh = (RenderingHints) super.clone(); rh = (RenderingHints) super.clone();
if (hintmap != null) { if (hintmap != null) {
rh.hintmap = (HashMap) hintmap.clone(); rh.hintmap = (HashMap<Object,Object>) hintmap.clone();
} }
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable // this shouldn't happen, since we are Cloneable
......
...@@ -71,7 +71,7 @@ public class Clipboard { ...@@ -71,7 +71,7 @@ public class Clipboard {
* *
* @since 1.5 * @since 1.5
*/ */
private Set currentDataFlavors; private Set<DataFlavor> currentDataFlavors;
/** /**
* Creates a clipboard object. * Creates a clipboard object.
...@@ -313,7 +313,7 @@ public class Clipboard { ...@@ -313,7 +313,7 @@ public class Clipboard {
if (flavorListeners == null) { if (flavorListeners == null) {
return; return;
} }
Set prevDataFlavors = currentDataFlavors; Set<DataFlavor> prevDataFlavors = currentDataFlavors;
currentDataFlavors = getAvailableDataFlavorSet(); currentDataFlavors = getAvailableDataFlavorSet();
if (prevDataFlavors.equals(currentDataFlavors)) { if (prevDataFlavors.equals(currentDataFlavors)) {
return; return;
...@@ -339,8 +339,8 @@ public class Clipboard { ...@@ -339,8 +339,8 @@ public class Clipboard {
* *
* @since 1.5 * @since 1.5
*/ */
private Set getAvailableDataFlavorSet() { private Set<DataFlavor> getAvailableDataFlavorSet() {
Set set = new HashSet(); Set<DataFlavor> set = new HashSet<>();
Transferable contents = getContents(null); Transferable contents = getContents(null);
if (contents != null) { if (contents != null) {
DataFlavor[] flavors = contents.getTransferDataFlavors(); DataFlavor[] flavors = contents.getTransferDataFlavors();
......
...@@ -165,7 +165,7 @@ public class DragGestureEvent extends EventObject { ...@@ -165,7 +165,7 @@ public class DragGestureEvent extends EventObject {
* <P> * <P>
* @return an Iterator for the events comprising the gesture * @return an Iterator for the events comprising the gesture
*/ */
@SuppressWarnings("unchecked")
public Iterator<InputEvent> iterator() { return events.iterator(); } public Iterator<InputEvent> iterator() { return events.iterator(); }
/** /**
...@@ -184,7 +184,7 @@ public class DragGestureEvent extends EventObject { ...@@ -184,7 +184,7 @@ public class DragGestureEvent extends EventObject {
* <P> * <P>
* @return an array of the events comprising the gesture * @return an array of the events comprising the gesture
*/ */
@SuppressWarnings("unchecked")
public Object[] toArray(Object[] array) { return events.toArray(array); } public Object[] toArray(Object[] array) { return events.toArray(array); }
/** /**
...@@ -333,7 +333,6 @@ public class DragGestureEvent extends EventObject { ...@@ -333,7 +333,6 @@ public class DragGestureEvent extends EventObject {
component = (Component)f.get("component", null); component = (Component)f.get("component", null);
origin = (Point)f.get("origin", null); origin = (Point)f.get("origin", null);
action = f.get("action", 0); action = f.get("action", 0);
// Pre-1.4 support. 'events' was previously non-transient // Pre-1.4 support. 'events' was previously non-transient
try { try {
events = (List)f.get("events", null); events = (List)f.get("events", null);
...@@ -351,7 +350,7 @@ public class DragGestureEvent extends EventObject { ...@@ -351,7 +350,7 @@ public class DragGestureEvent extends EventObject {
/* /*
* fields * fields
*/ */
@SuppressWarnings("rawtypes")
private transient List events; private transient List events;
/** /**
......
...@@ -297,7 +297,7 @@ public abstract class DragGestureRecognizer implements Serializable { ...@@ -297,7 +297,7 @@ public abstract class DragGestureRecognizer implements Serializable {
* @return the initial event that triggered the drag gesture * @return the initial event that triggered the drag gesture
*/ */
public InputEvent getTriggerEvent() { return events.isEmpty() ? null : (InputEvent)events.get(0); } public InputEvent getTriggerEvent() { return events.isEmpty() ? null : events.get(0); }
/** /**
* Reset the Recognizer, if its currently recognizing a gesture, ignore * Reset the Recognizer, if its currently recognizing a gesture, ignore
......
...@@ -600,7 +600,7 @@ public class DragSource implements Serializable { ...@@ -600,7 +600,7 @@ public class DragSource implements Serializable {
* @since 1.4 * @since 1.4
*/ */
public DragSourceListener[] getDragSourceListeners() { public DragSourceListener[] getDragSourceListeners() {
return (DragSourceListener[])getListeners(DragSourceListener.class); return getListeners(DragSourceListener.class);
} }
/** /**
...@@ -660,8 +660,7 @@ public class DragSource implements Serializable { ...@@ -660,8 +660,7 @@ public class DragSource implements Serializable {
* @since 1.4 * @since 1.4
*/ */
public DragSourceMotionListener[] getDragSourceMotionListeners() { public DragSourceMotionListener[] getDragSourceMotionListeners() {
return (DragSourceMotionListener[]) return getListeners(DragSourceMotionListener.class);
getListeners(DragSourceMotionListener.class);
} }
/** /**
...@@ -896,8 +895,8 @@ public class DragSource implements Serializable { ...@@ -896,8 +895,8 @@ public class DragSource implements Serializable {
* @since 1.5 * @since 1.5
*/ */
public static int getDragThreshold() { public static int getDragThreshold() {
int ts = ((Integer)AccessController.doPrivileged( int ts = AccessController.doPrivileged(
new GetIntegerAction("awt.dnd.drag.threshold", 0))).intValue(); new GetIntegerAction("awt.dnd.drag.threshold", 0)).intValue();
if (ts > 0) { if (ts > 0) {
return ts; return ts;
} else { } else {
......
...@@ -36,6 +36,8 @@ package java.awt.dnd; ...@@ -36,6 +36,8 @@ package java.awt.dnd;
public class InvalidDnDOperationException extends IllegalStateException { public class InvalidDnDOperationException extends IllegalStateException {
private static final long serialVersionUID = 5156676500247816278L;
static private String dft_msg = "The operation requested cannot be performed by the DnD system since it is not in the appropriate state"; static private String dft_msg = "The operation requested cannot be performed by the DnD system since it is not in the appropriate state";
/** /**
......
...@@ -876,6 +876,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -876,6 +876,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
* they have not been cached. * they have not been cached.
* @see #getType * @see #getType
*/ */
@SuppressWarnings("fallthrough")
private void calculateType() { private void calculateType() {
int ret = TYPE_IDENTITY; int ret = TYPE_IDENTITY;
boolean sgn0, sgn1; boolean sgn0, sgn1;
...@@ -1038,6 +1039,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -1038,6 +1039,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
* @see #TYPE_UNIFORM_SCALE * @see #TYPE_UNIFORM_SCALE
* @since 1.2 * @since 1.2
*/ */
@SuppressWarnings("fallthrough")
public double getDeterminant() { public double getDeterminant() {
switch (state) { switch (state) {
default: default:
...@@ -1250,6 +1252,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -1250,6 +1252,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
default: default:
stateError(); stateError();
/* NOTREACHED */ /* NOTREACHED */
return;
case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE):
m02 = tx * m00 + ty * m01 + m02; m02 = tx * m00 + ty * m01 + m02;
m12 = tx * m10 + ty * m11 + m12; m12 = tx * m10 + ty * m11 + m12;
...@@ -1631,6 +1634,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -1631,6 +1634,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
* Y axis direction * Y axis direction
* @since 1.2 * @since 1.2
*/ */
@SuppressWarnings("fallthrough")
public void scale(double sx, double sy) { public void scale(double sx, double sy) {
int state = this.state; int state = this.state;
switch (state) { switch (state) {
...@@ -1705,6 +1709,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -1705,6 +1709,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
default: default:
stateError(); stateError();
/* NOTREACHED */ /* NOTREACHED */
return;
case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE):
case (APPLY_SHEAR | APPLY_SCALE): case (APPLY_SHEAR | APPLY_SCALE):
double M0, M1; double M0, M1;
...@@ -2224,6 +2229,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -2224,6 +2229,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
* @see #preConcatenate * @see #preConcatenate
* @since 1.2 * @since 1.2
*/ */
@SuppressWarnings("fallthrough")
public void concatenate(AffineTransform Tx) { public void concatenate(AffineTransform Tx) {
double M0, M1; double M0, M1;
double T00, T01, T10, T11; double T00, T01, T10, T11;
...@@ -2432,6 +2438,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -2432,6 +2438,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
* @see #concatenate * @see #concatenate
* @since 1.2 * @since 1.2
*/ */
@SuppressWarnings("fallthrough")
public void preConcatenate(AffineTransform Tx) { public void preConcatenate(AffineTransform Tx) {
double M0, M1; double M0, M1;
double T00, T01, T10, T11; double T00, T01, T10, T11;
...@@ -2655,6 +2662,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -2655,6 +2662,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
default: default:
stateError(); stateError();
/* NOTREACHED */ /* NOTREACHED */
return null;
case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE):
det = m00 * m11 - m01 * m10; det = m00 * m11 - m01 * m10;
if (Math.abs(det) <= Double.MIN_VALUE) { if (Math.abs(det) <= Double.MIN_VALUE) {
...@@ -2751,6 +2759,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -2751,6 +2759,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
default: default:
stateError(); stateError();
/* NOTREACHED */ /* NOTREACHED */
return;
case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE):
M00 = m00; M01 = m01; M02 = m02; M00 = m00; M01 = m01; M02 = m02;
M10 = m10; M11 = m11; M12 = m12; M10 = m10; M11 = m11; M12 = m12;
...@@ -2885,6 +2894,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -2885,6 +2894,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
default: default:
stateError(); stateError();
/* NOTREACHED */ /* NOTREACHED */
return null;
case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE):
ptDst.setLocation(x * m00 + y * m01 + m02, ptDst.setLocation(x * m00 + y * m01 + m02,
x * m10 + y * m11 + m12); x * m10 + y * m11 + m12);
...@@ -2968,6 +2978,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -2968,6 +2978,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
default: default:
stateError(); stateError();
/* NOTREACHED */ /* NOTREACHED */
return;
case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE):
dst.setLocation(x * m00 + y * m01 + m02, dst.setLocation(x * m00 + y * m01 + m02,
x * m10 + y * m11 + m12); x * m10 + y * m11 + m12);
...@@ -3043,6 +3054,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -3043,6 +3054,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
default: default:
stateError(); stateError();
/* NOTREACHED */ /* NOTREACHED */
return;
case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE):
M00 = m00; M01 = m01; M02 = m02; M00 = m00; M01 = m01; M02 = m02;
M10 = m10; M11 = m11; M12 = m12; M10 = m10; M11 = m11; M12 = m12;
...@@ -3157,6 +3169,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -3157,6 +3169,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
default: default:
stateError(); stateError();
/* NOTREACHED */ /* NOTREACHED */
return;
case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE):
M00 = m00; M01 = m01; M02 = m02; M00 = m00; M01 = m01; M02 = m02;
M10 = m10; M11 = m11; M12 = m12; M10 = m10; M11 = m11; M12 = m12;
...@@ -3252,6 +3265,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -3252,6 +3265,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
default: default:
stateError(); stateError();
/* NOTREACHED */ /* NOTREACHED */
return;
case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE):
M00 = m00; M01 = m01; M02 = m02; M00 = m00; M01 = m01; M02 = m02;
M10 = m10; M11 = m11; M12 = m12; M10 = m10; M11 = m11; M12 = m12;
...@@ -3347,6 +3361,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -3347,6 +3361,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
default: default:
stateError(); stateError();
/* NOTREACHED */ /* NOTREACHED */
return;
case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE):
M00 = m00; M01 = m01; M02 = m02; M00 = m00; M01 = m01; M02 = m02;
M10 = m10; M11 = m11; M12 = m12; M10 = m10; M11 = m11; M12 = m12;
...@@ -3436,6 +3451,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -3436,6 +3451,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
* inverted. * inverted.
* @since 1.2 * @since 1.2
*/ */
@SuppressWarnings("fallthrough")
public Point2D inverseTransform(Point2D ptSrc, Point2D ptDst) public Point2D inverseTransform(Point2D ptSrc, Point2D ptDst)
throws NoninvertibleTransformException throws NoninvertibleTransformException
{ {
...@@ -3547,6 +3563,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -3547,6 +3563,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
default: default:
stateError(); stateError();
/* NOTREACHED */ /* NOTREACHED */
return;
case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE):
M00 = m00; M01 = m01; M02 = m02; M00 = m00; M01 = m01; M02 = m02;
M10 = m10; M11 = m11; M12 = m12; M10 = m10; M11 = m11; M12 = m12;
...@@ -3679,6 +3696,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -3679,6 +3696,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
default: default:
stateError(); stateError();
/* NOTREACHED */ /* NOTREACHED */
return null;
case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE):
case (APPLY_SHEAR | APPLY_SCALE): case (APPLY_SHEAR | APPLY_SCALE):
ptDst.setLocation(x * m00 + y * m01, x * m10 + y * m11); ptDst.setLocation(x * m00 + y * m01, x * m10 + y * m11);
...@@ -3754,6 +3772,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { ...@@ -3754,6 +3772,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
default: default:
stateError(); stateError();
/* NOTREACHED */ /* NOTREACHED */
return;
case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE):
case (APPLY_SHEAR | APPLY_SCALE): case (APPLY_SHEAR | APPLY_SCALE):
M00 = m00; M01 = m01; M00 = m00; M01 = m01;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册