Fixed the few uncheck warnings that I could... suppressed

the rest.  Added an UnsupportedOperationException to 
SerializableSerializer so that it doesn't silently fail
to do anything at all.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7219 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
PSp..om 14 years ago
parent 49f65bd7aa
commit 0f1b05b405
  1. 5
      engine/src/networking/com/jme3/network/serializing/Serializer.java
  2. 1
      engine/src/networking/com/jme3/network/serializing/serializers/ArraySerializer.java
  3. 1
      engine/src/networking/com/jme3/network/serializing/serializers/BooleanSerializer.java
  4. 2
      engine/src/networking/com/jme3/network/serializing/serializers/ByteSerializer.java
  5. 2
      engine/src/networking/com/jme3/network/serializing/serializers/CharSerializer.java
  6. 1
      engine/src/networking/com/jme3/network/serializing/serializers/CollectionSerializer.java
  7. 2
      engine/src/networking/com/jme3/network/serializing/serializers/DateSerializer.java
  8. 2
      engine/src/networking/com/jme3/network/serializing/serializers/DoubleSerializer.java
  9. 3
      engine/src/networking/com/jme3/network/serializing/serializers/FieldSerializer.java
  10. 2
      engine/src/networking/com/jme3/network/serializing/serializers/FloatSerializer.java
  11. 1
      engine/src/networking/com/jme3/network/serializing/serializers/GZIPSerializer.java
  12. 2
      engine/src/networking/com/jme3/network/serializing/serializers/IntSerializer.java
  13. 2
      engine/src/networking/com/jme3/network/serializing/serializers/LongSerializer.java
  14. 2
      engine/src/networking/com/jme3/network/serializing/serializers/MapSerializer.java
  15. 1
      engine/src/networking/com/jme3/network/serializing/serializers/SavableSerializer.java
  16. 5
      engine/src/networking/com/jme3/network/serializing/serializers/SerializableSerializer.java
  17. 1
      engine/src/networking/com/jme3/network/serializing/serializers/ShortSerializer.java
  18. 2
      engine/src/networking/com/jme3/network/serializing/serializers/StringSerializer.java
  19. 2
      engine/src/networking/com/jme3/network/serializing/serializers/Vector3Serializer.java
  20. 1
      engine/src/networking/com/jme3/network/serializing/serializers/ZIPSerializer.java

@ -134,6 +134,7 @@ public abstract class Serializer {
return registerClass(cls, true); return registerClass(cls, true);
} }
@SuppressWarnings("unchecked")
public static SerializerRegistration registerClass(Class cls, boolean failOnMiss) { public static SerializerRegistration registerClass(Class cls, boolean failOnMiss) {
if (cls.isAnnotationPresent(Serializable.class)) { if (cls.isAnnotationPresent(Serializable.class)) {
Serializable serializable = (Serializable)cls.getAnnotation(Serializable.class); Serializable serializable = (Serializable)cls.getAnnotation(Serializable.class);
@ -240,7 +241,8 @@ public abstract class Serializer {
public static SerializerRegistration getExactSerializerRegistration(Class cls) { public static SerializerRegistration getExactSerializerRegistration(Class cls) {
return classRegistrations.get(cls); return classRegistrations.get(cls);
} }
@SuppressWarnings("unchecked")
public static SerializerRegistration getSerializerRegistration(Class cls) { public static SerializerRegistration getSerializerRegistration(Class cls) {
SerializerRegistration reg = classRegistrations.get(cls); SerializerRegistration reg = classRegistrations.get(cls);
@ -280,6 +282,7 @@ public abstract class Serializer {
* @return The Object that was read. * @return The Object that was read.
* @throws IOException If serialization failed. * @throws IOException If serialization failed.
*/ */
@SuppressWarnings("unchecked")
public static Object readClassAndObject(ByteBuffer buffer) throws IOException { public static Object readClassAndObject(ByteBuffer buffer) throws IOException {
SerializerRegistration reg = readClass(buffer); SerializerRegistration reg = readClass(buffer);
if (reg == NULL_CLASS) return null; if (reg == NULL_CLASS) return null;

@ -43,6 +43,7 @@ import java.nio.ByteBuffer;
* *
* @author Nathan Sweet * @author Nathan Sweet
*/ */
@SuppressWarnings("unchecked")
public class ArraySerializer extends Serializer { public class ArraySerializer extends Serializer {
private int[] getDimensions (Object array) { private int[] getDimensions (Object array) {
int depth = 0; int depth = 0;

@ -41,6 +41,7 @@ import java.nio.ByteBuffer;
* *
* @author Lars Wesselius * @author Lars Wesselius
*/ */
@SuppressWarnings("unchecked")
public class BooleanSerializer extends Serializer { public class BooleanSerializer extends Serializer {
public Boolean readObject(ByteBuffer data, Class c) throws IOException { public Boolean readObject(ByteBuffer data, Class c) throws IOException {

@ -41,7 +41,9 @@ import java.nio.ByteBuffer;
* *
* @author Lars Wesselius * @author Lars Wesselius
*/ */
@SuppressWarnings("unchecked")
public class ByteSerializer extends Serializer { public class ByteSerializer extends Serializer {
public Byte readObject(ByteBuffer data, Class c) throws IOException { public Byte readObject(ByteBuffer data, Class c) throws IOException {
return data.get(); return data.get();
} }

@ -41,7 +41,9 @@ import java.nio.ByteBuffer;
* *
* @author Lars Wesselius * @author Lars Wesselius
*/ */
@SuppressWarnings("unchecked")
public class CharSerializer extends Serializer { public class CharSerializer extends Serializer {
public Character readObject(ByteBuffer data, Class c) throws IOException { public Character readObject(ByteBuffer data, Class c) throws IOException {
return data.getChar(); return data.getChar();
} }

@ -48,6 +48,7 @@ import java.util.logging.Level;
*/ */
public class CollectionSerializer extends Serializer { public class CollectionSerializer extends Serializer {
@SuppressWarnings("unchecked")
public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException { public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException {
int length = data.getInt(); int length = data.getInt();

@ -42,7 +42,9 @@ import java.util.Date;
* *
* @author Lars Wesselius * @author Lars Wesselius
*/ */
@SuppressWarnings("unchecked")
public class DateSerializer extends Serializer { public class DateSerializer extends Serializer {
public Date readObject(ByteBuffer data, Class c) throws IOException { public Date readObject(ByteBuffer data, Class c) throws IOException {
return new Date(data.getLong()); return new Date(data.getLong());
} }

@ -41,7 +41,9 @@ import java.nio.ByteBuffer;
* *
* @author Lars Wesselius * @author Lars Wesselius
*/ */
@SuppressWarnings("unchecked")
public class DoubleSerializer extends Serializer { public class DoubleSerializer extends Serializer {
public Double readObject(ByteBuffer data, Class c) throws IOException { public Double readObject(ByteBuffer data, Class c) throws IOException {
return data.getDouble(); return data.getDouble();
} }

@ -60,7 +60,7 @@ public class FieldSerializer extends Serializer {
processingClass = processingClass.getSuperclass(); processingClass = processingClass.getSuperclass();
} }
List<SavedField> cachedFields = new ArrayList(fields.size()); List<SavedField> cachedFields = new ArrayList<SavedField>(fields.size());
for (Field field : fields) { for (Field field : fields) {
int modifiers = field.getModifiers(); int modifiers = field.getModifiers();
if (Modifier.isTransient(modifiers)) continue; if (Modifier.isTransient(modifiers)) continue;
@ -87,6 +87,7 @@ public class FieldSerializer extends Serializer {
} }
@SuppressWarnings("unchecked")
public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException { public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException {
// Read the null/non-null marker // Read the null/non-null marker

@ -41,7 +41,9 @@ import java.nio.ByteBuffer;
* *
* @author Lars Wesselius * @author Lars Wesselius
*/ */
@SuppressWarnings("unchecked")
public class FloatSerializer extends Serializer { public class FloatSerializer extends Serializer {
public Float readObject(ByteBuffer data, Class c) throws IOException { public Float readObject(ByteBuffer data, Class c) throws IOException {
return data.getFloat(); return data.getFloat();
} }

@ -49,6 +49,7 @@ import java.util.zip.GZIPOutputStream;
*/ */
public class GZIPSerializer extends Serializer { public class GZIPSerializer extends Serializer {
@SuppressWarnings("unchecked")
public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException { public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException {
try try
{ {

@ -41,7 +41,9 @@ import java.nio.ByteBuffer;
* *
* @author Lars Wesselius * @author Lars Wesselius
*/ */
@SuppressWarnings("unchecked")
public class IntSerializer extends Serializer { public class IntSerializer extends Serializer {
public Integer readObject(ByteBuffer data, Class c) throws IOException { public Integer readObject(ByteBuffer data, Class c) throws IOException {
return data.getInt(); return data.getInt();
} }

@ -41,7 +41,9 @@ import java.nio.ByteBuffer;
* *
* @author Lars Wesselius * @author Lars Wesselius
*/ */
@SuppressWarnings("unchecked")
public class LongSerializer extends Serializer { public class LongSerializer extends Serializer {
public Long readObject(ByteBuffer data, Class c) throws IOException { public Long readObject(ByteBuffer data, Class c) throws IOException {
return data.getLong(); return data.getLong();
} }

@ -71,6 +71,7 @@ public class MapSerializer extends Serializer {
*/ */
@SuppressWarnings("unchecked")
public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException { public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException {
int length = data.getInt(); int length = data.getInt();
@ -123,6 +124,7 @@ public class MapSerializer extends Serializer {
return (T)map; return (T)map;
} }
@SuppressWarnings("unchecked")
public void writeObject(ByteBuffer buffer, Object object) throws IOException { public void writeObject(ByteBuffer buffer, Object object) throws IOException {
Map map = (Map)object; Map map = (Map)object;
int length = map.size(); int length = map.size();

@ -101,6 +101,7 @@ public class SavableSerializer extends Serializer {
} }
@Override @Override
@SuppressWarnings("unchecked")
public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException { public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException {
BufferInputStream in = new BufferInputStream(data); BufferInputStream in = new BufferInputStream(data);
Savable s = importer.load(in); Savable s = importer.load(in);

@ -43,11 +43,14 @@ import java.nio.ByteBuffer;
* TODO * TODO
* @author Lars Wesselius * @author Lars Wesselius
*/ */
@SuppressWarnings("unchecked")
public class SerializableSerializer extends Serializer { public class SerializableSerializer extends Serializer {
public Serializable readObject(ByteBuffer data, Class c) throws IOException { public Serializable readObject(ByteBuffer data, Class c) throws IOException {
return null; throw new UnsupportedOperationException( "Serializable serialization not supported." );
} }
public void writeObject(ByteBuffer buffer, Object object) throws IOException { public void writeObject(ByteBuffer buffer, Object object) throws IOException {
throw new UnsupportedOperationException( "Serializable serialization not supported." );
} }
} }

@ -41,6 +41,7 @@ import java.nio.ByteBuffer;
* *
* @author Lars Wesselius * @author Lars Wesselius
*/ */
@SuppressWarnings("unchecked")
public class ShortSerializer extends Serializer { public class ShortSerializer extends Serializer {
public Short readObject(ByteBuffer data, Class c) throws IOException { public Short readObject(ByteBuffer data, Class c) throws IOException {
return data.getShort(); return data.getShort();

@ -42,7 +42,9 @@ import java.nio.ByteBuffer;
* *
* @author Lars Wesselius * @author Lars Wesselius
*/ */
@SuppressWarnings("unchecked")
public class StringSerializer extends Serializer { public class StringSerializer extends Serializer {
public String readObject(ByteBuffer data, Class c) throws IOException { public String readObject(ByteBuffer data, Class c) throws IOException {
int length = -1; int length = -1;

@ -8,7 +8,9 @@ import java.nio.ByteBuffer;
/** /**
* @author Kirill Vainer * @author Kirill Vainer
*/ */
@SuppressWarnings("unchecked")
public class Vector3Serializer extends Serializer { public class Vector3Serializer extends Serializer {
public Vector3f readObject(ByteBuffer data, Class c) throws IOException { public Vector3f readObject(ByteBuffer data, Class c) throws IOException {
Vector3f vec3 = new Vector3f(); Vector3f vec3 = new Vector3f();
vec3.x = data.getFloat(); vec3.x = data.getFloat();

@ -50,6 +50,7 @@ import java.util.zip.ZipOutputStream;
*/ */
public class ZIPSerializer extends Serializer { public class ZIPSerializer extends Serializer {
@SuppressWarnings("unchecked")
public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException { public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException {
try try
{ {

Loading…
Cancel
Save