8043549: Fix raw and unchecked lint warnings in javax.swing.text.*
Reviewed-by: prr
--- a/jdk/src/share/classes/javax/swing/text/AbstractDocument.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/AbstractDocument.java Wed Jun 11 13:25:15 2014 -0700
@@ -1809,7 +1809,7 @@
if (getAttributeCount() > 0) {
out.println("");
// dump the attributes
- Enumeration names = attributes.getAttributeNames();
+ Enumeration<?> names = attributes.getAttributeNames();
while (names.hasMoreElements()) {
Object name = names.nextElement();
indent(out, indentAmount + 1);
@@ -2193,7 +2193,7 @@
* <code>Enumeration</code>.
* @return the children of the receiver as an <code>Enumeration</code>
*/
- public abstract Enumeration children();
+ public abstract Enumeration<?> children();
// --- serialization ---------------------------------------------
@@ -2456,7 +2456,7 @@
* <code>Enumeration</code>.
* @return the children of the receiver
*/
- public Enumeration children() {
+ public Enumeration<AbstractElement> children() {
if(nchildren == 0)
return null;
@@ -2610,7 +2610,7 @@
* <code>Enumeration</code>.
* @return the children of the receiver
*/
- public Enumeration children() {
+ public Enumeration<?> children() {
return null;
}
--- a/jdk/src/share/classes/javax/swing/text/AbstractWriter.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/AbstractWriter.java Wed Jun 11 13:25:15 2014 -0700
@@ -668,7 +668,7 @@
*/
protected void writeAttributes(AttributeSet attr) throws IOException {
- Enumeration names = attr.getAttributeNames();
+ Enumeration<?> names = attr.getAttributeNames();
while (names.hasMoreElements()) {
Object name = names.nextElement();
write(" " + name + "=" + attr.getAttribute(name));
--- a/jdk/src/share/classes/javax/swing/text/DateFormatter.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/DateFormatter.java Wed Jun 11 13:25:15 2014 -0700
@@ -108,8 +108,8 @@
/**
* Returns the field that will be adjusted by adjustValue.
*/
- Object getAdjustField(int start, Map attributes) {
- Iterator attrs = attributes.keySet().iterator();
+ Object getAdjustField(int start, Map<?, ?> attributes) {
+ Iterator<?> attrs = attributes.keySet().iterator();
while (attrs.hasNext()) {
Object key = attrs.next();
@@ -127,7 +127,7 @@
* Adjusts the Date if FieldPosition identifies a known calendar
* field.
*/
- Object adjustValue(Object value, Map attributes, Object key,
+ Object adjustValue(Object value, Map<?, ?> attributes, Object key,
int direction) throws
BadLocationException, ParseException {
if (key != null) {
--- a/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java Wed Jun 11 13:25:15 2014 -0700
@@ -246,12 +246,12 @@
}
}
if (vc != null) {
- Constructor cons;
+ Constructor<?> cons;
try {
ReflectUtil.checkPackageAccess(vc);
SwingUtilities2.checkAccess(vc.getModifiers());
- cons = vc.getConstructor(new Class[]{String.class});
+ cons = vc.getConstructor(new Class<?>[]{String.class});
} catch (NoSuchMethodException nsme) {
cons = null;
--- a/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java Wed Jun 11 13:25:15 2014 -0700
@@ -1048,8 +1048,9 @@
styleChangeListener = createStyleChangeListener();
}
if (styleChangeListener != null && styles != null) {
- Enumeration styleNames = styles.getStyleNames();
- Vector v = (Vector)listeningStyles.clone();
+ Enumeration<?> styleNames = styles.getStyleNames();
+ @SuppressWarnings("unchecked")
+ Vector<Style> v = (Vector<Style>)listeningStyles.clone();
listeningStyles.removeAllElements();
List<ChangeListener> staleListeners =
AbstractChangeHandler.getStaleListeners(styleChangeListener);
@@ -1069,7 +1070,7 @@
}
}
for (int counter = v.size() - 1; counter >= 0; counter--) {
- Style aStyle = (Style)v.elementAt(counter);
+ Style aStyle = v.elementAt(counter);
aStyle.removeChangeListener(styleChangeListener);
}
if (listeningStyles.size() == 0) {
@@ -2630,14 +2631,14 @@
}
/** Class-specific reference queues. */
- private final static Map<Class, ReferenceQueue<DefaultStyledDocument>> queueMap
- = new HashMap<Class, ReferenceQueue<DefaultStyledDocument>>();
+ private final static Map<Class<?>, ReferenceQueue<DefaultStyledDocument>> queueMap
+ = new HashMap<Class<?>, ReferenceQueue<DefaultStyledDocument>>();
/** A weak reference to the document object. */
private DocReference doc;
AbstractChangeHandler(DefaultStyledDocument d) {
- Class c = getClass();
+ Class<?> c = getClass();
ReferenceQueue<DefaultStyledDocument> q;
synchronized (queueMap) {
q = queueMap.get(c);
--- a/jdk/src/share/classes/javax/swing/text/ElementIterator.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/ElementIterator.java Wed Jun 11 13:25:15 2014 -0700
@@ -361,7 +361,7 @@
System.out.println("elem: " + elem.getName());
AttributeSet attr = elem.getAttributes();
String s = "";
- Enumeration names = attr.getAttributeNames();
+ Enumeration<?> names = attr.getAttributeNames();
while (names.hasMoreElements()) {
Object key = names.nextElement();
Object value = attr.getAttribute(key);
--- a/jdk/src/share/classes/javax/swing/text/GapContent.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/GapContent.java Wed Jun 11 13:25:15 2014 -0700
@@ -710,7 +710,8 @@
* @param length the length >= 0
* @return the set of instances
*/
- protected Vector getPositionsInRange(Vector v, int offset, int length) {
+ protected Vector<UndoPosRef> getPositionsInRange(Vector<UndoPosRef> v,
+ int offset, int length) {
int endOffset = offset + length;
int startIndex;
int endIndex;
@@ -738,8 +739,9 @@
endIndex = findMarkAdjustIndex(endOffset + (g1 - g0) + 1);
}
- Vector placeIn = (v == null) ? new Vector(Math.max(1, endIndex -
- startIndex)) : v;
+ Vector<UndoPosRef> placeIn = (v == null) ?
+ new Vector<>(Math.max(1, endIndex - startIndex)) :
+ v;
for (int counter = startIndex; counter < endIndex; counter++) {
placeIn.addElement(new UndoPosRef(marks.elementAt(counter)));
@@ -756,7 +758,7 @@
*
* @param positions the UndoPosRef instances to reset
*/
- protected void updateUndoPositions(Vector positions, int offset,
+ protected void updateUndoPositions(Vector<UndoPosRef> positions, int offset,
int length) {
// Find the indexs of the end points.
int endOffset = offset + length;
@@ -773,7 +775,7 @@
// Reset the location of the refenences.
for(int counter = positions.size() - 1; counter >= 0; counter--) {
- UndoPosRef ref = (UndoPosRef)positions.elementAt(counter);
+ UndoPosRef ref = positions.elementAt(counter);
ref.resetLocation(endOffset, g1);
}
// We have to resort the marks in the range startIndex to endIndex.
@@ -900,7 +902,7 @@
protected String string;
/** An array of instances of UndoPosRef for the Positions in the
* range that was removed, valid after undo. */
- protected Vector posRefs;
+ protected Vector<UndoPosRef> posRefs;
} // GapContent.InsertUndo
@@ -952,6 +954,6 @@
protected String string;
/** An array of instances of UndoPosRef for the Positions in the
* range that was removed, valid before undo. */
- protected Vector posRefs;
+ protected Vector<UndoPosRef> posRefs;
} // GapContent.RemoveUndo
}
--- a/jdk/src/share/classes/javax/swing/text/GlyphView.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/GlyphView.java Wed Jun 11 13:25:15 2014 -0700
@@ -253,7 +253,7 @@
// the classname should probably come from a property file.
String classname = "javax.swing.text.GlyphPainter1";
try {
- Class c;
+ Class<?> c;
ClassLoader loader = getClass().getClassLoader();
if (loader != null) {
c = loader.loadClass(classname);
--- a/jdk/src/share/classes/javax/swing/text/InternationalFormatter.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/InternationalFormatter.java Wed Jun 11 13:25:15 2014 -0700
@@ -106,11 +106,11 @@
/**
* Can be used to impose a maximum value.
*/
- private Comparable max;
+ private Comparable<?> max;
/**
* Can be used to impose a minimum value.
*/
- private Comparable min;
+ private Comparable<?> min;
/**
* <code>InternationalFormatter</code>'s behavior is dicatated by a
@@ -211,7 +211,7 @@
* @param minimum Minimum legal value that can be input
* @see #setValueClass
*/
- public void setMinimum(Comparable minimum) {
+ public void setMinimum(Comparable<?> minimum) {
if (getValueClass() == null && minimum != null) {
setValueClass(minimum.getClass());
}
@@ -223,7 +223,7 @@
*
* @return Minimum legal value that can be input
*/
- public Comparable getMinimum() {
+ public Comparable<?> getMinimum() {
return min;
}
@@ -236,7 +236,7 @@
* @param max Maximum legal value that can be input
* @see #setValueClass
*/
- public void setMaximum(Comparable max) {
+ public void setMaximum(Comparable<?> max) {
if (getValueClass() == null && max != null) {
setValueClass(max.getClass());
}
@@ -248,7 +248,7 @@
*
* @return Maximum legal value that can be input
*/
- public Comparable getMaximum() {
+ public Comparable<?> getMaximum() {
return max;
}
@@ -411,7 +411,8 @@
* false is returned.
*/
boolean isValidValue(Object value, boolean wantsCCE) {
- Comparable min = getMinimum();
+ @SuppressWarnings("unchecked")
+ Comparable<Object> min = (Comparable<Object>)getMinimum();
try {
if (min != null && min.compareTo(value) > 0) {
@@ -424,7 +425,8 @@
return false;
}
- Comparable max = getMaximum();
+ @SuppressWarnings("unchecked")
+ Comparable<Object> max = (Comparable<Object>)getMaximum();
try {
if (max != null && max.compareTo(value) < 0) {
return false;
@@ -770,7 +772,7 @@
/**
* Returns true if <code>attributes</code> is null or empty.
*/
- boolean isLiteral(Map attributes) {
+ boolean isLiteral(Map<?, ?> attributes) {
return ((attributes == null) || attributes.size() == 0);
}
@@ -797,7 +799,7 @@
iterator.first();
while (iterator.current() != CharacterIterator.DONE) {
- Map attributes = iterator.getAttributes();
+ Map<Attribute,Object> attributes = iterator.getAttributes();
boolean set = isLiteral(attributes);
int start = iterator.getIndex();
int end = iterator.getRunLimit();
@@ -858,7 +860,7 @@
/**
* Returns the field that will be adjusted by adjustValue.
*/
- Object getAdjustField(int start, Map attributes) {
+ Object getAdjustField(int start, Map<?, ?> attributes) {
return null;
}
@@ -900,7 +902,7 @@
* null depending upon <code>canIncrement</code>) and
* <code>direction</code> is the amount to increment by.
*/
- Object adjustValue(Object value, Map attributes, Object field,
+ Object adjustValue(Object value, Map<?, ?> attributes, Object field,
int direction) throws
BadLocationException, ParseException {
return null;
@@ -1023,7 +1025,7 @@
iterator.setIndex(start);
- Map attributes = iterator.getAttributes();
+ Map<Attribute,Object> attributes = iterator.getAttributes();
Object field = getAdjustField(start, attributes);
if (canIncrement(field, start)) {
--- a/jdk/src/share/classes/javax/swing/text/JTextComponent.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/JTextComponent.java Wed Jun 11 13:25:15 2014 -0700
@@ -1091,6 +1091,7 @@
private static HashMap<String,Keymap> getKeymapTable() {
synchronized (KEYMAP_TABLE) {
AppContext appContext = AppContext.getAppContext();
+ @SuppressWarnings("unchecked")
HashMap<String,Keymap> keymapTable =
(HashMap<String,Keymap>)appContext.get(KEYMAP_TABLE);
if (keymapTable == null) {
--- a/jdk/src/share/classes/javax/swing/text/NumberFormatter.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/NumberFormatter.java Wed Jun 11 13:25:15 2014 -0700
@@ -173,7 +173,8 @@
* <code>Byte</code> or <code>Short</code> and <code>value</code>
* is an instanceof <code>Number</code>.
*/
- private Object convertValueToValueClass(Object value, Class valueClass) {
+ private Object convertValueToValueClass(Object value,
+ Class<?> valueClass) {
if (valueClass != null && (value instanceof Number)) {
Number numberValue = (Number)value;
if (valueClass == Integer.class) {
@@ -266,7 +267,7 @@
* Subclassed to treat the decimal separator, grouping separator,
* exponent symbol, percent, permille, currency and sign as literals.
*/
- boolean isLiteral(Map attrs) {
+ boolean isLiteral(Map<?, ?> attrs) {
if (!super.isLiteral(attrs)) {
if (attrs == null) {
return false;
@@ -327,7 +328,7 @@
while (index >= 0 && index < max) {
iterator.setIndex(index);
- Map attrs = iterator.getAttributes();
+ Map<?,?> attrs = iterator.getAttributes();
if (attrs != null && attrs.size() > 0) {
for (Object key : attrs.keySet()) {
@@ -432,8 +433,8 @@
try {
ReflectUtil.checkPackageAccess(valueClass);
SwingUtilities2.checkAccess(valueClass.getModifiers());
- Constructor cons = valueClass.getConstructor(
- new Class[] { String.class });
+ Constructor<?> cons = valueClass.getConstructor(
+ new Class<?>[] { String.class });
if (cons != null) {
SwingUtilities2.checkAccess(cons.getModifiers());
return cons.newInstance(new Object[]{string});
--- a/jdk/src/share/classes/javax/swing/text/ParagraphView.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/ParagraphView.java Wed Jun 11 13:25:15 2014 -0700
@@ -806,7 +806,7 @@
/**
* Used to create an i18n-based layout strategy
*/
- static Class i18nStrategy;
+ static Class<?> i18nStrategy;
/** Used for searching for a tab. */
static char[] tabChars;
--- a/jdk/src/share/classes/javax/swing/text/SimpleAttributeSet.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/SimpleAttributeSet.java Wed Jun 11 13:25:15 2014 -0700
@@ -172,7 +172,7 @@
public boolean containsAttributes(AttributeSet attributes) {
boolean result = true;
- Enumeration names = attributes.getAttributeNames();
+ Enumeration<?> names = attributes.getAttributeNames();
while (result && names.hasMoreElements()) {
Object name = names.nextElement();
result = attributes.getAttribute(name).equals(getAttribute(name));
@@ -197,7 +197,7 @@
* @param attributes the set of attributes to add
*/
public void addAttributes(AttributeSet attributes) {
- Enumeration names = attributes.getAttributeNames();
+ Enumeration<?> names = attributes.getAttributeNames();
while (names.hasMoreElements()) {
Object name = names.nextElement();
addAttribute(name, attributes.getAttribute(name));
@@ -233,7 +233,7 @@
table.clear();
}
else {
- Enumeration names = attributes.getAttributeNames();
+ Enumeration<?> names = attributes.getAttributeNames();
while (names.hasMoreElements()) {
Object name = names.nextElement();
Object value = attributes.getAttribute(name);
@@ -272,6 +272,7 @@
*
* @return the new set of attributes
*/
+ @SuppressWarnings("unchecked") // Cast of result of clone
public Object clone() {
SimpleAttributeSet attr;
try {
@@ -317,7 +318,7 @@
*/
public String toString() {
String s = "";
- Enumeration names = getAttributeNames();
+ Enumeration<?> names = getAttributeNames();
while (names.hasMoreElements()) {
Object key = names.nextElement();
Object value = getAttribute(key);
@@ -364,7 +365,7 @@
public Object getAttribute(Object key) {
return null;
}
- public Enumeration getAttributeNames() {
+ public Enumeration<?> getAttributeNames() {
return Collections.emptyEnumeration();
}
public boolean containsAttribute(Object name, Object value) {
--- a/jdk/src/share/classes/javax/swing/text/StringContent.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/StringContent.java Wed Jun 11 13:25:15 2014 -0700
@@ -271,11 +271,11 @@
* @param length the length >= 0
* @return the set of instances
*/
- protected Vector getPositionsInRange(Vector v, int offset,
+ protected Vector<UndoPosRef> getPositionsInRange(Vector<UndoPosRef> v, int offset,
int length) {
int n = marks.size();
int end = offset + length;
- Vector placeIn = (v == null) ? new Vector() : v;
+ Vector<UndoPosRef> placeIn = (v == null) ? new Vector<>() : v;
for (int i = 0; i < n; i++) {
PosRec mark = marks.elementAt(i);
if (mark.unused) {
@@ -298,9 +298,9 @@
*
* @param positions the positions of the instances
*/
- protected void updateUndoPositions(Vector positions) {
+ protected void updateUndoPositions(Vector<UndoPosRef> positions) {
for(int counter = positions.size() - 1; counter >= 0; counter--) {
- UndoPosRef ref = (UndoPosRef)positions.elementAt(counter);
+ UndoPosRef ref = positions.elementAt(counter);
// Check if the Position is still valid.
if(ref.rec.unused) {
positions.removeElementAt(counter);
@@ -437,7 +437,7 @@
protected String string;
// An array of instances of UndoPosRef for the Positions in the
// range that was removed, valid after undo.
- protected Vector posRefs;
+ protected Vector<UndoPosRef> posRefs;
}
@@ -494,6 +494,6 @@
protected String string;
// An array of instances of UndoPosRef for the Positions in the
// range that was removed, valid before undo.
- protected Vector posRefs;
+ protected Vector<UndoPosRef> posRefs;
}
}
--- a/jdk/src/share/classes/javax/swing/text/StyleContext.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/StyleContext.java Wed Jun 11 13:25:15 2014 -0700
@@ -589,7 +589,7 @@
AttributeSet a) throws IOException {
int n = a.getAttributeCount();
out.writeInt(n);
- Enumeration keys = a.getAttributeNames();
+ Enumeration<?> keys = a.getAttributeNames();
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
if (key instanceof Serializable) {
@@ -771,7 +771,7 @@
public SmallAttributeSet(AttributeSet attrs) {
int n = attrs.getAttributeCount();
Object[] tbl = new Object[2 * n];
- Enumeration names = attrs.getAttributeNames();
+ Enumeration<?> names = attrs.getAttributeNames();
int i = 0;
while (names.hasMoreElements()) {
tbl[i] = names.nextElement();
@@ -971,7 +971,7 @@
public boolean containsAttributes(AttributeSet attrs) {
boolean result = true;
- Enumeration names = attrs.getAttributeNames();
+ Enumeration<?> names = attrs.getAttributeNames();
while (result && names.hasMoreElements()) {
Object name = names.nextElement();
result = attrs.getAttribute(name).equals(getAttribute(name));
@@ -1051,7 +1051,7 @@
} else {
keys.removeAllElements();
data.removeAllElements();
- Enumeration names = a.getAttributeNames();
+ Enumeration<?> names = a.getAttributeNames();
while (names.hasMoreElements()) {
Object name = names.nextElement();
addAttribute(name, a.getAttribute(name));
@@ -1117,7 +1117,7 @@
addAttribute(tbl[i], tbl[i+1]);
}
} else {
- Enumeration names = attr.getAttributeNames();
+ Enumeration<?> names = attr.getAttributeNames();
while (names.hasMoreElements()) {
Object name = names.nextElement();
addAttribute(name, attr.getAttribute(name));
@@ -1142,7 +1142,7 @@
/**
* Removes the set of keys from the set.
*/
- public void removeAttributes(Enumeration names) {
+ public void removeAttributes(Enumeration<?> names) {
while (names.hasMoreElements()) {
Object name = names.nextElement();
removeAttribute(name);
@@ -1153,7 +1153,7 @@
* Removes the set of matching attributes from the set.
*/
public void removeAttributes(AttributeSet attr) {
- Enumeration names = attr.getAttributeNames();
+ Enumeration<?> names = attr.getAttributeNames();
while (names.hasMoreElements()) {
Object name = names.nextElement();
Object value = attr.getAttribute(name);
--- a/jdk/src/share/classes/javax/swing/text/TextAction.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/TextAction.java Wed Jun 11 13:25:15 2014 -0700
@@ -115,8 +115,8 @@
}
Action[] actions = new Action[h.size()];
int index = 0;
- for (Enumeration e = h.elements() ; e.hasMoreElements() ;) {
- actions[index++] = (Action) e.nextElement();
+ for (Enumeration<Action> e = h.elements() ; e.hasMoreElements() ;) {
+ actions[index++] = e.nextElement();
}
return actions;
}
--- a/jdk/src/share/classes/javax/swing/text/html/AccessibleHTML.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/AccessibleHTML.java Wed Jun 11 13:25:15 2014 -0700
@@ -2740,7 +2740,7 @@
* <code>child</code> isn't a valid child.
*/
public int indexOf(ElementInfo child) {
- ArrayList children = this.children;
+ ArrayList<ElementInfo> children = this.children;
if (children != null) {
return children.indexOf(child);
--- a/jdk/src/share/classes/javax/swing/text/html/CSS.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/CSS.java Wed Jun 11 13:25:15 2014 -0700
@@ -1370,7 +1370,7 @@
private void translateEmbeddedAttributes(AttributeSet htmlAttrSet,
MutableAttributeSet cssAttrSet) {
- Enumeration keys = htmlAttrSet.getAttributeNames();
+ Enumeration<?> keys = htmlAttrSet.getAttributeNames();
if (htmlAttrSet.getAttribute(StyleConstants.NameAttribute) ==
HTML.Tag.HR) {
// HR needs special handling due to us treating it as a leaf.
@@ -1393,7 +1393,7 @@
private void translateAttributes(HTML.Tag tag,
AttributeSet htmlAttrSet,
MutableAttributeSet cssAttrSet) {
- Enumeration names = htmlAttrSet.getAttributeNames();
+ Enumeration<?> names = htmlAttrSet.getAttributeNames();
while (names.hasMoreElements()) {
Object name = names.nextElement();
@@ -3342,7 +3342,7 @@
s.defaultWriteObject();
// Determine what values in valueConvertor need to be written out.
- Enumeration keys = valueConvertor.keys();
+ Enumeration<?> keys = valueConvertor.keys();
s.writeInt(valueConvertor.size());
if (keys != null) {
while (keys.hasMoreElements()) {
--- a/jdk/src/share/classes/javax/swing/text/html/FormView.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/FormView.java Wed Jun 11 13:25:15 2014 -0700
@@ -168,8 +168,8 @@
} else if (t == HTML.Tag.SELECT) {
if (model instanceof OptionListModel) {
-
- JList list = new JList((ListModel) model);
+ @SuppressWarnings("unchecked")
+ JList<?> list = new JList<>((ListModel) model);
int size = HTML.getIntegerAttributeValue(attr,
HTML.Attribute.SIZE,
1);
@@ -177,7 +177,9 @@
list.setSelectionModel((ListSelectionModel)model);
c = new JScrollPane(list);
} else {
- c = new JComboBox((ComboBoxModel) model);
+ @SuppressWarnings("unchecked")
+ JComboBox<?> tmp = new JComboBox<>((ComboBoxModel) model);
+ c = tmp;
maxIsPreferred = 3;
}
} else if (t == HTML.Tag.TEXTAREA) {
@@ -342,7 +344,8 @@
// BasicListUI$Handler.
// For JComboBox, there are 2 stale ListDataListeners, which are
// BasicListUI$Handler and BasicComboBoxUI$Handler.
- AbstractListModel listModel = (AbstractListModel) model;
+ @SuppressWarnings("unchecked")
+ AbstractListModel<?> listModel = (AbstractListModel) model;
String listenerClass1 =
"javax.swing.plaf.basic.BasicListUI$Handler";
String listenerClass2 =
@@ -788,6 +791,7 @@
}
Object m = attr.getAttribute(StyleConstants.ModelAttribute);
if (m instanceof OptionListModel) {
+ @SuppressWarnings("unchecked")
OptionListModel<Option> model = (OptionListModel<Option>) m;
for (int i = 0; i < model.getSize(); i++) {
@@ -797,7 +801,8 @@
}
}
} else if (m instanceof ComboBoxModel) {
- ComboBoxModel model = (ComboBoxModel)m;
+ @SuppressWarnings("unchecked")
+ ComboBoxModel<?> model = (ComboBoxModel)m;
Option option = (Option)model.getSelectedItem();
if (option != null) {
appendBuffer(buffer, name, option.getValue());
@@ -904,7 +909,8 @@
} catch (BadLocationException e) {
}
} else if (m instanceof OptionListModel) {
- OptionListModel model = (OptionListModel) m;
+ @SuppressWarnings("unchecked")
+ OptionListModel<?> model = (OptionListModel) m;
int size = model.getSize();
for (int i = 0; i < size; i++) {
model.removeIndexInterval(i, i);
@@ -916,7 +922,8 @@
}
}
} else if (m instanceof OptionComboBoxModel) {
- OptionComboBoxModel model = (OptionComboBoxModel) m;
+ @SuppressWarnings("unchecked")
+ OptionComboBoxModel<?> model = (OptionComboBoxModel) m;
Option option = model.getInitialSelection();
if (option != null) {
model.setSelectedItem(option);
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java Wed Jun 11 13:25:15 2014 -0700
@@ -863,11 +863,13 @@
Object maps = getProperty(MAP_PROPERTY);
if (maps == null) {
- maps = new Hashtable(11);
+ maps = new Hashtable<>(11);
putProperty(MAP_PROPERTY, maps);
}
if (maps instanceof Hashtable) {
- ((Hashtable)maps).put("#" + name, map);
+ @SuppressWarnings("unchecked")
+ Hashtable<Object, Object> tmp = (Hashtable)maps;
+ tmp.put("#" + name, map);
}
}
}
@@ -910,11 +912,13 @@
* @return the enumerated list of maps, or <code>null</code>
* if the maps are not an instance of <code>Hashtable</code>
*/
- Enumeration getMaps() {
+ Enumeration<Object> getMaps() {
Object maps = getProperty(MAP_PROPERTY);
if (maps instanceof Hashtable) {
- return ((Hashtable)maps).elements();
+ @SuppressWarnings("unchecked")
+ Hashtable<Object, Object> tmp = (Hashtable) maps;
+ return tmp.elements();
}
return null;
}
@@ -1493,7 +1497,7 @@
else if (searchLeafAttributes && attr != null) {
// For some leaf elements we store the actual attributes inside
// the AttributeSet of the Element (such as anchors).
- Enumeration names = attr.getAttributeNames();
+ Enumeration<?> names = attr.getAttributeNames();
if (names != null) {
while (names.hasMoreElements()) {
Object name = names.nextElement();
@@ -2694,10 +2698,12 @@
return;
}
if (comments == null) {
- comments = new Vector();
+ comments = new Vector<>();
putProperty(AdditionalComments, comments);
}
- ((Vector)comments).addElement(comment);
+ @SuppressWarnings("unchecked")
+ Vector<Object> v = (Vector<Object>)comments;
+ v.addElement(comment);
}
/**
@@ -3439,6 +3445,7 @@
option = new Option(attr);
if (selectModel instanceof OptionListModel) {
+ @SuppressWarnings("unchecked")
OptionListModel<Option> m = (OptionListModel<Option>) selectModel;
m.addElement(option);
if (option.isSelected()) {
@@ -3446,6 +3453,7 @@
m.setInitialSelection(optionCount);
}
} else if (selectModel instanceof OptionComboBoxModel) {
+ @SuppressWarnings("unchecked")
OptionComboBoxModel<Option> m = (OptionComboBoxModel<Option>) selectModel;
m.addElement(option);
if (option.isSelected()) {
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java Wed Jun 11 13:25:15 2014 -0700
@@ -590,7 +590,7 @@
protected Parser getParser() {
if (defaultParser == null) {
try {
- Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator");
+ Class<?> c = Class.forName("javax.swing.text.html.parser.ParserDelegator");
defaultParser = (Parser) c.newInstance();
} catch (Throwable e) {
}
@@ -1874,7 +1874,7 @@
* Returns the object in an AttributeSet matching a key
*/
static private Object getAttrValue(AttributeSet attr, HTML.Attribute key) {
- Enumeration names = attr.getAttributeNames();
+ Enumeration<?> names = attr.getAttributeNames();
while (names.hasMoreElements()) {
Object nextKey = names.nextElement();
Object nextVal = attr.getAttribute(nextKey);
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLWriter.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLWriter.java Wed Jun 11 13:25:15 2014 -0700
@@ -254,7 +254,7 @@
convAttr.removeAttributes(convAttr);
convertToHTML32(attr, convAttr);
- Enumeration names = convAttr.getAttributeNames();
+ Enumeration<?> names = convAttr.getAttributeNames();
while (names.hasMoreElements()) {
Object name = names.nextElement();
if (name instanceof HTML.Tag ||
@@ -527,6 +527,7 @@
Object model = attr.getAttribute(StyleConstants.ModelAttribute);
incrIndent();
if (model instanceof OptionListModel) {
+ @SuppressWarnings("unchecked")
OptionListModel<Option> listModel = (OptionListModel<Option>) model;
int size = listModel.getSize();
for (int i = 0; i < size; i++) {
@@ -534,6 +535,7 @@
writeOption(option);
}
} else if (model instanceof OptionComboBoxModel) {
+ @SuppressWarnings("unchecked")
OptionComboBoxModel<Option> comboBoxModel = (OptionComboBoxModel<Option>) model;
int size = comboBoxModel.getSize();
for (int i = 0; i < size; i++) {
@@ -657,7 +659,7 @@
(HTMLDocument.AdditionalComments);
if (comments instanceof Vector) {
- Vector v = (Vector)comments;
+ Vector<?> v = (Vector)comments;
for (int counter = 0, maxCounter = v.size(); counter < maxCounter;
counter++) {
writeComment(v.elementAt(counter).toString());
@@ -707,7 +709,7 @@
// translate css attributes to html
attr = convertToHTML(attr, oConvAttr);
- Enumeration names = attr.getAttributeNames();
+ Enumeration<?> names = attr.getAttributeNames();
while (names.hasMoreElements()) {
Object name = names.nextElement();
if (name instanceof HTML.Tag) {
@@ -848,7 +850,7 @@
* Outputs the maps as elements. Maps are not stored as elements in
* the document, and as such this is used to output them.
*/
- void writeMaps(Enumeration maps) throws IOException {
+ void writeMaps(Enumeration<?> maps) throws IOException {
if (maps != null) {
while(maps.hasMoreElements()) {
Map map = (Map)maps.nextElement();
@@ -896,7 +898,7 @@
*/
void writeStyles(StyleSheet sheet) throws IOException {
if (sheet != null) {
- Enumeration styles = sheet.getStyleNames();
+ Enumeration<?> styles = sheet.getStyleNames();
if (styles != null) {
boolean outputStyle = false;
while (styles.hasMoreElements()) {
@@ -922,7 +924,7 @@
boolean writeStyle(String name, Style style, boolean outputStyle)
throws IOException{
boolean didOutputStyle = false;
- Enumeration attributes = style.getAttributeNames();
+ Enumeration<?> attributes = style.getAttributeNames();
if (attributes != null) {
while (attributes.hasMoreElements()) {
Object attribute = attributes.nextElement();
@@ -1032,7 +1034,7 @@
if (from == null) {
return;
}
- Enumeration keys = from.getAttributeNames();
+ Enumeration<?> keys = from.getAttributeNames();
String value = "";
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
@@ -1139,7 +1141,7 @@
* attribute.
*/
private static void convertToHTML40(AttributeSet from, MutableAttributeSet to) {
- Enumeration keys = from.getAttributeNames();
+ Enumeration<?> keys = from.getAttributeNames();
String value = "";
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
--- a/jdk/src/share/classes/javax/swing/text/html/ImageView.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/ImageView.java Wed Jun 11 13:25:15 2014 -0700
@@ -691,10 +691,11 @@
URL src = getImageURL();
Image newImage = null;
if (src != null) {
- Dictionary cache = (Dictionary)getDocument().
- getProperty(IMAGE_CACHE_PROPERTY);
+ @SuppressWarnings("unchecked")
+ Dictionary<URL, Image> cache = (Dictionary)getDocument().
+ getProperty(IMAGE_CACHE_PROPERTY);
if (cache != null) {
- newImage = (Image)cache.get(src);
+ newImage = cache.get(src);
}
else {
newImage = Toolkit.getDefaultToolkit().createImage(src);
--- a/jdk/src/share/classes/javax/swing/text/html/MinimalHTMLWriter.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/MinimalHTMLWriter.java Wed Jun 11 13:25:15 2014 -0700
@@ -155,7 +155,7 @@
* @exception IOException on any I/O error
*/
protected void writeAttributes(AttributeSet attr) throws IOException {
- Enumeration attributeNames = attr.getAttributeNames();
+ Enumeration<?> attributeNames = attr.getAttributeNames();
while (attributeNames.hasMoreElements()) {
Object name = attributeNames.nextElement();
if ((name instanceof StyleConstants.ParagraphConstants) ||
@@ -255,7 +255,7 @@
* stylenames.
*/
DefaultStyledDocument styledDoc = ((DefaultStyledDocument)getDocument());
- Enumeration styleNames = styledDoc.getStyleNames();
+ Enumeration<?> styleNames = styledDoc.getStyleNames();
while (styleNames.hasMoreElements()) {
Style s = styledDoc.getStyle((String)styleNames.nextElement());
--- a/jdk/src/share/classes/javax/swing/text/html/MuxingAttributeSet.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/MuxingAttributeSet.java Wed Jun 11 13:25:15 2014 -0700
@@ -213,7 +213,7 @@
* @return the attribute names
* @see AttributeSet#getAttributeNames
*/
- public Enumeration getAttributeNames() {
+ public Enumeration<?> getAttributeNames() {
return new MuxingAttributeNameEnumeration();
}
@@ -240,7 +240,7 @@
public boolean containsAttributes(AttributeSet attrs) {
boolean result = true;
- Enumeration names = attrs.getAttributeNames();
+ Enumeration<?> names = attrs.getAttributeNames();
while (result && names.hasMoreElements()) {
Object name = names.nextElement();
result = attrs.getAttribute(name).equals(getAttribute(name));
@@ -268,7 +268,7 @@
* An Enumeration of the Attribute names in a MuxingAttributeSet.
* This may return the same name more than once.
*/
- private class MuxingAttributeNameEnumeration implements Enumeration {
+ private class MuxingAttributeNameEnumeration implements Enumeration<Object> {
MuxingAttributeNameEnumeration() {
updateEnum();
@@ -307,6 +307,6 @@
/** Index into attrs the current Enumeration came from. */
private int attrIndex;
/** Enumeration from attrs. */
- private Enumeration currentEnum;
+ private Enumeration<?> currentEnum;
}
}
--- a/jdk/src/share/classes/javax/swing/text/html/ObjectView.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/ObjectView.java Wed Jun 11 13:25:15 2014 -0700
@@ -91,8 +91,8 @@
String classname = (String) attr.getAttribute(HTML.Attribute.CLASSID);
try {
ReflectUtil.checkPackageAccess(classname);
- Class c = Class.forName(classname, true,Thread.currentThread().
- getContextClassLoader());
+ Class<?> c = Class.forName(classname, true,Thread.currentThread().
+ getContextClassLoader());
Object o = c.newInstance();
if (o instanceof Component) {
Component comp = (Component) o;
@@ -125,7 +125,7 @@
* <object> element.
*/
private void setParameters(Component comp, AttributeSet attr) {
- Class k = comp.getClass();
+ Class<?> k = comp.getClass();
BeanInfo bi;
try {
bi = Introspector.getBeanInfo(k);
@@ -145,7 +145,7 @@
// read-only property. ignore
return; // for now
}
- Class[] params = writer.getParameterTypes();
+ Class<?>[] params = writer.getParameterTypes();
if (params.length != 1) {
// zero or more than one argument, ignore
return; // for now
--- a/jdk/src/share/classes/javax/swing/text/html/OptionListModel.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/OptionListModel.java Wed Jun 11 13:25:15 2014 -0700
@@ -40,7 +40,7 @@
* It also stores the initial state of the JList, to ensure an
* accurate reset, if the user requests a reset of the form.
*
- @author Sunita Mani
+ * @author Sunita Mani
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
class OptionListModel<E> extends DefaultListModel<E> implements ListSelectionModel, Serializable {
@@ -469,7 +469,8 @@
* and (b) define a <code>clone</code> method
*/
public Object clone() throws CloneNotSupportedException {
- OptionListModel clone = (OptionListModel)super.clone();
+ @SuppressWarnings("unchecked")
+ OptionListModel<E> clone = (OptionListModel)super.clone();
clone.value = (BitSet)value.clone();
clone.listenerList = new EventListenerList();
return clone;
--- a/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java Wed Jun 11 13:25:15 2014 -0700
@@ -192,6 +192,7 @@
try {
// Build an array of all the parent elements.
+ @SuppressWarnings("unchecked")
Vector<Element> searchContext = sb.getVector();
for (Element p = e; p != null; p = p.getParentElement()) {
@@ -693,7 +694,7 @@
private AttributeSet removeHTMLTags(AttributeSet old, AttributeSet attr) {
if (!(attr instanceof LargeConversionSet) &&
!(attr instanceof SmallConversionSet)) {
- Enumeration names = attr.getAttributeNames();
+ Enumeration<?> names = attr.getAttributeNames();
while (names.hasMoreElements()) {
Object key = names.nextElement();
@@ -726,14 +727,14 @@
// in most cases, there are no StyleConstants attributes
// so we iterate the collection of keys to avoid creating
// a new set.
- Enumeration names = a.getAttributeNames();
+ Enumeration<?> names = a.getAttributeNames();
while (names.hasMoreElements()) {
Object name = names.nextElement();
if (name instanceof StyleConstants) {
// we really need to do a conversion, iterate again
// building a new set.
MutableAttributeSet converted = new LargeConversionSet();
- Enumeration keys = a.getAttributeNames();
+ Enumeration<?> keys = a.getAttributeNames();
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
Object cssValue = null;
@@ -1078,6 +1079,7 @@
String[] getSimpleSelectors(String selector) {
selector = cleanSelectorString(selector);
SearchBuffer sb = SearchBuffer.obtainSearchBuffer();
+ @SuppressWarnings("unchecked")
Vector<String> selectors = sb.getVector();
int lastIndex = 0;
int length = selector.length();
@@ -1256,7 +1258,7 @@
* create the resolved style, if necessary.
*/
private synchronized Style getResolvedStyle(String selector,
- Vector elements,
+ Vector<Element> elements,
HTML.Tag t) {
Style retStyle = resolvedStyles.get(selector);
if (retStyle == null) {
@@ -1368,7 +1370,9 @@
String[] tags,
String[] ids, String[] classes) {
SearchBuffer sb = SearchBuffer.obtainSearchBuffer();
+ @SuppressWarnings("unchecked")
Vector<SelectorMapping> tempVector = sb.getVector();
+ @SuppressWarnings("unchecked")
Hashtable<SelectorMapping, SelectorMapping> tempHashtable = sb.getHashtable();
// Determine all the Styles that are appropriate, placing them
// in tempVector
@@ -1452,7 +1456,7 @@
* @param t the Tag to use for
* the first Element in <code>elements</code>
*/
- private Style createResolvedStyle(String selector, Vector elements,
+ private Style createResolvedStyle(String selector, Vector<Element> elements,
HTML.Tag t) {
int numElements = elements.size();
// Build three arrays, one for tags, one for class's, and one for
@@ -1461,7 +1465,7 @@
String ids[] = new String[numElements];
String classes[] = new String[numElements];
for (int counter = 0; counter < numElements; counter++) {
- Element e = (Element)elements.elementAt(counter);
+ Element e = elements.elementAt(counter);
AttributeSet attr = e.getAttributes();
if (counter == 0 && e.isLeaf()) {
// For leafs, we use the second tier attributes.
@@ -1513,6 +1517,7 @@
private Style createResolvedStyle(String selector) {
SearchBuffer sb = SearchBuffer.obtainSearchBuffer();
// Will contain the tags, ids, and classes, in that order.
+ @SuppressWarnings("unchecked")
Vector<String> elements = sb.getVector();
try {
boolean done;
@@ -1678,6 +1683,7 @@
* releaseSearchBuffer to get a SearchBuffer, and release it when
* done.
*/
+ @SuppressWarnings("rawtypes")
private static class SearchBuffer {
/** A stack containing instances of SearchBuffer. Used in getting
* rules. */
@@ -2630,6 +2636,7 @@
// implementation.
Document doc = v.getDocument();
SearchBuffer sb = SearchBuffer.obtainSearchBuffer();
+ @SuppressWarnings("unchecked")
Vector<AttributeSet> muxList = sb.getVector();
try {
if (doc instanceof HTMLDocument) {
@@ -2642,7 +2649,7 @@
muxList.addElement(htmlAttr);
}
if (elem.isLeaf()) {
- Enumeration keys = a.getAttributeNames();
+ Enumeration<?> keys = a.getAttributeNames();
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
if (key instanceof HTML.Tag) {
--- a/jdk/src/share/classes/javax/swing/text/html/parser/DTD.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/DTD.java Wed Jun 11 13:25:15 2014 -0700
@@ -370,6 +370,7 @@
private static Hashtable<String, DTD> getDtdHash() {
AppContext appContext = AppContext.getAppContext();
+ @SuppressWarnings("unchecked")
Hashtable<String, DTD> result = (Hashtable<String, DTD>) appContext.get(DTD_HASH_KEY);
if (result == null) {
--- a/jdk/src/share/classes/javax/swing/text/rtf/MockAttributeSet.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/rtf/MockAttributeSet.java Wed Jun 11 13:25:15 2014 -0700
@@ -74,7 +74,7 @@
public void addAttributes(AttributeSet attr)
{
- Enumeration as = attr.getAttributeNames();
+ Enumeration<?> as = attr.getAttributeNames();
while(as.hasMoreElements()) {
Object el = as.nextElement();
backing.put(el, attr.getAttribute(el));
@@ -102,7 +102,7 @@
}
- public Enumeration getAttributeNames()
+ public Enumeration<?> getAttributeNames()
{
return backing.keys();
}
--- a/jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java Wed Jun 11 13:25:15 2014 -0700
@@ -96,13 +96,13 @@
static {
MagicToken = new Object();
- Dictionary textKeywordDictionary = RTFReader.textKeywords;
- Enumeration keys = textKeywordDictionary.keys();
+ Dictionary<String, String> textKeywordDictionary = RTFReader.textKeywords;
+ Enumeration<String> keys = textKeywordDictionary.keys();
Vector<CharacterKeywordPair> tempPairs = new Vector<CharacterKeywordPair>();
while(keys.hasMoreElements()) {
CharacterKeywordPair pair = new CharacterKeywordPair();
- pair.keyword = (String)keys.nextElement();
- pair.character = ((String)textKeywordDictionary.get(pair.keyword)).charAt(0);
+ pair.keyword = keys.nextElement();
+ pair.character = textKeywordDictionary.get(pair.keyword).charAt(0);
tempPairs.addElement(pair);
}
textKeywords = new CharacterKeywordPair[tempPairs.size()];
@@ -340,7 +340,7 @@
/* write color table */
if (colorCount > 1) {
Color[] sortedColorTable = new Color[colorCount];
- Enumeration colors = colorTable.keys();
+ Enumeration<Object> colors = colorTable.keys();
Color color;
while(colors.hasMoreElements()) {
color = (Color)colors.nextElement();
--- a/jdk/src/share/classes/javax/swing/text/rtf/RTFReader.java Thu Jun 05 13:59:01 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/rtf/RTFReader.java Wed Jun 11 13:25:15 2014 -0700
@@ -220,6 +220,7 @@
Object oldSaveState = parserState.get("_savedState");
if (oldSaveState != null)
parserState.remove("_savedState");
+ @SuppressWarnings("unchecked")
Dictionary<String, Object> saveState = (Dictionary<String, Object>)((Hashtable)parserState).clone();
if (oldSaveState != null)
saveState.put("_savedState", oldSaveState);
@@ -242,13 +243,14 @@
skippingCharacters = 0;
}
+ @SuppressWarnings("unchecked")
Dictionary<Object, Object> restoredState = (Dictionary<Object, Object>)parserState.get("_savedState");
Destination restoredDestination = (Destination)restoredState.get("dst");
if (restoredDestination != rtfDestination) {
rtfDestination.close(); /* allow the destination to clean up */
rtfDestination = restoredDestination;
}
- Dictionary oldParserState = parserState;
+ Dictionary<Object, Object> oldParserState = parserState;
parserState = restoredState;
if (rtfDestination != null)
rtfDestination.endgroup(oldParserState);
@@ -258,7 +260,8 @@
{
/* Check that setting the destination won't close the
current destination (should never happen) */
- Dictionary previousState = (Dictionary)parserState.get("_savedState");
+ @SuppressWarnings("unchecked")
+ Dictionary<Object, Object> previousState = (Dictionary)parserState.get("_savedState");
if (previousState != null) {
if (rtfDestination != previousState.get("dst")) {
warning("Warning, RTF destination overridden, invalid RTF.");
@@ -277,7 +280,7 @@
public void close()
throws IOException
{
- Enumeration docProps = documentAttributes.getAttributeNames();
+ Enumeration<?> docProps = documentAttributes.getAttributeNames();
while(docProps.hasMoreElements()) {
Object propName = docProps.nextElement();
target.putProperty(propName,
@@ -628,7 +631,7 @@
boolean handleKeyword(String keyword, int parameter);
void begingroup();
- void endgroup(Dictionary oldState);
+ void endgroup(Dictionary<Object, Object> oldState);
void close();
}
@@ -666,7 +669,7 @@
current group level as necessary */
}
- public void endgroup(Dictionary oldState)
+ public void endgroup(Dictionary<Object, Object> oldState)
{
/* Ignore groups */
}
@@ -736,7 +739,7 @@
/* Groups are irrelevant. */
public void begingroup() {}
- public void endgroup(Dictionary oldState) {}
+ public void endgroup(Dictionary<Object, Object> oldState) {}
/* currently, the only thing we do when the font table ends is
dump its contents to the debugging log. */
@@ -806,7 +809,7 @@
/* Groups are irrelevant. */
public void begingroup() {}
- public void endgroup(Dictionary oldState) {}
+ public void endgroup(Dictionary<Object, Object> oldState) {}
/* Shouldn't see any binary blobs ... */
public void handleBinaryBlob(byte[] data) {}
@@ -1098,7 +1101,7 @@
parserState.put("sec", sectionAttributes);
}
- public void endgroup(Dictionary oldState)
+ public void endgroup(Dictionary<Object, Object> oldState)
{
characterAttributes = (MutableAttributeSet)parserState.get("chr");
paragraphAttributes = (MutableAttributeSet)parserState.get("pgf");
@@ -1262,7 +1265,9 @@
Dictionary<Object, Object> tabs;
Integer stopCount;
- tabs = (Dictionary<Object, Object>)parserState.get("_tabs");
+ @SuppressWarnings("unchecked")
+ Dictionary<Object, Object>tmp = (Dictionary)parserState.get("_tabs");
+ tabs = tmp;
if (tabs == null) {
tabs = new Hashtable<Object, Object>();
parserState.put("_tabs", tabs);
@@ -1420,7 +1425,8 @@
tabs = (TabStop[])parserState.get("_tabs_immutable");
if (tabs == null) {
- Dictionary workingTabs = (Dictionary)parserState.get("_tabs");
+ @SuppressWarnings("unchecked")
+ Dictionary<Object, Object> workingTabs = (Dictionary)parserState.get("_tabs");
if (workingTabs != null) {
int count = ((Integer)workingTabs.get("stop count")).intValue();
tabs = new TabStop[count];