diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-12-10 20:25:39 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-12-10 20:25:39 +0000 |
commit | da66af5951b18b6f5e8752cbbe11f5f842332a33 (patch) | |
tree | a28e126d1415e3689be6c7b2c2d061ae51194195 /javax | |
parent | ab90923ee693a17e2e0e37b6ba5a84794c9236de (diff) | |
download | classpath-da66af5951b18b6f5e8752cbbe11f5f842332a33.tar.gz |
2006-12-10 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Merge of generics-branch to HEAD (woohoo!)
Diffstat (limited to 'javax')
200 files changed, 2408 insertions, 557 deletions
diff --git a/javax/accessibility/AccessibleRelationSet.java b/javax/accessibility/AccessibleRelationSet.java index 8c33eaa72..768c9cd79 100644 --- a/javax/accessibility/AccessibleRelationSet.java +++ b/javax/accessibility/AccessibleRelationSet.java @@ -64,7 +64,8 @@ public class AccessibleRelationSet * @see #toArray() * @see #clear() */ - protected Vector relations = new Vector(); + protected Vector<AccessibleRelation> relations + = new Vector<AccessibleRelation>(); /** * Create an empty relation set. diff --git a/javax/accessibility/AccessibleStateSet.java b/javax/accessibility/AccessibleStateSet.java index 29fd2ed97..783f54127 100644 --- a/javax/accessibility/AccessibleStateSet.java +++ b/javax/accessibility/AccessibleStateSet.java @@ -62,7 +62,7 @@ public class AccessibleStateSet * @see #toArray() * @see #clear() */ - protected Vector states = new Vector(); + protected Vector<AccessibleState> states = new Vector<AccessibleState>(); /** * Create an empty state set. diff --git a/javax/crypto/Mac.java b/javax/crypto/Mac.java index ea3e42ba6..2a269ab80 100644 --- a/javax/crypto/Mac.java +++ b/javax/crypto/Mac.java @@ -41,6 +41,7 @@ package javax.crypto; import gnu.java.security.Engine; import java.lang.reflect.InvocationTargetException; +import java.nio.ByteBuffer; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.Key; @@ -406,6 +407,18 @@ public class Mac implements Cloneable } /** + * Update this MAC with the remaining bytes in the given buffer + * @param buffer The input buffer. + * @since 1.5 + */ + public final void update (final ByteBuffer buffer) + { + if (virgin) + throw new IllegalStateException ("not initialized"); + macSpi.engineUpdate(buffer); + } + + /** * Clone this instance, if the underlying implementation supports it. * * @return A clone of this instance. diff --git a/javax/crypto/MacSpi.java b/javax/crypto/MacSpi.java index b0f96bff3..853bd66aa 100644 --- a/javax/crypto/MacSpi.java +++ b/javax/crypto/MacSpi.java @@ -38,6 +38,7 @@ exception statement from your version. */ package javax.crypto; +import java.nio.ByteBuffer; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.Key; @@ -142,4 +143,21 @@ public abstract class MacSpi * @param length The number of bytes to update. */ protected abstract void engineUpdate(byte[] input, int offset, int length); + + /** + * Update this MAC with the remaining bytes of a buffer. + * + * @param buffer The input buffer. + * @since 1.5 + */ + protected void engineUpdate (final ByteBuffer buffer) + { + byte[] buf = new byte[1024]; + while (buffer.hasRemaining ()) + { + int n = Math.min (buffer.remaining (), buf.length); + buffer.get (buf, 0, n); + engineUpdate (buf, 0, n); + } + } } diff --git a/javax/imageio/IIOImage.java b/javax/imageio/IIOImage.java index 0d9874762..bd69bae5f 100644 --- a/javax/imageio/IIOImage.java +++ b/javax/imageio/IIOImage.java @@ -79,8 +79,7 @@ public class IIOImage /** * A list of BufferedImage thumbnails of this image. */ - // for 1.5 these lists are List<? extends BufferedImage> - protected List thumbnails; + protected List<? extends BufferedImage> thumbnails; /** * Construct an IIOImage containing raster image data, thumbnails @@ -92,7 +91,8 @@ public class IIOImage * * @exception IllegalArgumentException if raster is null */ - public IIOImage (Raster raster, List thumbnails, IIOMetadata metadata) + public IIOImage (Raster raster, List<? extends BufferedImage> thumbnails, + IIOMetadata metadata) { if (raster == null) throw new IllegalArgumentException ("raster may not be null"); @@ -112,7 +112,8 @@ public class IIOImage * * @exception IllegalArgumentException if image is null */ - public IIOImage (RenderedImage image, List thumbnails, IIOMetadata metadata) + public IIOImage (RenderedImage image, List<? extends BufferedImage> thumbnails, + IIOMetadata metadata) { if (image == null) throw new IllegalArgumentException ("image may not be null"); @@ -192,7 +193,7 @@ public class IIOImage * * @return a list of thumbnails or null */ - public List getThumbnails() + public List<? extends BufferedImage> getThumbnails() { return thumbnails; } @@ -260,7 +261,7 @@ public class IIOImage * * @param thumbnails a new list of thumbnails or null */ - public void setThumbnails (List thumbnails) + public void setThumbnails (List<? extends BufferedImage> thumbnails) { this.thumbnails = thumbnails; } diff --git a/javax/imageio/ImageIO.java b/javax/imageio/ImageIO.java index b2304a783..a3d967726 100644 --- a/javax/imageio/ImageIO.java +++ b/javax/imageio/ImageIO.java @@ -315,27 +315,37 @@ public final class ImageIO } } - private static final class ImageReaderIterator implements Iterator + private static final class ImageReaderIterator + implements Iterator<ImageReader> { - Iterator it; + Iterator<ImageReaderSpi> it; Object readerExtension; - public ImageReaderIterator(Iterator it, Object readerExtension) + public ImageReaderIterator(Iterator<ImageReaderSpi> it, + Object readerExtension) { this.it = it; this.readerExtension = readerExtension; } + + public ImageReaderIterator(Iterator<ImageReaderSpi> it) + { + this.it = it; + } public boolean hasNext() { return it.hasNext(); } - public Object next() + public ImageReader next() { try { - return ((ImageReaderSpi) it.next()).createReaderInstance(readerExtension); + ImageReaderSpi spi = it.next(); + return (readerExtension == null + ? spi.createReaderInstance() + : spi.createReaderInstance(readerExtension)); } catch (IOException e) { @@ -349,27 +359,37 @@ public final class ImageIO } } - private static final class ImageWriterIterator implements Iterator + private static final class ImageWriterIterator + implements Iterator<ImageWriter> { - Iterator it; + Iterator<ImageWriterSpi> it; Object writerExtension; - public ImageWriterIterator(Iterator it, Object writerExtension) + public ImageWriterIterator(Iterator<ImageWriterSpi> it, + Object writerExtension) { this.it = it; this.writerExtension = writerExtension; } + + public ImageWriterIterator(Iterator<ImageWriterSpi> it) + { + this.it = it; + } public boolean hasNext() { return it.hasNext(); } - public Object next() + public ImageWriter next() { try { - return ((ImageWriterSpi) it.next()).createWriterInstance(writerExtension); + ImageWriterSpi spi = it.next(); + return (writerExtension == null + ? spi.createWriterInstance() + : spi.createWriterInstance(writerExtension)); } catch (IOException e) { @@ -386,13 +406,14 @@ public final class ImageIO private static File cacheDirectory; private static boolean useCache = true; - private static Iterator getReadersByFilter(Class type, - ServiceRegistry.Filter filter, - Object readerExtension) + private static Iterator<ImageReader> getReadersByFilter(Class<ImageReaderSpi> type, + ServiceRegistry.Filter filter, + Object readerExtension) { try { - Iterator it = getRegistry().getServiceProviders(type, filter, true); + Iterator<ImageReaderSpi> it + = getRegistry().getServiceProviders(type, filter, true); return new ImageReaderIterator(it, readerExtension); } catch (IllegalArgumentException e) @@ -401,13 +422,14 @@ public final class ImageIO } } - private static Iterator getWritersByFilter(Class type, - ServiceRegistry.Filter filter, - Object writerExtension) + private static Iterator<ImageWriter> getWritersByFilter(Class<ImageWriterSpi> type, + ServiceRegistry.Filter filter, + Object writerExtension) { try { - Iterator it = getRegistry().getServiceProviders(type, filter, true); + Iterator<ImageWriterSpi> it + = getRegistry().getServiceProviders(type, filter, true); return new ImageWriterIterator(it, writerExtension); } catch (IllegalArgumentException e) @@ -436,7 +458,7 @@ public final class ImageIO * * @exception IllegalArgumentException if formatName is null */ - public static Iterator getImageReadersByFormatName(String formatName) + public static Iterator<ImageReader> getImageReadersByFormatName(String formatName) { if (formatName == null) throw new IllegalArgumentException("formatName may not be null"); @@ -457,7 +479,7 @@ public final class ImageIO * * @exception IllegalArgumentException if MIMEType is null */ - public static Iterator getImageReadersByMIMEType(String MIMEType) + public static Iterator<ImageReader> getImageReadersByMIMEType(String MIMEType) { if (MIMEType == null) throw new IllegalArgumentException("MIMEType may not be null"); @@ -477,7 +499,7 @@ public final class ImageIO * * @exception IllegalArgumentException if fileSuffix is null */ - public static Iterator getImageReadersBySuffix(String fileSuffix) + public static Iterator<ImageReader> getImageReadersBySuffix(String fileSuffix) { if (fileSuffix == null) throw new IllegalArgumentException("formatName may not be null"); @@ -497,7 +519,7 @@ public final class ImageIO * * @exception IllegalArgumentException if formatName is null */ - public static Iterator getImageWritersByFormatName(String formatName) + public static Iterator<ImageWriter> getImageWritersByFormatName(String formatName) { if (formatName == null) throw new IllegalArgumentException("formatName may not be null"); @@ -518,7 +540,7 @@ public final class ImageIO * * @exception IllegalArgumentException if MIMEType is null */ - public static Iterator getImageWritersByMIMEType(String MIMEType) + public static Iterator<ImageWriter> getImageWritersByMIMEType(String MIMEType) { if (MIMEType == null) throw new IllegalArgumentException("MIMEType may not be null"); @@ -538,7 +560,7 @@ public final class ImageIO * * @exception IllegalArgumentException if fileSuffix is null */ - public static Iterator getImageWritersBySuffix(String fileSuffix) + public static Iterator<ImageWriter> getImageWritersBySuffix(String fileSuffix) { if (fileSuffix == null) throw new IllegalArgumentException("fileSuffix may not be null"); @@ -1068,8 +1090,7 @@ public final class ImageIO if (writer == null) throw new IllegalArgumentException ("null argument"); - ImageWriterSpi spi = (ImageWriterSpi) getRegistry() - .getServiceProviderByClass(writer.getClass()); + ImageWriterSpi spi = writer.getOriginatingProvider(); String[] readerSpiNames = spi.getImageReaderSpiNames(); @@ -1098,14 +1119,16 @@ public final class ImageIO * * @return an iterator over a collection of image readers */ - public static Iterator getImageReaders (Object input) + public static Iterator<ImageReader> getImageReaders (Object input) { if (input == null) throw new IllegalArgumentException ("null argument"); - return getRegistry().getServiceProviders (ImageReaderSpi.class, - new ReaderObjectFilter(input), - true); + Iterator<ImageReaderSpi> spiIterator + = getRegistry().getServiceProviders (ImageReaderSpi.class, + new ReaderObjectFilter(input), + true); + return new ImageReaderIterator(spiIterator); } /** @@ -1118,16 +1141,18 @@ public final class ImageIO * * @return an iterator over a collection of image writers */ - public static Iterator getImageWriters (ImageTypeSpecifier type, + public static Iterator<ImageWriter> getImageWriters (ImageTypeSpecifier type, String formatName) { if (type == null || formatName == null) throw new IllegalArgumentException ("null argument"); - return getRegistry().getServiceProviders (ImageWriterSpi.class, - new WriterObjectFilter(type, - formatName), - true); + final Iterator<ImageWriterSpi> spiIterator + = getRegistry().getServiceProviders (ImageWriterSpi.class, + new WriterObjectFilter(type, + formatName), + true); + return new ImageWriterIterator(spiIterator); } /** @@ -1149,8 +1174,7 @@ public final class ImageIO if (reader == null) throw new IllegalArgumentException ("null argument"); - ImageReaderSpi spi = (ImageReaderSpi) getRegistry() - .getServiceProviderByClass(reader.getClass()); + ImageReaderSpi spi = reader.getOriginatingProvider(); String[] writerSpiNames = spi.getImageWriterSpiNames(); @@ -1184,15 +1208,33 @@ public final class ImageIO * @exception IllegalArgumentException if either reader or writer is * null */ - public static Iterator getImageTranscoders (ImageReader reader, - ImageWriter writer) + public static Iterator<ImageTranscoder> getImageTranscoders (ImageReader reader, + ImageWriter writer) { if (reader == null || writer == null) throw new IllegalArgumentException ("null argument"); - return getRegistry().getServiceProviders (ImageTranscoderSpi.class, - new TranscoderFilter (reader, - writer), - true); + final Iterator<ImageTranscoderSpi> spiIterator + = getRegistry().getServiceProviders (ImageTranscoderSpi.class, + new TranscoderFilter (reader, + writer), + true); + return new Iterator<ImageTranscoder>() + { + public boolean hasNext() + { + return spiIterator.hasNext(); + } + + public ImageTranscoder next() + { + return spiIterator.next().createTranscoderInstance(); + } + + public void remove() + { + throw new UnsupportedOperationException(); + } + }; } } diff --git a/javax/imageio/ImageReader.java b/javax/imageio/ImageReader.java index cdd77d52b..c7eed06fb 100644 --- a/javax/imageio/ImageReader.java +++ b/javax/imageio/ImageReader.java @@ -116,7 +116,7 @@ public abstract class ImageReader * A list of installed progress listeners. Initially null, meaning * no installed listeners. */ - protected List progressListeners = null; + protected List<IIOReadProgressListener> progressListeners = null; /** * true if this reader should only read data further ahead in the @@ -129,19 +129,19 @@ public abstract class ImageReader * A list of installed update listeners. Initially null, meaning no * installed listeners. */ - protected List updateListeners = null; + protected List<IIOReadUpdateListener> updateListeners = null; /** * A list of installed warning listeners. Initially null, meaning * no installed listeners. */ - protected List warningListeners = null; + protected List<IIOReadWarningListener> warningListeners = null; /** * A list of warning locales corresponding with the list of * installed warning listeners. Initially null, meaning no locales. */ - protected List warningLocales = null; + protected List<Locale> warningLocales = null; /** * Construct an image reader. @@ -371,7 +371,7 @@ public abstract class ImageReader * out-of-bounds * @exception IOException if a read error occurs */ - public abstract Iterator getImageTypes(int imageIndex) + public abstract Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex) throws IOException; /** @@ -1594,7 +1594,7 @@ public abstract class ImageReader * height is greater than Integer.MAX_VALUE */ protected static BufferedImage getDestination (ImageReadParam param, - Iterator imageTypes, + Iterator<ImageTypeSpecifier> imageTypes, int width, int height) throws IIOException @@ -1694,7 +1694,7 @@ public abstract class ImageReader */ public IIOMetadata getImageMetadata (int imageIndex, String formatName, - Set nodeNames) + Set<String> nodeNames) throws IOException { if (formatName == null || nodeNames == null) @@ -1808,7 +1808,7 @@ public abstract class ImageReader * @exception IOException if a read error occurs */ public IIOMetadata getStreamMetadata (String formatName, - Set nodeNames) + Set<String> nodeNames) throws IOException { if (formatName == null || nodeNames == null) @@ -1915,7 +1915,7 @@ public abstract class ImageReader * destination image regions are empty * @exception IOException if a read error occurs */ - public Iterator readAll (Iterator params) + public Iterator<IIOImage> readAll (Iterator<? extends ImageReadParam> params) throws IOException { List l = new ArrayList (); diff --git a/javax/imageio/ImageWriter.java b/javax/imageio/ImageWriter.java index ef3521541..b49e081f0 100644 --- a/javax/imageio/ImageWriter.java +++ b/javax/imageio/ImageWriter.java @@ -40,6 +40,7 @@ package javax.imageio; import java.awt.Dimension; import java.awt.Rectangle; +import java.awt.image.BufferedImage; import java.awt.image.Raster; import java.awt.image.RenderedImage; import java.io.IOException; @@ -102,19 +103,19 @@ public abstract class ImageWriter * A list of installed progress listeners. Initially null, meaning * no installed listeners. */ - protected List progressListeners = null; + protected List<IIOWriteProgressListener> progressListeners = null; /** * A list of installed warning listeners. Initially null, meaning * no installed listeners. */ - protected List warningListeners = null; + protected List<IIOWriteWarningListener> warningListeners = null; /** * A list of warning locales corresponding with the list of * installed warning listeners. Initially null, meaning no locales. */ - protected List warningLocales = null; + protected List<Locale> warningLocales = null; /** * Construct an image writer. @@ -1076,7 +1077,7 @@ public abstract class ImageWriter public void prepareInsertEmpty (int imageIndex, ImageTypeSpecifier imageType, int width, int height, IIOMetadata imageMetadata, - List thumbnails, + List<? extends BufferedImage> thumbnails, ImageWriteParam param) throws IOException { @@ -1149,7 +1150,7 @@ public abstract class ImageWriter ImageTypeSpecifier imageType, int width, int height, IIOMetadata imageMetadata, - List thumbnails, + List<? extends BufferedImage> thumbnails, ImageWriteParam param) throws IOException { diff --git a/javax/imageio/metadata/IIOMetadataFormat.java b/javax/imageio/metadata/IIOMetadataFormat.java index 76e0950a3..15f2ceb0b 100644 --- a/javax/imageio/metadata/IIOMetadataFormat.java +++ b/javax/imageio/metadata/IIOMetadataFormat.java @@ -106,15 +106,15 @@ public interface IIOMetadataFormat int getObjectArrayMinLength (String elementName); - Class getObjectClass (String elementName); + Class<?> getObjectClass (String elementName); Object getObjectDefaultValue (String elementName); Object[] getObjectEnumerations (String elementName); - Comparable getObjectMaxValue (String elementName); + Comparable<?> getObjectMaxValue (String elementName); - Comparable getObjectMinValue (String elementName); + Comparable<?> getObjectMinValue (String elementName); int getObjectValueType (String elementName); diff --git a/javax/imageio/metadata/IIOMetadataFormatImpl.java b/javax/imageio/metadata/IIOMetadataFormatImpl.java index aad30447c..78fad1a15 100644 --- a/javax/imageio/metadata/IIOMetadataFormatImpl.java +++ b/javax/imageio/metadata/IIOMetadataFormatImpl.java @@ -462,7 +462,7 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat int dataType, boolean required, String defaultValue, - List enumeratedValues) + List<String> enumeratedValues) { IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName); node.setAttributeNode (new IIOMetadataNodeAttrEnumerated (node, @@ -568,8 +568,8 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat node.setUserObject (null); } - protected void addObjectValue (String elementName, Class classType, - boolean required, Object defaultValue) + protected <T> void addObjectValue (String elementName, Class<T> classType, + boolean required, T defaultValue) { IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName); addNodeObject (node, new NodeObject (node, @@ -578,9 +578,9 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat defaultValue)); } - protected void addObjectValue (String elementName, Class classType, - boolean required, Object defaultValue, - List enumeratedValues) + protected <T> void addObjectValue (String elementName, Class<T> classType, + boolean required, T defaultValue, + List<? extends T> enumeratedValues) { IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName); addNodeObject (node, new NodeObjectEnumerated (node, @@ -590,12 +590,13 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat enumeratedValues)); } - protected void addObjectValue (String elementName, Class classType, - Object defaultValue, - Comparable minValue, - Comparable maxValue, - boolean minInclusive, - boolean maxInclusive) + protected <T extends Object & Comparable<? super T>> + void addObjectValue (String elementName, Class<T> classType, + T defaultValue, + Comparable<? super T> minValue, + Comparable<? super T> maxValue, + boolean minInclusive, + boolean maxInclusive) { IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName); addNodeObject (node, new NodeObjectBounded (node, @@ -607,7 +608,7 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat maxInclusive)); } - protected void addObjectValue (String elementName, Class classType, + protected void addObjectValue (String elementName, Class<?> classType, int arrayMinLength, int arrayMaxLength) { IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName); @@ -836,7 +837,7 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat return ((Integer) ((NodeObjectArray) getNodeObject (node)).getArrayMinLength ()).intValue(); } - public Class getObjectClass (String elementName) + public Class<?> getObjectClass (String elementName) { IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName); return getNodeObject (node).getClassType (); @@ -854,13 +855,13 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat return ((NodeObjectEnumerated) getNodeObject (node)).getEnumerations (); } - public Comparable getObjectMaxValue (String elementName) + public Comparable<?> getObjectMaxValue (String elementName) { IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName); return ((NodeObjectBounded) getNodeObject (node)).getMaxValue (); } - public Comparable getObjectMinValue (String elementName) + public Comparable<?> getObjectMinValue (String elementName) { IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName); return ((NodeObjectBounded) getNodeObject (node)).getMinValue (); diff --git a/javax/imageio/spi/IIORegistry.java b/javax/imageio/spi/IIORegistry.java index e762a9627..fc3087f0c 100644 --- a/javax/imageio/spi/IIORegistry.java +++ b/javax/imageio/spi/IIORegistry.java @@ -39,7 +39,6 @@ exception statement from your version. */ package javax.imageio.spi; import gnu.classpath.ServiceFactory; -import gnu.java.awt.ClasspathToolkit; import java.awt.Toolkit; import java.util.HashMap; @@ -92,8 +91,6 @@ public final class IIORegistry extends ServiceRegistry registerServiceProvider(new BMPImageWriterSpi()); Toolkit toolkit = Toolkit.getDefaultToolkit(); - if (toolkit instanceof ClasspathToolkit) - ((ClasspathToolkit)toolkit).registerImageIOSpis(this); registerApplicationClasspathSpis(); } diff --git a/javax/imageio/spi/IIOServiceProvider.java b/javax/imageio/spi/IIOServiceProvider.java index 1ec59d526..48fa7d414 100644 --- a/javax/imageio/spi/IIOServiceProvider.java +++ b/javax/imageio/spi/IIOServiceProvider.java @@ -110,7 +110,7 @@ public abstract class IIOServiceProvider * @param category the service category for which this provider has * been registered as an implementor. */ - public void onRegistration(ServiceRegistry registry, Class category) + public void onRegistration(ServiceRegistry registry, Class<?> category) { } @@ -128,7 +128,7 @@ public abstract class IIOServiceProvider * @param category the service category for which this provider has * been registered as an implementor. */ - public void onDeregistration(ServiceRegistry registry, Class category) + public void onDeregistration(ServiceRegistry registry, Class<?> category) { } diff --git a/javax/imageio/spi/ImageInputStreamSpi.java b/javax/imageio/spi/ImageInputStreamSpi.java index 51c58395f..2b60868a5 100644 --- a/javax/imageio/spi/ImageInputStreamSpi.java +++ b/javax/imageio/spi/ImageInputStreamSpi.java @@ -59,7 +59,7 @@ public abstract class ImageInputStreamSpi * Indicates which kind of input is processable by the streams * created by {@link #createInputStreamInstance(Object)}. */ - protected Class inputClass; + protected Class<?> inputClass; /** @@ -80,7 +80,7 @@ public abstract class ImageInputStreamSpi * or <code>version</code> is <code>null</code>. */ public ImageInputStreamSpi(String vendorName, String version, - Class inputClass) + Class<?> inputClass) { super(vendorName, version); this.inputClass = inputClass; @@ -91,7 +91,7 @@ public abstract class ImageInputStreamSpi * Determines which kind of input is processable by the streams * created by {@link #createInputStreamInstance(Object)}. */ - public Class getInputClass() + public Class<?> getInputClass() { return inputClass; } diff --git a/javax/imageio/spi/ImageOutputStreamSpi.java b/javax/imageio/spi/ImageOutputStreamSpi.java index 0f1d3cdb2..872e7181e 100644 --- a/javax/imageio/spi/ImageOutputStreamSpi.java +++ b/javax/imageio/spi/ImageOutputStreamSpi.java @@ -59,7 +59,7 @@ public abstract class ImageOutputStreamSpi * Indicates which kind of output is produced by the streams * created by {@link #createOutputStreamInstance(Object)}. */ - protected Class outputClass; + protected Class<?> outputClass; /** @@ -80,7 +80,7 @@ public abstract class ImageOutputStreamSpi * or <code>version</code> is <code>null</code>. */ public ImageOutputStreamSpi(String vendorName, String version, - Class outputClass) + Class<?> outputClass) { super(vendorName, version); this.outputClass = outputClass; @@ -91,7 +91,7 @@ public abstract class ImageOutputStreamSpi * Determines which kind of output is produced by the streams * created by {@link #createOutputStreamInstance(Object)}. */ - public Class getOutputClass() + public Class<?> getOutputClass() { return outputClass; } diff --git a/javax/imageio/spi/RegisterableService.java b/javax/imageio/spi/RegisterableService.java index ccf734e69..7be5a1bea 100644 --- a/javax/imageio/spi/RegisterableService.java +++ b/javax/imageio/spi/RegisterableService.java @@ -62,7 +62,7 @@ public interface RegisterableService * @param category the service category for which this provider has * been registered as an implementor. */ - void onRegistration(ServiceRegistry registry, Class category); + void onRegistration(ServiceRegistry registry, Class<?> category); /** @@ -78,6 +78,6 @@ public interface RegisterableService * @param category the service category for which this provider has * been registered as an implementor. */ - void onDeregistration(ServiceRegistry registry, Class category); + void onDeregistration(ServiceRegistry registry, Class<?> category); } diff --git a/javax/imageio/spi/ServiceRegistry.java b/javax/imageio/spi/ServiceRegistry.java index 031b66604..4848bc6db 100644 --- a/javax/imageio/spi/ServiceRegistry.java +++ b/javax/imageio/spi/ServiceRegistry.java @@ -121,7 +121,7 @@ public class ServiceRegistry * @throws ClassCastException if <code>categories</code> does not * iterate over instances of {@link java.lang.Class}. */ - public ServiceRegistry(Iterator categories) + public ServiceRegistry(Iterator<Class<?>> categories) { ArrayList cats = new ArrayList(/* expected size */ 10); @@ -178,8 +178,8 @@ public class ServiceRegistry * @throws IllegalArgumentException if <code>spi</code> is * <code>null</code>. */ - public static Iterator lookupProviders(Class spi, - ClassLoader loader) + public static <T> Iterator<T> lookupProviders(Class<T> spi, + ClassLoader loader) { return ServiceFactory.lookupProviders(spi, loader); } @@ -200,7 +200,7 @@ public class ServiceRegistry * * @see #lookupProviders(Class, ClassLoader) */ - public static Iterator lookupProviders(Class spi) + public static <T> Iterator<T> lookupProviders(Class<T> spi) { return ServiceFactory.lookupProviders(spi); } @@ -212,7 +212,7 @@ public class ServiceRegistry * @return an unmodifiable {@link * java.util.Iterator}<{@link java.lang.Class}>. */ - public Iterator getCategories() + public Iterator<Class<?>> getCategories() { return new Iterator() { @@ -317,8 +317,8 @@ public class ServiceRegistry * @throws ClassCastException if <code>provider</code> does not * implement <code>category</code>. */ - public synchronized boolean registerServiceProvider(Object provider, - Class category) + public synchronized <T> boolean registerServiceProvider(T provider, + Class<T> category) { for (int i = 0; i < categories.length; i++) if (categories[i] == category) @@ -383,7 +383,7 @@ public class ServiceRegistry * #ServiceRegistry(Iterator) constructor} of this * <code>ServiceRegistry</code>. */ - public synchronized void registerServiceProviders(Iterator providers) + public synchronized void registerServiceProviders(Iterator<?> providers) { if (providers == null) throw new IllegalArgumentException(); @@ -467,8 +467,8 @@ public class ServiceRegistry * @throws ClassCastException if <code>provider</code> does not * implement <code>category</code>. */ - public synchronized boolean deregisterServiceProvider(Object provider, - Class category) + public synchronized <T> boolean deregisterServiceProvider(T provider, + Class<T> category) { for (int i = 0; i < categories.length; i++) if (categories[i] == category) @@ -535,7 +535,7 @@ public class ServiceRegistry * #ServiceRegistry(Iterator) constructor} of this * <code>ServiceRegistry</code>. */ - public synchronized void deregisterAll(Class category) + public synchronized void deregisterAll(Class<?> category) { boolean ok = false; @@ -663,7 +663,8 @@ public class ServiceRegistry * * @see #getServiceProviders(Class, Filter, boolean) */ - public Iterator getServiceProviders(Class category, boolean useOrdering) + public <T> Iterator<T> getServiceProviders(Class<T> category, + boolean useOrdering) { return getServiceProviders(category, null, useOrdering); } @@ -691,9 +692,9 @@ public class ServiceRegistry * #ServiceRegistry(Iterator) constructor} of this * <code>ServiceRegistry</code>. */ - public synchronized Iterator getServiceProviders(Class category, - Filter filter, - boolean useOrdering) + public synchronized <T> Iterator<T> getServiceProviders(Class<T> category, + Filter filter, + boolean useOrdering) { int catid; LinkedList provs; @@ -751,7 +752,7 @@ public class ServiceRegistry * * @param providerClass a class to search for. */ - public synchronized Object getServiceProviderByClass(Class providerClass) + public synchronized <T> T getServiceProviderByClass(Class<T> providerClass) { if (providerClass == null) throw new IllegalArgumentException(); @@ -772,7 +773,7 @@ public class ServiceRegistry { Object provider = iter.next(); if (providerClass.isInstance(provider)) - return provider; + return (T) provider; } } @@ -799,9 +800,9 @@ public class ServiceRegistry * @see #unsetOrdering * @see #getServiceProviders(Class, Filter, boolean) */ - public synchronized boolean setOrdering(Class category, - Object firstProvider, - Object secondProvider) + public synchronized <T> boolean setOrdering(Class<T> category, + T firstProvider, + T secondProvider) { return addConstraint(getCategoryID(category), firstProvider, secondProvider); @@ -826,9 +827,9 @@ public class ServiceRegistry * * @see #setOrdering */ - public synchronized boolean unsetOrdering(Class category, - Object firstProvider, - Object secondProvider) + public synchronized <T> boolean unsetOrdering(Class<T> category, + T firstProvider, + T secondProvider) { return removeConstraint(getCategoryID(category), firstProvider, secondProvider); diff --git a/javax/naming/CannotProceedException.java b/javax/naming/CannotProceedException.java index 27868e21e..bc2085879 100644 --- a/javax/naming/CannotProceedException.java +++ b/javax/naming/CannotProceedException.java @@ -51,7 +51,7 @@ public class CannotProceedException extends NamingException // Serialized fields. protected Name remainingNewName; - protected Hashtable environment; + protected Hashtable<?, ?> environment; protected Name altName; protected Context altNameCtx; @@ -65,12 +65,12 @@ public class CannotProceedException extends NamingException super (msg); } - public Hashtable getEnvironment() + public Hashtable<?, ?> getEnvironment() { return environment; } - public void setEnvironment(Hashtable environment) + public void setEnvironment(Hashtable<?, ?> environment) { this.environment = environment; } diff --git a/javax/naming/CompositeName.java b/javax/naming/CompositeName.java index 322f63279..612932152 100644 --- a/javax/naming/CompositeName.java +++ b/javax/naming/CompositeName.java @@ -65,7 +65,7 @@ public class CompositeName implements Name, Cloneable, Serializable elts = new Vector (); } - protected CompositeName (Enumeration comps) + protected CompositeName (Enumeration<String> comps) { elts = new Vector (); try @@ -230,7 +230,7 @@ public class CompositeName implements Name, Cloneable, Serializable return (String) elts.get (posn); } - public Enumeration getAll () + public Enumeration<String> getAll () { return elts.elements (); } diff --git a/javax/naming/CompoundName.java b/javax/naming/CompoundName.java index 556edfc33..703d44e47 100644 --- a/javax/naming/CompoundName.java +++ b/javax/naming/CompoundName.java @@ -73,7 +73,7 @@ public class CompoundName implements Name, Cloneable, Serializable initializeSyntax (); } - protected CompoundName (Enumeration comps, Properties syntax) + protected CompoundName (Enumeration<String> comps, Properties syntax) { elts = new Vector (); mySyntax = syntax; @@ -289,7 +289,7 @@ public class CompoundName implements Name, Cloneable, Serializable return (String) elts.get (posn); } - public Enumeration getAll () + public Enumeration<String> getAll () { return elts.elements (); } diff --git a/javax/naming/Context.java b/javax/naming/Context.java index 46b540304..4b87b9e01 100644 --- a/javax/naming/Context.java +++ b/javax/naming/Context.java @@ -270,7 +270,7 @@ public interface Context * @return the enumeration over the names, known for the given subcontext. * @throws NamingException */ - NamingEnumeration list(Name name) throws NamingException; + NamingEnumeration<NameClassPair> list(Name name) throws NamingException; /** * Creates and returns the enumeration over the name bindings that are present @@ -284,7 +284,7 @@ public interface Context * @return the enumeration over the names, known for the given subcontext. * @throws NamingException */ - NamingEnumeration list(String name) throws NamingException; + NamingEnumeration<NameClassPair> list(String name) throws NamingException; /** * Creates and returns the enumeration over the name - object bindings that @@ -297,7 +297,7 @@ public interface Context * @return the enumeration over the names, known for the given subcontext. * @throws NamingException */ - NamingEnumeration listBindings(Name name) throws NamingException; + NamingEnumeration<Binding> listBindings(Name name) throws NamingException; /** * Creates and returns the enumeration over the name - object bindings that @@ -310,7 +310,7 @@ public interface Context * @return the enumeration over the names, known for the given subcontext. * @throws NamingException */ - NamingEnumeration listBindings(String name) throws NamingException; + NamingEnumeration<Binding> listBindings(String name) throws NamingException; /** * Creates the new naming subcontext and binds it to the current (this) @@ -467,7 +467,7 @@ public interface Context * @return the table, representing the environment of this context * @throws NamingException */ - Hashtable getEnvironment() throws NamingException; + Hashtable<?,?> getEnvironment() throws NamingException; /** * Releases all resources, associated with this context. The close() method diff --git a/javax/naming/InitialContext.java b/javax/naming/InitialContext.java index d4a9587f2..1a3b1e38b 100644 --- a/javax/naming/InitialContext.java +++ b/javax/naming/InitialContext.java @@ -73,7 +73,7 @@ public class InitialContext implements Context /** * The environment, associated with this initial context. */ - protected Hashtable myProps; + protected Hashtable<Object,Object> myProps; /** * The list of the properties, to that the second alternative value must @@ -111,7 +111,7 @@ public class InitialContext implements Context * created. * @throws NamingException */ - public InitialContext(Hashtable environment) throws NamingException + public InitialContext(Hashtable<?,?> environment) throws NamingException { init(environment); } @@ -166,13 +166,13 @@ public class InitialContext implements Context * not later reuse this structure for other purposes. * @since 1.3 */ - protected void init(Hashtable environment) throws NamingException + protected void init(Hashtable<?, ?> environment) throws NamingException { // If is documented that the caller should not modify the environment. if (environment != null) - myProps = environment; + myProps = (Hashtable<Object, Object>) environment; else - myProps = new Hashtable(); + myProps = new Hashtable<Object, Object>(); Applet napplet = (Applet) myProps.get(Context.APPLET); @@ -424,25 +424,25 @@ public class InitialContext implements Context } /** @inheritDoc */ - public NamingEnumeration list (Name name) throws NamingException + public NamingEnumeration<NameClassPair> list (Name name) throws NamingException { return getURLOrDefaultInitCtx (name).list (name); } /** @inheritDoc */ - public NamingEnumeration list (String name) throws NamingException + public NamingEnumeration<NameClassPair> list (String name) throws NamingException { return getURLOrDefaultInitCtx (name).list (name); } /** @inheritDoc */ - public NamingEnumeration listBindings (Name name) throws NamingException + public NamingEnumeration<Binding> listBindings (Name name) throws NamingException { return getURLOrDefaultInitCtx (name).listBindings (name); } /** @inheritDoc */ - public NamingEnumeration listBindings (String name) throws NamingException + public NamingEnumeration<Binding> listBindings (String name) throws NamingException { return getURLOrDefaultInitCtx (name).listBindings (name); } @@ -522,7 +522,7 @@ public class InitialContext implements Context } /** @inheritDoc */ - public Hashtable getEnvironment () throws NamingException + public Hashtable<?,?> getEnvironment () throws NamingException { return myProps; } diff --git a/javax/naming/Name.java b/javax/naming/Name.java index 24a425403..687ebd6fb 100644 --- a/javax/naming/Name.java +++ b/javax/naming/Name.java @@ -60,7 +60,7 @@ import java.util.Enumeration; * @author Anthony Green (green@redhat.com) * @author Mark Wielaard (mark@klomp.org) */ -public interface Name extends Cloneable, Serializable, Comparable +public interface Name extends Cloneable, Serializable, Comparable<Object> { // This class is implemented as gnu.javax.naming.ictxImpl.trans.GnuName @@ -82,7 +82,7 @@ public interface Name extends Cloneable, Serializable, Comparable * Returns a non-null (but possibly empty) <code>Enumeration</code> of the * components of the <code>Name</code> as <code>String</code>s. */ - Enumeration getAll(); + Enumeration<String> getAll(); /** * Gets the component at the given index. diff --git a/javax/naming/NamingEnumeration.java b/javax/naming/NamingEnumeration.java index 86b1dfb41..a7c57706f 100644 --- a/javax/naming/NamingEnumeration.java +++ b/javax/naming/NamingEnumeration.java @@ -52,7 +52,7 @@ import java.util.Enumeration; * exception has been thrown, not other method should be called of that * enumeration.</p> */ -public interface NamingEnumeration extends Enumeration +public interface NamingEnumeration<T> extends Enumeration<T> { /** * Returns the next element in this enumeration. The naming - specific @@ -62,7 +62,7 @@ public interface NamingEnumeration extends Enumeration * @return the next element of this enumeration * @throws NamingException */ - Object next() throws NamingException; + T next() throws NamingException; /** * Checks if there are more unvisited elements in the enumeration, throwing diff --git a/javax/naming/Reference.java b/javax/naming/Reference.java index 0fdecc19e..3379bd5a8 100644 --- a/javax/naming/Reference.java +++ b/javax/naming/Reference.java @@ -58,7 +58,7 @@ public class Reference implements Cloneable, Serializable * The list of addresses, stored in this reference. The object may be * have by several different addresses. */ - protected Vector addrs; + protected Vector<RefAddr> addrs; /** * The name of the class factory to create an instance of the object, @@ -218,7 +218,7 @@ public class Reference implements Cloneable, Serializable /** * Get the enumeration over all defined addresses of the object. */ - public Enumeration getAll () + public Enumeration<RefAddr> getAll () { return addrs.elements (); } diff --git a/javax/naming/ReferralException.java b/javax/naming/ReferralException.java index ec2178e77..c264d637f 100644 --- a/javax/naming/ReferralException.java +++ b/javax/naming/ReferralException.java @@ -61,7 +61,7 @@ public abstract class ReferralException extends NamingException public abstract Object getReferralInfo(); public abstract Context getReferralContext() throws NamingException; - public abstract Context getReferralContext(Hashtable env) + public abstract Context getReferralContext(Hashtable<?, ?> env) throws NamingException; public abstract boolean skipReferral(); public abstract void retryReferral(); diff --git a/javax/naming/directory/Attribute.java b/javax/naming/directory/Attribute.java index 59bf66dab..d29e1eae0 100644 --- a/javax/naming/directory/Attribute.java +++ b/javax/naming/directory/Attribute.java @@ -51,7 +51,7 @@ public interface Attribute extends Cloneable, Serializable { long serialVersionUID = 8707690322213556804L; - NamingEnumeration getAll() throws NamingException; + NamingEnumeration<?> getAll() throws NamingException; Object get() throws NamingException; int size(); String getID(); diff --git a/javax/naming/directory/Attributes.java b/javax/naming/directory/Attributes.java index 3d5ef9f4f..2dc2c6101 100644 --- a/javax/naming/directory/Attributes.java +++ b/javax/naming/directory/Attributes.java @@ -52,8 +52,8 @@ public interface Attributes extends Cloneable, Serializable boolean isCaseIgnored(); int size(); Attribute get(String attrID); - NamingEnumeration getAll(); - NamingEnumeration getIDs(); + NamingEnumeration<? extends Attribute> getAll(); + NamingEnumeration<String> getIDs(); Attribute put(String attrID, Object val); Attribute put(Attribute attr); Attribute remove(String attrID); diff --git a/javax/naming/directory/BasicAttribute.java b/javax/naming/directory/BasicAttribute.java index c6419794f..5a1bb0e88 100644 --- a/javax/naming/directory/BasicAttribute.java +++ b/javax/naming/directory/BasicAttribute.java @@ -62,7 +62,7 @@ public class BasicAttribute implements Attribute /** True if this attribute's values are ordered. */ protected boolean ordered; /** Values for this attribute. */ - protected transient Vector values; + protected transient Vector<Object> values; // Used by cloning. private BasicAttribute () @@ -182,7 +182,7 @@ public class BasicAttribute implements Attribute return values.get (index); } - public NamingEnumeration getAll () + public NamingEnumeration<?> getAll () throws NamingException { return new BasicAttributeEnumeration (); diff --git a/javax/naming/directory/BasicAttributes.java b/javax/naming/directory/BasicAttributes.java index 9318fbb2b..6880f5b33 100644 --- a/javax/naming/directory/BasicAttributes.java +++ b/javax/naming/directory/BasicAttributes.java @@ -126,12 +126,12 @@ public class BasicAttributes implements Attributes return null; } - public NamingEnumeration getAll () + public NamingEnumeration<Attribute> getAll () { return new BasicAttributesEnumeration (false); } - public NamingEnumeration getIDs () + public NamingEnumeration<String> getIDs () { return new BasicAttributesEnumeration (true); } diff --git a/javax/naming/directory/DirContext.java b/javax/naming/directory/DirContext.java index 002cb78a9..d7d94a345 100644 --- a/javax/naming/directory/DirContext.java +++ b/javax/naming/directory/DirContext.java @@ -72,12 +72,32 @@ public interface DirContext extends Context DirContext getSchema(String name) throws NamingException; DirContext getSchemaClassDefinition(Name name) throws NamingException; DirContext getSchemaClassDefinition(String name) throws NamingException; - NamingEnumeration search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException; - NamingEnumeration search(String name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException; - NamingEnumeration search(Name name, Attributes matchingAttributes) throws NamingException; - NamingEnumeration search(String name, Attributes matchingAttributes) throws NamingException; - NamingEnumeration search(Name name, String filter, SearchControls cons) throws NamingException; - NamingEnumeration search(String name, String filter, SearchControls cons) throws NamingException; - NamingEnumeration search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException; - NamingEnumeration search(String name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException; + NamingEnumeration<SearchResult> search(Name name, + Attributes matchingAttributes, + String[] attributesToReturn) + throws NamingException; + NamingEnumeration<SearchResult> search(String name, + Attributes matchingAttributes, + String[] attributesToReturn) + throws NamingException; + NamingEnumeration<SearchResult> search(Name name, + Attributes matchingAttributes) + throws NamingException; + NamingEnumeration<SearchResult> search(String name, + Attributes matchingAttributes) + throws NamingException; + NamingEnumeration<SearchResult> search(Name name, String filter, + SearchControls cons) + throws NamingException; + NamingEnumeration<SearchResult> search(String name, String filter, + SearchControls cons) + throws NamingException; + NamingEnumeration<SearchResult> search(Name name, String filterExpr, + Object[] filterArgs, + SearchControls cons) + throws NamingException; + NamingEnumeration<SearchResult> search(String name, String filterExpr, + Object[] filterArgs, + SearchControls cons) + throws NamingException; } diff --git a/javax/naming/directory/InitialDirContext.java b/javax/naming/directory/InitialDirContext.java index c946f416b..8c7852fbb 100644 --- a/javax/naming/directory/InitialDirContext.java +++ b/javax/naming/directory/InitialDirContext.java @@ -66,7 +66,7 @@ public class InitialDirContext extends InitialContext implements DirContext super (lazy); } - public InitialDirContext (Hashtable environment) + public InitialDirContext (Hashtable<?, ?> environment) throws NamingException { super (environment); @@ -205,58 +205,65 @@ public class InitialDirContext extends InitialContext implements DirContext return getURLOrDefaultInitDirCtx (name).getSchemaClassDefinition (name); } - public NamingEnumeration search(Name name, Attributes matchingAttributes, - String[] attributesToReturn) + public NamingEnumeration<SearchResult> search(Name name, + Attributes matchingAttributes, + String[] attributesToReturn) throws NamingException { return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes, attributesToReturn); } - public NamingEnumeration search(String name, Attributes matchingAttributes, - String[] attributesToReturn) + public NamingEnumeration<SearchResult> search(String name, + Attributes matchingAttributes, + String[] attributesToReturn) throws NamingException { return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes, attributesToReturn); } - public NamingEnumeration search(Name name, Attributes matchingAttributes) + public NamingEnumeration<SearchResult> search(Name name, + Attributes matchingAttributes) throws NamingException { return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes); } - public NamingEnumeration search(String name, Attributes matchingAttributes) + public NamingEnumeration<SearchResult> search(String name, + Attributes matchingAttributes) throws NamingException { return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes); } - public NamingEnumeration search(Name name, String filter, - SearchControls cons) + public NamingEnumeration<SearchResult> search(Name name, String filter, + SearchControls cons) throws NamingException { return getURLOrDefaultInitDirCtx (name).search (name, filter, cons); } - public NamingEnumeration search(String name, String filter, - SearchControls cons) + public NamingEnumeration<SearchResult> search(String name, String filter, + SearchControls cons) throws NamingException { return getURLOrDefaultInitDirCtx (name).search (name, filter, cons); } - public NamingEnumeration search(Name name, String filterExpr, - Object[] filterArgs, SearchControls cons) + public NamingEnumeration<SearchResult> search(Name name, String filterExpr, + Object[] filterArgs, + SearchControls cons) throws NamingException { return getURLOrDefaultInitDirCtx (name).search (name, filterExpr, filterArgs, cons); } - public NamingEnumeration search(String name, String filterExpr, - Object[] filterArgs, SearchControls cons) + public NamingEnumeration<SearchResult> search(String name, + String filterExpr, + Object[] filterArgs, + SearchControls cons) throws NamingException { return getURLOrDefaultInitDirCtx (name).search (name, filterExpr, diff --git a/javax/naming/ldap/ControlFactory.java b/javax/naming/ldap/ControlFactory.java index f72e67a75..b8151640f 100644 --- a/javax/naming/ldap/ControlFactory.java +++ b/javax/naming/ldap/ControlFactory.java @@ -59,7 +59,7 @@ public abstract class ControlFactory public static Control getControlInstance (Control control, Context ctx, - Hashtable env) + Hashtable<?, ?> env) throws NamingException { String path = (String) env.get (LdapContext.CONTROL_FACTORIES); diff --git a/javax/naming/ldap/InitialLdapContext.java b/javax/naming/ldap/InitialLdapContext.java index 45a9eae1a..f9493c3b2 100644 --- a/javax/naming/ldap/InitialLdapContext.java +++ b/javax/naming/ldap/InitialLdapContext.java @@ -60,22 +60,24 @@ public class InitialLdapContext this (null, null); } - public InitialLdapContext (Hashtable environment, Control[] connControls) + public InitialLdapContext (Hashtable<?, ?> environment, + Control[] connControls) throws NamingException { super (false); + Hashtable myenv = null; if (connControls != null) { if (environment == null) - environment = new Hashtable (); + myenv = new Hashtable (); else - environment = (Hashtable) environment.clone (); - environment.put ("java.naming.ldap.control.connect", + myenv = (Hashtable) environment.clone (); + myenv.put ("java.naming.ldap.control.connect", connControls); } - init (environment); + init (myenv); } private LdapContext getDefaultInitLdapCtx () diff --git a/javax/naming/ldap/LdapReferralException.java b/javax/naming/ldap/LdapReferralException.java index 61a2b8e44..87942b9fc 100644 --- a/javax/naming/ldap/LdapReferralException.java +++ b/javax/naming/ldap/LdapReferralException.java @@ -61,8 +61,9 @@ public abstract class LdapReferralException extends ReferralException } public abstract Context getReferralContext() throws NamingException; - public abstract Context getReferralContext(Hashtable env) + public abstract Context getReferralContext(Hashtable<?, ?> env) throws NamingException; - public abstract Context getReferralContext(Hashtable env, Control[] reqCtls) + public abstract Context getReferralContext(Hashtable<?, ?> env, + Control[] reqCtls) throws NamingException; } diff --git a/javax/naming/spi/DirObjectFactory.java b/javax/naming/spi/DirObjectFactory.java index ea0e69706..1a71c28f7 100644 --- a/javax/naming/spi/DirObjectFactory.java +++ b/javax/naming/spi/DirObjectFactory.java @@ -51,6 +51,6 @@ import javax.naming.directory.Attributes; public interface DirObjectFactory extends ObjectFactory { Object getObjectInstance(Object obj, Name name, Context nameCtx, - Hashtable environment, Attributes attrs) + Hashtable<?, ?> environment, Attributes attrs) throws Exception; } diff --git a/javax/naming/spi/DirStateFactory.java b/javax/naming/spi/DirStateFactory.java index b5add91cb..6ddd12f36 100644 --- a/javax/naming/spi/DirStateFactory.java +++ b/javax/naming/spi/DirStateFactory.java @@ -77,7 +77,7 @@ public interface DirStateFactory extends StateFactory DirStateFactory.Result getStateToBind(Object obj, Name name, Context nameCtx, - Hashtable environment, + Hashtable<?, ?> environment, Attributes inAttrs) throws NamingException; } diff --git a/javax/naming/spi/DirectoryManager.java b/javax/naming/spi/DirectoryManager.java index fd482efb5..a6d91b20c 100644 --- a/javax/naming/spi/DirectoryManager.java +++ b/javax/naming/spi/DirectoryManager.java @@ -93,7 +93,7 @@ public class DirectoryManager extends NamingManager public static Object getObjectInstance (Object refInfo, Name name, Context nameCtx, - Hashtable environment, + Hashtable<?, ?> environment, Attributes attrs) throws Exception { @@ -186,7 +186,7 @@ public class DirectoryManager extends NamingManager public static DirStateFactory.Result getStateToBind (Object obj, Name name, Context nameCtx, - Hashtable environment, + Hashtable<?, ?> environment, Attributes attrs) throws NamingException { diff --git a/javax/naming/spi/InitialContextFactory.java b/javax/naming/spi/InitialContextFactory.java index d9b3336dc..f715327ef 100644 --- a/javax/naming/spi/InitialContextFactory.java +++ b/javax/naming/spi/InitialContextFactory.java @@ -66,5 +66,6 @@ public interface InitialContextFactory * @return the new initial context * @throws NamingException if the naming exception has occured */ - Context getInitialContext(Hashtable environment) throws NamingException; + Context getInitialContext (Hashtable<?, ?> environment) + throws NamingException; } diff --git a/javax/naming/spi/InitialContextFactoryBuilder.java b/javax/naming/spi/InitialContextFactoryBuilder.java index 4696cecb8..31bafe6dc 100644 --- a/javax/naming/spi/InitialContextFactoryBuilder.java +++ b/javax/naming/spi/InitialContextFactoryBuilder.java @@ -53,14 +53,14 @@ import javax.naming.NamingException; public interface InitialContextFactoryBuilder { /** - * Create the new inital context factory + * Create the new initial context factory * - * @param environment the properties, used for creation of the initial context - * factory. The parameter is owned by the caller: it is safe to reuse - * the table for other purposes after the method returns. + * @param environment the properties, used for creation of the initial + * context factory. The parameter is owned by the caller: it is safe to reuse + * the table for other purposes after the method returns. * @return the created initial context factory, never null. * @throws NamingException on failure */ - InitialContextFactory createInitialContextFactory (Hashtable environment) + InitialContextFactory createInitialContextFactory (Hashtable<?, ?> environment) throws NamingException; } diff --git a/javax/naming/spi/NamingManager.java b/javax/naming/spi/NamingManager.java index 67c8e3510..3dfba0f66 100644 --- a/javax/naming/spi/NamingManager.java +++ b/javax/naming/spi/NamingManager.java @@ -79,7 +79,7 @@ public class NamingManager NamingManager () { } - + /** * Checks if the initial context factory builder has been set. * @@ -110,7 +110,7 @@ public class NamingManager * class, named by this property, cannot be instantiated. * @throws NamingException if throws by the context factory */ - public static Context getInitialContext (Hashtable environment) + public static Context getInitialContext (Hashtable<?, ?> environment) throws NamingException { InitialContextFactory icf = null; @@ -151,7 +151,7 @@ public class NamingManager return icf.getInitialContext (environment); } - + /** * <p> * Creates the URL context for the given URL scheme id. @@ -187,7 +187,7 @@ public class NamingManager * @throws NamingException if thrown by the factory when creating the context. */ static Context getURLContext(Object refInfo, Name name, Context nameCtx, - String scheme, Hashtable environment) + String scheme, Hashtable<?,?> environment) throws NamingException { // Doc specifies com.sun.jndi.url as the final destination, but we cannot @@ -196,17 +196,17 @@ public class NamingManager // The final default location, as specified in the documentation. String finalPrefix = "com.sun.jndi.url"; - + StringBuffer allPrefixes = new StringBuffer(); String prefixes; - if (environment != null) - { + if (environment != null) + { prefixes = (String) environment.get(Context.URL_PKG_PREFIXES); if (prefixes != null) allPrefixes.append(prefixes); - } - + } + prefixes = System.getProperty(Context.URL_PKG_PREFIXES); if (prefixes != null) { @@ -221,11 +221,11 @@ public class NamingManager allPrefixes.append(':'); allPrefixes.append(finalPrefix); - scheme = scheme + "." + scheme + "URLContextFactory"; - + scheme = scheme + "." + scheme + "URLContextFactory"; + StringTokenizer tokens = new StringTokenizer(allPrefixes.toString(), ":"); while (tokens.hasMoreTokens()) - { + { String aTry = tokens.nextToken(); try { @@ -277,11 +277,11 @@ public class NamingManager { // Anything from getObjectInstance. } - } - + } + return null; } - + /** * Load the class with the given name. This method tries to use the context * class loader first. If this fails, it searches for the suitable class @@ -329,15 +329,15 @@ public class NamingManager * </p> * <p> * The class name of the factory that creates the context has the naming - * pattern scheme-idURLContextFactory. For instance, the factory for the "ftp" - * sheme should be named "ftpURLContextFactory". The Context.URL_PKG_PREFIXES - * environment property contains the colon-separated list of the possible - * package prefixes. The package name is constructed concatenating the package - * prefix with the scheme id. + * pattern scheme-idURLContextFactory. For instance, the factory for the + * "ftp" scheme should be named "ftpURLContextFactory". + * The Context.URL_PKG_PREFIXES environment property contains the + * colon-separated list of the possible package prefixes. The package name + * is constructed by concatenating the package prefix with the scheme id. * </p> * <p> - * If the factory class cannot be found in the specified packages, system will - * try to use the default internal factory for the given scheme. + * If the factory class cannot be found in the specified packages, the + * system will try to use the default internal factory for the given scheme. * </p> * <p> * After the factory is instantiated, its method @@ -345,13 +345,14 @@ public class NamingManager * is called to create and return the object instance. * * @param scheme the url scheme that must be supported by the given context - * @param environment the properties for creating the factory and context (may - * be null) + * @param environment the properties for creating the factory and context + * (may be null) * @return the created context - * @throws NamingException if thrown by the factory when creating the context. + * @throws NamingException if thrown by the factory when creating the + * context. */ public static Context getURLContext (String scheme, - Hashtable environment) + Hashtable<?, ?> environment) throws NamingException { return getURLContext (null, null, null, scheme, environment); @@ -450,7 +451,7 @@ public class NamingManager public static Object getObjectInstance (Object refInfo, Name name, Context nameCtx, - Hashtable environment) + Hashtable<?, ?> environment) throws Exception { ObjectFactory factory = null; @@ -623,7 +624,7 @@ public class NamingManager * @throws NamingException */ public static Object getStateToBind (Object obj, Name name, - Context nameCtx, Hashtable environment) + Context nameCtx, Hashtable<?, ?> environment) throws NamingException { StringTokenizer tokens = getPlusPath (Context.STATE_FACTORIES, diff --git a/javax/naming/spi/ObjectFactory.java b/javax/naming/spi/ObjectFactory.java index 27771b6cb..4534481a7 100644 --- a/javax/naming/spi/ObjectFactory.java +++ b/javax/naming/spi/ObjectFactory.java @@ -70,6 +70,7 @@ public interface ObjectFactory * * @see NamingManager#getObjectInstance(Object, Name, Context, Hashtable) */ - Object getObjectInstance(Object refObj, Name name, Context nameCtx, - Hashtable environment) throws Exception; + Object getObjectInstance (Object refObj, Name name, Context nameCtx, + Hashtable<?, ?> environment) + throws Exception; } diff --git a/javax/naming/spi/ObjectFactoryBuilder.java b/javax/naming/spi/ObjectFactoryBuilder.java index cb20c666e..6a528b17a 100644 --- a/javax/naming/spi/ObjectFactoryBuilder.java +++ b/javax/naming/spi/ObjectFactoryBuilder.java @@ -52,7 +52,7 @@ import javax.naming.Referenceable; * @author Warren Levy (warrenl@redhat.com) */ public interface ObjectFactoryBuilder -{ +{ /** * Create a new object using the supplied environment. * @@ -65,6 +65,6 @@ public interface ObjectFactoryBuilder * @throws NamingException */ ObjectFactory createObjectFactory(Object refInfo, - Hashtable environment) + Hashtable<?, ?> environment) throws NamingException; } diff --git a/javax/naming/spi/Resolver.java b/javax/naming/spi/Resolver.java index eb3eeb560..f01790502 100644 --- a/javax/naming/spi/Resolver.java +++ b/javax/naming/spi/Resolver.java @@ -44,41 +44,20 @@ import javax.naming.NamingException; import javax.naming.NotContextException; /** - * <p>Represents the object, capable for the at least partial name resolution. - * The object is not necessay capable for the complete name resolution and - * need not implement the {@link Context}.</p> - * <p> - * Both passed parameters and returned results are owned by the caller.</p> - * ++ * <p>Represents the object, capable for the at least partial name resolution. ++ * The object is not necessay capable for the complete name resolution and ++ * need not implement the {@link Context}.</p> ++ * <p> ++ * Both passed parameters and returned results are owned by the caller.</p> ++ * * @author Warren Levy (warrenl@redhat.com) */ public interface Resolver { - /** - * Partially resolve the name, stopping at the first instance of the context - * that is an instance of the contextType - * - * @param name the name to resolve - * @param contextType the class of the context, on that the resolution should - * be terminated - * @return the complete or partial name resolution - * @throws NotContextException if the context of the contextType is not found - * @throws NamingException on other failure - */ - ResolveResult resolveToClass(Name name, Class contextType) + ResolveResult resolveToClass(Name name, + Class<? extends Context> contextType) throws NamingException; - - /** - * Partially resolve the name, stopping at the first instance of the context - * that is an instance of the contextType - * - * @param name the name to resolve - * @param contextType the class of the context, on that the resolution should - * be terminated - * @return the complete or partial name resolution - * @throws NotContextException if the context of the contextType is not found - * @throws NamingException on other failure - */ - ResolveResult resolveToClass(String name, Class contextType) + ResolveResult resolveToClass(String name, + Class<? extends Context> contextType) throws NamingException; } diff --git a/javax/naming/spi/StateFactory.java b/javax/naming/spi/StateFactory.java index 5694f8a1a..0c48309e3 100644 --- a/javax/naming/spi/StateFactory.java +++ b/javax/naming/spi/StateFactory.java @@ -75,5 +75,5 @@ public interface StateFactory * @see DirectoryManager#getStateToBind */ Object getStateToBind(Object obj, Name name, Context nameCtx, - Hashtable environment) throws NamingException; + Hashtable<?, ?> environment) throws NamingException; } diff --git a/javax/net/ssl/CertPathTrustManagerParameters.java b/javax/net/ssl/CertPathTrustManagerParameters.java new file mode 100644 index 000000000..b6dc135e1 --- /dev/null +++ b/javax/net/ssl/CertPathTrustManagerParameters.java @@ -0,0 +1,71 @@ +/* CertPathTrustManagerParameters.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is a part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +USA + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.net.ssl; + +import java.security.cert.CertPathParameters; + +/** + * Trust manager parameters for certification paths. + */ +public class CertPathTrustManagerParameters implements ManagerFactoryParameters +{ + private final CertPathParameters params; + + /** + * Creates a new trust manager parameter instance. The argument is + * cloned to prevent modification of this instance. + * + * @param params The certificate path parameters. + * @throws NullPointerException If params is null. + */ + public CertPathTrustManagerParameters (final CertPathParameters params) + { + this.params = (CertPathParameters) params.clone (); + } + + /** + * Returns a copy of the certificate path parameters. + * + * @return A copy of the certificate path parameters. + */ + public CertPathParameters getParameters () + { + return (CertPathParameters) params.clone (); + } +} diff --git a/javax/net/ssl/HandshakeCompletedEvent.java b/javax/net/ssl/HandshakeCompletedEvent.java index 743f13726..b65dff06c 100644 --- a/javax/net/ssl/HandshakeCompletedEvent.java +++ b/javax/net/ssl/HandshakeCompletedEvent.java @@ -38,6 +38,7 @@ exception statement from your version. */ package javax.net.ssl; +import java.security.Principal; import java.security.cert.Certificate; import javax.security.cert.X509Certificate; @@ -108,6 +109,20 @@ public class HandshakeCompletedEvent extends java.util.EventObject } /** + * Returns the local identity used in this connection, or + * <code>null</code> if there is none. + * + * @return The local identity. + * @since 1.5 + */ + public Principal getLocalPrincipal () + { + if (session != null) + return session.getLocalPrincipal (); + return null; + } + + /** * Returns the peer's certificates being used in this connection. * * @return The peer's certificates. @@ -129,6 +144,22 @@ public class HandshakeCompletedEvent extends java.util.EventObject } /** + * Returns the peer's identity, or <code>null</code> if there is + * none. + * + * @return The peer's identity. + * @throws SSLPeerUnverifiedException If the remote peer's identity + * could not be verified. + * @since 1.5 + */ + public Principal getPeerPrincipal () throws SSLPeerUnverifiedException + { + if (session != null) + return session.getPeerPrincipal (); + return null; + } + + /** * Returns the SSL session object associated with this connection. * * @return The session object. diff --git a/javax/net/ssl/HttpsURLConnection.java b/javax/net/ssl/HttpsURLConnection.java index 3f30dc1b8..7d68162c9 100644 --- a/javax/net/ssl/HttpsURLConnection.java +++ b/javax/net/ssl/HttpsURLConnection.java @@ -38,9 +38,12 @@ exception statement from your version. */ package javax.net.ssl; +import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; +import java.security.Principal; import java.security.cert.Certificate; +import java.security.cert.X509Certificate; /** * A URL connection that connects via the <i>Secure Socket Layer</i> @@ -245,6 +248,48 @@ public abstract class HttpsURLConnection extends HttpURLConnection this.factory = factory; } + /** + * Returns the local principal for this connection. + * + * <p>The default implementation will return the {@link + * javax.security.x500.X500Principal} for the end entity certificate + * in the local certificate chain if those certificates are of type + * {@link java.security.cert.X509Certificate}. Otherwise, this + * method returns <code>null</code>. + * + * @return The local principal. + * @since 1.5 + */ + public Principal getLocalPrincipal () + { + Certificate[] c = getLocalCertificates (); + if (c != null && c.length > 0 && (c[0] instanceof X509Certificate)) + return ((X509Certificate) c[0]).getSubjectX500Principal (); + return null; + } + + /** + * Returns the remote peer's principal for this connection. + * + * <p>The default implementation will return the {@link + * javax.security.x500.X500Principal} for the end entity certificate + * in the remote peer's certificate chain if those certificates are + * of type {@link java.security.cert.X509Certificate}. Otherwise, + * this method returns <code>null</code>. + * + * @return The remote principal. + * @throws SSLPeerUnverifiedException If the remote peer has not + * been verified. + * @since 1.5 + */ + public Principal getPeerPrincipal () throws SSLPeerUnverifiedException + { + Certificate[] c = getServerCertificates (); + if (c != null && c.length > 0 && (c[0] instanceof X509Certificate)) + return ((X509Certificate) c[0]).getSubjectX500Principal (); + return null; + } + // Abstract methods. // ------------------------------------------------------------------- diff --git a/javax/net/ssl/KeyStoreBuilderParameters.java b/javax/net/ssl/KeyStoreBuilderParameters.java new file mode 100644 index 000000000..2aa665ed5 --- /dev/null +++ b/javax/net/ssl/KeyStoreBuilderParameters.java @@ -0,0 +1,48 @@ +/* KeyStoreBuilderParameters.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is a part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +USA + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.net.ssl; + +/** + * <p style="color: red;"><b>FIXME</b> this class is currently a stub; + * it depends on an implementation of {@link + * java.security.KeyStore.Builder}</p>. + */ +public class KeyStoreBuilderParameters implements ManagerFactoryParameters +{ +} diff --git a/javax/net/ssl/SSLContext.java b/javax/net/ssl/SSLContext.java index 64bb09ade..dcc850809 100644 --- a/javax/net/ssl/SSLContext.java +++ b/javax/net/ssl/SSLContext.java @@ -189,6 +189,31 @@ public class SSLContext } /** + * Creates a new {@link SSLEngine} for this context. + * + * @return The new SSLEngine. + * @since 1.5 + */ + public final SSLEngine createSSLEngine () + { + return ctxSpi.engineCreateSSLEngine (); + } + + /** + * Creates a new {@link SSLEngine} for this context, with a given + * host name and port number. + * + * @param host The local host name. + * @param port The local port number. + * @return The new SSLEngine. + * @since 1.5 + */ + public final SSLEngine createSSLEngine (final String host, final int port) + { + return ctxSpi.engineCreateSSLEngine (host, port); + } + + /** * Returns the set of SSL contexts available for client connections. * * @return The set of SSL contexts available for client connections. diff --git a/javax/net/ssl/SSLContextSpi.java b/javax/net/ssl/SSLContextSpi.java index a6b0c7581..03c44f85e 100644 --- a/javax/net/ssl/SSLContextSpi.java +++ b/javax/net/ssl/SSLContextSpi.java @@ -64,6 +64,28 @@ public abstract class SSLContextSpi // Abstract methods. // ------------------------------------------------------------------- + // Sun, you've broken existing applications by introducing new + // abstract methods! Goodjob!!! + + /** + * Returns a new {@link SSLEngine} for this context. + * + * @return A new SSLEngine. + * @since 1.5 + */ + protected abstract SSLEngine engineCreateSSLEngine (); + + /** + * Returns a new {@link SSLEngine} for this context, for the given + * host name and port number. + * + * @param host The local host name. + * @param port The local port number. + * @return A new SSLEngine. + * @since 1.5 + */ + protected abstract SSLEngine engineCreateSSLEngine (String host, int port); + /** * Returns the set of SSL sessions available for client connections. * diff --git a/javax/net/ssl/SSLEngine.java b/javax/net/ssl/SSLEngine.java new file mode 100644 index 000000000..efab9725b --- /dev/null +++ b/javax/net/ssl/SSLEngine.java @@ -0,0 +1,442 @@ +/* SSLEngine.java -- advanced, generic utility for manipulating SSL messages. + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is a part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +USA + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.net.ssl; + +import java.nio.ByteBuffer; + +/** + * A class for low-level message wrapping and unwrapping of SSL + * messages. + * + * @author Casey Marshall (csm@gnu.org) + * @since 1.5 + */ +public abstract class SSLEngine +{ + private final String peerHost; + private final int peerPort; + + /** + * Creates a new SSLEngine with no peer host name or port number. + */ + protected SSLEngine () + { + this (null, -1); + } + + /** + * Creates a new SSLEngine with the specified peer host name and + * port number. + * + * @param peerHost The peer's host name. + * @param peerPort The peer's port number. + */ + protected SSLEngine (String peerHost, int peerPort) + { + this.peerHost = peerHost; + this.peerPort = peerPort; + } + + + + /** + * Begin, or restart, the SSL handshake. + * + * @throws SSLException + */ + public abstract void beginHandshake () throws SSLException; + + /** + * Close the inbound state. + * + * @throws SSLException + */ + public abstract void closeInbound () throws SSLException; + + /** + * Close the outbound state. + */ + public abstract void closeOutbound (); + + /** + * + */ + public abstract Runnable getDelegatedTask (); + + /** + * Returns the peer host name this SSL session is connected to, or + * <code>null</code> if this value was not set. + * + * @return The peer host's name. + */ + public String getPeerHost () + { + return peerHost; + } + + /** + * Returns the peer IP port number this SSL session in communicating + * on, or -1 if this value was not set. + * + * @return The peer's port number. + */ + public int getPeerPort () + { + return peerPort; + } + + /** + * Returns a list of SSL cipher suite names this SSLEngine is + * configured to use. + * + * @return The list of enabled cipher suite names. + */ + public abstract String[] getEnabledCipherSuites(); + + /** + * Returns a list of SSL protocol version names this SSLEngine is + * configured to use. + * + * @return The list of enabled protocol names. + */ + public abstract String[] getEnabledProtocols (); + + /** + * Tells if sessions will be created by this engine, and therefore + * may be resumed at a later time. + * + * @return True if sessions will be created. + */ + public abstract boolean getEnableSessionCreation(); + + /** + * Return the current handshake status. + * + * @return The current handshake status. + */ + public abstract SSLEngineResult.HandshakeStatus getHandshakeStatus (); + + /** + * Tells if this SSLEngine is configured to require client + * authentication when in server mode. + * + * @return True iff client authentication is required. + */ + public abstract boolean getNeedClientAuth (); + + /** + * Return the {@link SSLSession} object this connection represents. + * + * @return The SSL session. + */ + public abstract SSLSession getSession (); + + /** + * Returns a list of SSL cipher suite names this SSLEngine + * implementation supports. + * + * @return The list of cipher suite names supported by this + * implementation. + */ + public abstract String[] getSupportedCipherSuites (); + + /** + * Returns a list of SSL protocol version names this SSLEngine + * implementation supports. SSL protocol names include things like + * "SSLv3" or "TLSv1". + * + * @return The list of SSL protocol names + */ + public abstract String[] getSupportedProtocols (); + + /** + * Tells if this SSLEngine is a "client" session. + * + * @return True iff this session is configured for client mode. + */ + public abstract boolean getUseClientMode (); + + /** + * Tells if client authentication is requested, but not required, + * for sessions in server mode. If true, a server session will + * request an authentication message from connecting clients, but + * will still allow clients to connect if they cannot be + * authenticated. + * + * @return True iff client authentication is requested. + */ + public abstract boolean getWantClientAuth (); + + /** + * Tells if the incoming data stream is finished, and thus if no + * more data will be available to be unwrapped. + * + * @return True if no more data is to be unwrapped. + */ + public abstract boolean isInboundDone (); + + /** + * Tells if the outgoing data stream is finished, and thus if no + * more data may be wrapped. + * + * @return True if no more data may be wrapped. + */ + public abstract boolean isOutboundDone (); + + /** + * Sets the list of enabled cipher suites. The argument is an array + * of strings of the canonical suite names. + * + * @param suites The cipher suites to enable. + * @throws IllegalArgumentException If any of the specified suite + * strings is not supported by this implementation, or if the + * argument is null. + */ + public abstract void setEnabledCipherSuites (String[] suites); + + /** + * Sets the list of enabled protocol versions. The argument is an + * array of strings of the canonical protocol version names, such as + * "TLSv1". + * + * @param protocols The protocol versions to enable. + * @throws IllegalArgumentException If any of the specified + * protocols are not supported, or if the argument is null. + */ + public abstract void setEnabledProtocols (String[] protocols); + + /** + * Enables or disables session creation. If enabled, each connection + * will create session that may be resumed by another connection. + * + * @param create Whether or not to enable session creation. + */ + public abstract void setEnableSessionCreation (boolean create); + + /** + * Enables client or server mode. If the argument is true, this + * engine will run in client mode; if false, server mode. + * + * @param clientMode Whether or not to use client mode. + */ + public abstract void setUseClientMode (boolean clientMode); + + /** + * Enables or disables required client authentication. If enabled, + * clients may only connect if they provide proper identification. + * + * <p>This parameter is only used in server mode. + * + * @param needAuth Whether or not client authentication is required. + */ + public abstract void setNeedClientAuth (boolean needAuth); + + /** + * Enables or disables requested client authentication. If enabled, + * clients will be asked to provide proper identification, but will + * still be allowed to connect if they do not provide it. + * + * <p>This parameter is only used in server mode. + * + * @param wantAuth Whether or not client authentication will be + * requested, but not required. + */ + public abstract void setWantClientAuth (boolean wantAuth); + + /** + * Unwraps a byte buffer recieved from the network, storing the + * decrypted, unwrapped bytes into the given buffer. + * + * <p>This call is exactly equivalent to <code>unwrap (source, new + * ByteBuffer[] { sink }, 0, 1)</code>. + * + * @param source The source bytes, coming from the network. + * @param sink The buffer to hold the unwrapped message. + * @return An engine result object for the operation. + * @throws SSLException If an SSL message parsing error occurs. + * @throws java.nio.ReadOnlyBufferException If 'sink' is not + * writable. + * @throws IllegalArgumentException If either 'source' or 'sink' is + * null. + * @throws IllegalStateException If this engine has not been put + * into client or server mode. + */ + public SSLEngineResult unwrap (ByteBuffer source, ByteBuffer sink) + throws SSLException + { + return unwrap (source, new ByteBuffer[] { sink }, 0, 1); + } + + /** + * Unwraps a byte buffer recieved from the network, storing the + * decrypted, unwrapped bytes into the given buffers. + * + * <p>This call is exactly equivalent to <code>unwrap (source, + * sinks, 0, sinks.length)</code>. + * + * @param source The source bytes, coming from the network. + * @param sinks The buffers to hold the unwrapped message. + * @return An engine result object for the operation. + * @throws SSLException If an SSL message parsing error occurs. + * @throws java.nio.ReadOnlyBufferException If any buffer in 'sinks' + * is not writable. + * @throws IllegalArgumentException If either 'source' or 'sinks' is + * null. + * @throws IllegalStateException If this engine has not been put + * into client or server mode. + */ + public SSLEngineResult unwrap (ByteBuffer source, ByteBuffer[] sinks) + throws SSLException + { + return unwrap (source, sinks, 0, sinks.length); + } + + /** + * Unwraps a byte buffer received from the network, storing the + * decrypted, unwrapped bytes into the given buffers. After + * unwrapping, the bytes placed into the sink buffers are ready for + * consumption by the application. + * + * <p>This method may place no bytes in the destination buffer; for + * example, if this engine is still performing the SSL handshake, + * only handshake data will be consumed, and no application data. + * + * <p>It is stated that this method may modify the source buffer, + * and that it must not be passed to another SSLEngine (SSL + * connections are independent, so another SSLEngine will not have + * the parameters or state to handle messages meant for this + * engine). + * + * @param source The source bytes, coming from the network. + * @param sinks The buffers to hold the unwrapped message. + * @param offset The index of the first buffer in 'sinks' to use. + * @param length The number of buffers in 'sinks' to use. + * @return An engine result object for the operation. + * @throws SSLException If an SSL message parsing error occurs. + * @throws java.nio.ReadOnlyBufferException If any buffer in 'sinks' + * is not writable. + * @throws IllegalArgumentException If either 'source' or 'sinks' is + * null. + * @throws IllegalStateException If this engine has not been put + * into client or server mode. + * @throws IndexOutOfBoundsException If 'offset' or 'length' is + * negative, or if 'length+offset' is greater than 'sinks.length'. + */ + public abstract SSLEngineResult unwrap (ByteBuffer source, + ByteBuffer[] sinks, int offset, + int length) + throws javax.net.ssl.SSLException; + + /** + * Wraps a byte buffer into an SSL message, for preparation to send + * it over the network. + * + * <p>This method is exactly equivalent to <code>wrap (new + * ByteBuffer[] { source }, 0, 1, sink)</code>. + * + * @param source The source buffer with application data. + * @param sink The buffer to hold the wrapped data. + * @return An engine result object for the operation. + * @throws SSLException If an SSL error occurs. + * @throws java.nio.ReadOnlyBufferException If 'sink' is read-only. + * @throws IllegalArgumentException If either 'source' or 'sink' is + * null. + * @throws IllegalStateException If this engine has not been put + * into client or server mode. + */ + public SSLEngineResult wrap (ByteBuffer source, ByteBuffer sink) + throws SSLException + { + return wrap (new ByteBuffer[] { source }, 0, 1, sink); + } + + /** + * Wraps byte buffers into an SSL message, for preparation to send + * them over the network. + * + * <p>This method is exactly equivalent to <code>wrap (sources, 0, + * 1, sink)</code>. + * + * @param sources The source buffers with application data. + * @param sink The buffer to hold the wrapped data. + * @return An engine result object for the operation. + * @throws SSLException If an SSL error occurs. + * @throws java.nio.ReadOnlyBufferException If 'sink' is read-only. + * @throws IllegalArgumentException If either 'sources' or 'sink' is + * null. + * @throws IllegalStateException If this engine has not been put + * into client or server mode. + */ + public SSLEngineResult wrap (ByteBuffer[] sources, ByteBuffer sink) + throws SSLException + { + return wrap (sources, 0, sources.length, sink); + } + + /** + * Wraps byte buffers into an SSL message, for preparation to send + * them over the network. After wrapping, the data in the sink + * buffer is ready to be sent over the transport layer. + * + * <p>This method may consume no data from the source buffers, and + * yet still produce output that should be sent accross the wire; + * for example if this engine has not yet completed the SSL + * handshake, the sink buffer will be filled with handshake + * messages. + * + * @param sources The source buffers with application data. + * @param offset The offset into the source buffers to start reading + * application data. + * @param length The number of buffers to read from 'sources'. + * @param sink The buffer to hold the wrapped data. + * @return An engine result object for the operation. + * @throws SSLException If an SSL error occurs. + * @throws java.nio.ReadOnlyBufferException If 'sink' is read-only. + * @throws IllegalArgumentException If either 'sources' or 'sink' is + * null. + * @throws IllegalStateException If this engine has not been put + * into client or server mode. + * @throws IndexOutOfBoundsException If 'offset' or 'length' is + * negative, or if 'length+offset' is greater than 'sources.length'. + */ + public abstract SSLEngineResult wrap (ByteBuffer[] sources, int offset, + int length, ByteBuffer sink) + throws SSLException; + +} diff --git a/javax/net/ssl/SSLEngineResult.java b/javax/net/ssl/SSLEngineResult.java new file mode 100644 index 000000000..0d6a435dd --- /dev/null +++ b/javax/net/ssl/SSLEngineResult.java @@ -0,0 +1,194 @@ +/* SSLEngineResult.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.net.ssl; + +/** + * A result from an {@link SSLEngine} <code>wrap</code> or + * <code>unwrap</code> operation. This class conveys a possibly + * intermediate result, and may ask for more input data or request + * that output data be sent over a connection. + */ +public class SSLEngineResult +{ + private final HandshakeStatus handshakeStatus; + private final Status status; + private final int bytesConsumed; + private final int bytesProduced; + + /** + * Creates a new SSL engine result. + * + * @param status The status of the SSL connection. + * @param handshakeStatus The status of the SSL handshake. + * @param bytesConsumed The number of bytes consumed by the previous + * operation. + * @param bytesProduced The number of bytes produced by the previous + * operation. + * @throws IllegalArgumentException If either enum value is + * <code>null</code>, or if either integer is negative. + */ + public SSLEngineResult (Status status, HandshakeStatus handshakeStatus, + int bytesConsumed, int bytesProduced) + { + if (status == null) + throw new IllegalArgumentException ("'status' may not be null"); + if (handshakeStatus == null) + throw new IllegalArgumentException ("'handshakeStatus' may not be null"); + if (bytesConsumed < 0) + throw new IllegalArgumentException ("'bytesConumed' must be nonnegative"); + if (bytesProduced < 0) + throw new IllegalArgumentException ("'bytesProduced' must be nonnegative"); + this.status = status; + this.handshakeStatus = handshakeStatus; + this.bytesConsumed = bytesConsumed; + this.bytesProduced = bytesProduced; + } + + + + /** + * An enumeration of possible general states. + */ + public static enum Status + { + + /** + * There were not enough input bytes available to complete the + * operation. + */ + BUFFER_UNDERFLOW, + + /** + * There was not enough space for the output message. + */ + BUFFER_OVERFLOW, + + /** + * Okay. No error. + */ + OK, + + /** + * The connection is closed. + */ + CLOSED + } + + /** + * An enumeration of possible handshake status states. + */ + public static enum HandshakeStatus + { + + /** + * Not currently handshaking. + */ + NOT_HANDSHAKING, + + /** + * The handshake is finished. + */ + FINISHED, + + /** + * Needs the status of one or more delegated tasks. + */ + NEED_TASK, + + /** + * Has data prepared for output, and needs a new call to + * <code>wrap</code>. + */ + NEED_WRAP, + + /** + * Is waiting for more input. + */ + NEED_UNWRAP + } + + + + /** + * Returns the number of bytes consumed by the previous operation. + * + * @return The number of bytes consumed. + */ + public int bytesConsumed () + { + return bytesConsumed; + } + + /** + * Returns the number of bytes produced by the previous operation. + * + * @return The number of bytes produced. + */ + public int bytesProduced () + { + return bytesProduced; + } + + /** + * Returns the handshake status. + * + * @return The handshake status. + */ + public HandshakeStatus getHandshakeStatus () + { + return handshakeStatus; + } + + /** + * Returns the connection status. + * + * @return The connection status. + */ + public Status getStatus () + { + return status; + } + + public String toString () + { + return (super.toString () + " [ status: " + status + "; handshakeStatus: " + + handshakeStatus + "; bytesConsumed: " + bytesConsumed + + "; bytesProduced: " + bytesProduced + " ]"); + } +} diff --git a/javax/net/ssl/SSLSession.java b/javax/net/ssl/SSLSession.java index 9400a1a51..c8a4785f9 100644 --- a/javax/net/ssl/SSLSession.java +++ b/javax/net/ssl/SSLSession.java @@ -38,6 +38,7 @@ exception statement from your version. */ package javax.net.ssl; +import java.security.Principal; import java.security.cert.Certificate; import javax.security.cert.X509Certificate; @@ -48,6 +49,20 @@ import javax.security.cert.X509Certificate; */ public interface SSLSession { + + /** + * Returns the size of the largest application data buffer that can + * occur in this session. + * + * <p>Buffers passed to handle the incoming data for the + * <code>unwrap</code> method of SSLEngine must be at least this + * large. + * + * @return The size of application buffers. + * @since 1.5 + */ + int getApplicationBufferSize (); + /** * Returns this session's cihper suite. * @@ -87,6 +102,28 @@ public interface SSLSession Certificate[] getLocalCertificates(); /** + * Returns the {@link Principal} representing the local identity + * used in this session, or <code>null</code> if there is no local + * identity. + * + * @return The local principal. + */ + Principal getLocalPrincipal (); + + /** + * Returns the size of the largest SSL message that will be + * generated by this session. + * + * <p>Callers of <code>wrap</code> and <code>unwrap</code> should + * use this value to determine the size of buffers for data coming + * into, or going out over, the network. + * + * @returns The maximum network packet size. + * @since 1.5 + */ + int getPacketBufferSize (); + + /** * Returns the chain of certificates that the remote side used in * the handshake, or null if none were used. * @@ -115,6 +152,27 @@ public interface SSLSession String getPeerHost(); /** + * Returns the port number the remote peer is using for this + * session. + * + * @return The peer's port number. + * @since 1.5 + */ + int getPeerPort (); + + /** + * Returns the {@link Principal} representing the identity of the + * remote peer, or <code>null</code> if the remote peer has no known + * identity. + * + * @return The remote peer's principal. + * @throws SSLPeerUnverifiedException If the remote peer's identity + * could not be verified. + * @since 1.5 + */ + Principal getPeerPrincipal () throws SSLPeerUnverifiedException; + + /** * Returns the protocol this session uses. * * @return The protocol. @@ -152,6 +210,15 @@ public interface SSLSession void invalidate(); /** + * Tells if this session is currently valid, and may be resumed. + * + * @return True if this session is valid. + * @since 1.5 + * @see #invalidate() + */ + boolean isValid (); + + /** * Binds a value to this session, with the given name. * * @param name The name to bind the object with. diff --git a/javax/net/ssl/X509ExtendedKeyManager.java b/javax/net/ssl/X509ExtendedKeyManager.java new file mode 100644 index 000000000..ccd146f82 --- /dev/null +++ b/javax/net/ssl/X509ExtendedKeyManager.java @@ -0,0 +1,96 @@ +/* X509ExtendedKeyManager.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is a part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +USA + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.net.ssl; + +import java.security.Principal; + +/** + * An extended {@link X509KeyManager} for use with {@link SSLEngine}. + * + * @since 1.5 + * @author Casey Marshall (csm@gnu.org) + */ +public abstract class X509ExtendedKeyManager implements X509KeyManager +{ + + /** + * Default constructor. + */ + protected X509ExtendedKeyManager () + { + } + + /** + * Return a client alias given a list of key types, a list of + * allowable issuers, and the SSLEngine being used. + * + * <p>This implementation always returns <code>null</code>. + * + * @param keyTypes The list of desired key types. + * @param issuers The list of desired key issuers. + * @param engine This client's SSLEngine. + * @return A key alias that matches the given parameters, or + * <code>null</code> if the parameters were not matched. + */ + public String chooseEngineClientAlias (final String[] keyTypes, + final Principal[] issuers, + final SSLEngine engine) + { + return null; + } + + /** + * Return a server alias given a key type, a list of allowable + * issuers, and the SSLEngine being used. + * + * <p>This implementation always returns <code>null</code>. + * + * @param keyType The desired key type. + * @param issuers The list of desired key issuers. + * @param engine The server's SSLEngine. + * @return A key alias that matches the given parameters, or + * <code>null</code> if the parameters were not matched. + */ + public String chooseEngineServerAlias (final String keyType, + final Principal[] issuers, + final SSLEngine engine) + { + return null; + } +} diff --git a/javax/print/PrintService.java b/javax/print/PrintService.java index b5fe004a7..125d27083 100644 --- a/javax/print/PrintService.java +++ b/javax/print/PrintService.java @@ -89,7 +89,7 @@ public interface PrintService * @throws IllegalArgumentException if category is not a class that * implements <code>PrintServiceAttribute</code>. */ - PrintServiceAttribute getAttribute(Class category); + <T extends PrintServiceAttribute> T getAttribute(Class<T> category); /** * Returns the attributes describing this print service. The returned @@ -123,7 +123,7 @@ public interface PrintService * @throws IllegalArgumentException if <code>category</code> is a class * not implementing <code>Attribute</code> */ - Object getDefaultAttributeValue(Class category); + Object getDefaultAttributeValue(Class<? extends Attribute> category); /** * Returns the name of this print service. @@ -145,7 +145,7 @@ public interface PrintService * * @return The class array of all supported attribute categories. */ - Class[] getSupportedAttributeCategories(); + Class<?>[] getSupportedAttributeCategories(); /** * Determines and returns all supported attribute values of a given @@ -177,7 +177,9 @@ public interface PrintService * implementing <code>Attribute</code>, or if <code>flavor</code> is not * supported */ - Object getSupportedAttributeValues(Class category, DocFlavor flavor, AttributeSet attributes); + Object getSupportedAttributeValues(Class<? extends Attribute> category, + DocFlavor flavor, + AttributeSet attributes); /** * Determines and returns an array of all supported document flavors which @@ -189,7 +191,7 @@ public interface PrintService * the specific doc flavor and attributes set. * </p> * - * @return The supported document flavors. + * @return the supported document flavors */ DocFlavor[] getSupportedDocFlavors(); @@ -240,7 +242,7 @@ public interface PrintService * @throws IllegalArgumentException if <code>category</code> is a class not * implementing <code>Attribute</code>. */ - boolean isAttributeCategorySupported(Class category); + boolean isAttributeCategorySupported(Class<? extends Attribute> category); /** * Determines if a given attribute value is supported when creating a print diff --git a/javax/print/attribute/Attribute.java b/javax/print/attribute/Attribute.java index 7ce0247ce..8b98377ba 100644 --- a/javax/print/attribute/Attribute.java +++ b/javax/print/attribute/Attribute.java @@ -52,7 +52,7 @@ public interface Attribute extends Serializable * * @return The concrete {@link Class} instance of the attribute class. */ - Class getCategory (); + Class< ? extends Attribute> getCategory (); /** * Returns the descriptive name of the attribute category. diff --git a/javax/print/attribute/AttributeSet.java b/javax/print/attribute/AttributeSet.java index b4bdecad2..c8130c19f 100644 --- a/javax/print/attribute/AttributeSet.java +++ b/javax/print/attribute/AttributeSet.java @@ -110,7 +110,7 @@ public interface AttributeSet * @return <code>true</code> if an attribute of the category is contained * in the set, <code>false</code> otherwise. */ - boolean containsKey (Class category); + boolean containsKey (Class<?> category); /** * Checks if this attribute set contains the given attribute. @@ -143,7 +143,7 @@ public interface AttributeSet * @throws ClassCastException if category is not implementing * <code>Attribute</code>. */ - Attribute get (Class category); + Attribute get (Class<?> category); /** * Returns the hashcode value. The hashcode value is the sum of all hashcodes @@ -178,7 +178,7 @@ public interface AttributeSet * @return <code>true</code> if an attribute is removed, false in all other cases. * @throws UnmodifiableSetException if the set does not support modification. */ - boolean remove (Class category); + boolean remove (Class<?> category); /** * Returns the number of elements in this attribute set. diff --git a/javax/print/attribute/AttributeSetUtilities.java b/javax/print/attribute/AttributeSetUtilities.java index f6a64ebc5..95c11a6ed 100644 --- a/javax/print/attribute/AttributeSetUtilities.java +++ b/javax/print/attribute/AttributeSetUtilities.java @@ -435,8 +435,8 @@ public final class AttributeSetUtilities * that implements interfaceName * @exception NullPointerException if object is null */ - public static Class verifyAttributeCategory(Object object, - Class interfaceName) + public static Class<?> verifyAttributeCategory(Object object, + Class<?> interfaceName) { if (object == null) throw new NullPointerException("object may not be null"); @@ -461,7 +461,7 @@ public final class AttributeSetUtilities * @exception NullPointerException if object is null */ public static Attribute verifyAttributeValue(Object object, - Class interfaceName) + Class<?> interfaceName) { if (object == null) throw new NullPointerException("object may not be null"); @@ -482,7 +482,7 @@ public final class AttributeSetUtilities * @exception IllegalArgumentException if the categories are not equal * @exception NullPointerException if category is null */ - public static void verifyCategoryForValue(Class category, + public static void verifyCategoryForValue(Class<?> category, Attribute attribute) { if (category == null || attribute == null) diff --git a/javax/print/attribute/HashAttributeSet.java b/javax/print/attribute/HashAttributeSet.java index 65371ea9f..0f6b00730 100644 --- a/javax/print/attribute/HashAttributeSet.java +++ b/javax/print/attribute/HashAttributeSet.java @@ -110,7 +110,7 @@ public class HashAttributeSet implements AttributeSet, Serializable * * @exception NullPointerException if interfaceName is null */ - protected HashAttributeSet(Class interfaceName) + protected HashAttributeSet(Class<?> interfaceName) { if (interfaceName == null) throw new NullPointerException("interfaceName may not be null"); @@ -129,7 +129,7 @@ public class HashAttributeSet implements AttributeSet, Serializable * interfaceName * @exception NullPointerException if attribute or interfaceName is null */ - protected HashAttributeSet(Attribute attribute, Class interfaceName) + protected HashAttributeSet(Attribute attribute, Class<?> interfaceName) { this(interfaceName); @@ -151,7 +151,7 @@ public class HashAttributeSet implements AttributeSet, Serializable * interface of interfaceName * @exception NullPointerException if attributes or interfaceName is null */ - protected HashAttributeSet(Attribute[] attributes, Class interfaceName) + protected HashAttributeSet(Attribute[] attributes, Class<?> interfaceName) { this(interfaceName); @@ -173,7 +173,7 @@ public class HashAttributeSet implements AttributeSet, Serializable * @exception ClassCastException if any element of attributes is not an * interface of interfaceName */ - protected HashAttributeSet(AttributeSet attributes, Class interfaceName) + protected HashAttributeSet(AttributeSet attributes, Class<?> interfaceName) { this(interfaceName); @@ -256,7 +256,7 @@ public class HashAttributeSet implements AttributeSet, Serializable * @return <code>true</code> if an attribute of the category is contained * in the set, <code>false</code> otherwise. */ - public boolean containsKey(Class category) + public boolean containsKey(Class<?> category) { return attributeMap.containsKey(category); } @@ -301,7 +301,7 @@ public class HashAttributeSet implements AttributeSet, Serializable * @throws ClassCastException if category is not implementing * <code>Attribute</code>. */ - public Attribute get(Class category) + public Attribute get(Class<?> category) { if (category == null) throw new NullPointerException("category may not be null"); @@ -359,7 +359,7 @@ public class HashAttributeSet implements AttributeSet, Serializable * @return <code>true</code> if an attribute is removed, false in all other cases. * @throws UnmodifiableSetException if the set does not support modification. */ - public boolean remove(Class category) + public boolean remove(Class<?> category) { if (category == null) return false; diff --git a/javax/print/attribute/standard/Chromaticity.java b/javax/print/attribute/standard/Chromaticity.java index cc834f680..3dec79893 100644 --- a/javax/print/attribute/standard/Chromaticity.java +++ b/javax/print/attribute/standard/Chromaticity.java @@ -38,6 +38,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.DocAttribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintJobAttribute; @@ -94,7 +95,7 @@ public final class Chromaticity extends EnumSyntax * * @return The class <code>Chromaticity</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return Chromaticity.class; } diff --git a/javax/print/attribute/standard/ColorSupported.java b/javax/print/attribute/standard/ColorSupported.java index bca932dd7..c5e251a50 100644 --- a/javax/print/attribute/standard/ColorSupported.java +++ b/javax/print/attribute/standard/ColorSupported.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintServiceAttribute; @@ -88,7 +89,7 @@ public final class ColorSupported extends EnumSyntax * * @return The class <code>ColorSupported</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return ColorSupported.class; } diff --git a/javax/print/attribute/standard/Compression.java b/javax/print/attribute/standard/Compression.java index 01891fe23..f2f4f1cc1 100644 --- a/javax/print/attribute/standard/Compression.java +++ b/javax/print/attribute/standard/Compression.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.DocAttribute; import javax.print.attribute.EnumSyntax; @@ -91,7 +92,7 @@ public class Compression extends EnumSyntax * * @return The class <code>Compression</code> itself. */ - public final Class getCategory() + public Class< ? extends Attribute> getCategory() { return Compression.class; } diff --git a/javax/print/attribute/standard/Copies.java b/javax/print/attribute/standard/Copies.java index 78ca6c6cc..ea9a0990a 100644 --- a/javax/print/attribute/standard/Copies.java +++ b/javax/print/attribute/standard/Copies.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; @@ -97,7 +98,7 @@ public final class Copies extends IntegerSyntax * * @return The class <code>Copies</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return Copies.class; } diff --git a/javax/print/attribute/standard/CopiesSupported.java b/javax/print/attribute/standard/CopiesSupported.java index fec426bec..1f62f48a8 100644 --- a/javax/print/attribute/standard/CopiesSupported.java +++ b/javax/print/attribute/standard/CopiesSupported.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.SetOfIntegerSyntax; import javax.print.attribute.SupportedValuesAttribute; @@ -112,7 +113,7 @@ public final class CopiesSupported extends SetOfIntegerSyntax * * @return The class <code>CopiesSupported</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return CopiesSupported.class; } diff --git a/javax/print/attribute/standard/DateTimeAtCompleted.java b/javax/print/attribute/standard/DateTimeAtCompleted.java index 36b740ef3..324bab73b 100644 --- a/javax/print/attribute/standard/DateTimeAtCompleted.java +++ b/javax/print/attribute/standard/DateTimeAtCompleted.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.util.Date; +import javax.print.attribute.Attribute; import javax.print.attribute.DateTimeSyntax; import javax.print.attribute.PrintJobAttribute; @@ -92,7 +93,7 @@ public final class DateTimeAtCompleted extends DateTimeSyntax * * @return The class <code>DateTimeAtCompleted</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return DateTimeAtCompleted.class; } diff --git a/javax/print/attribute/standard/DateTimeAtCreation.java b/javax/print/attribute/standard/DateTimeAtCreation.java index b463c40ac..5e975b64a 100644 --- a/javax/print/attribute/standard/DateTimeAtCreation.java +++ b/javax/print/attribute/standard/DateTimeAtCreation.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.util.Date; +import javax.print.attribute.Attribute; import javax.print.attribute.DateTimeSyntax; import javax.print.attribute.PrintJobAttribute; @@ -92,7 +93,7 @@ public final class DateTimeAtCreation extends DateTimeSyntax * * @return The class <code>DateTimeAtCreation</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return DateTimeAtCreation.class; } diff --git a/javax/print/attribute/standard/DateTimeAtProcessing.java b/javax/print/attribute/standard/DateTimeAtProcessing.java index 42dee8048..b407d2b2a 100644 --- a/javax/print/attribute/standard/DateTimeAtProcessing.java +++ b/javax/print/attribute/standard/DateTimeAtProcessing.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.util.Date; +import javax.print.attribute.Attribute; import javax.print.attribute.DateTimeSyntax; import javax.print.attribute.PrintJobAttribute; @@ -92,7 +93,7 @@ public final class DateTimeAtProcessing extends DateTimeSyntax * * @return The class <code>DateTimeAtProcessing</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return DateTimeAtProcessing.class; } diff --git a/javax/print/attribute/standard/Destination.java b/javax/print/attribute/standard/Destination.java index 1a4e79dd8..a82aa4b36 100644 --- a/javax/print/attribute/standard/Destination.java +++ b/javax/print/attribute/standard/Destination.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.net.URI; +import javax.print.attribute.Attribute; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.URISyntax; @@ -104,7 +105,7 @@ public final class Destination extends URISyntax * * @return The class <code>Destination</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return Destination.class; } diff --git a/javax/print/attribute/standard/DocumentName.java b/javax/print/attribute/standard/DocumentName.java index d1428ed8b..6a377d5be 100644 --- a/javax/print/attribute/standard/DocumentName.java +++ b/javax/print/attribute/standard/DocumentName.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.util.Locale; +import javax.print.attribute.Attribute; import javax.print.attribute.DocAttribute; import javax.print.attribute.TextSyntax; @@ -98,7 +99,7 @@ public final class DocumentName extends TextSyntax * * @return The class <code>DocumentName</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return DocumentName.class; } diff --git a/javax/print/attribute/standard/Fidelity.java b/javax/print/attribute/standard/Fidelity.java index 02e292f58..5e25f5b88 100644 --- a/javax/print/attribute/standard/Fidelity.java +++ b/javax/print/attribute/standard/Fidelity.java @@ -38,6 +38,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; @@ -107,7 +108,7 @@ public final class Fidelity extends EnumSyntax * * @return The class <code>Fidelity</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return Fidelity.class; } diff --git a/javax/print/attribute/standard/Finishings.java b/javax/print/attribute/standard/Finishings.java index 963485e7b..cd8f6753b 100644 --- a/javax/print/attribute/standard/Finishings.java +++ b/javax/print/attribute/standard/Finishings.java @@ -38,6 +38,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.DocAttribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintJobAttribute; @@ -238,7 +239,7 @@ public class Finishings extends EnumSyntax * * @return the class <code>Finishings</code> itself */ - public final Class getCategory() + public Class< ? extends Attribute> getCategory() { return Finishings.class; } diff --git a/javax/print/attribute/standard/JobHoldUntil.java b/javax/print/attribute/standard/JobHoldUntil.java index 768600f80..7c137ccd1 100644 --- a/javax/print/attribute/standard/JobHoldUntil.java +++ b/javax/print/attribute/standard/JobHoldUntil.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.util.Date; +import javax.print.attribute.Attribute; import javax.print.attribute.DateTimeSyntax; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; @@ -98,7 +99,7 @@ public final class JobHoldUntil extends DateTimeSyntax * * @return The class <code>JobHoldUntil</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobHoldUntil.class; } diff --git a/javax/print/attribute/standard/JobImpressions.java b/javax/print/attribute/standard/JobImpressions.java index 0da3e59cf..a2c7d4dd6 100644 --- a/javax/print/attribute/standard/JobImpressions.java +++ b/javax/print/attribute/standard/JobImpressions.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; @@ -110,7 +111,7 @@ public final class JobImpressions extends IntegerSyntax * * @return The class <code>JobImpressions</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobImpressions.class; } diff --git a/javax/print/attribute/standard/JobImpressionsCompleted.java b/javax/print/attribute/standard/JobImpressionsCompleted.java index 82da507a0..55d3fd6b9 100644 --- a/javax/print/attribute/standard/JobImpressionsCompleted.java +++ b/javax/print/attribute/standard/JobImpressionsCompleted.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintJobAttribute; @@ -101,7 +102,7 @@ public final class JobImpressionsCompleted extends IntegerSyntax * * @return The class <code>JobImpressionsCompleted</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobImpressionsCompleted.class; } diff --git a/javax/print/attribute/standard/JobImpressionsSupported.java b/javax/print/attribute/standard/JobImpressionsSupported.java index bd1045751..5be3fc0a6 100644 --- a/javax/print/attribute/standard/JobImpressionsSupported.java +++ b/javax/print/attribute/standard/JobImpressionsSupported.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.SetOfIntegerSyntax; import javax.print.attribute.SupportedValuesAttribute; @@ -96,7 +97,7 @@ public final class JobImpressionsSupported extends SetOfIntegerSyntax * * @return The class <code>JobImpressionsSupported</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobImpressionsSupported.class; } diff --git a/javax/print/attribute/standard/JobKOctets.java b/javax/print/attribute/standard/JobKOctets.java index b380aa17c..ac9a7eff6 100644 --- a/javax/print/attribute/standard/JobKOctets.java +++ b/javax/print/attribute/standard/JobKOctets.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; @@ -110,7 +111,7 @@ public final class JobKOctets extends IntegerSyntax * * @return The class <code>JobKOctets</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobKOctets.class; } diff --git a/javax/print/attribute/standard/JobKOctetsProcessed.java b/javax/print/attribute/standard/JobKOctetsProcessed.java index 762369565..34616edfe 100644 --- a/javax/print/attribute/standard/JobKOctetsProcessed.java +++ b/javax/print/attribute/standard/JobKOctetsProcessed.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintJobAttribute; @@ -102,7 +103,7 @@ public final class JobKOctetsProcessed extends IntegerSyntax * * @return The class <code>JobKOctetsProcessed</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobKOctetsProcessed.class; } diff --git a/javax/print/attribute/standard/JobKOctetsSupported.java b/javax/print/attribute/standard/JobKOctetsSupported.java index 8a4cbfc8c..4936fd49f 100644 --- a/javax/print/attribute/standard/JobKOctetsSupported.java +++ b/javax/print/attribute/standard/JobKOctetsSupported.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.SetOfIntegerSyntax; import javax.print.attribute.SupportedValuesAttribute; @@ -96,7 +97,7 @@ public final class JobKOctetsSupported extends SetOfIntegerSyntax * * @return The class <code>JobKOctetsSupported</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobKOctetsSupported.class; } diff --git a/javax/print/attribute/standard/JobMediaSheets.java b/javax/print/attribute/standard/JobMediaSheets.java index 04b83069c..17cf96f33 100644 --- a/javax/print/attribute/standard/JobMediaSheets.java +++ b/javax/print/attribute/standard/JobMediaSheets.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; @@ -107,7 +108,7 @@ public class JobMediaSheets extends IntegerSyntax * * @return The class <code>JobMediaSheets</code> itself. */ - public final Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobMediaSheets.class; } diff --git a/javax/print/attribute/standard/JobMediaSheetsCompleted.java b/javax/print/attribute/standard/JobMediaSheetsCompleted.java index 85b9ab048..353c044ec 100644 --- a/javax/print/attribute/standard/JobMediaSheetsCompleted.java +++ b/javax/print/attribute/standard/JobMediaSheetsCompleted.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintJobAttribute; @@ -96,7 +97,7 @@ public final class JobMediaSheetsCompleted extends IntegerSyntax * * @return The class <code>JobMediaSheetsCompleted</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobMediaSheetsCompleted.class; } diff --git a/javax/print/attribute/standard/JobMediaSheetsSupported.java b/javax/print/attribute/standard/JobMediaSheetsSupported.java index cb06af6fa..d9a0ed2df 100644 --- a/javax/print/attribute/standard/JobMediaSheetsSupported.java +++ b/javax/print/attribute/standard/JobMediaSheetsSupported.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.SetOfIntegerSyntax; import javax.print.attribute.SupportedValuesAttribute; @@ -96,7 +97,7 @@ public final class JobMediaSheetsSupported extends SetOfIntegerSyntax * * @return The class <code>JobMediaSheetsSupported</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobMediaSheetsSupported.class; } diff --git a/javax/print/attribute/standard/JobMessageFromOperator.java b/javax/print/attribute/standard/JobMessageFromOperator.java index 8eaae357c..f2a589af4 100644 --- a/javax/print/attribute/standard/JobMessageFromOperator.java +++ b/javax/print/attribute/standard/JobMessageFromOperator.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.util.Locale; +import javax.print.attribute.Attribute; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.TextSyntax; @@ -95,7 +96,7 @@ public final class JobMessageFromOperator extends TextSyntax * * @return The class <code>JobMessageFromOperator</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobMessageFromOperator.class; } diff --git a/javax/print/attribute/standard/JobName.java b/javax/print/attribute/standard/JobName.java index c848a63d3..5f5310e96 100644 --- a/javax/print/attribute/standard/JobName.java +++ b/javax/print/attribute/standard/JobName.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.util.Locale; +import javax.print.attribute.Attribute; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.TextSyntax; @@ -93,7 +94,7 @@ public final class JobName extends TextSyntax * * @return The class <code>JobName</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobName.class; } diff --git a/javax/print/attribute/standard/JobOriginatingUserName.java b/javax/print/attribute/standard/JobOriginatingUserName.java index 2d6e79df6..62073daa6 100644 --- a/javax/print/attribute/standard/JobOriginatingUserName.java +++ b/javax/print/attribute/standard/JobOriginatingUserName.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.util.Locale; +import javax.print.attribute.Attribute; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.TextSyntax; @@ -92,7 +93,7 @@ public final class JobOriginatingUserName extends TextSyntax * * @return The class <code>JobOriginatingUserName</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobOriginatingUserName.class; } diff --git a/javax/print/attribute/standard/JobPriority.java b/javax/print/attribute/standard/JobPriority.java index bcfb239ed..88fc685b8 100644 --- a/javax/print/attribute/standard/JobPriority.java +++ b/javax/print/attribute/standard/JobPriority.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; @@ -97,7 +98,7 @@ public final class JobPriority extends IntegerSyntax * * @return The class <code>JobPriority</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobPriority.class; } diff --git a/javax/print/attribute/standard/JobPrioritySupported.java b/javax/print/attribute/standard/JobPrioritySupported.java index 0db7107b3..e7ebca2db 100644 --- a/javax/print/attribute/standard/JobPrioritySupported.java +++ b/javax/print/attribute/standard/JobPrioritySupported.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.SupportedValuesAttribute; @@ -99,7 +100,7 @@ public final class JobPrioritySupported extends IntegerSyntax * * @return The class <code>JobPrioritySupported</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobPrioritySupported.class; } diff --git a/javax/print/attribute/standard/JobSheets.java b/javax/print/attribute/standard/JobSheets.java index f2cfacc9e..a930f63cf 100644 --- a/javax/print/attribute/standard/JobSheets.java +++ b/javax/print/attribute/standard/JobSheets.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; @@ -88,7 +89,7 @@ public class JobSheets extends EnumSyntax * * @return The class <code>JobSheets</code> itself. */ - public final Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobSheets.class; } diff --git a/javax/print/attribute/standard/JobState.java b/javax/print/attribute/standard/JobState.java index 8289569c3..fa769bbf3 100644 --- a/javax/print/attribute/standard/JobState.java +++ b/javax/print/attribute/standard/JobState.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintJobAttribute; @@ -137,7 +138,7 @@ public class JobState extends EnumSyntax * * @return The class <code>JobState</code> itself. */ - public final Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobState.class; } diff --git a/javax/print/attribute/standard/JobStateReason.java b/javax/print/attribute/standard/JobStateReason.java index 967a6bf2e..b8420b180 100644 --- a/javax/print/attribute/standard/JobStateReason.java +++ b/javax/print/attribute/standard/JobStateReason.java @@ -262,7 +262,7 @@ public class JobStateReason extends EnumSyntax * * @return The class <code>JobStateReason</code> itself. */ - public final Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobStateReason.class; } diff --git a/javax/print/attribute/standard/JobStateReasons.java b/javax/print/attribute/standard/JobStateReasons.java index 32f942b6b..997dcbc37 100644 --- a/javax/print/attribute/standard/JobStateReasons.java +++ b/javax/print/attribute/standard/JobStateReasons.java @@ -42,6 +42,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.Iterator; +import javax.print.attribute.Attribute; import javax.print.attribute.PrintJobAttribute; /** @@ -56,7 +57,7 @@ import javax.print.attribute.PrintJobAttribute; * @author Michael Koch (konqueror@gmx.de) * @author Wolfgang Baer (WBaer@gmx.de) */ -public final class JobStateReasons extends HashSet +public final class JobStateReasons extends HashSet<JobStateReason> implements PrintJobAttribute { private static final long serialVersionUID = 8849088261264331812L; @@ -108,12 +109,11 @@ public final class JobStateReasons extends HashSet * @throws ClassCastException if values of collection are not of type * <code>JobStateReason</code>. */ - public JobStateReasons(Collection collection) + public JobStateReasons(Collection<JobStateReason> collection) { super(collection.size(), 0.75f); - Iterator it = collection.iterator(); - while (it.hasNext()) - add(it.next()); + for (JobStateReason reason : collection) + add(reason); } /** @@ -126,12 +126,12 @@ public final class JobStateReasons extends HashSet * @throws ClassCastException if given object is not an instance of * <code>JobStateReason</code>. */ - public boolean add(Object o) + public boolean add(JobStateReason o) { if (o == null) throw new NullPointerException("reason is null"); - return super.add((JobStateReason) o); + return add(o); } /** @@ -139,7 +139,7 @@ public final class JobStateReasons extends HashSet * * @return The class <code>JobStateReasons</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return JobStateReasons.class; } diff --git a/javax/print/attribute/standard/Media.java b/javax/print/attribute/standard/Media.java index 37132e727..4c0af0ed1 100644 --- a/javax/print/attribute/standard/Media.java +++ b/javax/print/attribute/standard/Media.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.DocAttribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintJobAttribute; @@ -105,7 +106,7 @@ public abstract class Media extends EnumSyntax * * @return The class <code>Media</code> itself. */ - public final Class getCategory() + public Class< ? extends Attribute> getCategory() { return Media.class; } diff --git a/javax/print/attribute/standard/MediaPrintableArea.java b/javax/print/attribute/standard/MediaPrintableArea.java index e0366f589..84ebd61ce 100644 --- a/javax/print/attribute/standard/MediaPrintableArea.java +++ b/javax/print/attribute/standard/MediaPrintableArea.java @@ -38,6 +38,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.DocAttribute; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; @@ -152,7 +153,7 @@ public final class MediaPrintableArea * * @return The class <code>MediaPrintableArea</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return MediaPrintableArea.class; } diff --git a/javax/print/attribute/standard/MediaSize.java b/javax/print/attribute/standard/MediaSize.java index 982b5c5ef..be3f15678 100644 --- a/javax/print/attribute/standard/MediaSize.java +++ b/javax/print/attribute/standard/MediaSize.java @@ -66,13 +66,13 @@ public class MediaSize extends Size2DSyntax implements Attribute { private static final long serialVersionUID = -1967958664615414771L; - - private static ArrayList mediaCache; + + private static ArrayList<MediaSize> mediaCache; static { - mediaCache = new ArrayList(); - + mediaCache = new ArrayList<MediaSize>(); + // We call one instance of every container class to make sure it gets // loaded during class initialization and therefore all other static // fields of this container class also. @@ -86,7 +86,7 @@ public class MediaSize extends Size2DSyntax tmp = MediaSize.NA.LEGAL; tmp = MediaSize.Other.EXECUTIVE; } - + private MediaSizeName mediaName; /** @@ -180,10 +180,11 @@ public class MediaSize extends Size2DSyntax * * @return The class <code>MediaSize</code> itself. */ - public final Class getCategory() + public Class< ? extends Attribute> getCategory() { return MediaSize.class; } + /** * Searches for a MediaSize object with the given dimensions. @@ -201,7 +202,7 @@ public class MediaSize extends Size2DSyntax if (x <= 0.0f || y <= 0.0f) throw new IllegalArgumentException( "x and/or y may not be less or equal 0"); - + if (units < 1) throw new IllegalArgumentException("units may not be less then 1"); diff --git a/javax/print/attribute/standard/MultipleDocumentHandling.java b/javax/print/attribute/standard/MultipleDocumentHandling.java index 1a89fd01a..3ee1b4126 100644 --- a/javax/print/attribute/standard/MultipleDocumentHandling.java +++ b/javax/print/attribute/standard/MultipleDocumentHandling.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; @@ -108,7 +109,7 @@ public class MultipleDocumentHandling extends EnumSyntax * * @return The class <code>MultipleDocumentHandling</code> itself. */ - public final Class getCategory() + public Class< ? extends Attribute> getCategory() { return MultipleDocumentHandling.class; } diff --git a/javax/print/attribute/standard/NumberOfDocuments.java b/javax/print/attribute/standard/NumberOfDocuments.java index b9363eb91..1121a1f0f 100644 --- a/javax/print/attribute/standard/NumberOfDocuments.java +++ b/javax/print/attribute/standard/NumberOfDocuments.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintJobAttribute; @@ -90,7 +91,7 @@ public final class NumberOfDocuments extends IntegerSyntax * * @return The class <code>NumberOfDocuments</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return NumberOfDocuments.class; } diff --git a/javax/print/attribute/standard/NumberOfInterveningJobs.java b/javax/print/attribute/standard/NumberOfInterveningJobs.java index d3c0952fc..b968f9a7b 100644 --- a/javax/print/attribute/standard/NumberOfInterveningJobs.java +++ b/javax/print/attribute/standard/NumberOfInterveningJobs.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintJobAttribute; @@ -91,7 +92,7 @@ public final class NumberOfInterveningJobs extends IntegerSyntax * * @return The class <code>NumberOfInterveningJobs</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return NumberOfInterveningJobs.class; } diff --git a/javax/print/attribute/standard/NumberUp.java b/javax/print/attribute/standard/NumberUp.java index aa2324040..219a1c1a8 100644 --- a/javax/print/attribute/standard/NumberUp.java +++ b/javax/print/attribute/standard/NumberUp.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.DocAttribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintJobAttribute; @@ -95,7 +96,7 @@ public final class NumberUp extends IntegerSyntax * * @return The class <code>NumberUp</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return NumberUp.class; } diff --git a/javax/print/attribute/standard/NumberUpSupported.java b/javax/print/attribute/standard/NumberUpSupported.java index 71392a9ef..20bd9c93b 100644 --- a/javax/print/attribute/standard/NumberUpSupported.java +++ b/javax/print/attribute/standard/NumberUpSupported.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.SetOfIntegerSyntax; import javax.print.attribute.SupportedValuesAttribute; @@ -128,7 +129,7 @@ public final class NumberUpSupported extends SetOfIntegerSyntax * * @return The class <code>NumberUpSupported</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return NumberUpSupported.class; } diff --git a/javax/print/attribute/standard/OrientationRequested.java b/javax/print/attribute/standard/OrientationRequested.java index 1f9f0bf6f..8d3468556 100644 --- a/javax/print/attribute/standard/OrientationRequested.java +++ b/javax/print/attribute/standard/OrientationRequested.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.DocAttribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintJobAttribute; @@ -112,7 +113,7 @@ public final class OrientationRequested extends EnumSyntax * * @return The class <code>OrientationRequested</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return OrientationRequested.class; } diff --git a/javax/print/attribute/standard/OutputDeviceAssigned.java b/javax/print/attribute/standard/OutputDeviceAssigned.java index 917064f54..df8a5453f 100644 --- a/javax/print/attribute/standard/OutputDeviceAssigned.java +++ b/javax/print/attribute/standard/OutputDeviceAssigned.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.util.Locale; +import javax.print.attribute.Attribute; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.TextSyntax; @@ -98,7 +99,7 @@ public final class OutputDeviceAssigned extends TextSyntax * * @return The class <code>OutputDeviceAssigned</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return OutputDeviceAssigned.class; } diff --git a/javax/print/attribute/standard/PDLOverrideSupported.java b/javax/print/attribute/standard/PDLOverrideSupported.java index ee07edb1a..02c9c198c 100644 --- a/javax/print/attribute/standard/PDLOverrideSupported.java +++ b/javax/print/attribute/standard/PDLOverrideSupported.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintServiceAttribute; @@ -91,7 +92,7 @@ public class PDLOverrideSupported extends EnumSyntax * * @return The class <code>PDLOverrideSupported</code> itself. */ - public final Class getCategory() + public Class< ? extends Attribute> getCategory() { return PDLOverrideSupported.class; } diff --git a/javax/print/attribute/standard/PageRanges.java b/javax/print/attribute/standard/PageRanges.java index 3aa1b5625..9637a917f 100644 --- a/javax/print/attribute/standard/PageRanges.java +++ b/javax/print/attribute/standard/PageRanges.java @@ -38,6 +38,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.DocAttribute; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; @@ -154,7 +155,7 @@ public final class PageRanges extends SetOfIntegerSyntax * * @return The class <code>PageRanges</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return PageRanges.class; } diff --git a/javax/print/attribute/standard/PagesPerMinute.java b/javax/print/attribute/standard/PagesPerMinute.java index c06fb9746..6305842c0 100644 --- a/javax/print/attribute/standard/PagesPerMinute.java +++ b/javax/print/attribute/standard/PagesPerMinute.java @@ -38,6 +38,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintServiceAttribute; @@ -92,7 +93,7 @@ public final class PagesPerMinute extends IntegerSyntax * * @return The class <code>PagesPerMinute</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return PagesPerMinute.class; } diff --git a/javax/print/attribute/standard/PagesPerMinuteColor.java b/javax/print/attribute/standard/PagesPerMinuteColor.java index 80a397e63..3d5fa2ca5 100644 --- a/javax/print/attribute/standard/PagesPerMinuteColor.java +++ b/javax/print/attribute/standard/PagesPerMinuteColor.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintServiceAttribute; @@ -91,7 +92,7 @@ public final class PagesPerMinuteColor extends IntegerSyntax * * @return The class <code>PagesPerMinuteColor</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return PagesPerMinuteColor.class; } diff --git a/javax/print/attribute/standard/PresentationDirection.java b/javax/print/attribute/standard/PresentationDirection.java index 3a479abfa..14d560533 100644 --- a/javax/print/attribute/standard/PresentationDirection.java +++ b/javax/print/attribute/standard/PresentationDirection.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; @@ -138,7 +139,7 @@ public final class PresentationDirection extends EnumSyntax * * @return The class <code>PresentationDirection</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return PresentationDirection.class; } diff --git a/javax/print/attribute/standard/PrintQuality.java b/javax/print/attribute/standard/PrintQuality.java index c581d5f9d..bc94d532b 100644 --- a/javax/print/attribute/standard/PrintQuality.java +++ b/javax/print/attribute/standard/PrintQuality.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.DocAttribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintJobAttribute; @@ -92,7 +93,7 @@ public class PrintQuality extends EnumSyntax * * @return The class <code>PrintQuality</code> itself. */ - public final Class getCategory() + public Class< ? extends Attribute> getCategory() { return PrintQuality.class; } diff --git a/javax/print/attribute/standard/PrinterInfo.java b/javax/print/attribute/standard/PrinterInfo.java index 2cd496cf0..e287f8ce9 100644 --- a/javax/print/attribute/standard/PrinterInfo.java +++ b/javax/print/attribute/standard/PrinterInfo.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.util.Locale; +import javax.print.attribute.Attribute; import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.TextSyntax; @@ -92,7 +93,7 @@ public final class PrinterInfo extends TextSyntax * * @return The class <code>PrinterInfo</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return PrinterInfo.class; } diff --git a/javax/print/attribute/standard/PrinterIsAcceptingJobs.java b/javax/print/attribute/standard/PrinterIsAcceptingJobs.java index 96dbc57ce..1c9c39930 100644 --- a/javax/print/attribute/standard/PrinterIsAcceptingJobs.java +++ b/javax/print/attribute/standard/PrinterIsAcceptingJobs.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintServiceAttribute; @@ -93,7 +94,7 @@ public final class PrinterIsAcceptingJobs extends EnumSyntax * * @return The class <code>PrinterIsAcceptingJobs</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return PrinterIsAcceptingJobs.class; } diff --git a/javax/print/attribute/standard/PrinterLocation.java b/javax/print/attribute/standard/PrinterLocation.java index 35b61e4e5..7a446adcb 100644 --- a/javax/print/attribute/standard/PrinterLocation.java +++ b/javax/print/attribute/standard/PrinterLocation.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.util.Locale; +import javax.print.attribute.Attribute; import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.TextSyntax; @@ -92,7 +93,7 @@ public final class PrinterLocation extends TextSyntax * * @return The class <code>PrinterLocation</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return PrinterLocation.class; } diff --git a/javax/print/attribute/standard/PrinterMakeAndModel.java b/javax/print/attribute/standard/PrinterMakeAndModel.java index 7010746a5..77fd84b4a 100644 --- a/javax/print/attribute/standard/PrinterMakeAndModel.java +++ b/javax/print/attribute/standard/PrinterMakeAndModel.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.util.Locale; +import javax.print.attribute.Attribute; import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.TextSyntax; @@ -92,7 +93,7 @@ public final class PrinterMakeAndModel extends TextSyntax * * @return The class <code>PrinterMakeAndModel</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return PrinterMakeAndModel.class; } diff --git a/javax/print/attribute/standard/PrinterMessageFromOperator.java b/javax/print/attribute/standard/PrinterMessageFromOperator.java index b4f5d88bd..55bc7406a 100644 --- a/javax/print/attribute/standard/PrinterMessageFromOperator.java +++ b/javax/print/attribute/standard/PrinterMessageFromOperator.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.util.Locale; +import javax.print.attribute.Attribute; import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.TextSyntax; @@ -95,7 +96,7 @@ public final class PrinterMessageFromOperator extends TextSyntax * * @return The class <code>PrinterMessageFromOperator</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return PrinterMessageFromOperator.class; } diff --git a/javax/print/attribute/standard/PrinterMoreInfo.java b/javax/print/attribute/standard/PrinterMoreInfo.java index 28abd4e3f..de330fe0b 100644 --- a/javax/print/attribute/standard/PrinterMoreInfo.java +++ b/javax/print/attribute/standard/PrinterMoreInfo.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.net.URI; +import javax.print.attribute.Attribute; import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.URISyntax; @@ -94,7 +95,7 @@ public final class PrinterMoreInfo extends URISyntax * * @return The class <code>PrinterMoreInfo</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return PrinterMoreInfo.class; } diff --git a/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java b/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java index df0232e16..73a627eb3 100644 --- a/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java +++ b/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.net.URI; +import javax.print.attribute.Attribute; import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.URISyntax; @@ -98,7 +99,7 @@ public final class PrinterMoreInfoManufacturer extends URISyntax * * @return The class <code>PrinterMoreInfoManufacturer</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return PrinterMoreInfoManufacturer.class; } diff --git a/javax/print/attribute/standard/PrinterName.java b/javax/print/attribute/standard/PrinterName.java index 5b7da6059..b084c2c0f 100644 --- a/javax/print/attribute/standard/PrinterName.java +++ b/javax/print/attribute/standard/PrinterName.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.util.Locale; +import javax.print.attribute.Attribute; import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.TextSyntax; @@ -94,7 +95,7 @@ public final class PrinterName extends TextSyntax * * @return The class <code>PrinterName</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return PrinterName.class; } diff --git a/javax/print/attribute/standard/PrinterResolution.java b/javax/print/attribute/standard/PrinterResolution.java index f4cde0f5e..7b60a0cad 100644 --- a/javax/print/attribute/standard/PrinterResolution.java +++ b/javax/print/attribute/standard/PrinterResolution.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.DocAttribute; import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; @@ -95,7 +96,7 @@ public final class PrinterResolution extends ResolutionSyntax * * @return The class <code>PrinterResolution</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return PrinterResolution.class; } diff --git a/javax/print/attribute/standard/PrinterState.java b/javax/print/attribute/standard/PrinterState.java index 6fd4c3f46..4b85c0189 100644 --- a/javax/print/attribute/standard/PrinterState.java +++ b/javax/print/attribute/standard/PrinterState.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintServiceAttribute; @@ -108,7 +109,7 @@ public final class PrinterState extends EnumSyntax * * @return The class <code>PrinterState</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return PrinterState.class; } diff --git a/javax/print/attribute/standard/PrinterStateReason.java b/javax/print/attribute/standard/PrinterStateReason.java index 340bfbabf..1abb7c6aa 100644 --- a/javax/print/attribute/standard/PrinterStateReason.java +++ b/javax/print/attribute/standard/PrinterStateReason.java @@ -293,7 +293,7 @@ public class PrinterStateReason extends EnumSyntax * * @return The class <code>PrintStateReason</code> itself. */ - public final Class getCategory() + public Class< ? extends Attribute> getCategory() { return PrinterStateReason.class; } diff --git a/javax/print/attribute/standard/PrinterStateReasons.java b/javax/print/attribute/standard/PrinterStateReasons.java index 40c6f1b71..c58dd5379 100644 --- a/javax/print/attribute/standard/PrinterStateReasons.java +++ b/javax/print/attribute/standard/PrinterStateReasons.java @@ -45,6 +45,7 @@ import java.util.Iterator; import java.util.Map; import java.util.Set; +import javax.print.attribute.Attribute; import javax.print.attribute.PrintServiceAttribute; /** @@ -68,7 +69,8 @@ import javax.print.attribute.PrintServiceAttribute; * @author Michael Koch (konqueror@gmx.de) * @author Wolfgang Baer (WBaer@gmx.de) */ -public final class PrinterStateReasons extends HashMap +public final class PrinterStateReasons + extends HashMap<PrinterStateReason, Severity> implements PrintServiceAttribute { private static final long serialVersionUID = -3731791085163619457L; @@ -121,13 +123,11 @@ public final class PrinterStateReasons extends HashMap * <code>PrinterStateReason</code> and keys are not of type * <code>Severity</code>. */ - public PrinterStateReasons(Map map) + public PrinterStateReasons(Map<PrinterStateReason,Severity> map) { super(map.size(), 0.75f); - Iterator it = map.entrySet().iterator(); - while (it.hasNext()) + for (Map.Entry<PrinterStateReason,Severity> entry : map.entrySet()) { - Map.Entry entry = (Map.Entry) it.next(); put(entry.getKey(), entry.getValue()); } } @@ -139,7 +139,7 @@ public final class PrinterStateReasons extends HashMap * @param severity the severity level for the constructed set. * @return The set of printer state reasons. */ - public Set printerStateReasonSet(Severity severity) + public Set<PrinterStateReason> printerStateReasonSet(Severity severity) { if (severity == null) throw new NullPointerException("severity is null"); @@ -171,7 +171,7 @@ public final class PrinterStateReasons extends HashMap * <code>PrinterStateReason</code> and severity is not a * <code>Severity</code> instance. */ - public Object put(Object reason, Object severity) + public Severity put(PrinterStateReason reason,Severity severity) { if (reason == null) throw new NullPointerException("reason is null"); @@ -186,7 +186,7 @@ public final class PrinterStateReasons extends HashMap * * @return The class <code>PrintStateReasons</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return PrinterStateReasons.class; } diff --git a/javax/print/attribute/standard/PrinterURI.java b/javax/print/attribute/standard/PrinterURI.java index 0deca90be..017e6b85a 100644 --- a/javax/print/attribute/standard/PrinterURI.java +++ b/javax/print/attribute/standard/PrinterURI.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.net.URI; +import javax.print.attribute.Attribute; import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.URISyntax; @@ -94,7 +95,7 @@ public final class PrinterURI extends URISyntax * * @return The class <code>PrinterURI</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return PrinterURI.class; } diff --git a/javax/print/attribute/standard/QueuedJobCount.java b/javax/print/attribute/standard/QueuedJobCount.java index 8ff46a954..d024b3dcc 100644 --- a/javax/print/attribute/standard/QueuedJobCount.java +++ b/javax/print/attribute/standard/QueuedJobCount.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; import javax.print.attribute.PrintServiceAttribute; @@ -93,7 +94,7 @@ public final class QueuedJobCount extends IntegerSyntax * * @return The class <code>QueuedJobCount</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return QueuedJobCount.class; } diff --git a/javax/print/attribute/standard/ReferenceUriSchemesSupported.java b/javax/print/attribute/standard/ReferenceUriSchemesSupported.java index aeccaac5b..9d2354bd6 100644 --- a/javax/print/attribute/standard/ReferenceUriSchemesSupported.java +++ b/javax/print/attribute/standard/ReferenceUriSchemesSupported.java @@ -128,7 +128,7 @@ public class ReferenceUriSchemesSupported extends EnumSyntax * * @return The class <code>ReferenceUriSchemesSupported</code> itself. */ - public final Class getCategory() + public Class< ? extends Attribute> getCategory() { return ReferenceUriSchemesSupported.class; } diff --git a/javax/print/attribute/standard/RequestingUserName.java b/javax/print/attribute/standard/RequestingUserName.java index 8b947036c..b7b85abbd 100644 --- a/javax/print/attribute/standard/RequestingUserName.java +++ b/javax/print/attribute/standard/RequestingUserName.java @@ -40,6 +40,7 @@ package javax.print.attribute.standard; import java.util.Locale; +import javax.print.attribute.Attribute; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.TextSyntax; @@ -92,7 +93,7 @@ public final class RequestingUserName extends TextSyntax * * @return The class <code>RequestingUserName</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return RequestingUserName.class; } diff --git a/javax/print/attribute/standard/Severity.java b/javax/print/attribute/standard/Severity.java index 5569816de..019c8c6fc 100644 --- a/javax/print/attribute/standard/Severity.java +++ b/javax/print/attribute/standard/Severity.java @@ -97,7 +97,7 @@ public final class Severity extends EnumSyntax * * @return The class <code>Severity</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return Severity.class; } diff --git a/javax/print/attribute/standard/SheetCollate.java b/javax/print/attribute/standard/SheetCollate.java index 5343bc6df..886b8d6c9 100644 --- a/javax/print/attribute/standard/SheetCollate.java +++ b/javax/print/attribute/standard/SheetCollate.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.DocAttribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintJobAttribute; @@ -97,7 +98,7 @@ public final class SheetCollate extends EnumSyntax * * @return The class <code>SheetCollate</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return SheetCollate.class; } diff --git a/javax/print/attribute/standard/Sides.java b/javax/print/attribute/standard/Sides.java index 816365aed..02fe4a1e5 100644 --- a/javax/print/attribute/standard/Sides.java +++ b/javax/print/attribute/standard/Sides.java @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.DocAttribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.PrintJobAttribute; @@ -108,7 +109,7 @@ public final class Sides extends EnumSyntax * * @return The class <code>Sides</code> itself. */ - public Class getCategory() + public Class< ? extends Attribute> getCategory() { return Sides.class; } diff --git a/javax/security/auth/Subject.java b/javax/security/auth/Subject.java index 1659c6425..038363458 100644 --- a/javax/security/auth/Subject.java +++ b/javax/security/auth/Subject.java @@ -91,8 +91,9 @@ public final class Subject implements Serializable readOnly = false; } - public Subject (final boolean readOnly, final Set principals, - final Set pubCred, final Set privCred) + public Subject (final boolean readOnly, + final Set<? extends Principal> principals, + final Set<?> pubCred, final Set<?> privCred) { if (principals == null || pubCred == null || privCred == null) { @@ -265,12 +266,12 @@ public final class Subject implements Serializable privCred.containsAll (that.getPrivateCredentials()); } - public Set getPrincipals() + public Set<Principal> getPrincipals() { return principals; } - public Set getPrincipals(Class clazz) + public <T extends Principal> Set<T> getPrincipals(Class<T> clazz) { HashSet result = new HashSet (principals.size()); for (Iterator it = principals.iterator(); it.hasNext(); ) @@ -284,12 +285,12 @@ public final class Subject implements Serializable return Collections.unmodifiableSet (result); } - public Set getPrivateCredentials() + public Set<Object> getPrivateCredentials() { return privCred; } - public Set getPrivateCredentials (Class clazz) + public <T> Set<T> getPrivateCredentials (Class<T> clazz) { HashSet result = new HashSet (privCred.size()); for (Iterator it = privCred.iterator(); it.hasNext(); ) @@ -303,12 +304,12 @@ public final class Subject implements Serializable return Collections.unmodifiableSet (result); } - public Set getPublicCredentials() + public Set<Object> getPublicCredentials() { return pubCred; } - public Set getPublicCredentials (Class clazz) + public <T> Set<T> getPublicCredentials (Class<T> clazz) { HashSet result = new HashSet (pubCred.size()); for (Iterator it = pubCred.iterator(); it.hasNext(); ) diff --git a/javax/security/auth/login/AppConfigurationEntry.java b/javax/security/auth/login/AppConfigurationEntry.java index b455dbb6c..3c8b64d4c 100644 --- a/javax/security/auth/login/AppConfigurationEntry.java +++ b/javax/security/auth/login/AppConfigurationEntry.java @@ -56,7 +56,7 @@ public class AppConfigurationEntry public AppConfigurationEntry (final String loginModuleName, final LoginModuleControlFlag controlFlag, - final Map options) + final Map<String, ?> options) { if (loginModuleName == null || loginModuleName.length() == 0) throw new IllegalArgumentException ("module name cannot be null nor empty"); @@ -88,7 +88,7 @@ public class AppConfigurationEntry return loginModuleName; } - public Map getOptions() + public Map<String, ?> getOptions() { return options; } diff --git a/javax/security/auth/spi/LoginModule.java b/javax/security/auth/spi/LoginModule.java index 00b33c517..197cd692e 100644 --- a/javax/security/auth/spi/LoginModule.java +++ b/javax/security/auth/spi/LoginModule.java @@ -95,7 +95,7 @@ public interface LoginModule * @param options A mapping of options given to this module. */ void initialize(Subject subject, CallbackHandler handler, - Map sharedState, Map options); + Map<String, ?> sharedState, Map<String, ?> options); /** * Authenticates a subject to the system. This is the primary diff --git a/javax/security/sasl/Sasl.java b/javax/security/sasl/Sasl.java index dbe4cc8c2..52210d971 100644 --- a/javax/security/sasl/Sasl.java +++ b/javax/security/sasl/Sasl.java @@ -356,7 +356,8 @@ public class Sasl public static SaslClient createSaslClient(String[] mechanisms, String authorizationID, String protocol, - String serverName, Map props, + String serverName, + Map<String, ?> props, CallbackHandler cbh) throws SaslException { @@ -444,7 +445,7 @@ public class Sasl * {@link SaslClient} instance. * @see #createSaslClient(String[],String,String,String,Map,CallbackHandler) */ - public static Enumeration getSaslClientFactories() + public static Enumeration<SaslClientFactory> getSaslClientFactories() { Vector result = new Vector(); HashSet names = new HashSet(); @@ -559,7 +560,8 @@ public class Sasl */ public static SaslServer createSaslServer(String mechanism, String protocol, String serverName, - Map props, CallbackHandler cbh) + Map<String, ?> props, + CallbackHandler cbh) throws SaslException { if (mechanism == null) @@ -636,7 +638,7 @@ public class Sasl * {@link SaslServer} instance. * @see #createSaslServer(String,String,String,Map,CallbackHandler) */ - public static Enumeration getSaslServerFactories() + public static Enumeration<SaslServerFactory> getSaslServerFactories() { Vector result = new Vector(); HashSet names = new HashSet(); diff --git a/javax/security/sasl/SaslClientFactory.java b/javax/security/sasl/SaslClientFactory.java index ae36171c5..be80fd9f1 100644 --- a/javax/security/sasl/SaslClientFactory.java +++ b/javax/security/sasl/SaslClientFactory.java @@ -97,8 +97,8 @@ public interface SaslClientFactory * because of an error. */ SaslClient createSaslClient(String[] mechanisms, String authorizationID, - String protocol, String serverName, Map props, - CallbackHandler cbh) + String protocol, String serverName, + Map<String, ?> props, CallbackHandler cbh) throws SaslException; /** @@ -114,5 +114,5 @@ public interface SaslClientFactory * properties, if present in props, are ignored. * @return a non-null array containing IANA-registered SASL mechanism names. */ - String[] getMechanismNames(Map props); + String[] getMechanismNames(Map<String, ?> props); } diff --git a/javax/security/sasl/SaslServerFactory.java b/javax/security/sasl/SaslServerFactory.java index fc43fb636..b51ce3dba 100644 --- a/javax/security/sasl/SaslServerFactory.java +++ b/javax/security/sasl/SaslServerFactory.java @@ -95,7 +95,8 @@ public interface SaslServerFactory * of an error. */ SaslServer createSaslServer(String mechanism, String protocol, - String serverName, Map props, CallbackHandler cbh) + String serverName, Map<String, ?> props, + CallbackHandler cbh) throws SaslException; /** @@ -111,5 +112,5 @@ public interface SaslServerFactory * properties, if present in props, are ignored. * @return a non-null array containing IANA-registered SASL mechanism names. */ - String[] getMechanismNames(Map props); + String[] getMechanismNames(Map<String, ?> props); } diff --git a/javax/sound/midi/Instrument.java b/javax/sound/midi/Instrument.java index 3402e8289..f2821db64 100644 --- a/javax/sound/midi/Instrument.java +++ b/javax/sound/midi/Instrument.java @@ -59,7 +59,7 @@ public abstract class Instrument extends SoundbankResource * @param dataClass the class used to represent sample data for this instrument */ protected Instrument(Soundbank soundbank, Patch patch, - String name, Class dataClass) + String name, Class<?> dataClass) { super(soundbank, name, dataClass); this.patch = patch; diff --git a/javax/sound/midi/Sequence.java b/javax/sound/midi/Sequence.java index 1a43d207c..2ea201cb2 100644 --- a/javax/sound/midi/Sequence.java +++ b/javax/sound/midi/Sequence.java @@ -65,7 +65,7 @@ public class Sequence /** * The MIDI tracks used by this sequence. */ - protected Vector tracks; + protected Vector<Track> tracks; /** * Tempo-based timing. Resolution is specified in ticks per beat. @@ -107,7 +107,7 @@ public class Sequence this.divisionType = divisionType; this.resolution = resolution; - tracks = new Vector(numTracks); + tracks = new Vector<Track>(numTracks); while (numTracks > 0) tracks.set(--numTracks, new Track()); } @@ -189,7 +189,7 @@ public class Sequence */ public Track[] getTracks() { - return (Track[]) tracks.toArray(new Track[tracks.size()]); + return tracks.toArray(new Track[tracks.size()]); } /** @@ -224,10 +224,10 @@ public class Sequence public long getTickLength() { long length = 0; - Iterator itr = tracks.iterator(); + Iterator<Track> itr = tracks.iterator(); while (itr.hasNext()) { - Track track = (Track) itr.next(); + Track track = itr.next(); long trackTicks = track.ticks(); if (trackTicks > length) length = trackTicks; diff --git a/javax/sound/midi/SoundbankResource.java b/javax/sound/midi/SoundbankResource.java index 435017e4c..93f42e48e 100644 --- a/javax/sound/midi/SoundbankResource.java +++ b/javax/sound/midi/SoundbankResource.java @@ -58,7 +58,7 @@ public abstract class SoundbankResource * @param name the name of the resource * @param dataClass the class used to represent the audio data */ - protected SoundbankResource(Soundbank soundbank, String name, Class dataClass) + protected SoundbankResource(Soundbank soundbank, String name, Class<?> dataClass) { this.soundbank = soundbank; this.name = name; @@ -90,7 +90,7 @@ public abstract class SoundbankResource * * @return the class used to represent the audio data for this resource */ - public Class getDataClass() + public Class<?> getDataClass() { return dataClass; } diff --git a/javax/sound/sampled/AudioFileFormat.java b/javax/sound/sampled/AudioFileFormat.java index 81bbe4ecf..37c2df465 100644 --- a/javax/sound/sampled/AudioFileFormat.java +++ b/javax/sound/sampled/AudioFileFormat.java @@ -153,7 +153,7 @@ public class AudioFileFormat * @param properties the properties */ public AudioFileFormat(Type type, AudioFormat fmt, int frameLen, - Map properties) + Map<String, Object> properties) { this.byteLength = AudioSystem.NOT_SPECIFIED; this.format = fmt; @@ -226,7 +226,7 @@ public class AudioFileFormat * Return the properties associated with this format, as a Map. * The returned Map is unmodifiable. */ - public Map properties() + public Map<String, Object> properties() { return properties; } diff --git a/javax/sound/sampled/AudioFormat.java b/javax/sound/sampled/AudioFormat.java index 5199d71c3..a474ff9a5 100644 --- a/javax/sound/sampled/AudioFormat.java +++ b/javax/sound/sampled/AudioFormat.java @@ -177,7 +177,7 @@ public class AudioFormat */ public AudioFormat(Encoding encoding, float sampleRate, int sampleSizeInBits, int channels, int frameSize, float frameRate, - boolean bigEndian, Map properties) + boolean bigEndian, Map<String, Object> properties) { this.encoding = encoding; this.sampleRate = sampleRate; @@ -319,7 +319,7 @@ public class AudioFormat * Return a read-only Map holding the properties associated with * this format. */ - public Map properties() + public Map<String, Object> properties() { return properties; } diff --git a/javax/sound/sampled/DataLine.java b/javax/sound/sampled/DataLine.java index f755958fe..aa99a046c 100644 --- a/javax/sound/sampled/DataLine.java +++ b/javax/sound/sampled/DataLine.java @@ -64,7 +64,7 @@ public interface DataLine extends Line * @param klass the class of the line * @param fmt the supported format */ - public Info(Class klass, AudioFormat fmt) + public Info(Class<?> klass, AudioFormat fmt) { super(klass); this.minBufferSize = AudioSystem.NOT_SPECIFIED; @@ -80,7 +80,7 @@ public interface DataLine extends Line * @param minSize the minimum buffer size * @param maxSize the maximum buffer size */ - public Info(Class klass, AudioFormat[] fmts, int minSize, int maxSize) + public Info(Class<?> klass, AudioFormat[] fmts, int minSize, int maxSize) { super(klass); this.minBufferSize = minSize; @@ -96,7 +96,7 @@ public interface DataLine extends Line * @param fmt the supported format * @param size the buffer size */ - public Info(Class klass, AudioFormat fmt, int size) + public Info(Class<?> klass, AudioFormat fmt, int size) { super(klass); this.minBufferSize = size; diff --git a/javax/sound/sampled/Line.java b/javax/sound/sampled/Line.java index 69bb9084f..536752a1c 100644 --- a/javax/sound/sampled/Line.java +++ b/javax/sound/sampled/Line.java @@ -57,7 +57,7 @@ public interface Line * for instance TargetDataLine.class. * @param klass the class of the line */ - public Info(Class klass) + public Info(Class<?> klass) { this.klass = klass; } @@ -65,7 +65,7 @@ public interface Line /** * Return the line's class. */ - public Class getLineClass() + public Class<?> getLineClass() { return klass; } diff --git a/javax/sound/sampled/Port.java b/javax/sound/sampled/Port.java index fb39e6c07..fc0bf71d9 100644 --- a/javax/sound/sampled/Port.java +++ b/javax/sound/sampled/Port.java @@ -89,7 +89,7 @@ public interface Port extends Line * @param name the name of the line * @param isSource true if this is an input source */ - public Info(Class klass, String name, boolean isSource) + public Info(Class<?> klass, String name, boolean isSource) { super(klass); this.name = name; diff --git a/javax/sql/RowSet.java b/javax/sql/RowSet.java index 46b776b3c..2a9ad2784 100644 --- a/javax/sql/RowSet.java +++ b/javax/sql/RowSet.java @@ -78,9 +78,9 @@ public interface RowSet extends ResultSet void setTransactionIsolation(int level) throws SQLException; - Map getTypeMap() throws SQLException; + Map<String, Class<?>> getTypeMap() throws SQLException; - void setTypeMap(Map map) throws SQLException; + void setTypeMap(Map<String, Class<?>> map) throws SQLException; String getCommand(); diff --git a/javax/swing/AbstractListModel.java b/javax/swing/AbstractListModel.java index 4b89689dd..7d4b2bb2a 100644 --- a/javax/swing/AbstractListModel.java +++ b/javax/swing/AbstractListModel.java @@ -164,7 +164,7 @@ public abstract class AbstractListModel implements ListModel, Serializable * * @return The set of listeners of the specified type */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } diff --git a/javax/swing/AbstractSpinnerModel.java b/javax/swing/AbstractSpinnerModel.java index 1d9476635..d247a3313 100644 --- a/javax/swing/AbstractSpinnerModel.java +++ b/javax/swing/AbstractSpinnerModel.java @@ -84,7 +84,7 @@ public abstract class AbstractSpinnerModel implements SpinnerModel * @param c the type of listener * @return the listeners that are of the specific type */ - public EventListener[] getListeners(Class c) + public <T extends EventListener> T[] getListeners(Class<T> c) { return listenerList.getListeners(c); } diff --git a/javax/swing/ButtonGroup.java b/javax/swing/ButtonGroup.java index 19ce65949..6a474f98d 100644 --- a/javax/swing/ButtonGroup.java +++ b/javax/swing/ButtonGroup.java @@ -68,7 +68,7 @@ public class ButtonGroup implements Serializable private static final long serialVersionUID = 4259076101881721375L; /** Stores references to the buttons added to this button group. */ - protected Vector buttons = new Vector(); + protected Vector<AbstractButton> buttons = new Vector<AbstractButton>(); /** The currently selected button model. */ ButtonModel sel; @@ -129,7 +129,7 @@ public class ButtonGroup implements Serializable * * @return <code>Enumeration</code> over all added buttons */ - public Enumeration getElements() + public Enumeration<AbstractButton> getElements() { return buttons.elements(); } diff --git a/javax/swing/DefaultBoundedRangeModel.java b/javax/swing/DefaultBoundedRangeModel.java index efca148f4..786e4ee92 100644 --- a/javax/swing/DefaultBoundedRangeModel.java +++ b/javax/swing/DefaultBoundedRangeModel.java @@ -424,7 +424,7 @@ public class DefaultBoundedRangeModel * * @since 1.3 */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } diff --git a/javax/swing/DefaultButtonModel.java b/javax/swing/DefaultButtonModel.java index f408bffdf..c0eaea239 100644 --- a/javax/swing/DefaultButtonModel.java +++ b/javax/swing/DefaultButtonModel.java @@ -166,7 +166,7 @@ public class DefaultButtonModel implements ButtonModel, Serializable * * @return array of listeners */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } diff --git a/javax/swing/DefaultComboBoxModel.java b/javax/swing/DefaultComboBoxModel.java index 71ab11fe3..9b5bdb60d 100644 --- a/javax/swing/DefaultComboBoxModel.java +++ b/javax/swing/DefaultComboBoxModel.java @@ -104,7 +104,7 @@ public class DefaultComboBoxModel extends AbstractListModel * * @throws NullPointerException if <code>vector</code> is <code>null</code>. */ - public DefaultComboBoxModel(Vector vector) + public DefaultComboBoxModel(Vector<?> vector) { this.list = vector; if (getSize() > 0) diff --git a/javax/swing/DefaultListModel.java b/javax/swing/DefaultListModel.java index 2d02874a7..674864cce 100644 --- a/javax/swing/DefaultListModel.java +++ b/javax/swing/DefaultListModel.java @@ -309,7 +309,7 @@ public class DefaultListModel extends AbstractListModel * * @return A new enumeration which iterates over the list */ - public Enumeration elements() + public Enumeration<?> elements() { return elements.elements(); } diff --git a/javax/swing/DefaultListSelectionModel.java b/javax/swing/DefaultListSelectionModel.java index 482ce2cc2..d1e2da85f 100644 --- a/javax/swing/DefaultListSelectionModel.java +++ b/javax/swing/DefaultListSelectionModel.java @@ -815,7 +815,7 @@ public class DefaultListSelectionModel implements Cloneable, * @see #getListSelectionListeners * @since 1.3 */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } diff --git a/javax/swing/DefaultSingleSelectionModel.java b/javax/swing/DefaultSingleSelectionModel.java index 1c6f473fd..3f79f0dee 100644 --- a/javax/swing/DefaultSingleSelectionModel.java +++ b/javax/swing/DefaultSingleSelectionModel.java @@ -174,7 +174,7 @@ public class DefaultSingleSelectionModel * * @since 1.3 */ - public EventListener[] getListeners(Class listenerClass) + public <T extends EventListener> T[] getListeners(Class<T> listenerClass) { return listenerList.getListeners(listenerClass); } diff --git a/javax/swing/JComboBox.java b/javax/swing/JComboBox.java index c75a94bdc..fa6941cf9 100644 --- a/javax/swing/JComboBox.java +++ b/javax/swing/JComboBox.java @@ -196,7 +196,7 @@ public class JComboBox extends JComponent implements ItemSelectable, * * @param itemVector vector containing list of items for this JComboBox. */ - public JComboBox(Vector itemVector) + public JComboBox(Vector<?> itemVector) { this(new DefaultComboBoxModel(itemVector)); diff --git a/javax/swing/JComponent.java b/javax/swing/JComponent.java index cc317492c..5ec507922 100644 --- a/javax/swing/JComponent.java +++ b/javax/swing/JComponent.java @@ -927,12 +927,12 @@ public abstract class JComponent extends Container implements Serializable * * @since 1.3 */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { if (listenerType == PropertyChangeListener.class) - return getPropertyChangeListeners(); + return (T[]) getPropertyChangeListeners(); else if (listenerType == VetoableChangeListener.class) - return getVetoableChangeListeners(); + return (T[]) getVetoableChangeListeners(); else return listenerList.getListeners(listenerType); } diff --git a/javax/swing/JLayeredPane.java b/javax/swing/JLayeredPane.java index ca913e97f..d981788ec 100644 --- a/javax/swing/JLayeredPane.java +++ b/javax/swing/JLayeredPane.java @@ -406,7 +406,7 @@ public class JLayeredPane extends JComponent implements Accessible * Return a hashtable mapping child components of this container to * Integer objects representing the component's layer assignments. */ - protected Hashtable getComponentToLayer() + protected Hashtable<Component, Integer> getComponentToLayer() { return componentToLayer; } diff --git a/javax/swing/JList.java b/javax/swing/JList.java index 98b299044..ff1b23921 100644 --- a/javax/swing/JList.java +++ b/javax/swing/JList.java @@ -1041,7 +1041,7 @@ public class JList extends JComponent implements Accessible, Scrollable * * @param items the initial list items. */ - public JList(Vector items) + public JList(Vector<?> items) { init(createListModel(items)); } @@ -1643,9 +1643,20 @@ public class JList extends JComponent implements Accessible, Scrollable * @param listData The object array to build a new list model on * @see #setModel */ - public void setListData(Vector listData) + public void setListData(final Vector<?> listData) { - setModel(createListModel(listData)); + setModel(new AbstractListModel() + { + public int getSize() + { + return listData.size(); + } + + public Object getElementAt(int i) + { + return listData.elementAt(i); + } + }); } /** diff --git a/javax/swing/JTable.java b/javax/swing/JTable.java index 33f5947c1..42563e6a2 100644 --- a/javax/swing/JTable.java +++ b/javax/swing/JTable.java @@ -3429,7 +3429,7 @@ public class JTable * * @return the editor, suitable for editing this data type */ - public TableCellEditor getDefaultEditor(Class columnClass) + public TableCellEditor getDefaultEditor(Class<?> columnClass) { if (defaultEditorsByColumnClass.containsKey(columnClass)) return (TableCellEditor) defaultEditorsByColumnClass.get(columnClass); @@ -3441,7 +3441,7 @@ public class JTable return r; } } - + /** * Get the cell renderer for rendering the given cell. * @@ -3461,7 +3461,7 @@ public class JTable } return renderer; } - + /** * Set default renderer for rendering the given data type. * @@ -3469,11 +3469,11 @@ public class JTable * rendered. * @param rend the renderer that will rend this data type */ - public void setDefaultRenderer(Class columnClass, TableCellRenderer rend) + public void setDefaultRenderer(Class<?> columnClass, TableCellRenderer rend) { defaultRenderersByColumnClass.put(columnClass, rend); } - + /** * Get the default renderer for rendering the given data type. * @@ -3481,7 +3481,7 @@ public class JTable * * @return the appropriate defauld renderer for rendering that data type. */ - public TableCellRenderer getDefaultRenderer(Class columnClass) + public TableCellRenderer getDefaultRenderer(Class<?> columnClass) { if (defaultRenderersByColumnClass.containsKey(columnClass)) return (TableCellRenderer) defaultRenderersByColumnClass.get(columnClass); @@ -4624,7 +4624,7 @@ public class JTable { setUI((TableUI) UIManager.getUI(this)); } - + /** * Get the class (datatype) of the column. The cells are rendered and edited * differently, depending from they data type. @@ -4634,7 +4634,7 @@ public class JTable * @return the class, defining data type of that column (String.class for * String, Boolean.class for boolean and so on). */ - public Class getColumnClass(int column) + public Class<?> getColumnClass(int column) { return getModel().getColumnClass(convertColumnIndexToModel(column)); } @@ -4655,7 +4655,7 @@ public class JTable int modelColumn = columnModel.getColumn(column).getModelIndex(); return dataModel.getColumnName(modelColumn); } - + /** * Get the column, currently being edited * @@ -4665,7 +4665,7 @@ public class JTable { return editingColumn; } - + /** * Set the column, currently being edited * @@ -4685,7 +4685,7 @@ public class JTable { return editingRow; } - + /** * Set the row currently being edited. * @@ -4716,7 +4716,7 @@ public class JTable { return editorComp != null; } - + /** * Set the default editor for the given column class (column data type). * By default, String is handled by text field and Boolean is handled by @@ -4727,7 +4727,7 @@ public class JTable * * @see TableModel#getColumnClass(int) */ - public void setDefaultEditor(Class columnClass, TableCellEditor editor) + public void setDefaultEditor(Class<?> columnClass, TableCellEditor editor) { if (editor != null) defaultEditorsByColumnClass.put(columnClass, editor); diff --git a/javax/swing/JTree.java b/javax/swing/JTree.java index f1add1293..332ec7424 100644 --- a/javax/swing/JTree.java +++ b/javax/swing/JTree.java @@ -1534,7 +1534,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @param value the initial nodes in the tree */ - public JTree(Hashtable value) + public JTree(Hashtable<?, ?> value) { this(createTreeModel(value)); } @@ -1601,7 +1601,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @param value the initial nodes in the tree */ - public JTree(Vector value) + public JTree(Vector<?> value) { this(createTreeModel(value)); } @@ -2824,7 +2824,7 @@ public class JTree extends JComponent implements Scrollable, Accessible nodeStates.clear(); } - protected Enumeration getDescendantToggledPaths(TreePath parent) + protected Enumeration<TreePath> getDescendantToggledPaths(TreePath parent) { if (parent == null) return null; @@ -2973,7 +2973,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @return An Enumeration containing TreePath objects */ - public Enumeration getExpandedDescendants(TreePath path) + public Enumeration<TreePath> getExpandedDescendants(TreePath path) { Enumeration paths = nodeStates.keys(); Vector relevantPaths = new Vector(); @@ -3101,7 +3101,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * @param toRemove - Enumeration of TreePaths that need to be removed from * cache of toggled tree paths. */ - protected void removeDescendantToggledPaths(Enumeration toRemove) + protected void removeDescendantToggledPaths(Enumeration<TreePath> toRemove) { while (toRemove.hasMoreElements()) { diff --git a/javax/swing/LookAndFeel.java b/javax/swing/LookAndFeel.java index be5434396..d995bc9e9 100644 --- a/javax/swing/LookAndFeel.java +++ b/javax/swing/LookAndFeel.java @@ -284,7 +284,7 @@ public abstract class LookAndFeel * @return A {@link UIDefaults.LazyValue} that serves up an * {@link IconUIResource}. */ - public static Object makeIcon(Class baseClass, String gifFile) + public static Object makeIcon(Class<?> baseClass, String gifFile) { final URL file = baseClass.getResource(gifFile); return new UIDefaults.LazyValue() diff --git a/javax/swing/RepaintManager.java b/javax/swing/RepaintManager.java index d6a00ec43..773371489 100644 --- a/javax/swing/RepaintManager.java +++ b/javax/swing/RepaintManager.java @@ -568,7 +568,7 @@ public class RepaintManager */ public void paintDirtyRegions() { - // Short cicuit if there is nothing to paint. + // Short circuit if there is nothing to paint. if (dirtyComponents.size() == 0) return; diff --git a/javax/swing/SortingFocusTraversalPolicy.java b/javax/swing/SortingFocusTraversalPolicy.java index 96ef38329..d14ee1d30 100644 --- a/javax/swing/SortingFocusTraversalPolicy.java +++ b/javax/swing/SortingFocusTraversalPolicy.java @@ -91,7 +91,7 @@ public class SortingFocusTraversalPolicy * * @param comparator the comparator to set */ - public SortingFocusTraversalPolicy(Comparator comparator) + public SortingFocusTraversalPolicy(Comparator<? super Component> comparator) { this.comparator = comparator; } @@ -119,7 +119,7 @@ public class SortingFocusTraversalPolicy * * @see #setComparator */ - protected Comparator getComparator() + protected Comparator<? super Component> getComparator() { return comparator; } @@ -131,7 +131,7 @@ public class SortingFocusTraversalPolicy * * @see #getComparator */ - protected void setComparator(Comparator comparator) + protected void setComparator(Comparator<? super Component> comparator) { this.comparator = comparator; } diff --git a/javax/swing/SpinnerListModel.java b/javax/swing/SpinnerListModel.java index d8e2f22d5..52ac360e9 100644 --- a/javax/swing/SpinnerListModel.java +++ b/javax/swing/SpinnerListModel.java @@ -118,7 +118,7 @@ public class SpinnerListModel extends AbstractSpinnerModel * @see SpinnerListModel#getNextValue() * @see SpinnerListModel#getValue() */ - public SpinnerListModel(List list) + public SpinnerListModel(List<?> list) { // Retain a reference to the valid list. setList(list); @@ -163,7 +163,7 @@ public class SpinnerListModel extends AbstractSpinnerModel * * @return The backing list. */ - public List getList() + public List<?> getList() { return list; } @@ -239,7 +239,7 @@ public class SpinnerListModel extends AbstractSpinnerModel * * @see ChangeEvent */ - public void setList(List list) + public void setList(List<?> list) { // Check for null or zero size list. if (list == null || list.size() == 0) diff --git a/javax/swing/SwingUtilities.java b/javax/swing/SwingUtilities.java index c6e50fba5..6ff0b3346 100644 --- a/javax/swing/SwingUtilities.java +++ b/javax/swing/SwingUtilities.java @@ -325,7 +325,7 @@ public class SwingUtilities * @see #getAncestorOfClass * @see #windowForComponent */ - public static Container getAncestorOfClass(Class c, Component comp) + public static Container getAncestorOfClass(Class<?> c, Component comp) { while (comp != null && (! c.isInstance(comp))) comp = comp.getParent(); diff --git a/javax/swing/Timer.java b/javax/swing/Timer.java index acd226249..acd1eb493 100644 --- a/javax/swing/Timer.java +++ b/javax/swing/Timer.java @@ -228,7 +228,7 @@ public class Timer * fired by this timer * @since 1.3 */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } diff --git a/javax/swing/UIDefaults.java b/javax/swing/UIDefaults.java index bf5242f65..9766cb05c 100644 --- a/javax/swing/UIDefaults.java +++ b/javax/swing/UIDefaults.java @@ -63,7 +63,7 @@ import javax.swing.plaf.InputMapUIResource; * * @author Ronald Veldema (rveldema@cs.vu.nl) */ -public class UIDefaults extends Hashtable +public class UIDefaults extends Hashtable<Object, Object> { /** Our ResourceBundles. */ @@ -672,7 +672,7 @@ public class UIDefaults extends Hashtable * * @return the UI class for <code>id</code> */ - public Class getUIClass(String id, ClassLoader loader) + public Class<? extends ComponentUI> getUIClass(String id, ClassLoader loader) { String className = (String) get(id); if (className == null) @@ -681,7 +681,7 @@ public class UIDefaults extends Hashtable { if (loader == null) loader = ClassLoader.getSystemClassLoader(); - return loader.loadClass (className); + return (Class<? extends ComponentUI>) loader.loadClass (className); } catch (Exception e) { @@ -698,7 +698,7 @@ public class UIDefaults extends Hashtable * * @return the UI class for <code>id</code> */ - public Class getUIClass(String id) + public Class<? extends ComponentUI> getUIClass(String id) { return getUIClass (id, null); } diff --git a/javax/swing/event/EventListenerList.java b/javax/swing/event/EventListenerList.java index ab9d46d8c..1568039f0 100644 --- a/javax/swing/event/EventListenerList.java +++ b/javax/swing/event/EventListenerList.java @@ -139,7 +139,7 @@ public class EventListenerList * * @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; @@ -178,7 +178,7 @@ public class EventListenerList * <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) @@ -227,7 +227,7 @@ public class EventListenerList * * @since 1.3 */ - public EventListener[] getListeners(Class c) + public <T extends EventListener> T[] getListeners(Class<T> c) { int count, f; EventListener[] result; @@ -239,7 +239,7 @@ public class EventListenerList if (listenerList[i] == c) result[f++] = (EventListener) listenerList[i + 1]; - return result; + return (T[]) result; } @@ -256,7 +256,7 @@ public class EventListenerList * * @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; @@ -341,7 +341,7 @@ public class EventListenerList * @throws ClassNotFoundException if a serialized class can't be found * @throws IOException if something goes wrong */ - private void readObject(ObjectInputStream in) + private <T extends EventListener> void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException { listenerList = NO_LISTENERS; @@ -351,7 +351,7 @@ public class EventListenerList while ((type = in.readObject()) != null) { EventListener l = (EventListener) in.readObject(); - add(Class.forName((String) type, true, cl), l); + add(((Class<T>) Class.forName((String) type, true, cl)), (T) l); } } } diff --git a/javax/swing/plaf/basic/BasicDirectoryModel.java b/javax/swing/plaf/basic/BasicDirectoryModel.java index ed916cb5f..de82bd47b 100644 --- a/javax/swing/plaf/basic/BasicDirectoryModel.java +++ b/javax/swing/plaf/basic/BasicDirectoryModel.java @@ -381,7 +381,7 @@ public class BasicDirectoryModel extends AbstractListModel * * @return a Vector */ - public Vector getDirectories() + public Vector<File> getDirectories() { // Synchronize this with the UpdateSwingRequest for the case when // contents is modified. @@ -418,7 +418,7 @@ public class BasicDirectoryModel extends AbstractListModel * * @return a Vector */ - public Vector getFiles() + public Vector<File> getFiles() { synchronized (contents) { @@ -562,7 +562,7 @@ public class BasicDirectoryModel extends AbstractListModel * * @param v The Vector to sort. */ - protected void sort(Vector v) + protected void sort(Vector<? extends File> v) { Collections.sort(v, comparator); } diff --git a/javax/swing/plaf/basic/BasicFileChooserUI.java b/javax/swing/plaf/basic/BasicFileChooserUI.java index dfe76ba0c..e1f8e4b28 100644 --- a/javax/swing/plaf/basic/BasicFileChooserUI.java +++ b/javax/swing/plaf/basic/BasicFileChooserUI.java @@ -183,7 +183,7 @@ public class BasicFileChooserUI extends FileChooserUI protected class BasicFileView extends FileView { /** Storage for cached icons. */ - protected Hashtable iconCache = new Hashtable(); + protected Hashtable<File, Icon> iconCache = new Hashtable<File, Icon>(); /** * Creates a new instance. diff --git a/javax/swing/plaf/basic/BasicListUI.java b/javax/swing/plaf/basic/BasicListUI.java index 493fc0578..befc22736 100644 --- a/javax/swing/plaf/basic/BasicListUI.java +++ b/javax/swing/plaf/basic/BasicListUI.java @@ -921,7 +921,7 @@ public class BasicListUI extends ListUI */ protected void maybeUpdateLayoutState() { - if (updateLayoutStateNeeded != 0) + if (updateLayoutStateNeeded != 0 || !list.isValid()) { updateLayoutState(); updateLayoutStateNeeded = 0; diff --git a/javax/swing/plaf/basic/BasicTreeUI.java b/javax/swing/plaf/basic/BasicTreeUI.java index 2c8c1e0b7..5b0ffce09 100644 --- a/javax/swing/plaf/basic/BasicTreeUI.java +++ b/javax/swing/plaf/basic/BasicTreeUI.java @@ -195,7 +195,7 @@ public class BasicTreeUI protected AbstractLayoutCache treeState; /** Used for minimizing the drawing of vertical lines. */ - protected Hashtable drawingCache; + protected Hashtable<TreePath, Boolean> drawingCache; /** * True if doing optimizations for a largeModel. Subclasses that don't support diff --git a/javax/swing/plaf/metal/MetalButtonListener.java b/javax/swing/plaf/metal/MetalButtonListener.java new file mode 100644 index 000000000..f2f778f95 --- /dev/null +++ b/javax/swing/plaf/metal/MetalButtonListener.java @@ -0,0 +1,74 @@ +/* MetalButtonListener.java + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.plaf.metal; + +import java.beans.PropertyChangeEvent; + +import javax.swing.AbstractButton; +import javax.swing.plaf.basic.BasicButtonListener; + +/** + * A listener for buttons under the {@link MetalLookAndFeel}. + * + * @see MetalButtonUI#createButtonListener + */ +class MetalButtonListener extends BasicButtonListener +{ + + /** + * Creates a new instance. + * + * @param button the button. + */ + public MetalButtonListener(AbstractButton button) + { + super(button); + } + + /** + * Handles property change events. + * + * @param e the event. + */ + public void propertyChange(PropertyChangeEvent e) + { + super.propertyChange(e); + // TODO: What should be done here? + } +} diff --git a/javax/swing/plaf/metal/MetalLookAndFeel.java b/javax/swing/plaf/metal/MetalLookAndFeel.java index 651fcdfaa..a9a679093 100644 --- a/javax/swing/plaf/metal/MetalLookAndFeel.java +++ b/javax/swing/plaf/metal/MetalLookAndFeel.java @@ -1203,7 +1203,7 @@ public class MetalLookAndFeel extends BasicLookAndFeel "TabbedPane.tabAreaBackground", getControl(), // overridden in OceanTheme "TabbedPane.tabAreaInsets", new InsetsUIResource(4, 2, 0, 6), // dito "TabbedPane.tabInsets", new InsetsUIResource(0, 9, 1, 9), - + // new properties in OceanTheme: // TabbedPane.contentAreaColor // TabbedPane.unselectedBackground diff --git a/javax/swing/plaf/synth/SynthLookAndFeel.java b/javax/swing/plaf/synth/SynthLookAndFeel.java index 1a2489e7e..46a95f098 100644 --- a/javax/swing/plaf/synth/SynthLookAndFeel.java +++ b/javax/swing/plaf/synth/SynthLookAndFeel.java @@ -216,9 +216,7 @@ public class SynthLookAndFeel * @throws IllegalArgumentException if one of the parameters is * <code>null</code> */ - // FIXME: The signature in the JDK has a Class<?> here. Should be fixed as - // soon as we switch to the generics branch. - public void load(InputStream in, Class resourceBase) + public void load(InputStream in, Class<?> resourceBase) throws ParseException, IllegalArgumentException, NotImplementedException { // FIXME: Implement this correctly. diff --git a/javax/swing/table/AbstractTableModel.java b/javax/swing/table/AbstractTableModel.java index 7914e0b3f..66b6a0743 100644 --- a/javax/swing/table/AbstractTableModel.java +++ b/javax/swing/table/AbstractTableModel.java @@ -125,7 +125,7 @@ public abstract class AbstractTableModel implements TableModel, Serializable * * @return The class. */ - public Class getColumnClass(int columnIndex) + public Class<?> getColumnClass(int columnIndex) { return Object.class; } @@ -294,7 +294,7 @@ public abstract class AbstractTableModel implements TableModel, Serializable * * @return An array of listeners (possibly empty). */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } diff --git a/javax/swing/table/DefaultTableColumnModel.java b/javax/swing/table/DefaultTableColumnModel.java index 33e68ea9f..e4e7201b1 100644 --- a/javax/swing/table/DefaultTableColumnModel.java +++ b/javax/swing/table/DefaultTableColumnModel.java @@ -71,7 +71,7 @@ public class DefaultTableColumnModel /** * Storage for the table columns. */ - protected Vector tableColumns; + protected Vector<TableColumn> tableColumns; /** * A selection model that keeps track of column selections. @@ -187,7 +187,7 @@ public class DefaultTableColumnModel throw new IllegalArgumentException("Index 'i' out of range."); if (j < 0 || j >= columnCount) throw new IllegalArgumentException("Index 'j' out of range."); - Object column = tableColumns.remove(i); + TableColumn column = tableColumns.remove(i); tableColumns.add(j, column); fireColumnMoved(new TableColumnModelEvent(this, i, j)); } @@ -221,7 +221,7 @@ public class DefaultTableColumnModel * * @return An enumeration of the columns in the model. */ - public Enumeration getColumns() + public Enumeration<TableColumn> getColumns() { return tableColumns.elements(); } @@ -597,7 +597,7 @@ public class DefaultTableColumnModel * @return An array containing the listeners (of the specified type) that * are registered with this model. */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } diff --git a/javax/swing/table/TableColumnModel.java b/javax/swing/table/TableColumnModel.java index 986c02533..7e8a70c3a 100644 --- a/javax/swing/table/TableColumnModel.java +++ b/javax/swing/table/TableColumnModel.java @@ -102,7 +102,7 @@ public interface TableColumnModel * * @return An enumeration of the columns in the model. */ - Enumeration getColumns(); + Enumeration<TableColumn> getColumns(); /** * Returns the index of the {@link TableColumn} with the given identifier. diff --git a/javax/swing/table/TableModel.java b/javax/swing/table/TableModel.java index 016ae171d..7629fa4e4 100644 --- a/javax/swing/table/TableModel.java +++ b/javax/swing/table/TableModel.java @@ -84,7 +84,7 @@ public interface TableModel * * @return The class. */ - Class getColumnClass(int columnIndex); + Class<?> getColumnClass(int columnIndex); /** * Returns <code>true</code> if the cell is editable, and <code>false</code> diff --git a/javax/swing/text/AbstractDocument.java b/javax/swing/text/AbstractDocument.java index b52c76363..eead8de52 100644 --- a/javax/swing/text/AbstractDocument.java +++ b/javax/swing/text/AbstractDocument.java @@ -467,7 +467,7 @@ public abstract class AbstractDocument implements Document, Serializable * * @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 @@ public abstract class AbstractDocument implements Document, Serializable * * @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 @@ public abstract class AbstractDocument implements Document, Serializable * * @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 @@ public abstract class AbstractDocument implements Document, Serializable * @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 @@ public abstract class AbstractDocument implements Document, Serializable * * @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 @@ public abstract class AbstractDocument implements Document, Serializable * * @return the names of the attributes of this element */ - public Enumeration getAttributeNames() + public Enumeration<?> getAttributeNames() { return attributes.getAttributeNames(); } diff --git a/javax/swing/text/AttributeSet.java b/javax/swing/text/AttributeSet.java index 01d148c06..2d39881c2 100644 --- a/javax/swing/text/AttributeSet.java +++ b/javax/swing/text/AttributeSet.java @@ -158,7 +158,7 @@ public interface AttributeSet * @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>. diff --git a/javax/swing/text/DefaultCaret.java b/javax/swing/text/DefaultCaret.java index d3d96ba60..c4c2580c3 100644 --- a/javax/swing/text/DefaultCaret.java +++ b/javax/swing/text/DefaultCaret.java @@ -804,7 +804,7 @@ public class DefaultCaret extends Rectangle } } } - + private void handleHighlight() { Highlighter highlighter = textComponent.getHighlighter(); @@ -946,7 +946,7 @@ public class DefaultCaret extends Rectangle * * @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); } diff --git a/javax/swing/text/DefaultFormatter.java b/javax/swing/text/DefaultFormatter.java index ce3686586..bf7c02a00 100644 --- a/javax/swing/text/DefaultFormatter.java +++ b/javax/swing/text/DefaultFormatter.java @@ -330,7 +330,7 @@ public class DefaultFormatter extends JFormattedTextField.AbstractFormatter * * @return the class that is used for values */ - public Class getValueClass() + public Class<?> getValueClass() { return valueClass; } @@ -342,7 +342,7 @@ public class DefaultFormatter extends JFormattedTextField.AbstractFormatter * * @see #getValueClass() */ - public void setValueClass(Class valueClass) + public void setValueClass(Class<?> valueClass) { this.valueClass = valueClass; } diff --git a/javax/swing/text/DefaultStyledDocument.java b/javax/swing/text/DefaultStyledDocument.java index 015b09ca0..3156ca67f 100644 --- a/javax/swing/text/DefaultStyledDocument.java +++ b/javax/swing/text/DefaultStyledDocument.java @@ -2377,7 +2377,7 @@ public class DefaultStyledDocument extends AbstractDocument implements * * @return an enumeration of all style names */ - public Enumeration getStyleNames() + public Enumeration<?> getStyleNames() { StyleContext context = (StyleContext) getAttributeContext(); return context.getStyleNames(); diff --git a/javax/swing/text/MutableAttributeSet.java b/javax/swing/text/MutableAttributeSet.java index 3728b9ce1..5dd2406a3 100644 --- a/javax/swing/text/MutableAttributeSet.java +++ b/javax/swing/text/MutableAttributeSet.java @@ -90,7 +90,7 @@ public interface MutableAttributeSet extends AttributeSet * @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 diff --git a/javax/swing/text/SimpleAttributeSet.java b/javax/swing/text/SimpleAttributeSet.java index cdd3a7ee7..701fa8a7c 100644 --- a/javax/swing/text/SimpleAttributeSet.java +++ b/javax/swing/text/SimpleAttributeSet.java @@ -261,7 +261,7 @@ public class SimpleAttributeSet * * @return An enumeration of the attribute names. */ - public Enumeration getAttributeNames() + public Enumeration<?> getAttributeNames() { return tab.keys(); } @@ -375,7 +375,7 @@ public class SimpleAttributeSet * @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()) { diff --git a/javax/swing/text/StyleContext.java b/javax/swing/text/StyleContext.java index 238fabb9d..4dded0d04 100644 --- a/javax/swing/text/StyleContext.java +++ b/javax/swing/text/StyleContext.java @@ -121,7 +121,7 @@ public class StyleContext 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 @@ public class StyleContext return attributes.getAttributeCount(); } - public Enumeration getAttributeNames() + public Enumeration<?> getAttributeNames() { return attributes.getAttributeNames(); } @@ -210,7 +210,7 @@ public class StyleContext fireStateChanged(); } - public void removeAttributes(Enumeration names) + public void removeAttributes(Enumeration<?> names) { attributes = StyleContext.this.removeAttributes(attributes, names); fireStateChanged(); @@ -351,7 +351,7 @@ public class StyleContext return attrs.length / 2; } - public Enumeration getAttributeNames() + public Enumeration<?> getAttributeNames() { return new Enumeration() { @@ -539,7 +539,7 @@ public class StyleContext * 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 class StyleContext } public synchronized AttributeSet removeAttributes(AttributeSet old, - Enumeration names) + Enumeration<?> names) { AttributeSet ret; if (old.getAttributeCount() <= getCompressionThreshold()) diff --git a/javax/swing/text/TextAction.java b/javax/swing/text/TextAction.java index 7a27f21f6..49c49cb9d 100644 --- a/javax/swing/text/TextAction.java +++ b/javax/swing/text/TextAction.java @@ -96,7 +96,7 @@ public abstract class TextAction extends AbstractAction */ 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 @@ public abstract class TextAction extends AbstractAction 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 @@ public abstract class TextAction extends AbstractAction 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; + } /** diff --git a/javax/swing/text/html/CSSParser.java b/javax/swing/text/html/CSSParser.java new file mode 100644 index 000000000..0bf76eb80 --- /dev/null +++ b/javax/swing/text/html/CSSParser.java @@ -0,0 +1,568 @@ +/* CSSParser.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.html; + +import java.io.*; + +/** + * Parses a CSS document. This works by way of a delegate that implements the + * CSSParserCallback interface. The delegate is notified of the following + * events: + * - Import statement: handleImport + * - Selectors handleSelector. This is invoked for each string. For example if + * the Reader contained p, bar , a {}, the delegate would be notified 4 times, + * for 'p,' 'bar' ',' and 'a'. + * - When a rule starts, startRule + * - Properties in the rule via the handleProperty. This + * is invoked one per property/value key, eg font size: foo;, would cause the + * delegate to be notified once with a value of 'font size'. + * - Values in the rule via the handleValue, this is notified for the total value. + * - When a rule ends, endRule + * + * @author Lillian Angel (langel@redhat.com) + */ +class CSSParser +{ + + /** + * Receives all information about the CSS document structure while parsing it. + * The methods are invoked by parser. + */ + static interface CSSParserCallback + { + /** + * Handles the import statment in the document. + * + * @param imp - the import string + */ + public abstract void handleImport(String imp); + + /** + * Called when the start of a rule is encountered. + */ + public abstract void startRule(); + + /** + * Called when the end of a rule is encountered. + */ + public abstract void endRule(); + + /** + * Handles the selector of a rule. + * + * @param selector - the selector in the rule + */ + public abstract void handleSelector(String selector); + + /** + * Handles the properties in the document. + * + * @param property - the property in the document. + */ + public abstract void handleProperty(String property); + + /** + * Handles the values in the document. + * + * @param value - the value to handle. + */ + public abstract void handleValue(String value); + + } + + /** + * The identifier of the rule. + */ + private static final int IDENTIFIER = 1; + + /** + * The open bracket. + */ + private static final int BRACKET_OPEN = 2; + + /** + * The close bracket. + */ + private static final int BRACKET_CLOSE = 3; + + /** + * The open brace. + */ + private static final int BRACE_OPEN = 4; + + /** + * The close brace. + */ + private static final int BRACE_CLOSE = 5; + + /** + * The open parentheses. + */ + private static final int PAREN_OPEN = 6; + + /** + * The close parentheses. + */ + private static final int PAREN_CLOSE = 7; + + /** + * The end of the document. + */ + private static final int END = -1; + + /** + * The character mapping in the document. + */ + // FIXME: What is this used for? + private static final char[] charMapping = null; + + /** + * Set to true if one character has been read ahead. + */ + private boolean didPushChar; + + /** + * The read ahead character. + */ + private int pushedChar; + + /** + * Temporary place to hold identifiers. + */ + private StringBuffer unitBuffer; + + /** + * Used to indicate blocks. + */ + private int[] unitStack; + + /** + * Number of valid blocks. + */ + private int stackCount; + + /** + * Holds the incoming CSS rules. + */ + private Reader reader; + + /** + * Set to true when the first non @ rule is encountered. + */ + private boolean encounteredRuleSet; + + /** + * The call back used to parse. + */ + private CSSParser.CSSParserCallback callback; + + /** + * nextToken() inserts the string here. + */ + private char[] tokenBuffer; + + /** + * Current number of chars in tokenBufferLength. + */ + private int tokenBufferLength; + + /** + * Set to true if any whitespace is read. + */ + private boolean readWS; + + /** + * Constructor + */ + CSSParser() + { + unitBuffer = new StringBuffer(); + tokenBuffer = new char[10]; + } + + /** + * Appends a character to the token buffer. + * + * @param c - the character to append + */ + private void append(char c) + { + if (tokenBuffer.length >= tokenBufferLength) + { + char[] temp = new char[tokenBufferLength * 2]; + if (tokenBuffer != null) + System.arraycopy(tokenBuffer, 0, temp, 0, tokenBufferLength); + + temp[tokenBufferLength] = c; + tokenBuffer = temp; + } + else + tokenBuffer[tokenBufferLength] = c; + tokenBufferLength++; + } + + /** + * Fetches the next token. + * + * @param c - the character to fetch. + * @return the location + * @throws IOException - any i/o error encountered while reading + */ + private int nextToken(char c) throws IOException + { + readWS = false; + int next = readWS(); + + switch (next) + { + case '\"': + if (tokenBufferLength > 0) + tokenBufferLength--; + return IDENTIFIER; + case '\'': + if (tokenBufferLength > 0) + tokenBufferLength--; + return IDENTIFIER; + case '(': + return PAREN_OPEN; + case ')': + return PAREN_CLOSE; + case '{': + return BRACE_OPEN; + case '}': + return BRACE_CLOSE; + case '[': + return BRACKET_OPEN; + case ']': + return BRACKET_CLOSE; + case -1: + return END; + default: + pushChar(next); + getIdentifier(c); + return IDENTIFIER; + } + } + + /** + * Reads a character from the stream. + * + * @return the number of characters read or -1 if end of stream is reached. + * @throws IOException - any i/o encountered while reading + */ + private int readChar() throws IOException + { + if (didPushChar) + { + didPushChar = false; + return pushedChar; + } + return reader.read(); + } + + /** + * Parses the the contents of the reader using the + * callback. + * + * @param reader - the reader to read from + * @param callback - the callback instance + * @param parsingDeclaration - true if parsing a declaration + * @throws IOException - any i/o error from the reader + */ + void parse(Reader reader, CSSParser.CSSParserCallback callback, + boolean parsingDeclaration) + throws IOException + { + this.reader = reader; + this.callback = callback; + + try + { + if (!parsingDeclaration) + while(getNextStatement()); + else + parseDeclarationBlock(); + } + catch (IOException ioe) + { + // Nothing to do here. + } + } + + /** + * Skips any white space, returning the character after the white space. + * + * @return the character after the whitespace + * @throws IOException - any i/o error from the reader + */ + private int readWS() throws IOException + { + int next = readChar(); + while (Character.isWhitespace((char) next)) + { + readWS = true; + int tempNext = readChar(); + if (tempNext == END) + return next; + next = tempNext; + } + + // Its all whitespace + return END; + } + + /** + * Gets the next statement, returning false if the end is reached. + * A statement is either an At-rule, or a ruleset. + * + * @return false if the end is reached + * @throws IOException - any i/o error from the reader + */ + private boolean getNextStatement() throws IOException + { + int c = nextToken((char) 0); + switch (c) + { + case PAREN_OPEN: + case BRACE_OPEN: + case BRACKET_OPEN: + parseTillClosed(c); + break; + case BRACKET_CLOSE: + case BRACE_CLOSE: + case PAREN_CLOSE: + throw new IOException("Not a proper statement."); + case IDENTIFIER: + if (tokenBuffer[0] == ('@')) + parseAtRule(); + else + parseRuleSet(); + break; + case END: + return false; + } + return true; + } + + /** + * Parses an @ rule, stopping at a matching brace pair, or ;. + * + * @throws IOException - any i/o error from the reader + */ + private void parseAtRule() throws IOException + { + // An At-Rule begins with the "@" character followed immediately by a keyword. + // Following the keyword separated by a space is an At-rule statement appropriate + // to the At-keyword used. If the At-Rule is a simple declarative statement + // (charset, import, fontdef), it is terminated by a semi-colon (";".) + // If the At-Rule is a conditional or informative statement (media, page, font-face), + // it is followed by optional arguments and then a style declaration block inside matching + // curly braces ("{", "}".) At-Rules are sometimes nestable, depending on the context. + // If any part of an At-Rule is not understood, it should be ignored. + + // FIXME: Not Implemented + // call handleimport + } + + /** + * Parses the next rule set, which is a selector followed by a declaration + * block. + * + * @throws IOException - any i/o error from the reader + */ + private void parseRuleSet() throws IOException + { + // call parseDeclarationBlock + // call parse selectors + // call parse identifiers + // call startrule/endrule + // FIXME: Not Implemented + } + + /** + * Parses a set of selectors, returning false if the end of the stream is + * reached. + * + * @return false if the end of stream is reached + * @throws IOException - any i/o error from the reader + */ + private boolean parseSelectors() throws IOException + { + // FIXME: Not Implemented + // call handleselector + return false; + } + + /** + * Parses a declaration block. Which a number of declarations followed by a + * })]. + * + * @throws IOException - any i/o error from the reader + */ + private void parseDeclarationBlock() throws IOException + { + // call parseDeclaration + // FIXME: Not Implemented + } + + /** + * Parses a single declaration, which is an identifier a : and another identifier. + * This returns the last token seen. + * + * @returns the last token + * @throws IOException - any i/o error from the reader + */ + private int parseDeclaration() throws IOException + { + // call handleValue + // FIXME: Not Implemented + return 0; + } + + /** + * Parses identifiers until c is encountered, returning the ending token, + * which will be IDENTIFIER if c is found. + * + * @param c - the stop character + * @param wantsBlocks - true if blocks are wanted + * @return the ending token + * @throws IOException - any i/o error from the reader + */ + private int parseIdentifiers(char c, boolean wantsBlocks) throws IOException + { + // FIXME: Not implemented + // call handleproperty? + return 0; + } + + /** + * Parses till a matching block close is encountered. This is only appropriate + * to be called at the top level (no nesting). + * + * @param i - FIXME + * @throws IOException - any i/o error from the reader + */ + private void parseTillClosed(int i) throws IOException + { + // FIXME: Not Implemented + } + + /** + * Gets an identifier, returning true if the length of the string is greater + * than 0, stopping when c, whitespace, or one of {}()[] is hit. + * + * @param c - the stop character + * @return returns true if the length of the string > 0 + * @throws IOException - any i/o error from the reader + */ + private boolean getIdentifier(char c) throws IOException + { + // FIXME: Not Implemented + return false; + } + + /** + * Reads till c is encountered, escaping characters as necessary. + * + * @param c - the stop character + * @throws IOException - any i/o error from the reader + */ + private void readTill(char c) throws IOException + { + // FIXME: Not Implemented + } + + /** + * Parses a comment block. + * + * @throws IOException - any i/o error from the reader + */ + private void readComment() throws IOException + { + // Should ignore comments. Read until end of comment. + // FIXME: Not implemented + } + + /** + * Called when a block start is encountered ({[. + * + * @param start of block + */ + private void startBlock(int start) + { + // FIXME: Not Implemented + } + + /** + * Called when an end block is encountered )]} + * + * @param end of block + */ + private void endBlock(int end) + { + // FIXME: Not Implemented + } + + /** + * Checks if currently in a block. + * + * @return true if currently in a block. + */ + private boolean inBlock() + { + // FIXME: Not Implemented + return false; + } + + /** + * Supports one character look ahead, this will throw if called twice in a row. + * + * @param c - the character to push. + * @throws IOException - if called twice in a row + */ + private void pushChar(int c) throws IOException + { + if (didPushChar) + throw new IOException("pushChar called twice."); + didPushChar = true; + pushedChar = c; + } +} + +
\ No newline at end of file diff --git a/javax/swing/text/html/HTML.java b/javax/swing/text/html/HTML.java index 29e6335a0..93c05daa2 100644 --- a/javax/swing/text/html/HTML.java +++ b/javax/swing/text/html/HTML.java @@ -1129,8 +1129,8 @@ public class HTML 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 @@ public class HTML if (attrMap == null) { // Create the map on demand. - attrMap = new TreeMap(); + attrMap = new TreeMap<String,Attribute>(); Attribute[] attrs = getAllAttributeKeys(); @@ -1179,7 +1179,7 @@ public class HTML } } - return (Attribute) attrMap.get(attName.toLowerCase()); + return attrMap.get(attName.toLowerCase()); } /** @@ -1238,7 +1238,7 @@ public class HTML if (tagMap == null) { // Create the mao on demand. - tagMap = new TreeMap(); + tagMap = new TreeMap<String,Tag>(); Tag[] tags = getAllTags(); @@ -1248,6 +1248,6 @@ public class HTML } } - return (Tag) tagMap.get(tagName.toLowerCase()); + return tagMap.get(tagName.toLowerCase()); } } diff --git a/javax/swing/text/html/HTMLDocument.java b/javax/swing/text/html/HTMLDocument.java index 05a250da3..f3d3ce3fa 100644 --- a/javax/swing/text/html/HTMLDocument.java +++ b/javax/swing/text/html/HTMLDocument.java @@ -649,12 +649,12 @@ public class HTMLDocument extends DefaultStyledDocument */ 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 @@ public class HTMLDocument extends DefaultStyledDocument 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 @@ public class HTMLDocument extends DefaultStyledDocument 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; diff --git a/javax/swing/text/html/StyleSheet.java b/javax/swing/text/html/StyleSheet.java index cb10ac1c5..01f19fd7b 100644 --- a/javax/swing/text/html/StyleSheet.java +++ b/javax/swing/text/html/StyleSheet.java @@ -870,10 +870,10 @@ public class StyleSheet extends StyleContext * @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); + return super.removeAttributes(old, names); } /** diff --git a/javax/swing/text/html/parser/AttributeList.java b/javax/swing/text/html/parser/AttributeList.java index 5bca0bfa7..d48266d47 100644 --- a/javax/swing/text/html/parser/AttributeList.java +++ b/javax/swing/text/html/parser/AttributeList.java @@ -122,7 +122,7 @@ public final class AttributeList * 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 @@ public final class AttributeList * 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 @@ public final class AttributeList /** * Get the allowed values of this attribute. */ - public Enumeration getValues() + public Enumeration<?> getValues() { return values.elements(); } diff --git a/javax/swing/text/html/parser/ContentModel.java b/javax/swing/text/html/parser/ContentModel.java index 70e9c2acb..d5c4418de 100644 --- a/javax/swing/text/html/parser/ContentModel.java +++ b/javax/swing/text/html/parser/ContentModel.java @@ -151,13 +151,15 @@ public final class ContentModel * 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; } } diff --git a/javax/swing/text/html/parser/DTD.java b/javax/swing/text/html/parser/DTD.java index 16bc5b0d6..ae3c184f1 100644 --- a/javax/swing/text/html/parser/DTD.java +++ b/javax/swing/text/html/parser/DTD.java @@ -88,7 +88,7 @@ public class DTD /** * 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 @@ public class DTD /** * 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 @@ public class DTD * 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 @@ public class DTD 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 class DTD */ 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 @@ public class DTD 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 @@ public class DTD */ private Element newElement(String name) { - Element e = (Element) elementHash.get(name.toLowerCase()); + Element e = elementHash.get(name.toLowerCase()); if (e == null) { diff --git a/javax/swing/tree/AbstractLayoutCache.java b/javax/swing/tree/AbstractLayoutCache.java index d674a8a05..4a6899fbe 100644 --- a/javax/swing/tree/AbstractLayoutCache.java +++ b/javax/swing/tree/AbstractLayoutCache.java @@ -344,7 +344,7 @@ public abstract class AbstractLayoutCache * * @return Enumeration */ - public abstract Enumeration getVisiblePathsFrom(TreePath path); + public abstract Enumeration<TreePath> getVisiblePathsFrom(TreePath path); /** * getVisibleChildCount diff --git a/javax/swing/tree/DefaultMutableTreeNode.java b/javax/swing/tree/DefaultMutableTreeNode.java index 6951b9600..9f587946f 100644 --- a/javax/swing/tree/DefaultMutableTreeNode.java +++ b/javax/swing/tree/DefaultMutableTreeNode.java @@ -67,7 +67,7 @@ public class DefaultMutableTreeNode * An empty enumeration, returned by {@link #children()} if a node has no * children. */ - public static final Enumeration EMPTY_ENUMERATION = + public static final Enumeration<TreeNode> EMPTY_ENUMERATION = EmptyEnumeration.getInstance(); /** @@ -78,7 +78,7 @@ public class DefaultMutableTreeNode /** * The child nodes for this node (may be empty). */ - protected Vector children = new Vector(); + protected Vector<MutableTreeNode> children = new Vector<MutableTreeNode>(); /** * userObject @@ -480,7 +480,7 @@ public class DefaultMutableTreeNode public TreeNode getSharedAncestor(DefaultMutableTreeNode node) { TreeNode current = this; - ArrayList list = new ArrayList(); + ArrayList<TreeNode> list = new ArrayList<TreeNode>(); while (current != null) { @@ -527,7 +527,7 @@ public class DefaultMutableTreeNode || children.size() == 0) return 0; - Stack stack = new Stack(); + Stack<Integer> stack = new Stack<Integer>(); stack.push(new Integer(0)); TreeNode node = getChildAt(0); int depth = 0; @@ -765,7 +765,7 @@ public class DefaultMutableTreeNode throw new IllegalArgumentException(); TreeNode parent = this; - Vector nodes = new Vector(); + Vector<TreeNode> nodes = new Vector<TreeNode>(); nodes.add(this); while (parent != node && parent != null) @@ -1148,7 +1148,7 @@ public class DefaultMutableTreeNode static class PostorderEnumeration implements Enumeration { - Stack nodes = new Stack(); + Stack<TreeNode> nodes = new Stack<TreeNode>(); Stack childrenEnums = new Stack(); PostorderEnumeration(TreeNode node) diff --git a/javax/swing/tree/DefaultTreeModel.java b/javax/swing/tree/DefaultTreeModel.java index 639d861fb..afee7ea22 100644 --- a/javax/swing/tree/DefaultTreeModel.java +++ b/javax/swing/tree/DefaultTreeModel.java @@ -615,7 +615,7 @@ public class DefaultTreeModel * * @since 1.3 */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } diff --git a/javax/swing/tree/DefaultTreeSelectionModel.java b/javax/swing/tree/DefaultTreeSelectionModel.java index 734d899bb..3d9c67728 100644 --- a/javax/swing/tree/DefaultTreeSelectionModel.java +++ b/javax/swing/tree/DefaultTreeSelectionModel.java @@ -776,7 +776,7 @@ public class DefaultTreeSelectionModel * @return an array of listeners * @since 1.3 */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } diff --git a/javax/swing/tree/FixedHeightLayoutCache.java b/javax/swing/tree/FixedHeightLayoutCache.java index a699a6c9f..dff9298e8 100644 --- a/javax/swing/tree/FixedHeightLayoutCache.java +++ b/javax/swing/tree/FixedHeightLayoutCache.java @@ -480,7 +480,7 @@ public class FixedHeightLayoutCache * @param parentPath the parent path * @return the enumeration over pathes */ - public Enumeration getVisiblePathsFrom(TreePath parentPath) + public Enumeration<TreePath> getVisiblePathsFrom(TreePath parentPath) { if (dirty) update(); diff --git a/javax/swing/tree/VariableHeightLayoutCache.java b/javax/swing/tree/VariableHeightLayoutCache.java index 408c220a7..8c70c13af 100644 --- a/javax/swing/tree/VariableHeightLayoutCache.java +++ b/javax/swing/tree/VariableHeightLayoutCache.java @@ -494,7 +494,7 @@ public class VariableHeightLayoutCache * @param parentPath the parent path * @return the enumeration over pathes */ - public Enumeration getVisiblePathsFrom(TreePath parentPath) + public Enumeration<TreePath> getVisiblePathsFrom(TreePath parentPath) { if (dirty) update(); diff --git a/javax/swing/undo/CompoundEdit.java b/javax/swing/undo/CompoundEdit.java index e1cfbb619..fbff2a264 100644 --- a/javax/swing/undo/CompoundEdit.java +++ b/javax/swing/undo/CompoundEdit.java @@ -1,5 +1,5 @@ /* CompoundEdit.java -- Combines multiple UndoableEdits. - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -75,7 +75,7 @@ public class CompoundEdit * The <code>UndoableEdit</code>s being combined into a compound * editing action. */ - protected Vector edits; + protected Vector<UndoableEdit> edits; /** @@ -92,7 +92,7 @@ public class CompoundEdit */ public CompoundEdit() { - edits = new Vector(); + edits = new Vector<UndoableEdit>(); inProgress = true; } @@ -118,7 +118,7 @@ public class CompoundEdit super.undo(); for (int i = edits.size() - 1; i >= 0; i--) - ((UndoableEdit) edits.elementAt(i)).undo(); + edits.elementAt(i).undo(); } @@ -143,7 +143,7 @@ public class CompoundEdit super.redo(); for (int i = 0; i < edits.size(); i++) - ((UndoableEdit) edits.elementAt(i)).redo(); + edits.elementAt(i).redo(); } @@ -156,7 +156,7 @@ public class CompoundEdit if (edits.size() == 0) return null; else - return (UndoableEdit) edits.elementAt(edits.size() - 1); + return edits.elementAt(edits.size() - 1); } @@ -172,7 +172,7 @@ public class CompoundEdit public void die() { for (int i = edits.size() - 1; i >= 0; i--) - ((UndoableEdit) edits.elementAt(i)).die(); + edits.elementAt(i).die(); super.die(); } @@ -316,7 +316,7 @@ public class CompoundEdit public boolean isSignificant() { for (int i = edits.size() - 1; i >= 0; i--) - if (((UndoableEdit) edits.elementAt(i)).isSignificant()) + if (edits.elementAt(i).isSignificant()) return true; return false; diff --git a/javax/swing/undo/StateEdit.java b/javax/swing/undo/StateEdit.java index 326abea1f..91fc88faa 100644 --- a/javax/swing/undo/StateEdit.java +++ b/javax/swing/undo/StateEdit.java @@ -121,14 +121,14 @@ public class StateEdit * The state of <code>object</code> at the time of constructing * this <code>StateEdit</code>. */ - protected Hashtable preState; + protected Hashtable<Object, Object> preState; /** * The state of <code>object</code> at the time when {@link #end()} * was called. */ - protected Hashtable postState; + protected Hashtable<Object, Object> postState; /** diff --git a/javax/swing/undo/StateEditable.java b/javax/swing/undo/StateEditable.java index 459025be7..7e6cc9785 100644 --- a/javax/swing/undo/StateEditable.java +++ b/javax/swing/undo/StateEditable.java @@ -100,7 +100,7 @@ public interface StateEditable * @param state a hash table containing the relevant state * information. */ - void restoreState(Hashtable state); + void restoreState(Hashtable<?, ?> state); /** @@ -110,5 +110,5 @@ public interface StateEditable * @param state a hash table for storing relevant state * information. */ - void storeState(Hashtable state); + void storeState(Hashtable<Object, Object> state); } diff --git a/javax/swing/undo/UndoableEditSupport.java b/javax/swing/undo/UndoableEditSupport.java index 6d7bbea07..b5a933419 100644 --- a/javax/swing/undo/UndoableEditSupport.java +++ b/javax/swing/undo/UndoableEditSupport.java @@ -69,7 +69,8 @@ public class UndoableEditSupport /** * The currently registered listeners. */ - protected Vector listeners = new Vector(); + protected Vector<UndoableEditListener> listeners = + new Vector<UndoableEditListener>(); /** @@ -148,7 +149,7 @@ public class UndoableEditSupport public synchronized UndoableEditListener[] getUndoableEditListeners() { UndoableEditListener[] result = new UndoableEditListener[listeners.size()]; - return (UndoableEditListener[]) listeners.toArray(result); + return listeners.toArray(result); } |