diff options
Diffstat (limited to 'libjava/classpath/javax')
24 files changed, 165 insertions, 129 deletions
diff --git a/libjava/classpath/javax/activation/ActivationDataFlavor.java b/libjava/classpath/javax/activation/ActivationDataFlavor.java index 9181209..0ab5a80 100644 --- a/libjava/classpath/javax/activation/ActivationDataFlavor.java +++ b/libjava/classpath/javax/activation/ActivationDataFlavor.java @@ -63,7 +63,7 @@ public class ActivationDataFlavor extends DataFlavor * flavor */ // Raw types enforced as part of spec. - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public ActivationDataFlavor(Class representationClass, String mimeType, String humanPresentableName) { @@ -80,7 +80,7 @@ public class ActivationDataFlavor extends DataFlavor * flavor */ // Raw types enforced as part of spec. - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public ActivationDataFlavor(Class representationClass, String humanPresentableName) { @@ -110,7 +110,7 @@ public class ActivationDataFlavor extends DataFlavor } // Raw types enforced as part of spec. - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public Class getRepresentationClass() { return representationClass; diff --git a/libjava/classpath/javax/activation/MimeTypeParameterList.java b/libjava/classpath/javax/activation/MimeTypeParameterList.java index 3d36ede..24c9486 100644 --- a/libjava/classpath/javax/activation/MimeTypeParameterList.java +++ b/libjava/classpath/javax/activation/MimeTypeParameterList.java @@ -224,7 +224,7 @@ public class MimeTypeParameterList * Returns an enumeration of all the parameter names. */ // Raw type is forced by public spec. - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public synchronized Enumeration getNames() { return new IteratorEnumeration(parameterNames.iterator()); diff --git a/libjava/classpath/javax/management/DefaultLoaderRepository.java b/libjava/classpath/javax/management/DefaultLoaderRepository.java index d331552..d70bf7e 100644 --- a/libjava/classpath/javax/management/DefaultLoaderRepository.java +++ b/libjava/classpath/javax/management/DefaultLoaderRepository.java @@ -78,7 +78,7 @@ import java.util.List; * to load the class. */ // API issue with lack of <?> on Class - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public static Class loadClass(String name) throws ClassNotFoundException { @@ -127,7 +127,7 @@ import java.util.List; * to load the class. */ // API issue with lack of <?> on Class - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public static Class loadClassWithout(ClassLoader exclude, String name) throws ClassNotFoundException { diff --git a/libjava/classpath/javax/management/MBeanConstructorInfo.java b/libjava/classpath/javax/management/MBeanConstructorInfo.java index 509483f..3d5ebda 100644 --- a/libjava/classpath/javax/management/MBeanConstructorInfo.java +++ b/libjava/classpath/javax/management/MBeanConstructorInfo.java @@ -76,7 +76,7 @@ public class MBeanConstructorInfo * @param cons the constructor. */ // API issue with lack of <?> on Constructor - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public MBeanConstructorInfo(String desc, Constructor cons) { super(cons.getName(), desc); diff --git a/libjava/classpath/javax/management/remote/rmi/RMIConnection.java b/libjava/classpath/javax/management/remote/rmi/RMIConnection.java index 434051d..edf8c89 100644 --- a/libjava/classpath/javax/management/remote/rmi/RMIConnection.java +++ b/libjava/classpath/javax/management/remote/rmi/RMIConnection.java @@ -152,7 +152,7 @@ public interface RMIConnection * NotificationFilter, * Object) */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") void addNotificationListener(ObjectName name, ObjectName listener, MarshalledObject filter, MarshalledObject passback, Subject delegationSubject) @@ -224,7 +224,7 @@ public interface RMIConnection * NotificationFilter, * Object) */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") Integer[] addNotificationListeners(ObjectName[] names, MarshalledObject[] filters, Subject[] delegationSubjects) throws InstanceNotFoundException, IOException; @@ -298,7 +298,7 @@ public interface RMIConnection * @throws IOException if an I/O error occurred in communicating with * the bean server. */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") ObjectInstance createMBean(String className, ObjectName name, MarshalledObject params, String[] sig, Subject delegationSubject) @@ -367,7 +367,7 @@ public interface RMIConnection * @throws IOException if an I/O error occurred in communicating with * the bean server. */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, MarshalledObject params, String[] sig, Subject delegationSubject) @@ -767,7 +767,7 @@ public interface RMIConnection * the bean server. * @see DynamicMBean#invoke(String, Object[], String[]) */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") Object invoke(ObjectName bean, String name, MarshalledObject params, String[] sig, Subject delegationSubject) throws InstanceNotFoundException, MBeanException, @@ -871,7 +871,7 @@ public interface RMIConnection * @throws SecurityException if the client or delegated subject (if any) does * not have permission to invoke this operation. */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") Set<ObjectInstance> queryMBeans(ObjectName name, MarshalledObject query, Subject delegationSubject) throws IOException; @@ -914,7 +914,7 @@ public interface RMIConnection * @throws IOException if an I/O error occurred in communicating with * the bean server. */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") Set<ObjectName> queryNames(ObjectName name, MarshalledObject query, Subject delegationSubject) throws IOException; @@ -960,7 +960,7 @@ public interface RMIConnection * NotificationFilter, * Object) */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") void removeNotificationListener(ObjectName name, ObjectName listener, MarshalledObject filter, @@ -1080,7 +1080,7 @@ public interface RMIConnection * @see #getAttribute(ObjectName, String, Subject) * @see javax.management.DynamicMBean#setAttribute(Attribute) */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") void setAttribute(ObjectName name, MarshalledObject attribute, Subject delegationSubject) throws InstanceNotFoundException, AttributeNotFoundException, @@ -1121,7 +1121,7 @@ public interface RMIConnection * @see #getAttributes(ObjectName, String[]) * @see DynamicMBean#setAttributes(AttributeList) */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") AttributeList setAttributes(ObjectName name, MarshalledObject attributes, Subject delegationSubject) throws InstanceNotFoundException, ReflectionException, diff --git a/libjava/classpath/javax/security/sasl/Sasl.java b/libjava/classpath/javax/security/sasl/Sasl.java index 402ad6e..475be09 100644 --- a/libjava/classpath/javax/security/sasl/Sasl.java +++ b/libjava/classpath/javax/security/sasl/Sasl.java @@ -265,6 +265,16 @@ public class Sasl */ public static final String REUSE = "javax.security.sasl.reuse"; + /** + * <p>The name of a property which specifies the credentials to use. + * The value of the property is a mechanism-specific object which can + * be used to supply credentials to a mechanism which provides delegated + * authentication.</p> + * + * <p>The value of this constant is <code>"javax.security.sasl.credentials"</code>.</p> + */ + public static final String CREDENTIALS = "javax.security.sasl.credentials"; + private static final String CLIENT_FACTORY_SVC = "SaslClientFactory."; private static final String SERVER_FACTORY_SVC = "SaslServerFactory."; private static final String ALIAS = "Alg.Alias."; diff --git a/libjava/classpath/javax/sound/midi/MetaMessage.java b/libjava/classpath/javax/sound/midi/MetaMessage.java index 4d43975..0aab153 100644 --- a/libjava/classpath/javax/sound/midi/MetaMessage.java +++ b/libjava/classpath/javax/sound/midi/MetaMessage.java @@ -120,10 +120,12 @@ public class MetaMessage extends MidiMessage // Now compute the length representation long buffer = length & 0x7F; - while ((length >>= 7) > 0) + // Avoid altering length variable; PR42551 + lengthValue = length; + while ((lengthValue >>= 7) > 0) { buffer <<= 8; - buffer |= ((length & 0x7F) | 0x80); + buffer |= ((lengthValue & 0x7F) | 0x80); } // Now store the variable length length value diff --git a/libjava/classpath/javax/sound/midi/MidiDevice.java b/libjava/classpath/javax/sound/midi/MidiDevice.java index 7a0ca7f..7ce22ca 100644 --- a/libjava/classpath/javax/sound/midi/MidiDevice.java +++ b/libjava/classpath/javax/sound/midi/MidiDevice.java @@ -46,6 +46,7 @@ package javax.sound.midi; * */ public interface MidiDevice + extends AutoCloseable { /** * Get the Info object describing this device. diff --git a/libjava/classpath/javax/sound/midi/MidiSystem.java b/libjava/classpath/javax/sound/midi/MidiSystem.java index b273b98..0e36805 100644 --- a/libjava/classpath/javax/sound/midi/MidiSystem.java +++ b/libjava/classpath/javax/sound/midi/MidiSystem.java @@ -1,5 +1,5 @@ /* MidiSystem.java -- Access system MIDI resources - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -76,9 +76,9 @@ public class MidiSystem */ public static MidiDevice.Info[] getMidiDeviceInfo() { - Iterator deviceProviders = + Iterator<MidiDeviceProvider> deviceProviders = ServiceFactory.lookupProviders(MidiDeviceProvider.class); - List infoList = new ArrayList(); + List<MidiDevice.Info> infoList = new ArrayList<MidiDevice.Info>(); while (deviceProviders.hasNext()) { @@ -88,8 +88,7 @@ public class MidiSystem infoList.add(infos[--i]); } - return (MidiDevice.Info[]) - infoList.toArray(new MidiDevice.Info[infoList.size()]); + return infoList.toArray(new MidiDevice.Info[infoList.size()]); } /** @@ -103,7 +102,7 @@ public class MidiSystem public static MidiDevice getMidiDevice(MidiDevice.Info info) throws MidiUnavailableException { - Iterator deviceProviders = + Iterator<MidiDeviceProvider> deviceProviders = ServiceFactory.lookupProviders(MidiDeviceProvider.class); if (! deviceProviders.hasNext()) @@ -216,10 +215,11 @@ public class MidiSystem public static Soundbank getSoundbank(InputStream stream) throws InvalidMidiDataException, IOException { - Iterator readers = ServiceFactory.lookupProviders(SoundbankReader.class); + Iterator<SoundbankReader> readers = + ServiceFactory.lookupProviders(SoundbankReader.class); while (readers.hasNext()) { - SoundbankReader sr = (SoundbankReader) readers.next(); + SoundbankReader sr = readers.next(); Soundbank sb = sr.getSoundbank(stream); if (sb != null) return sb; @@ -238,10 +238,11 @@ public class MidiSystem public static Soundbank getSoundbank(URL url) throws InvalidMidiDataException, IOException { - Iterator readers = ServiceFactory.lookupProviders(SoundbankReader.class); + Iterator<SoundbankReader> readers = + ServiceFactory.lookupProviders(SoundbankReader.class); while (readers.hasNext()) { - SoundbankReader sr = (SoundbankReader) readers.next(); + SoundbankReader sr = readers.next(); Soundbank sb = sr.getSoundbank(url); if (sb != null) return sb; @@ -260,7 +261,8 @@ public class MidiSystem public static Soundbank getSoundbank(File file) throws InvalidMidiDataException, IOException { - Iterator readers = ServiceFactory.lookupProviders(SoundbankReader.class); + Iterator<SoundbankReader> readers = + ServiceFactory.lookupProviders(SoundbankReader.class); while (readers.hasNext()) { SoundbankReader sr = (SoundbankReader) readers.next(); @@ -283,10 +285,11 @@ public class MidiSystem public static MidiFileFormat getMidiFileFormat(InputStream stream) throws InvalidMidiDataException, IOException { - Iterator readers = ServiceFactory.lookupProviders(MidiFileReader.class); + Iterator<MidiFileReader> readers = + ServiceFactory.lookupProviders(MidiFileReader.class); while (readers.hasNext()) { - MidiFileReader sr = (MidiFileReader) readers.next(); + MidiFileReader sr = readers.next(); MidiFileFormat sb = sr.getMidiFileFormat(stream); if (sb != null) return sb; @@ -305,10 +308,11 @@ public class MidiSystem public static MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException { - Iterator readers = ServiceFactory.lookupProviders(MidiFileReader.class); + Iterator<MidiFileReader> readers = + ServiceFactory.lookupProviders(MidiFileReader.class); while (readers.hasNext()) { - MidiFileReader sr = (MidiFileReader) readers.next(); + MidiFileReader sr = readers.next(); MidiFileFormat sb = sr.getMidiFileFormat(url); if (sb != null) return sb; @@ -327,10 +331,11 @@ public class MidiSystem public static MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException { - Iterator readers = ServiceFactory.lookupProviders(MidiFileReader.class); + Iterator<MidiFileReader> readers = + ServiceFactory.lookupProviders(MidiFileReader.class); while (readers.hasNext()) { - MidiFileReader sr = (MidiFileReader) readers.next(); + MidiFileReader sr = readers.next(); MidiFileFormat sb = sr.getMidiFileFormat(file); if (sb != null) return sb; @@ -350,10 +355,11 @@ public class MidiSystem public static Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException { - Iterator readers = ServiceFactory.lookupProviders(MidiFileReader.class); + Iterator<MidiFileReader> readers = + ServiceFactory.lookupProviders(MidiFileReader.class); while (readers.hasNext()) { - MidiFileReader sr = (MidiFileReader) readers.next(); + MidiFileReader sr = readers.next(); Sequence sq = sr.getSequence(stream); if (sq != null) return sq; @@ -372,10 +378,11 @@ public class MidiSystem public static Sequence getSequence(URL url) throws InvalidMidiDataException, IOException { - Iterator readers = ServiceFactory.lookupProviders(MidiFileReader.class); + Iterator<MidiFileReader> readers = + ServiceFactory.lookupProviders(MidiFileReader.class); while (readers.hasNext()) { - MidiFileReader sr = (MidiFileReader) readers.next(); + MidiFileReader sr = readers.next(); Sequence sq = sr.getSequence(url); if (sq != null) return sq; @@ -394,10 +401,11 @@ public class MidiSystem public static Sequence getSequence(File file) throws InvalidMidiDataException, IOException { - Iterator readers = ServiceFactory.lookupProviders(MidiFileReader.class); + Iterator<MidiFileReader> readers = + ServiceFactory.lookupProviders(MidiFileReader.class); while (readers.hasNext()) { - MidiFileReader sr = (MidiFileReader) readers.next(); + MidiFileReader sr = readers.next(); Sequence sq = sr.getSequence(file); if (sq != null) return sq; @@ -417,10 +425,11 @@ public class MidiSystem boolean supported[] = new boolean[3]; // The number of supported formats. int count = 0; - Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class); + Iterator<MidiFileWriter> writers = + ServiceFactory.lookupProviders(MidiFileWriter.class); while (writers.hasNext()) { - MidiFileWriter fw = (MidiFileWriter) writers.next(); + MidiFileWriter fw = writers.next(); int types[] = fw.getMidiFileTypes(); for (int i = types.length; i > 0;) { @@ -449,10 +458,10 @@ public class MidiSystem */ public static boolean isFileTypeSupported(int fileType) { - Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class); + Iterator<MidiFileWriter> writers = ServiceFactory.lookupProviders(MidiFileWriter.class); while (writers.hasNext()) { - MidiFileWriter fw = (MidiFileWriter) writers.next(); + MidiFileWriter fw = writers.next(); if (fw.isFileTypeSupported(fileType)) return true; @@ -473,7 +482,7 @@ public class MidiSystem boolean supported[] = new boolean[3]; // The number of supported formats. int count = 0; - Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class); + Iterator<MidiFileWriter> writers = ServiceFactory.lookupProviders(MidiFileWriter.class); while (writers.hasNext()) { MidiFileWriter fw = (MidiFileWriter) writers.next(); @@ -507,7 +516,7 @@ public class MidiSystem */ public static boolean isFileTypeSupported(int fileType, Sequence sequence) { - Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class); + Iterator<MidiFileWriter> writers = ServiceFactory.lookupProviders(MidiFileWriter.class); while (writers.hasNext()) { MidiFileWriter fw = (MidiFileWriter) writers.next(); @@ -531,7 +540,7 @@ public class MidiSystem public static int write(Sequence in, int fileType, OutputStream out) throws IOException { - Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class); + Iterator<MidiFileWriter> writers = ServiceFactory.lookupProviders(MidiFileWriter.class); while (writers.hasNext()) { MidiFileWriter fw = (MidiFileWriter) writers.next(); @@ -556,7 +565,7 @@ public class MidiSystem public static int write(Sequence in, int fileType, File out) throws IOException { - Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class); + Iterator<MidiFileWriter> writers = ServiceFactory.lookupProviders(MidiFileWriter.class); while (writers.hasNext()) { MidiFileWriter fw = (MidiFileWriter) writers.next(); diff --git a/libjava/classpath/javax/sound/midi/Receiver.java b/libjava/classpath/javax/sound/midi/Receiver.java index bc660d0..535c9df 100644 --- a/libjava/classpath/javax/sound/midi/Receiver.java +++ b/libjava/classpath/javax/sound/midi/Receiver.java @@ -47,6 +47,7 @@ package javax.sound.midi; * */ public interface Receiver + extends AutoCloseable { /** * Send a MIDI message and timestamp. Some receivers don't support diff --git a/libjava/classpath/javax/sound/midi/SoundbankResource.java b/libjava/classpath/javax/sound/midi/SoundbankResource.java index 0b4675b..6c3a4f2 100644 --- a/libjava/classpath/javax/sound/midi/SoundbankResource.java +++ b/libjava/classpath/javax/sound/midi/SoundbankResource.java @@ -1,5 +1,5 @@ /* SoundbankResource.java -- An audio resource from a sound bank - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -49,7 +49,7 @@ public abstract class SoundbankResource { private final Soundbank soundbank; private final String name; - private final Class dataClass; + private final Class<?> dataClass; /** * Create a SoundbankResource object. diff --git a/libjava/classpath/javax/sound/midi/Track.java b/libjava/classpath/javax/sound/midi/Track.java index 550d2e1..9c39257 100644 --- a/libjava/classpath/javax/sound/midi/Track.java +++ b/libjava/classpath/javax/sound/midi/Track.java @@ -1,5 +1,5 @@ /* Track.java -- A track of MIDI events - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -54,10 +54,10 @@ public class Track /** * The list of MidiEvents for this track. */ - Vector events = new Vector(); + Vector<MidiEvent> events = new Vector<MidiEvent>(); // A HashSet to speed processing - private HashSet eventSet = new HashSet(); + private HashSet<MidiEvent> eventSet = new HashSet<MidiEvent>(); // This is only instantiable within this package. Track() @@ -83,7 +83,7 @@ public class Track long targetTick = event.getTick(); int i = events.size() - 1; - while (i >= 0 && (((MidiEvent)events.get(i)).getTick() > targetTick)) + while (i >= 0 && (events.get(i).getTick() > targetTick)) i--; events.add(i+1, event); return true; @@ -127,7 +127,7 @@ public class Track { try { - return (MidiEvent) events.get(index); + return events.get(index); } catch (IndexOutOfBoundsException e) { @@ -158,7 +158,7 @@ public class Track synchronized (events) { int size = events.size(); - return ((MidiEvent) events.get(size - 1)).getTick(); + return events.get(size - 1).getTick(); } } } diff --git a/libjava/classpath/javax/sound/midi/Transmitter.java b/libjava/classpath/javax/sound/midi/Transmitter.java index ab81cc8..2c62795 100644 --- a/libjava/classpath/javax/sound/midi/Transmitter.java +++ b/libjava/classpath/javax/sound/midi/Transmitter.java @@ -47,6 +47,7 @@ package javax.sound.midi; * */ public interface Transmitter + extends AutoCloseable { /** * Set the Receiver to which MIDI events will be sent. diff --git a/libjava/classpath/javax/sound/sampled/AudioSystem.java b/libjava/classpath/javax/sound/sampled/AudioSystem.java index 01133c9..5999521 100644 --- a/libjava/classpath/javax/sound/sampled/AudioSystem.java +++ b/libjava/classpath/javax/sound/sampled/AudioSystem.java @@ -1,5 +1,5 @@ /* Main interface to audio system - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -84,10 +84,10 @@ public class AudioSystem public static AudioFileFormat getAudioFileFormat(File f) throws UnsupportedAudioFileException, IOException { - Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class); + Iterator<AudioFileReader> i = ServiceFactory.lookupProviders(AudioFileReader.class); while (i.hasNext()) { - AudioFileReader reader = (AudioFileReader) i.next(); + AudioFileReader reader = i.next(); try { return reader.getAudioFileFormat(f); @@ -111,10 +111,10 @@ public class AudioSystem public static AudioFileFormat getAudioFileFormat(InputStream is) throws UnsupportedAudioFileException, IOException { - Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class); + Iterator<AudioFileReader> i = ServiceFactory.lookupProviders(AudioFileReader.class); while (i.hasNext()) { - AudioFileReader reader = (AudioFileReader) i.next(); + AudioFileReader reader = i.next(); try { return reader.getAudioFileFormat(is); @@ -138,10 +138,10 @@ public class AudioSystem public static AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException { - Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class); + Iterator<AudioFileReader> i = ServiceFactory.lookupProviders(AudioFileReader.class); while (i.hasNext()) { - AudioFileReader reader = (AudioFileReader) i.next(); + AudioFileReader reader = i.next(); try { return reader.getAudioFileFormat(url); @@ -162,10 +162,10 @@ public class AudioSystem { HashSet<AudioFileFormat.Type> result = new HashSet<AudioFileFormat.Type>(); - Iterator i = ServiceFactory.lookupProviders(AudioFileWriter.class); + Iterator<AudioFileWriter> i = ServiceFactory.lookupProviders(AudioFileWriter.class); while (i.hasNext()) { - AudioFileWriter writer = (AudioFileWriter) i.next(); + AudioFileWriter writer = i.next(); AudioFileFormat.Type[] types = writer.getAudioFileTypes(); for (int j = 0; j < types.length; ++j) result.add(types[j]); @@ -183,10 +183,10 @@ public class AudioSystem { HashSet<AudioFileFormat.Type> result = new HashSet<AudioFileFormat.Type>(); - Iterator i = ServiceFactory.lookupProviders(AudioFileWriter.class); + Iterator<AudioFileWriter> i = ServiceFactory.lookupProviders(AudioFileWriter.class); while (i.hasNext()) { - AudioFileWriter writer = (AudioFileWriter) i.next(); + AudioFileWriter writer = i.next(); AudioFileFormat.Type[] types = writer.getAudioFileTypes(ais); for (int j = 0; j < types.length; ++j) result.add(types[j]); @@ -206,10 +206,11 @@ public class AudioSystem public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targ, AudioInputStream ais) { - Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class); + Iterator<FormatConversionProvider> i = + ServiceFactory.lookupProviders(FormatConversionProvider.class); while (i.hasNext()) { - FormatConversionProvider prov = (FormatConversionProvider) i.next(); + FormatConversionProvider prov = i.next(); if (! prov.isConversionSupported(targ, ais.getFormat())) continue; return prov.getAudioInputStream(targ, ais); @@ -229,10 +230,11 @@ public class AudioSystem public static AudioInputStream getAudioInputStream(AudioFormat targ, AudioInputStream ais) { - Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class); + Iterator<FormatConversionProvider> i = + ServiceFactory.lookupProviders(FormatConversionProvider.class); while (i.hasNext()) { - FormatConversionProvider prov = (FormatConversionProvider) i.next(); + FormatConversionProvider prov = i.next(); if (! prov.isConversionSupported(targ, ais.getFormat())) continue; return prov.getAudioInputStream(targ, ais); @@ -251,10 +253,10 @@ public class AudioSystem public static AudioInputStream getAudioInputStream(File f) throws UnsupportedAudioFileException, IOException { - Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class); + Iterator<AudioFileReader> i = ServiceFactory.lookupProviders(AudioFileReader.class); while (i.hasNext()) { - AudioFileReader reader = (AudioFileReader) i.next(); + AudioFileReader reader = i.next(); try { return reader.getAudioInputStream(f); @@ -278,10 +280,10 @@ public class AudioSystem public static AudioInputStream getAudioInputStream(InputStream is) throws UnsupportedAudioFileException, IOException { - Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class); + Iterator<AudioFileReader> i = ServiceFactory.lookupProviders(AudioFileReader.class); while (i.hasNext()) { - AudioFileReader reader = (AudioFileReader) i.next(); + AudioFileReader reader = i.next(); try { return reader.getAudioInputStream(is); @@ -305,10 +307,10 @@ public class AudioSystem public static AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException { - Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class); + Iterator<AudioFileReader> i = ServiceFactory.lookupProviders(AudioFileReader.class); while (i.hasNext()) { - AudioFileReader reader = (AudioFileReader) i.next(); + AudioFileReader reader = i.next(); try { return reader.getAudioInputStream(url); @@ -401,10 +403,10 @@ public class AudioSystem */ public static Mixer getMixer(Mixer.Info info) { - Iterator i = ServiceFactory.lookupProviders(MixerProvider.class); + Iterator<MixerProvider> i = ServiceFactory.lookupProviders(MixerProvider.class); while (i.hasNext()) { - MixerProvider prov = (MixerProvider) i.next(); + MixerProvider prov = i.next(); if (prov.isMixerSupported(info)) return prov.getMixer(info); } @@ -417,10 +419,10 @@ public class AudioSystem public static Mixer.Info[] getMixerInfo() { HashSet<Mixer.Info> result = new HashSet<Mixer.Info>(); - Iterator i = ServiceFactory.lookupProviders(MixerProvider.class); + Iterator<MixerProvider> i = ServiceFactory.lookupProviders(MixerProvider.class); while (i.hasNext()) { - MixerProvider prov = (MixerProvider) i.next(); + MixerProvider prov = i.next(); Mixer.Info[] is = prov.getMixerInfo(); for (int j = 0; j < is.length; ++j) result.add(is[j]); @@ -536,10 +538,11 @@ public class AudioSystem { HashSet<AudioFormat.Encoding> result = new HashSet<AudioFormat.Encoding>(); - Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class); + Iterator<FormatConversionProvider> i = + ServiceFactory.lookupProviders(FormatConversionProvider.class); while (i.hasNext()) { - FormatConversionProvider prov = (FormatConversionProvider) i.next(); + FormatConversionProvider prov = i.next(); if (! prov.isSourceEncodingSupported(source)) continue; AudioFormat.Encoding[] es = prov.getTargetEncodings(); @@ -558,10 +561,11 @@ public class AudioSystem { HashSet<AudioFormat.Encoding> result = new HashSet<AudioFormat.Encoding>(); - Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class); + Iterator<FormatConversionProvider> i = + ServiceFactory.lookupProviders(FormatConversionProvider.class); while (i.hasNext()) { - FormatConversionProvider prov = (FormatConversionProvider) i.next(); + FormatConversionProvider prov = i.next(); AudioFormat.Encoding[] es = prov.getTargetEncodings(source); for (int j = 0; j < es.length; ++j) result.add(es[j]); @@ -579,10 +583,11 @@ public class AudioSystem AudioFormat sourceFmt) { HashSet<AudioFormat> result = new HashSet<AudioFormat>(); - Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class); + Iterator<FormatConversionProvider> i = + ServiceFactory.lookupProviders(FormatConversionProvider.class); while (i.hasNext()) { - FormatConversionProvider prov = (FormatConversionProvider) i.next(); + FormatConversionProvider prov = i.next(); AudioFormat[] es = prov.getTargetFormats(encoding, sourceFmt); for (int j = 0; j < es.length; ++j) result.add(es[j]); @@ -618,11 +623,11 @@ public class AudioSystem public static boolean isConversionSupported(AudioFormat.Encoding targ, AudioFormat source) { - Iterator i + Iterator<FormatConversionProvider> i = ServiceFactory.lookupProviders(FormatConversionProvider.class); while (i.hasNext()) { - FormatConversionProvider prov = (FormatConversionProvider) i.next(); + FormatConversionProvider prov = i.next(); if (prov.isConversionSupported(targ, source)) return true; } @@ -638,11 +643,11 @@ public class AudioSystem public static boolean isConversionSupported(AudioFormat targ, AudioFormat source) { - Iterator i + Iterator<FormatConversionProvider> i = ServiceFactory.lookupProviders(FormatConversionProvider.class); while (i.hasNext()) { - FormatConversionProvider prov = (FormatConversionProvider) i.next(); + FormatConversionProvider prov = i.next(); if (prov.isConversionSupported(targ, source)) return true; } @@ -714,10 +719,10 @@ public class AudioSystem File out) throws IOException { - Iterator i = ServiceFactory.lookupProviders(AudioFileWriter.class); + Iterator<AudioFileWriter> i = ServiceFactory.lookupProviders(AudioFileWriter.class); while (i.hasNext()) { - AudioFileWriter w = (AudioFileWriter) i.next(); + AudioFileWriter w = i.next(); if (w.isFileTypeSupported(type, ais)) return w.write(ais, type, out); } @@ -739,10 +744,10 @@ public class AudioSystem OutputStream os) throws IOException { - Iterator i = ServiceFactory.lookupProviders(AudioFileWriter.class); + Iterator<AudioFileWriter> i = ServiceFactory.lookupProviders(AudioFileWriter.class); while (i.hasNext()) { - AudioFileWriter w = (AudioFileWriter) i.next(); + AudioFileWriter w = i.next(); if (w.isFileTypeSupported(type, ais)) return w.write(ais, type, os); } diff --git a/libjava/classpath/javax/sound/sampled/Line.java b/libjava/classpath/javax/sound/sampled/Line.java index 62d284b..1e08f1a 100644 --- a/libjava/classpath/javax/sound/sampled/Line.java +++ b/libjava/classpath/javax/sound/sampled/Line.java @@ -1,5 +1,5 @@ /* An input or output line - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -43,6 +43,7 @@ package javax.sound.sampled; * @since 1.3 */ public interface Line + extends AutoCloseable { /** * An object of this type holds information about a Line. @@ -50,7 +51,7 @@ public interface Line */ class Info { - private Class klass; + private Class<?> klass; /** * Create a new Info object. The argument is the class of the line, diff --git a/libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java b/libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java index 260c385..1e53961 100644 --- a/libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java +++ b/libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java @@ -293,7 +293,7 @@ public class DefaultMutableTreeNode * * @return an enumeration of tree nodes */ - @SuppressWarnings("unchecked") // Required for API compatibility + @SuppressWarnings("rawtypes") // Required for API compatibility public Enumeration children() { if (children.size() == 0) @@ -718,7 +718,7 @@ public class DefaultMutableTreeNode * * @return Enumeration */ - @SuppressWarnings("unchecked") // Required for API compatibility + @SuppressWarnings("rawtypes") // Required for API compatibility public Enumeration preorderEnumeration() { return new PreorderEnumeration(this); @@ -729,7 +729,7 @@ public class DefaultMutableTreeNode * * @return Enumeration */ - @SuppressWarnings("unchecked") // Required for API compatibility + @SuppressWarnings("rawtypes") // Required for API compatibility public Enumeration postorderEnumeration() { return new PostorderEnumeration(this); @@ -740,7 +740,7 @@ public class DefaultMutableTreeNode * * @return Enumeration */ - @SuppressWarnings("unchecked") // Required for API compatibility + @SuppressWarnings("rawtypes") // Required for API compatibility public Enumeration breadthFirstEnumeration() { return new BreadthFirstEnumeration(this); @@ -751,7 +751,7 @@ public class DefaultMutableTreeNode * * @return Enumeration */ - @SuppressWarnings("unchecked") // Required for API compatibility + @SuppressWarnings("rawtypes") // Required for API compatibility public Enumeration depthFirstEnumeration() { return postorderEnumeration(); @@ -764,7 +764,7 @@ public class DefaultMutableTreeNode * * @return Enumeration */ - @SuppressWarnings("unchecked") // Required for API compatibility + @SuppressWarnings("rawtypes") // Required for API compatibility public Enumeration pathFromAncestorEnumeration(TreeNode node) { if (node == null) @@ -1073,7 +1073,6 @@ public class DefaultMutableTreeNode return !queue.isEmpty(); } - @SuppressWarnings("unchecked") public TreeNode nextElement() { if (queue.isEmpty()) @@ -1081,6 +1080,7 @@ public class DefaultMutableTreeNode TreeNode node = queue.removeFirst(); + @SuppressWarnings("unchecked") Enumeration<TreeNode> children = (Enumeration<TreeNode>) node.children(); while (children.hasMoreElements()) @@ -1100,11 +1100,13 @@ public class DefaultMutableTreeNode Stack<Enumeration<TreeNode>> childrenEnums = new Stack<Enumeration<TreeNode>>(); - @SuppressWarnings("unchecked") PreorderEnumeration(TreeNode node) { next = node; - childrenEnums.push((Enumeration<TreeNode>) node.children()); + @SuppressWarnings("unchecked") + Enumeration<TreeNode> children = + (Enumeration<TreeNode>) node.children(); + childrenEnums.push(children); } public boolean hasMoreElements() @@ -1127,14 +1129,16 @@ public class DefaultMutableTreeNode return current; } - @SuppressWarnings("unchecked") private TreeNode traverse(Enumeration<TreeNode> children) { // If more children are available step down. if (children.hasMoreElements()) { TreeNode child = children.nextElement(); - childrenEnums.push((Enumeration<TreeNode>) child.children()); + @SuppressWarnings("unchecked") + Enumeration<TreeNode> grandchildren = + (Enumeration<TreeNode>) child.children(); + childrenEnums.push(grandchildren); return child; } @@ -1163,11 +1167,13 @@ public class DefaultMutableTreeNode Stack<Enumeration<TreeNode>> childrenEnums = new Stack<Enumeration<TreeNode>>(); - @SuppressWarnings("unchecked") PostorderEnumeration(TreeNode node) { nodes.push(node); - childrenEnums.push((Enumeration<TreeNode>) node.children()); + @SuppressWarnings("unchecked") + Enumeration<TreeNode> children = + (Enumeration<TreeNode>) node.children(); + childrenEnums.push(children); } public boolean hasMoreElements() @@ -1185,7 +1191,6 @@ public class DefaultMutableTreeNode return traverse(children); } - @SuppressWarnings("unchecked") private TreeNode traverse(Enumeration<TreeNode> children) { if (children.hasMoreElements()) @@ -1193,8 +1198,9 @@ public class DefaultMutableTreeNode TreeNode node = children.nextElement(); nodes.push(node); - Enumeration<TreeNode> newChildren = - (Enumeration<TreeNode>) node.children(); + @SuppressWarnings("unchecked") + Enumeration<TreeNode> newChildren = + (Enumeration<TreeNode>) node.children(); childrenEnums.push(newChildren); return traverse(newChildren); diff --git a/libjava/classpath/javax/swing/tree/TreeNode.java b/libjava/classpath/javax/swing/tree/TreeNode.java index b68b498..f146741 100644 --- a/libjava/classpath/javax/swing/tree/TreeNode.java +++ b/libjava/classpath/javax/swing/tree/TreeNode.java @@ -107,7 +107,7 @@ public interface TreeNode * * @return An enumeration of the children of this node. */ - @SuppressWarnings("unchecked") // Required for API compatibility + @SuppressWarnings("rawtypes") // Required for API compatibility Enumeration children(); } diff --git a/libjava/classpath/javax/xml/namespace/NamespaceContext.java b/libjava/classpath/javax/xml/namespace/NamespaceContext.java index b3e1e1f..9816480 100644 --- a/libjava/classpath/javax/xml/namespace/NamespaceContext.java +++ b/libjava/classpath/javax/xml/namespace/NamespaceContext.java @@ -61,7 +61,7 @@ public interface NamespaceContext /** * Returns all the prefixes currently bound to the given namespace URI. */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public Iterator getPrefixes(String namespaceURI); } diff --git a/libjava/classpath/javax/xml/stream/XMLEventFactory.java b/libjava/classpath/javax/xml/stream/XMLEventFactory.java index fc2d493..750b62e 100644 --- a/libjava/classpath/javax/xml/stream/XMLEventFactory.java +++ b/libjava/classpath/javax/xml/stream/XMLEventFactory.java @@ -223,7 +223,7 @@ public abstract class XMLEventFactory /** * Create a start-element event. */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public abstract StartElement createStartElement(QName name, Iterator attributes, Iterator namespaces); @@ -238,7 +238,7 @@ public abstract class XMLEventFactory /** * Create a start-element event. */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public abstract StartElement createStartElement(String prefix, String namespaceUri, String localName, @@ -248,7 +248,7 @@ public abstract class XMLEventFactory /** * Create a start-element event. */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public abstract StartElement createStartElement(String prefix, String namespaceUri, String localName, @@ -259,7 +259,7 @@ public abstract class XMLEventFactory /** * Create an end-element event. */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public abstract EndElement createEndElement(QName name, Iterator namespaces); @@ -273,7 +273,7 @@ public abstract class XMLEventFactory /** * Create an end-element event. */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public abstract EndElement createEndElement(String prefix, String namespaceUri, String localName, diff --git a/libjava/classpath/javax/xml/stream/XMLEventReader.java b/libjava/classpath/javax/xml/stream/XMLEventReader.java index d5c76b6..10373ee 100644 --- a/libjava/classpath/javax/xml/stream/XMLEventReader.java +++ b/libjava/classpath/javax/xml/stream/XMLEventReader.java @@ -43,7 +43,7 @@ import javax.xml.stream.events.XMLEvent; /** * An XML parser. */ -@SuppressWarnings("unchecked") +@SuppressWarnings("rawtypes") public interface XMLEventReader extends Iterator { diff --git a/libjava/classpath/javax/xml/stream/events/DTD.java b/libjava/classpath/javax/xml/stream/events/DTD.java index b1a9069..f7c0795 100644 --- a/libjava/classpath/javax/xml/stream/events/DTD.java +++ b/libjava/classpath/javax/xml/stream/events/DTD.java @@ -60,13 +60,13 @@ public interface DTD /** * Returns the notations declared in the DTD. */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") List getNotations(); /** * Returns the entities declared in the DTD. */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") List getEntities(); } diff --git a/libjava/classpath/javax/xml/stream/events/EndElement.java b/libjava/classpath/javax/xml/stream/events/EndElement.java index a6b5c3f..cd7c2d3 100644 --- a/libjava/classpath/javax/xml/stream/events/EndElement.java +++ b/libjava/classpath/javax/xml/stream/events/EndElement.java @@ -55,7 +55,7 @@ public interface EndElement /** * Returns the namespaces that have gone out of scope. */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") Iterator getNamespaces(); } diff --git a/libjava/classpath/javax/xml/stream/events/StartElement.java b/libjava/classpath/javax/xml/stream/events/StartElement.java index 359b57e..9d18972 100644 --- a/libjava/classpath/javax/xml/stream/events/StartElement.java +++ b/libjava/classpath/javax/xml/stream/events/StartElement.java @@ -56,13 +56,13 @@ public interface StartElement /** * Returns the attributes declared on this element. */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") Iterator getAttributes(); /** * Returns the namespaces declared on this element. */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") Iterator getNamespaces(); /** diff --git a/libjava/classpath/javax/xml/xpath/XPathFunction.java b/libjava/classpath/javax/xml/xpath/XPathFunction.java index 4406e31..b7be090 100644 --- a/libjava/classpath/javax/xml/xpath/XPathFunction.java +++ b/libjava/classpath/javax/xml/xpath/XPathFunction.java @@ -52,7 +52,7 @@ public interface XPathFunction * Evaluate the function with the specified arguments. * @param args the list of arguments */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") Object evaluate(List args) throws XPathFunctionException; |