summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2009-03-09 16:09:02 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2009-03-09 16:09:02 +0000
commit526684ef33cdc9e14c83c10cc25d4e3b64389938 (patch)
tree26eac63d4a9f7e524dfe2b133f00f3374de9c0eb
parent0807654fb0860934433f77d7e74f17b713c0cce5 (diff)
downloadclasspath-526684ef33cdc9e14c83c10cc25d4e3b64389938.tar.gz
More warning fixes.
2009-03-09 Andrew John Hughes <ahughes@redhat.com> * gnu/javax/swing/text/html/css/Selector.java: Use CPStringBuilder. Use typed list of maps rather than an array for type safety. * javax/swing/text/html/HTMLEditorKit.java, * javax/swing/text/html/HTMLWriter.java: Add generic typing where appropriate. * javax/swing/text/html/ImageView.java: Remove unused AttributeSet variables. * javax/swing/text/html/MinimalHTMLWriter.java: Switch to an ArrayDeque to avoid unnecessary internal synchronisation on a private variable. Add generic typing. * javax/swing/text/html/MultiAttributeSet.java: Add generic typing. * javax/swing/text/html/MultiStyle.java: Add generic typing, make class package-private as not part of the standard classes. * javax/swing/text/html/ObjectView.java, * javax/swing/text/html/StyleSheet.java: Add generic typing. * javax/swing/text/html/TableView.java: Remove unused variable. * javax/swing/tree/DefaultMutableTreeNode.java: Add generic typing, mute warnings where necessary. * javax/swing/tree/FixedHeightLayoutCache.java: Add generic typing. * javax/swing/tree/TreeNode.java: Mute warnings where necessary. * javax/swing/tree/VariableHeightLayoutCache.java, * javax/swing/undo/StateEdit.java, * javax/swing/undo/UndoableEditSupport.java, * org/ietf/jgss/GSSManager.java: Add generic typing.
-rw-r--r--ChangeLog36
-rw-r--r--gnu/javax/swing/text/html/css/Selector.java15
-rw-r--r--javax/swing/text/html/HTMLEditorKit.java2
-rw-r--r--javax/swing/text/html/HTMLWriter.java38
-rw-r--r--javax/swing/text/html/ImageView.java3
-rw-r--r--javax/swing/text/html/MinimalHTMLWriter.java17
-rw-r--r--javax/swing/text/html/MultiAttributeSet.java8
-rw-r--r--javax/swing/text/html/MultiStyle.java4
-rw-r--r--javax/swing/text/html/ObjectView.java2
-rw-r--r--javax/swing/text/html/StyleSheet.java31
-rw-r--r--javax/swing/text/html/TableView.java1
-rw-r--r--javax/swing/tree/DefaultMutableTreeNode.java14
-rw-r--r--javax/swing/tree/FixedHeightLayoutCache.java4
-rw-r--r--javax/swing/tree/TreeNode.java1
-rw-r--r--javax/swing/tree/VariableHeightLayoutCache.java8
-rw-r--r--javax/swing/undo/StateEdit.java2
-rw-r--r--javax/swing/undo/UndoableEditSupport.java6
-rw-r--r--org/ietf/jgss/GSSManager.java2
18 files changed, 119 insertions, 75 deletions
diff --git a/ChangeLog b/ChangeLog
index e922adca4..fac808cf0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,39 @@
+2009-03-09 Andrew John Hughes <ahughes@redhat.com>
+
+ * gnu/javax/swing/text/html/css/Selector.java:
+ Use CPStringBuilder. Use typed list of maps
+ rather than an array for type safety.
+ * javax/swing/text/html/HTMLEditorKit.java,
+ * javax/swing/text/html/HTMLWriter.java:
+ Add generic typing where appropriate.
+ * javax/swing/text/html/ImageView.java:
+ Remove unused AttributeSet variables.
+ * javax/swing/text/html/MinimalHTMLWriter.java:
+ Switch to an ArrayDeque to avoid unnecessary
+ internal synchronisation on a private variable.
+ Add generic typing.
+ * javax/swing/text/html/MultiAttributeSet.java:
+ Add generic typing.
+ * javax/swing/text/html/MultiStyle.java:
+ Add generic typing, make class package-private
+ as not part of the standard classes.
+ * javax/swing/text/html/ObjectView.java,
+ * javax/swing/text/html/StyleSheet.java:
+ Add generic typing.
+ * javax/swing/text/html/TableView.java:
+ Remove unused variable.
+ * javax/swing/tree/DefaultMutableTreeNode.java:
+ Add generic typing, mute warnings where necessary.
+ * javax/swing/tree/FixedHeightLayoutCache.java:
+ Add generic typing.
+ * javax/swing/tree/TreeNode.java:
+ Mute warnings where necessary.
+ * javax/swing/tree/VariableHeightLayoutCache.java,
+ * javax/swing/undo/StateEdit.java,
+ * javax/swing/undo/UndoableEditSupport.java,
+ * org/ietf/jgss/GSSManager.java:
+ Add generic typing.
+
2009-02-14 Andrew John Hughes <ahughes@redhat.com>
* org/omg/CORBA/LocalObject.java,
diff --git a/gnu/javax/swing/text/html/css/Selector.java b/gnu/javax/swing/text/html/css/Selector.java
index 6e182a536..06d515c62 100644
--- a/gnu/javax/swing/text/html/css/Selector.java
+++ b/gnu/javax/swing/text/html/css/Selector.java
@@ -38,6 +38,9 @@ exception statement from your version. */
package gnu.javax.swing.text.html.css;
+import gnu.java.lang.CPStringBuilder;
+
+import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
@@ -97,7 +100,7 @@ public class Selector
* @return <code>true</code> when this selector matches the element path,
* <code>false</code> otherwise
*/
- public boolean matches(String[] tags, Map[] attributes)
+ public boolean matches(String[] tags, List<Map<String,String>> attributes)
{
// TODO: This implements class, id and descendent matching. These are
// the most commonly used selector matchers in CSS together with HTML.
@@ -118,11 +121,11 @@ public class Selector
boolean tagMatch = false;
for (; tagIndex < numTags && tagMatch == false; tagIndex++)
{
- Object pathClass = attributes[tagIndex].get("class");
+ Object pathClass = attributes.get(tagIndex).get("class");
// Try pseudo class too.
- Object pseudoClass = attributes[tagIndex].get("_pseudo");
- Object dynClass = attributes[tagIndex].get("_dynamic");
- Object pathId = attributes[tagIndex].get("id");
+ Object pseudoClass = attributes.get(tagIndex).get("_pseudo");
+ Object dynClass = attributes.get(tagIndex).get("_dynamic");
+ Object pathId = attributes.get(tagIndex).get("id");
String tag = elements[j];
String clazz = classes[j];
String id = ids[j];
@@ -167,7 +170,7 @@ public class Selector
*/
public String toString()
{
- StringBuilder b = new StringBuilder();
+ CPStringBuilder b = new CPStringBuilder();
for (int i = selector.length - 1; i >= 0; i--)
{
b.append(selector[i]);
diff --git a/javax/swing/text/html/HTMLEditorKit.java b/javax/swing/text/html/HTMLEditorKit.java
index cc61889d7..45381d60e 100644
--- a/javax/swing/text/html/HTMLEditorKit.java
+++ b/javax/swing/text/html/HTMLEditorKit.java
@@ -1454,7 +1454,7 @@ public class HTMLEditorKit
try
{
styleSheet = new StyleSheet();
- Class c = HTMLEditorKit.class;
+ Class<?> c = HTMLEditorKit.class;
InputStream in = c.getResourceAsStream(DEFAULT_CSS);
InputStreamReader r = new InputStreamReader(in);
styleSheet.loadRules(r, null);
diff --git a/javax/swing/text/html/HTMLWriter.java b/javax/swing/text/html/HTMLWriter.java
index 6cc23df9a..6a5e6ed58 100644
--- a/javax/swing/text/html/HTMLWriter.java
+++ b/javax/swing/text/html/HTMLWriter.java
@@ -79,9 +79,9 @@ public class HTMLWriter
private HTMLDocument htmlDoc = null;
/**
- * Used to keep track of which embeded has been written out.
+ * Used to keep track of which embedded has been written out.
*/
- private HashSet openEmbededTagHashSet = null;
+ private HashSet<HTML.Tag> openEmbeddedTagHashSet = null;
private String new_line_str = "" + NEWLINE;
@@ -95,7 +95,7 @@ public class HTMLWriter
private int doc_len = -1;
private int doc_offset_remaining = -1;
private int doc_len_remaining = -1;
- private HashSet htmlFragmentParentHashSet = null;
+ private HashSet<Element> htmlFragmentParentHashSet = null;
private Element startElem = null;
private Element endElem = null;
private boolean fg_pass_start_elem = false;
@@ -112,7 +112,7 @@ public class HTMLWriter
super(writer, doc);
outWriter = writer;
htmlDoc = doc;
- openEmbededTagHashSet = new HashSet();
+ openEmbeddedTagHashSet = new HashSet<HTML.Tag>();
} // public HTMLWriter(Writer writer, HTMLDocument doc)
/**
@@ -129,13 +129,13 @@ public class HTMLWriter
super(writer, doc, pos, len);
outWriter = writer;
htmlDoc = doc;
- openEmbededTagHashSet = new HashSet();
+ openEmbeddedTagHashSet = new HashSet<HTML.Tag>();
doc_pos = pos;
doc_offset_remaining = pos;
doc_len = len;
doc_len_remaining = len;
- htmlFragmentParentHashSet = new HashSet();
+ htmlFragmentParentHashSet = new HashSet<Element>();
} // public HTMLWriter(Writer writer, HTMLDocument doc, int pos, int len)
/**
@@ -197,7 +197,8 @@ public class HTMLWriter
} // else
// NOTE: close out remaining open embeded tags.
- Object[] tag_arr = openEmbededTagHashSet.toArray();
+ HTML.Tag[] tag_arr =
+ openEmbeddedTagHashSet.toArray(new HTML.Tag[openEmbeddedTagHashSet.size()]);
for (int i = 0; i < tag_arr.length; i++)
{
@@ -219,8 +220,8 @@ public class HTMLWriter
protected void writeAttributes(AttributeSet attrSet)
throws IOException
{
- Enumeration attrNameEnum = attrSet.getAttributeNames();
-
+ Enumeration<?> attrNameEnum = attrSet.getAttributeNames();
+
while (attrNameEnum.hasMoreElements())
{
Object key = attrNameEnum.nextElement();
@@ -502,7 +503,7 @@ public class HTMLWriter
protected void writeEmbeddedTags(AttributeSet attrSet)
throws IOException
{
- Enumeration attrNameEnum = attrSet.getAttributeNames();
+ Enumeration<?> attrNameEnum = attrSet.getAttributeNames();
while (attrNameEnum.hasMoreElements())
{
@@ -511,12 +512,12 @@ public class HTMLWriter
if (key instanceof HTML.Tag)
{
- if (!openEmbededTagHashSet.contains(key))
+ if (!openEmbeddedTagHashSet.contains(key))
{
writeRaw("<" + key);
writeAttributes((AttributeSet) value);
writeRaw(">");
- openEmbededTagHashSet.add(key);
+ openEmbeddedTagHashSet.add((HTML.Tag) key);
} // if(!openEmbededTagHashSet.contains(key))
} // if(key instanceof HTML.Tag)
} // while(attrNameEnum.hasMoreElements())
@@ -535,16 +536,17 @@ public class HTMLWriter
protected void closeOutUnwantedEmbeddedTags(AttributeSet attrSet)
throws IOException
{
- Object[] tag_arr = openEmbededTagHashSet.toArray();
+ HTML.Tag[] tag_arr =
+ openEmbeddedTagHashSet.toArray(new HTML.Tag[openEmbeddedTagHashSet.size()]);
for (int i = 0; i < tag_arr.length; i++)
{
- HTML.Tag key = (HTML.Tag) tag_arr[i];
+ HTML.Tag key = tag_arr[i];
if (!attrSet.isDefined(key))
{
writeRaw("</" + key.toString() + ">");
- openEmbededTagHashSet.remove(key);
+ openEmbeddedTagHashSet.remove(key);
} // if(!attrSet.isDefined(key))
} // for(int i = 0; i < tag_arr.length; i++)
@@ -645,7 +647,7 @@ public class HTMLWriter
if (matchNameAttribute(attrSet, HTML.Tag.TITLE))
{
boolean fg_is_end_tag = false;
- Enumeration attrNameEnum = attrSet.getAttributeNames();
+ Enumeration<?> attrNameEnum = attrSet.getAttributeNames();
while (attrNameEnum.hasMoreElements())
{
@@ -860,7 +862,7 @@ public class HTMLWriter
if (matchNameAttribute(attrSet, HTML.Tag.TITLE))
{
boolean fg_is_end_tag = false;
- Enumeration attrNameEnum = attrSet.getAttributeNames();
+ Enumeration<?> attrNameEnum = attrSet.getAttributeNames();
while (attrNameEnum.hasMoreElements())
{
@@ -996,7 +998,7 @@ public class HTMLWriter
private void writeAllAttributes(AttributeSet attrSet)
throws IOException
{
- Enumeration attrNameEnum = attrSet.getAttributeNames();
+ Enumeration<?> attrNameEnum = attrSet.getAttributeNames();
while (attrNameEnum.hasMoreElements())
{
diff --git a/javax/swing/text/html/ImageView.java b/javax/swing/text/html/ImageView.java
index bf906e450..bb6af4f45 100644
--- a/javax/swing/text/html/ImageView.java
+++ b/javax/swing/text/html/ImageView.java
@@ -323,8 +323,6 @@ public class ImageView extends View
*/
public float getPreferredSpan(int axis)
{
- AttributeSet attrs = getAttributes();
-
Image image = getImage();
if (axis == View.X_AXIS)
@@ -522,7 +520,6 @@ public class ImageView extends View
Image newIm = getImage();
if (newIm != null)
{
- AttributeSet atts = getAttributes();
// Fetch width.
Length l = spans[X_AXIS];
if (l != null)
diff --git a/javax/swing/text/html/MinimalHTMLWriter.java b/javax/swing/text/html/MinimalHTMLWriter.java
index acb2c04ac..9f5f019fa 100644
--- a/javax/swing/text/html/MinimalHTMLWriter.java
+++ b/javax/swing/text/html/MinimalHTMLWriter.java
@@ -48,8 +48,9 @@ import javax.swing.text.Style;
import javax.swing.text.StyledDocument;
import java.io.Writer;
import java.io.IOException;
+import java.util.ArrayDeque;
+import java.util.Deque;
import java.util.Enumeration;
-import java.util.Stack;
import java.awt.Color;
/**
@@ -61,7 +62,7 @@ import java.awt.Color;
public class MinimalHTMLWriter extends AbstractWriter
{
private StyledDocument doc;
- private Stack tagStack;
+ private Deque<String> tagStack;
private boolean inFontTag = false;
/**
@@ -73,7 +74,7 @@ public class MinimalHTMLWriter extends AbstractWriter
{
super(w, doc);
this.doc = doc;
- tagStack = new Stack();
+ tagStack = new ArrayDeque<String>();
}
/**
@@ -87,7 +88,7 @@ public class MinimalHTMLWriter extends AbstractWriter
{
super(w, doc, pos, len);
this.doc = doc;
- tagStack = new Stack();
+ tagStack = new ArrayDeque<String>();
}
/**
@@ -315,7 +316,7 @@ public class MinimalHTMLWriter extends AbstractWriter
{
if(doc instanceof DefaultStyledDocument)
{
- Enumeration styles = ((DefaultStyledDocument)doc).getStyleNames();
+ Enumeration<?> styles = ((DefaultStyledDocument)doc).getStyleNames();
while(styles.hasMoreElements())
writeStyle(doc.getStyle((String)styles.nextElement()));
}
@@ -332,7 +333,7 @@ public class MinimalHTMLWriter extends AbstractWriter
*/
protected void writeAttributes(AttributeSet attr) throws IOException
{
- Enumeration attribs = attr.getAttributeNames();
+ Enumeration<?> attribs = attr.getAttributeNames();
while(attribs.hasMoreElements())
{
Object attribName = attribs.nextElement();
@@ -422,8 +423,8 @@ public class MinimalHTMLWriter extends AbstractWriter
*/
private void endOpenTags() throws IOException
{
- while(!tagStack.empty())
- write((String)tagStack.pop());
+ while(tagStack.size() > 0)
+ write(tagStack.pop());
if( inFontTag() )
{
diff --git a/javax/swing/text/html/MultiAttributeSet.java b/javax/swing/text/html/MultiAttributeSet.java
index 0f1145084..296144460 100644
--- a/javax/swing/text/html/MultiAttributeSet.java
+++ b/javax/swing/text/html/MultiAttributeSet.java
@@ -57,7 +57,7 @@ class MultiAttributeSet
* The Enumeration for the multiplexed names.
*/
private class MultiNameEnumeration
- implements Enumeration
+ implements Enumeration<Object>
{
/**
* The index of the current AttributeSet.
@@ -67,7 +67,7 @@ class MultiAttributeSet
/**
* The names Enumeration of the current AttributeSet.
*/
- private Enumeration current;
+ private Enumeration<?> current;
/**
* Creates a new instance.
@@ -147,7 +147,7 @@ class MultiAttributeSet
public boolean containsAttributes(AttributeSet attributes)
{
boolean ret = true;
- Enumeration e = attributes.getAttributeNames();
+ Enumeration<?> e = attributes.getAttributeNames();
while (ret && e.hasMoreElements())
{
Object key = e.nextElement();
@@ -186,7 +186,7 @@ class MultiAttributeSet
return n;
}
- public Enumeration getAttributeNames()
+ public Enumeration<?> getAttributeNames()
{
return new MultiNameEnumeration();
}
diff --git a/javax/swing/text/html/MultiStyle.java b/javax/swing/text/html/MultiStyle.java
index 3937bff75..2f43a19c2 100644
--- a/javax/swing/text/html/MultiStyle.java
+++ b/javax/swing/text/html/MultiStyle.java
@@ -51,7 +51,7 @@ import javax.swing.text.Style;
*
* @author Roman Kennke (kennke@aicas.com)
*/
-public class MultiStyle
+class MultiStyle
extends MultiAttributeSet
implements Style
{
@@ -118,7 +118,7 @@ public class MultiStyle
attributes.removeAttribute(name);
}
- public void removeAttributes(Enumeration names)
+ public void removeAttributes(Enumeration<?> names)
{
attributes.removeAttribute(names);
}
diff --git a/javax/swing/text/html/ObjectView.java b/javax/swing/text/html/ObjectView.java
index d6a77c06a..9d900441b 100644
--- a/javax/swing/text/html/ObjectView.java
+++ b/javax/swing/text/html/ObjectView.java
@@ -88,7 +88,7 @@ public class ObjectView extends ComponentView
String classId = (String) atts.getAttribute("classid");
try
{
- Class objectClass = Class.forName(classId);
+ Class<?> objectClass = Class.forName(classId);
Object instance = objectClass.newInstance();
comp = (Component) instance;
}
diff --git a/javax/swing/text/html/StyleSheet.java b/javax/swing/text/html/StyleSheet.java
index 08578c80f..c4ddddb73 100644
--- a/javax/swing/text/html/StyleSheet.java
+++ b/javax/swing/text/html/StyleSheet.java
@@ -369,7 +369,7 @@ public class StyleSheet extends StyleContext
*
* @return the resolved style
*/
- private Style getResolvedStyle(String selector, List path, HTML.Tag tag)
+ private Style getResolvedStyle(String selector, List<Element> path, HTML.Tag tag)
{
Style style = resolvedStyles.get(selector);
if (style == null)
@@ -380,7 +380,7 @@ public class StyleSheet extends StyleContext
/**
* Resolves a style. This creates arrays that hold the tag names,
* class and id attributes and delegates the work to
- * {@link #resolveStyle(String, String[], Map[])}.
+ * {@link #resolveStyle(String, String[], List<Map<String,String>>)}.
*
* @param selector the selector
* @param path the Element path
@@ -388,14 +388,15 @@ public class StyleSheet extends StyleContext
*
* @return the resolved style
*/
- private Style resolveStyle(String selector, List path, HTML.Tag tag)
+ private Style resolveStyle(String selector, List<Element> path, HTML.Tag tag)
{
int count = path.size();
String[] tags = new String[count];
- Map[] attributes = new Map[count];
+ List<Map<String,String>> attributes =
+ new ArrayList<Map<String,String>>(count);
for (int i = 0; i < count; i++)
{
- Element el = (Element) path.get(i);
+ Element el = path.get(i);
AttributeSet atts = el.getAttributes();
if (i == 0 && el.isLeaf())
{
@@ -413,12 +414,11 @@ public class StyleSheet extends StyleContext
tags[i] = t.toString();
else
tags[i] = null;
- attributes[i] = attributeSetToMap(atts);
+ attributes.set(i, attributeSetToMap(atts));
}
else
{
tags[i] = null;
- attributes[i] = null;
}
}
tags[0] = tag.toString();
@@ -434,7 +434,8 @@ public class StyleSheet extends StyleContext
*
* @return the resolved style
*/
- private Style resolveStyle(String selector, String[] tags, Map[] attributes)
+ private Style resolveStyle(String selector, String[] tags,
+ List<Map<String,String>> attributes)
{
// FIXME: This style resolver is not correct. But it works good enough for
// the default.css.
@@ -462,10 +463,8 @@ public class StyleSheet extends StyleContext
// Sort selectors.
Collections.sort(styles);
- Style[] styleArray = new Style[styles.size()];
- styleArray = (Style[]) styles.toArray(styleArray);
- Style resolved = new MultiStyle(selector,
- (Style[]) styles.toArray(styleArray));
+ Style[] styleArray = styles.toArray(new Style[styles.size()]);
+ Style resolved = new MultiStyle(selector, styleArray);
resolvedStyles.put(selector, resolved);
return resolved;
}
@@ -481,9 +480,9 @@ public class StyleSheet extends StyleContext
public Style getRule(String selector)
{
CSSStyle best = null;
- for (Iterator i = css.iterator(); i.hasNext();)
+ for (Iterator<CSSStyle> i = css.iterator(); i.hasNext();)
{
- CSSStyle style = (CSSStyle) i.next();
+ CSSStyle style = i.next();
if (style.compareTo(best) < 0)
best = style;
}
@@ -584,7 +583,7 @@ public class StyleSheet extends StyleContext
public void addStyleSheet(StyleSheet ss)
{
if (linked == null)
- linked = new ArrayList();
+ linked = new ArrayList<StyleSheet>();
linked.add(ss);
}
@@ -1441,7 +1440,7 @@ public class StyleSheet extends StyleContext
*
* @return the converted map
*/
- private Map attributeSetToMap(AttributeSet atts)
+ private Map<String,String> attributeSetToMap(AttributeSet atts)
{
HashMap<String,String> map = new HashMap<String,String>();
Enumeration<?> keys = atts.getAttributeNames();
diff --git a/javax/swing/text/html/TableView.java b/javax/swing/text/html/TableView.java
index f87d7b35f..912240c28 100644
--- a/javax/swing/text/html/TableView.java
+++ b/javax/swing/text/html/TableView.java
@@ -181,7 +181,6 @@ class TableView
int spans[])
{
updateGrid();
- int numCols = offsets.length;
int realColumn = 0;
int colCount = getViewCount();
for (int i = 0; i < numColumns;)
diff --git a/javax/swing/tree/DefaultMutableTreeNode.java b/javax/swing/tree/DefaultMutableTreeNode.java
index 34a70c19b..e4cc97838 100644
--- a/javax/swing/tree/DefaultMutableTreeNode.java
+++ b/javax/swing/tree/DefaultMutableTreeNode.java
@@ -293,6 +293,7 @@ public class DefaultMutableTreeNode
*
* @return an enumeration of tree nodes
*/
+ @SuppressWarnings("unchecked") // Required for API compatibility
public Enumeration children()
{
if (children.size() == 0)
@@ -320,7 +321,7 @@ public class DefaultMutableTreeNode
*/
public TreeNode getChildAt(int index)
{
- return (TreeNode) children.elementAt(index);
+ return children.elementAt(index);
}
/**
@@ -717,6 +718,7 @@ public class DefaultMutableTreeNode
*
* @return Enumeration
*/
+ @SuppressWarnings("unchecked") // Required for API compatibility
public Enumeration preorderEnumeration()
{
return new PreorderEnumeration(this);
@@ -727,6 +729,7 @@ public class DefaultMutableTreeNode
*
* @return Enumeration
*/
+ @SuppressWarnings("unchecked") // Required for API compatibility
public Enumeration postorderEnumeration()
{
return new PostorderEnumeration(this);
@@ -737,6 +740,7 @@ public class DefaultMutableTreeNode
*
* @return Enumeration
*/
+ @SuppressWarnings("unchecked") // Required for API compatibility
public Enumeration breadthFirstEnumeration()
{
return new BreadthFirstEnumeration(this);
@@ -747,6 +751,7 @@ public class DefaultMutableTreeNode
*
* @return Enumeration
*/
+ @SuppressWarnings("unchecked") // Required for API compatibility
public Enumeration depthFirstEnumeration()
{
return postorderEnumeration();
@@ -759,6 +764,7 @@ public class DefaultMutableTreeNode
*
* @return Enumeration
*/
+ @SuppressWarnings("unchecked") // Required for API compatibility
public Enumeration pathFromAncestorEnumeration(TreeNode node)
{
if (node == null)
@@ -806,7 +812,7 @@ public class DefaultMutableTreeNode
*/
public TreeNode getFirstChild()
{
- return (TreeNode) children.firstElement();
+ return children.firstElement();
}
/**
@@ -818,7 +824,7 @@ public class DefaultMutableTreeNode
*/
public TreeNode getLastChild()
{
- return (TreeNode) children.lastElement();
+ return children.lastElement();
}
/**
@@ -1036,7 +1042,7 @@ public class DefaultMutableTreeNode
public int getLeafCount()
{
int count = 0;
- Enumeration e = depthFirstEnumeration();
+ Enumeration<?> e = depthFirstEnumeration();
while (e.hasMoreElements())
{
diff --git a/javax/swing/tree/FixedHeightLayoutCache.java b/javax/swing/tree/FixedHeightLayoutCache.java
index 488809e02..89f05d31c 100644
--- a/javax/swing/tree/FixedHeightLayoutCache.java
+++ b/javax/swing/tree/FixedHeightLayoutCache.java
@@ -484,7 +484,7 @@ public class FixedHeightLayoutCache
{
if (dirty)
update();
- Vector p = new Vector(parentPath.getPathCount());
+ Vector<TreePath> p = new Vector<TreePath>(parentPath.getPathCount());
Object node;
NodeRecord nr;
@@ -493,7 +493,7 @@ public class FixedHeightLayoutCache
node = parentPath.getPathComponent(i);
nr = nodes.get(node);
if (nr.row >= 0)
- p.add(node);
+ p.add((TreePath) node);
}
return p.elements();
}
diff --git a/javax/swing/tree/TreeNode.java b/javax/swing/tree/TreeNode.java
index ae7380c70..53d52f0a7 100644
--- a/javax/swing/tree/TreeNode.java
+++ b/javax/swing/tree/TreeNode.java
@@ -107,6 +107,7 @@ public interface TreeNode
*
* @return An enumeration of the children of this node.
*/
+ @SuppressWarnings("unchecked") // Required for API compatibility
Enumeration children();
}
diff --git a/javax/swing/tree/VariableHeightLayoutCache.java b/javax/swing/tree/VariableHeightLayoutCache.java
index 50e8e5ce9..aac68692e 100644
--- a/javax/swing/tree/VariableHeightLayoutCache.java
+++ b/javax/swing/tree/VariableHeightLayoutCache.java
@@ -381,10 +381,10 @@ public class VariableHeightLayoutCache
TreePath path = null;
// Search row in the nodes map. TODO: This is inefficient, optimize this.
- Enumeration nodesEnum = nodes.elements();
+ Enumeration<NodeRecord> nodesEnum = nodes.elements();
while (nodesEnum.hasMoreElements() && path == null)
{
- NodeRecord record = (NodeRecord) nodesEnum.nextElement();
+ NodeRecord record = nodesEnum.nextElement();
if (record.row == row)
path = record.getPath();
}
@@ -498,7 +498,7 @@ public class VariableHeightLayoutCache
{
if (dirty)
update();
- Vector p = new Vector(parentPath.getPathCount());
+ Vector<TreePath> p = new Vector<TreePath>(parentPath.getPathCount());
Object node;
NodeRecord nr;
@@ -507,7 +507,7 @@ public class VariableHeightLayoutCache
node = parentPath.getPathComponent(i);
nr = nodes.get(node);
if (nr != null && nr.row >= 0)
- p.add(node);
+ p.add((TreePath) node);
}
return p.elements();
}
diff --git a/javax/swing/undo/StateEdit.java b/javax/swing/undo/StateEdit.java
index 55282ab37..a032d02cd 100644
--- a/javax/swing/undo/StateEdit.java
+++ b/javax/swing/undo/StateEdit.java
@@ -248,7 +248,7 @@ public class StateEdit
*/
protected void removeRedundantState()
{
- Iterator i = preState.keySet().iterator();
+ Iterator<Object> i = preState.keySet().iterator();
while (i.hasNext())
{
Object key = i.next();
diff --git a/javax/swing/undo/UndoableEditSupport.java b/javax/swing/undo/UndoableEditSupport.java
index b5a933419..2e5d90954 100644
--- a/javax/swing/undo/UndoableEditSupport.java
+++ b/javax/swing/undo/UndoableEditSupport.java
@@ -167,7 +167,7 @@ public class UndoableEditSupport
protected void _postEdit(UndoableEdit edit)
{
UndoableEditEvent event;
- Iterator iter;
+ Iterator<UndoableEditListener> iter;
// Do nothing if we have no listeners.
if (listeners.isEmpty())
@@ -181,9 +181,9 @@ public class UndoableEditSupport
// Iterator, a java.util.ConcurrentModificationException; in the
// case of a direct loop over the Vector elements, some
// index-out-of-bounds exception).
- iter = ((Vector) listeners.clone()).iterator();
+ iter = new Vector<UndoableEditListener>(listeners).iterator();
while (iter.hasNext())
- ((UndoableEditListener) iter.next()).undoableEditHappened(event);
+ iter.next().undoableEditHappened(event);
}
diff --git a/org/ietf/jgss/GSSManager.java b/org/ietf/jgss/GSSManager.java
index 3c735a2fd..60eca49ab 100644
--- a/org/ietf/jgss/GSSManager.java
+++ b/org/ietf/jgss/GSSManager.java
@@ -180,7 +180,7 @@ public abstract class GSSManager
ClassLoader loader = GSSManager.class.getClassLoader();
if (loader == null)
loader = ClassLoader.getSystemClassLoader();
- Class c = loader.loadClass(impl);
+ Class<?> c = loader.loadClass(impl);
return (GSSManager) c.newInstance();
}
catch (Exception x)