From: <ls...@us...> - 2007-01-07 21:54:38
|
Revision: 3047 http://jnode.svn.sourceforge.net/jnode/?rev=3047&view=rev Author: lsantha Date: 2007-01-07 13:54:36 -0800 (Sun, 07 Jan 2007) Log Message: ----------- Classpath patches. Modified Paths: -------------- trunk/core/src/classpath/javax/javax/swing/colorchooser/DefaultHSBChooserPanel.java trunk/core/src/classpath/javax/javax/swing/event/EventListenerList.java trunk/core/src/classpath/javax/javax/swing/filechooser/FileSystemView.java trunk/core/src/classpath/javax/javax/swing/text/AbstractDocument.java trunk/core/src/classpath/javax/javax/swing/text/AsyncBoxView.java trunk/core/src/classpath/javax/javax/swing/text/AttributeSet.java trunk/core/src/classpath/javax/javax/swing/text/DefaultCaret.java trunk/core/src/classpath/javax/javax/swing/text/DefaultFormatter.java trunk/core/src/classpath/javax/javax/swing/text/DefaultStyledDocument.java trunk/core/src/classpath/javax/javax/swing/text/FieldView.java trunk/core/src/classpath/javax/javax/swing/text/InternationalFormatter.java trunk/core/src/classpath/javax/javax/swing/text/JTextComponent.java trunk/core/src/classpath/javax/javax/swing/text/MutableAttributeSet.java trunk/core/src/classpath/javax/javax/swing/text/SimpleAttributeSet.java trunk/core/src/classpath/javax/javax/swing/text/StyleContext.java trunk/core/src/classpath/javax/javax/swing/text/TextAction.java trunk/core/src/classpath/javax/javax/swing/text/html/HTML.java trunk/core/src/classpath/javax/javax/swing/text/html/HTMLDocument.java trunk/core/src/classpath/javax/javax/swing/text/html/StyleSheet.java trunk/core/src/classpath/javax/javax/swing/text/html/parser/AttributeList.java trunk/core/src/classpath/javax/javax/swing/text/html/parser/ContentModel.java trunk/core/src/classpath/javax/javax/swing/text/html/parser/DTD.java Modified: trunk/core/src/classpath/javax/javax/swing/colorchooser/DefaultHSBChooserPanel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/colorchooser/DefaultHSBChooserPanel.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/colorchooser/DefaultHSBChooserPanel.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -778,7 +778,6 @@ if (locked == HLOCKED) { slider.setMaximum(359); - ; slider.setValue(((Number) hSpinner.getValue()).intValue()); slider.setInverted(true); } Modified: trunk/core/src/classpath/javax/javax/swing/event/EventListenerList.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/event/EventListenerList.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/event/EventListenerList.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -37,6 +37,9 @@ package javax.swing.event; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.io.Serializable; import java.lang.reflect.Array; import java.util.EventListener; @@ -136,7 +139,7 @@ * * @throws NullPointerException if <code>t</code> is <code>null</code>. */ - public void add(Class t, EventListener listener) + public <T extends EventListener> void add(Class<T> t, T listener) { int oldLength; Object[] newList; @@ -175,7 +178,7 @@ * <code>t</code>. Thus, subclasses of <code>t</code> will not be * counted. */ - public int getListenerCount(Class t) + public int getListenerCount(Class<?> t) { int result = 0; for (int i = 0; i < listenerList.length; i += 2) @@ -224,7 +227,7 @@ * * @since 1.3 */ - public EventListener[] getListeners(Class c) + public <T extends EventListener> T[] getListeners(Class<T> c) { int count, f; EventListener[] result; @@ -236,7 +239,7 @@ if (listenerList[i] == c) result[f++] = (EventListener) listenerList[i + 1]; - return result; + return (T[]) result; } @@ -253,7 +256,7 @@ * * @throws NullPointerException if <code>t</code> is <code>null</code>. */ - public void remove(Class t, EventListener listener) + public <T extends EventListener> void remove(Class<T> t, T listener) { Object[] oldList, newList; int oldLength; @@ -304,4 +307,51 @@ } return buf.toString(); } + + /** + * Serializes an instance to an ObjectOutputStream. + * + * @param out the stream to serialize to + * + * @throws IOException if something goes wrong + */ + private void writeObject(ObjectOutputStream out) + throws IOException + { + out.defaultWriteObject(); + for (int i = 0; i < listenerList.length; i += 2) + { + Class cl = (Class) listenerList[i]; + EventListener l = (EventListener) listenerList[i + 1]; + if (l != null && l instanceof Serializable) + { + out.writeObject(cl.getName()); + out.writeObject(l); + } + } + // Write end marker. + out.writeObject(null); + } + + /** + * Deserializes an instance from an ObjectInputStream. + * + * @param in the input stream + * + * @throws ClassNotFoundException if a serialized class can't be found + * @throws IOException if something goes wrong + */ + private <T extends EventListener> void readObject(ObjectInputStream in) + throws ClassNotFoundException, IOException + { + listenerList = NO_LISTENERS; + in.defaultReadObject(); + Object type; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + while ((type = in.readObject()) != null) + { + EventListener l = (EventListener) in.readObject(); + add(((Class<T>) Class.forName((String) type, true, cl)), (T) l); + } + } } Modified: trunk/core/src/classpath/javax/javax/swing/filechooser/FileSystemView.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/filechooser/FileSystemView.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/filechooser/FileSystemView.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -37,8 +37,6 @@ package javax.swing.filechooser; -import gnu.classpath.NotImplementedException; - import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -171,7 +169,6 @@ * @return A default {@link FileSystemView} appropriate for the platform. */ public static FileSystemView getFileSystemView() - throws NotImplementedException { if (defaultFileSystemView == null) { Modified: trunk/core/src/classpath/javax/javax/swing/text/AbstractDocument.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/AbstractDocument.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/AbstractDocument.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -1,5 +1,5 @@ /* AbstractDocument.java -- - Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -467,7 +467,7 @@ * * @return the properties of this <code>Document</code> */ - public Dictionary getDocumentProperties() + public Dictionary<Object, Object> getDocumentProperties() { // FIXME: make me thread-safe if (properties == null) @@ -518,7 +518,7 @@ * * @return all registered listeners of the specified type */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } @@ -1347,7 +1347,7 @@ * * @param p the document properties to set */ - public void setDocumentProperties(Dictionary p) + public void setDocumentProperties(Dictionary<Object, Object> p) { // FIXME: make me thread-safe properties = p; @@ -1521,7 +1521,7 @@ * @return the attributes of <code>old</code> minus the attributes in * <code>attributes</code> */ - AttributeSet removeAttributes(AttributeSet old, Enumeration names); + AttributeSet removeAttributes(AttributeSet old, Enumeration<?> names); } /** @@ -1777,7 +1777,7 @@ * * @param names the names of the attributes to be removed */ - public void removeAttributes(Enumeration names) + public void removeAttributes(Enumeration<?> names) { attributes = getAttributeContext().removeAttributes(attributes, names); } @@ -1872,7 +1872,7 @@ * * @return the names of the attributes of this element */ - public Enumeration getAttributeNames() + public Enumeration<?> getAttributeNames() { return attributes.getAttributeNames(); } @@ -2093,7 +2093,7 @@ /** * The child elements of this BranchElement. */ - private Element[] children;; + private Element[] children; /** * The number of children in the branch element. @@ -2450,8 +2450,6 @@ */ public boolean addEdit(UndoableEdit edit) { - // XXX - Fully qualify ElementChange to work around gcj bug #2499. - // Start using Hashtable when we pass a certain threshold. This // gives a good memory/performance compromise. if (changes == null && edits.size() > THRESHOLD) @@ -2461,19 +2459,17 @@ for (int i = 0; i < count; i++) { Object o = edits.elementAt(i); - if (o instanceof DocumentEvent.ElementChange) + if (o instanceof ElementChange) { - DocumentEvent.ElementChange ec = - (DocumentEvent.ElementChange) o; + ElementChange ec = (ElementChange) o; changes.put(ec.getElement(), ec); } } } - if (changes != null && edit instanceof DocumentEvent.ElementChange) + if (changes != null && edit instanceof ElementChange) { - DocumentEvent.ElementChange elEdit = - (DocumentEvent.ElementChange) edit; + ElementChange elEdit = (ElementChange) edit; changes.put(elEdit.getElement(), elEdit); } return super.addEdit(edit); @@ -2527,13 +2523,12 @@ * @return the changes for <code>elem</code> or <code>null</code> if * <code>elem</code> has not been changed */ - public DocumentEvent.ElementChange getChange(Element elem) + public ElementChange getChange(Element elem) { - // XXX - Fully qualify ElementChange to work around gcj bug #2499. - DocumentEvent.ElementChange change = null; + ElementChange change = null; if (changes != null) { - change = (DocumentEvent.ElementChange) changes.get(elem); + change = (ElementChange) changes.get(elem); } else { @@ -2541,10 +2536,9 @@ for (int i = 0; i < count && change == null; i++) { Object o = edits.get(i); - if (o instanceof DocumentEvent.ElementChange) + if (o instanceof ElementChange) { - DocumentEvent.ElementChange ec = - (DocumentEvent.ElementChange) o; + ElementChange ec = (ElementChange) o; if (elem.equals(ec.getElement())) change = ec; } Modified: trunk/core/src/classpath/javax/javax/swing/text/AsyncBoxView.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/AsyncBoxView.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/AsyncBoxView.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -307,7 +307,7 @@ private int updateChildOffsets(float targetOffset) { int n = getViewCount(); - int targetIndex = n - 1;; + int targetIndex = n - 1; int pos = lastValidOffset.getChildView().getStartOffset(); int startIndex = getViewIndexAtPosition(pos, Position.Bias.Forward); float start = lastValidOffset.getMajorOffset(); Modified: trunk/core/src/classpath/javax/javax/swing/text/AttributeSet.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/AttributeSet.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/AttributeSet.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -158,7 +158,7 @@ * @return the names of the attributes that are stored in this * <code>AttributeSet</code> */ - Enumeration getAttributeNames(); + Enumeration<?> getAttributeNames(); /** * Returns the resolving parent of this <code>AttributeSet</code>. Modified: trunk/core/src/classpath/javax/javax/swing/text/DefaultCaret.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/DefaultCaret.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/DefaultCaret.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -946,7 +946,7 @@ * * @return all registered event listeners of the specified type */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } Modified: trunk/core/src/classpath/javax/javax/swing/text/DefaultFormatter.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/DefaultFormatter.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/DefaultFormatter.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -330,7 +330,7 @@ * * @return the class that is used for values */ - public Class getValueClass() + public Class<?> getValueClass() { return valueClass; } @@ -342,7 +342,7 @@ * * @see #getValueClass() */ - public void setValueClass(Class valueClass) + public void setValueClass(Class<?> valueClass) { this.valueClass = valueClass; } Modified: trunk/core/src/classpath/javax/javax/swing/text/DefaultStyledDocument.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/DefaultStyledDocument.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/DefaultStyledDocument.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -1126,7 +1126,9 @@ int p; for (p = 0; p < data.length && data[p].getType() == ElementSpec.EndTagType; - p++); + p++) + ; + Edit edit = insertPath[insertPath.length - p - 1]; edit.index--; edit.removed.add(0, edit.e.getElement(edit.index)); @@ -2377,7 +2379,7 @@ * * @return an enumeration of all style names */ - public Enumeration getStyleNames() + public Enumeration<?> getStyleNames() { StyleContext context = (StyleContext) getAttributeContext(); return context.getStyleNames(); Modified: trunk/core/src/classpath/javax/javax/swing/text/FieldView.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/FieldView.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/FieldView.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -91,7 +91,7 @@ horizontalVisibility.addChangeListener(new ChangeListener(){ public void stateChanged(ChangeEvent event) { getContainer().repaint(); - }; + } }); // It turned out that the span calculated at this point is wrong Modified: trunk/core/src/classpath/javax/javax/swing/text/InternationalFormatter.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/InternationalFormatter.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/InternationalFormatter.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -1,5 +1,5 @@ /* InternationalFormatter.java -- -Copyright (C) 2005 Free Software Foundation, Inc. +Copyright (C) 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -329,7 +329,7 @@ * * @throws CloneNotSupportedException not thrown here, since cloning is * supported - * XXX - FIXME - Whole method disabled as workaround for gcj bug #22060. + */ public Object clone() throws CloneNotSupportedException { @@ -338,7 +338,6 @@ Object clone = super.clone(); return clone; } - */ /** * Returns the Actions that are supported by this Formatter. Modified: trunk/core/src/classpath/javax/javax/swing/text/JTextComponent.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/JTextComponent.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/JTextComponent.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -1821,7 +1821,7 @@ public boolean getScrollableTracksViewportWidth() { - boolean res = false;; + boolean res = false; Container c = getParent(); if (c instanceof JViewport) res = ((JViewport) c).getExtentSize().width > getPreferredSize().width; Modified: trunk/core/src/classpath/javax/javax/swing/text/MutableAttributeSet.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/MutableAttributeSet.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/MutableAttributeSet.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -90,7 +90,7 @@ * @throws NullPointerException if <code>names</code> is <code>null</code> * or contains any <code>null</code> values. */ - void removeAttributes(Enumeration names); + void removeAttributes(Enumeration<?> names); /** * Removes attributes from this set if they are found in the Modified: trunk/core/src/classpath/javax/javax/swing/text/SimpleAttributeSet.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/SimpleAttributeSet.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/SimpleAttributeSet.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -261,7 +261,7 @@ * * @return An enumeration of the attribute names. */ - public Enumeration getAttributeNames() + public Enumeration<?> getAttributeNames() { return tab.keys(); } @@ -375,7 +375,7 @@ * @throws NullPointerException if <code>names</code> is <code>null</code> * or contains any <code>null</code> values. */ - public void removeAttributes(Enumeration names) + public void removeAttributes(Enumeration<?> names) { while (names.hasMoreElements()) { Modified: trunk/core/src/classpath/javax/javax/swing/text/StyleContext.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/StyleContext.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/StyleContext.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -121,7 +121,7 @@ listenerList.remove(ChangeListener.class, l); } - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } @@ -183,7 +183,7 @@ return attributes.getAttributeCount(); } - public Enumeration getAttributeNames() + public Enumeration<?> getAttributeNames() { return attributes.getAttributeNames(); } @@ -210,7 +210,7 @@ fireStateChanged(); } - public void removeAttributes(Enumeration names) + public void removeAttributes(Enumeration<?> names) { attributes = StyleContext.this.removeAttributes(attributes, names); fireStateChanged(); @@ -351,7 +351,7 @@ return attrs.length / 2; } - public Enumeration getAttributeNames() + public Enumeration<?> getAttributeNames() { return new Enumeration() { @@ -539,7 +539,7 @@ * Get the names of the style. The returned enumeration always * contains at least one member, the default style. */ - public Enumeration getStyleNames() + public Enumeration<?> getStyleNames() { return styles.getAttributeNames(); } @@ -749,7 +749,7 @@ } public synchronized AttributeSet removeAttributes(AttributeSet old, - Enumeration names) + Enumeration<?> names) { AttributeSet ret; if (old.getAttributeCount() <= getCompressionThreshold()) Modified: trunk/core/src/classpath/javax/javax/swing/text/TextAction.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/TextAction.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/TextAction.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -96,7 +96,7 @@ */ public static final Action[] augmentList(Action[] list1, Action[] list2) { - HashMap actions = new HashMap(); + HashMap<Object,Action> actions = new HashMap<Object,Action>(); for (int i = 0; i < list1.length; ++i) { @@ -104,6 +104,7 @@ Object name = a.getValue(Action.NAME); actions.put(name != null ? name : "", a); } + for (int i = 0; i < list2.length; ++i) { Action a = list2[i]; @@ -113,9 +114,10 @@ Action[] augmented = new Action[actions.size()]; int i = 0; - for (Iterator it = actions.values().iterator(); it.hasNext(); i++) - augmented[i] = (Action) it.next(); + for (Iterator<Action> it = actions.values().iterator(); it.hasNext(); i++) + augmented[i] = it.next(); return augmented; + } /** Modified: trunk/core/src/classpath/javax/javax/swing/text/html/HTML.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/html/HTML.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/html/HTML.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -1129,8 +1129,8 @@ static final int BLOCK = 2; static final int PREFORMATTED = 4; static final int SYNTHETIC = 8; - private static Map tagMap; - private static Map attrMap; + private static Map<String,Tag> tagMap; + private static Map<String,Attribute> attrMap; /** * The public constructor (does nothing). It it seldom required to have @@ -1169,7 +1169,7 @@ if (attrMap == null) { // Create the map on demand. - attrMap = new TreeMap(); + attrMap = new TreeMap<String,Attribute>(); Attribute[] attrs = getAllAttributeKeys(); @@ -1179,7 +1179,7 @@ } } - return (Attribute) attrMap.get(attName.toLowerCase()); + return attrMap.get(attName.toLowerCase()); } /** @@ -1238,7 +1238,7 @@ if (tagMap == null) { // Create the mao on demand. - tagMap = new TreeMap(); + tagMap = new TreeMap<String,Tag>(); Tag[] tags = getAllTags(); @@ -1248,6 +1248,6 @@ } } - return (Tag) tagMap.get(tagName.toLowerCase()); + return tagMap.get(tagName.toLowerCase()); } } Modified: trunk/core/src/classpath/javax/javax/swing/text/html/HTMLDocument.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/html/HTMLDocument.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/html/HTMLDocument.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -649,12 +649,12 @@ */ protected MutableAttributeSet charAttr = new SimpleAttributeSet(); - protected Vector parseBuffer = new Vector(); + protected Vector<ElementSpec> parseBuffer = new Vector<ElementSpec>(); /** * The parse stack. It holds the current element tree path. */ - private Stack parseStack = new Stack(); + private Stack<HTML.Tag> parseStack = new Stack<HTML.Tag>(); /** * A stack for character attribute sets * @@ -1791,7 +1791,7 @@ boolean inParagraph = false; if (! parseStack.isEmpty()) { - HTML.Tag top = (HTML.Tag) parseStack.peek(); + HTML.Tag top = parseStack.peek(); inParagraph = top == HTML.Tag.P || top == HTML.Tag.IMPLIED; } return inParagraph; @@ -1802,7 +1802,7 @@ boolean inParagraph = false; if (! parseStack.isEmpty()) { - HTML.Tag top = (HTML.Tag) parseStack.peek(); + HTML.Tag top = parseStack.peek(); inParagraph = top == HTML.Tag.IMPLIED; } return inParagraph; Modified: trunk/core/src/classpath/javax/javax/swing/text/html/StyleSheet.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/html/StyleSheet.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/html/StyleSheet.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -870,7 +870,7 @@ * @param names - the attribute names * @return the update attribute set */ - public AttributeSet removeAttributes(AttributeSet old, Enumeration names) + public AttributeSet removeAttributes(AttributeSet old, Enumeration<?> names) { // FIXME: Not implemented. return super.removeAttributes(old, names); Modified: trunk/core/src/classpath/javax/javax/swing/text/html/parser/AttributeList.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/html/parser/AttributeList.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/html/parser/AttributeList.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -122,7 +122,7 @@ * null, if this parameter was not specified. * Values, defined in DTD, are case insensitive. */ - public Vector values; + public Vector<?> values; /** * The modifier of this attribute. This field contains one of the @@ -176,7 +176,7 @@ * Equals to null for the last attribute definition. */ public AttributeList(String a_name, int a_type, int a_modifier, - String a_default, Vector allowed_values, + String a_default, Vector<?> allowed_values, AttributeList a_next ) { @@ -251,7 +251,7 @@ /** * Get the allowed values of this attribute. */ - public Enumeration getValues() + public Enumeration<?> getValues() { return values.elements(); } Modified: trunk/core/src/classpath/javax/javax/swing/text/html/parser/ContentModel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/html/parser/ContentModel.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/html/parser/ContentModel.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -151,13 +151,15 @@ * discarded. * @param elements - a vector to add the values to. */ - public void getElements(Vector elements) + public void getElements(Vector<Element> elements) { ContentModel c = this; while (c != null) { - elements.add(c.content); + // FIXME: correct? + if (c.content instanceof Element) + elements.add((Element) c.content); c = c.next; } } Modified: trunk/core/src/classpath/javax/javax/swing/text/html/parser/DTD.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/html/parser/DTD.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/html/parser/DTD.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -88,7 +88,7 @@ /** * The table of existing available DTDs. */ - static Hashtable dtdHash = new Hashtable(); + static Hashtable<String,DTD> dtdHash = new Hashtable<String,DTD>(); /** * The applet element for this DTD. @@ -148,12 +148,13 @@ /** * The element for accessing all DTD elements by name. */ - public Hashtable elementHash = new Hashtable(); + public Hashtable<String,Element> elementHash = + new Hashtable<String,Element>(); /** * The entity table for accessing all DTD entities by name. */ - public Hashtable entityHash = new Hashtable(); + public Hashtable<Object, Entity> entityHash = new Hashtable<Object, Entity>(); /** * The name of this DTD. @@ -165,7 +166,7 @@ * javax.swing.text.html.parser.Element#index field of all elements * in this vector is set to the element position in this vector. */ - public Vector elements = new Vector(); + public Vector<Element> elements = new Vector<Element>(); /** Create a new DTD with the specified name. */ protected DTD(String a_name) @@ -224,7 +225,7 @@ String name = Entity.mapper.get(id); if (name != null) - return (Entity) entityHash.get(name); + return entityHash.get(name); else return null; } @@ -269,7 +270,7 @@ */ public void defineAttributes(String forElement, AttributeList attributes) { - Element e = (Element) elementHash.get(forElement.toLowerCase()); + Element e = elementHash.get(forElement.toLowerCase()); if (e == null) e = newElement(forElement); @@ -420,7 +421,7 @@ if (allowed_values != null) { StringTokenizer st = new StringTokenizer(allowed_values, " \t|"); - Vector v = new Vector(st.countTokens()); + Vector<String> v = new Vector<String>(st.countTokens()); while (st.hasMoreTokens()) v.add(st.nextToken()); @@ -571,7 +572,7 @@ */ private Element newElement(String name) { - Element e = (Element) elementHash.get(name.toLowerCase()); + Element e = elementHash.get(name.toLowerCase()); if (e == null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |