This patch fixes a few more of the warnings related to generic
typing and unused variables.
ChangeLog:
2009-03-09 Andrew John Hughes <[email protected]>
* 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.
--
Andrew :)
Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)
Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net
PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint = F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8
Index: gnu/javax/swing/text/html/css/Selector.java
===================================================================
RCS file:
/sources/classpath/classpath/gnu/javax/swing/text/html/css/Selector.java,v
retrieving revision 1.4
diff -u -u -r1.4 Selector.java
--- gnu/javax/swing/text/html/css/Selector.java 7 Jan 2008 21:11:22 -0000
1.4
+++ gnu/javax/swing/text/html/css/Selector.java 9 Mar 2009 15:30:05 -0000
@@ -38,6 +38,9 @@
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 @@
* @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 @@
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 String toString()
{
- StringBuilder b = new StringBuilder();
+ CPStringBuilder b = new CPStringBuilder();
for (int i = selector.length - 1; i >= 0; i--)
{
b.append(selector[i]);
Index: javax/swing/text/html/HTMLEditorKit.java
===================================================================
RCS file:
/sources/classpath/classpath/javax/swing/text/html/HTMLEditorKit.java,v
retrieving revision 1.48
diff -u -u -r1.48 HTMLEditorKit.java
--- javax/swing/text/html/HTMLEditorKit.java 3 May 2007 21:30:37 -0000
1.48
+++ javax/swing/text/html/HTMLEditorKit.java 9 Mar 2009 15:30:11 -0000
@@ -1454,7 +1454,7 @@
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);
Index: javax/swing/text/html/HTMLWriter.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/text/html/HTMLWriter.java,v
retrieving revision 1.3
diff -u -u -r1.3 HTMLWriter.java
--- javax/swing/text/html/HTMLWriter.java 7 May 2008 01:23:00 -0000
1.3
+++ javax/swing/text/html/HTMLWriter.java 9 Mar 2009 15:30:12 -0000
@@ -79,9 +79,9 @@
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 @@
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 @@
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 @@
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 @@
} // 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 @@
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 @@
protected void writeEmbeddedTags(AttributeSet attrSet)
throws IOException
{
- Enumeration attrNameEnum = attrSet.getAttributeNames();
+ Enumeration<?> attrNameEnum = attrSet.getAttributeNames();
while (attrNameEnum.hasMoreElements())
{
@@ -511,12 +512,12 @@
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 @@
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 @@
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 @@
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 @@
private void writeAllAttributes(AttributeSet attrSet)
throws IOException
{
- Enumeration attrNameEnum = attrSet.getAttributeNames();
+ Enumeration<?> attrNameEnum = attrSet.getAttributeNames();
while (attrNameEnum.hasMoreElements())
{
Index: javax/swing/text/html/ImageView.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/text/html/ImageView.java,v
retrieving revision 1.7
diff -u -u -r1.7 ImageView.java
--- javax/swing/text/html/ImageView.java 5 Dec 2006 13:03:31 -0000
1.7
+++ javax/swing/text/html/ImageView.java 9 Mar 2009 15:30:12 -0000
@@ -323,8 +323,6 @@
*/
public float getPreferredSpan(int axis)
{
- AttributeSet attrs = getAttributes();
-
Image image = getImage();
if (axis == View.X_AXIS)
@@ -522,7 +520,6 @@
Image newIm = getImage();
if (newIm != null)
{
- AttributeSet atts = getAttributes();
// Fetch width.
Length l = spans[X_AXIS];
if (l != null)
Index: javax/swing/text/html/MinimalHTMLWriter.java
===================================================================
RCS file:
/sources/classpath/classpath/javax/swing/text/html/MinimalHTMLWriter.java,v
retrieving revision 1.3
diff -u -u -r1.3 MinimalHTMLWriter.java
--- javax/swing/text/html/MinimalHTMLWriter.java 9 Jan 2008 20:42:41
-0000 1.3
+++ javax/swing/text/html/MinimalHTMLWriter.java 9 Mar 2009 15:30:12
-0000
@@ -48,8 +48,9 @@
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 @@
public class MinimalHTMLWriter extends AbstractWriter
{
private StyledDocument doc;
- private Stack tagStack;
+ private Deque<String> tagStack;
private boolean inFontTag = false;
/**
@@ -73,7 +74,7 @@
{
super(w, doc);
this.doc = doc;
- tagStack = new Stack();
+ tagStack = new ArrayDeque<String>();
}
/**
@@ -87,7 +88,7 @@
{
super(w, doc, pos, len);
this.doc = doc;
- tagStack = new Stack();
+ tagStack = new ArrayDeque<String>();
}
/**
@@ -315,7 +316,7 @@
{
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 @@
*/
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 @@
*/
private void endOpenTags() throws IOException
{
- while(!tagStack.empty())
- write((String)tagStack.pop());
+ while(tagStack.size() > 0)
+ write(tagStack.pop());
if( inFontTag() )
{
Index: javax/swing/text/html/MultiAttributeSet.java
===================================================================
RCS file:
/sources/classpath/classpath/javax/swing/text/html/MultiAttributeSet.java,v
retrieving revision 1.1
diff -u -u -r1.1 MultiAttributeSet.java
--- javax/swing/text/html/MultiAttributeSet.java 24 Aug 2006 16:58:11
-0000 1.1
+++ javax/swing/text/html/MultiAttributeSet.java 9 Mar 2009 15:30:12
-0000
@@ -57,7 +57,7 @@
* The Enumeration for the multiplexed names.
*/
private class MultiNameEnumeration
- implements Enumeration
+ implements Enumeration<Object>
{
/**
* The index of the current AttributeSet.
@@ -67,7 +67,7 @@
/**
* The names Enumeration of the current AttributeSet.
*/
- private Enumeration current;
+ private Enumeration<?> current;
/**
* Creates a new instance.
@@ -147,7 +147,7 @@
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 @@
return n;
}
- public Enumeration getAttributeNames()
+ public Enumeration<?> getAttributeNames()
{
return new MultiNameEnumeration();
}
Index: javax/swing/text/html/MultiStyle.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/text/html/MultiStyle.java,v
retrieving revision 1.1
diff -u -u -r1.1 MultiStyle.java
--- javax/swing/text/html/MultiStyle.java 24 Aug 2006 16:58:11 -0000
1.1
+++ javax/swing/text/html/MultiStyle.java 9 Mar 2009 15:30:12 -0000
@@ -51,7 +51,7 @@
*
* @author Roman Kennke ([email protected])
*/
-public class MultiStyle
+class MultiStyle
extends MultiAttributeSet
implements Style
{
@@ -118,7 +118,7 @@
attributes.removeAttribute(name);
}
- public void removeAttributes(Enumeration names)
+ public void removeAttributes(Enumeration<?> names)
{
attributes.removeAttribute(names);
}
Index: javax/swing/text/html/ObjectView.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/text/html/ObjectView.java,v
retrieving revision 1.1
diff -u -u -r1.1 ObjectView.java
--- javax/swing/text/html/ObjectView.java 26 Jan 2006 12:34:56 -0000
1.1
+++ javax/swing/text/html/ObjectView.java 9 Mar 2009 15:30:12 -0000
@@ -88,7 +88,7 @@
String classId = (String) atts.getAttribute("classid");
try
{
- Class objectClass = Class.forName(classId);
+ Class<?> objectClass = Class.forName(classId);
Object instance = objectClass.newInstance();
comp = (Component) instance;
}
Index: javax/swing/text/html/StyleSheet.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/text/html/StyleSheet.java,v
retrieving revision 1.28
diff -u -u -r1.28 StyleSheet.java
--- javax/swing/text/html/StyleSheet.java 1 Sep 2008 14:54:36 -0000
1.28
+++ javax/swing/text/html/StyleSheet.java 9 Mar 2009 15:30:13 -0000
@@ -369,7 +369,7 @@
*
* @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 @@
/**
* 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 @@
*
* @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 @@
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 @@
*
* @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 @@
// 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 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 void addStyleSheet(StyleSheet ss)
{
if (linked == null)
- linked = new ArrayList();
+ linked = new ArrayList<StyleSheet>();
linked.add(ss);
}
@@ -1441,7 +1440,7 @@
*
* @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();
Index: javax/swing/text/html/TableView.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/text/html/TableView.java,v
retrieving revision 1.15
diff -u -u -r1.15 TableView.java
--- javax/swing/text/html/TableView.java 6 Dec 2006 19:50:42 -0000
1.15
+++ javax/swing/text/html/TableView.java 9 Mar 2009 15:30:15 -0000
@@ -181,7 +181,6 @@
int spans[])
{
updateGrid();
- int numCols = offsets.length;
int realColumn = 0;
int colCount = getViewCount();
for (int i = 0; i < numColumns;)
Index: javax/swing/tree/DefaultMutableTreeNode.java
===================================================================
RCS file:
/sources/classpath/classpath/javax/swing/tree/DefaultMutableTreeNode.java,v
retrieving revision 1.21
diff -u -u -r1.21 DefaultMutableTreeNode.java
--- javax/swing/tree/DefaultMutableTreeNode.java 28 Feb 2008 23:50:13
-0000 1.21
+++ javax/swing/tree/DefaultMutableTreeNode.java 9 Mar 2009 15:30:15
-0000
@@ -293,6 +293,7 @@
*
* @return an enumeration of tree nodes
*/
+ @SuppressWarnings("unchecked") // Required for API compatibility
public Enumeration children()
{
if (children.size() == 0)
@@ -320,7 +321,7 @@
*/
public TreeNode getChildAt(int index)
{
- return (TreeNode) children.elementAt(index);
+ return children.elementAt(index);
}
/**
@@ -717,6 +718,7 @@
*
* @return Enumeration
*/
+ @SuppressWarnings("unchecked") // Required for API compatibility
public Enumeration preorderEnumeration()
{
return new PreorderEnumeration(this);
@@ -727,6 +729,7 @@
*
* @return Enumeration
*/
+ @SuppressWarnings("unchecked") // Required for API compatibility
public Enumeration postorderEnumeration()
{
return new PostorderEnumeration(this);
@@ -737,6 +740,7 @@
*
* @return Enumeration
*/
+ @SuppressWarnings("unchecked") // Required for API compatibility
public Enumeration breadthFirstEnumeration()
{
return new BreadthFirstEnumeration(this);
@@ -747,6 +751,7 @@
*
* @return Enumeration
*/
+ @SuppressWarnings("unchecked") // Required for API compatibility
public Enumeration depthFirstEnumeration()
{
return postorderEnumeration();
@@ -759,6 +764,7 @@
*
* @return Enumeration
*/
+ @SuppressWarnings("unchecked") // Required for API compatibility
public Enumeration pathFromAncestorEnumeration(TreeNode node)
{
if (node == null)
@@ -806,7 +812,7 @@
*/
public TreeNode getFirstChild()
{
- return (TreeNode) children.firstElement();
+ return children.firstElement();
}
/**
@@ -818,7 +824,7 @@
*/
public TreeNode getLastChild()
{
- return (TreeNode) children.lastElement();
+ return children.lastElement();
}
/**
@@ -1036,7 +1042,7 @@
public int getLeafCount()
{
int count = 0;
- Enumeration e = depthFirstEnumeration();
+ Enumeration<?> e = depthFirstEnumeration();
while (e.hasMoreElements())
{
Index: javax/swing/tree/FixedHeightLayoutCache.java
===================================================================
RCS file:
/sources/classpath/classpath/javax/swing/tree/FixedHeightLayoutCache.java,v
retrieving revision 1.19
diff -u -u -r1.19 FixedHeightLayoutCache.java
--- javax/swing/tree/FixedHeightLayoutCache.java 17 Feb 2008 17:03:07
-0000 1.19
+++ javax/swing/tree/FixedHeightLayoutCache.java 9 Mar 2009 15:30:16
-0000
@@ -484,7 +484,7 @@
{
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 @@
node = parentPath.getPathComponent(i);
nr = nodes.get(node);
if (nr.row >= 0)
- p.add(node);
+ p.add((TreePath) node);
}
return p.elements();
}
Index: javax/swing/tree/TreeNode.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/tree/TreeNode.java,v
retrieving revision 1.8
diff -u -u -r1.8 TreeNode.java
--- javax/swing/tree/TreeNode.java 23 May 2006 16:01:38 -0000 1.8
+++ javax/swing/tree/TreeNode.java 9 Mar 2009 15:30:16 -0000
@@ -107,6 +107,7 @@
*
* @return An enumeration of the children of this node.
*/
+ @SuppressWarnings("unchecked") // Required for API compatibility
Enumeration children();
}
Index: javax/swing/tree/VariableHeightLayoutCache.java
===================================================================
RCS file:
/sources/classpath/classpath/javax/swing/tree/VariableHeightLayoutCache.java,v
retrieving revision 1.21
diff -u -u -r1.21 VariableHeightLayoutCache.java
--- javax/swing/tree/VariableHeightLayoutCache.java 17 Feb 2008 17:03:07
-0000 1.21
+++ javax/swing/tree/VariableHeightLayoutCache.java 9 Mar 2009 15:30:16
-0000
@@ -381,10 +381,10 @@
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 @@
{
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 @@
node = parentPath.getPathComponent(i);
nr = nodes.get(node);
if (nr != null && nr.row >= 0)
- p.add(node);
+ p.add((TreePath) node);
}
return p.elements();
}
Index: javax/swing/undo/StateEdit.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/undo/StateEdit.java,v
retrieving revision 1.11
diff -u -u -r1.11 StateEdit.java
--- javax/swing/undo/StateEdit.java 17 Feb 2008 17:03:07 -0000 1.11
+++ javax/swing/undo/StateEdit.java 9 Mar 2009 15:30:16 -0000
@@ -248,7 +248,7 @@
*/
protected void removeRedundantState()
{
- Iterator i = preState.keySet().iterator();
+ Iterator<Object> i = preState.keySet().iterator();
while (i.hasNext())
{
Object key = i.next();
Index: javax/swing/undo/UndoableEditSupport.java
===================================================================
RCS file:
/sources/classpath/classpath/javax/swing/undo/UndoableEditSupport.java,v
retrieving revision 1.12
diff -u -u -r1.12 UndoableEditSupport.java
--- javax/swing/undo/UndoableEditSupport.java 10 Dec 2006 20:25:49 -0000
1.12
+++ javax/swing/undo/UndoableEditSupport.java 9 Mar 2009 15:30:16 -0000
@@ -167,7 +167,7 @@
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 @@
// 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);
}
Index: org/ietf/jgss/GSSManager.java
===================================================================
RCS file: /sources/classpath/classpath/org/ietf/jgss/GSSManager.java,v
retrieving revision 1.3
diff -u -u -r1.3 GSSManager.java
--- org/ietf/jgss/GSSManager.java 2 Jul 2005 20:32:55 -0000 1.3
+++ org/ietf/jgss/GSSManager.java 9 Mar 2009 15:30:17 -0000
@@ -180,7 +180,7 @@
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)