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

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

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

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

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

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

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

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

@ -60,7 +60,7 @@ public class FieldSerializer extends Serializer {
processingClass = processingClass.getSuperclass();
}
List<SavedField> cachedFields = new ArrayList(fields.size());
List<SavedField> cachedFields = new ArrayList<SavedField>(fields.size());
for (Field field : fields) {
int modifiers = field.getModifiers();
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 {
// Read the null/non-null marker

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

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

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

@ -41,7 +41,9 @@ import java.nio.ByteBuffer;
*
* @author Lars Wesselius
*/
@SuppressWarnings("unchecked")
public class LongSerializer extends Serializer {
public Long readObject(ByteBuffer data, Class c) throws IOException {
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 {
int length = data.getInt();
@ -123,6 +124,7 @@ public class MapSerializer extends Serializer {
return (T)map;
}
@SuppressWarnings("unchecked")
public void writeObject(ByteBuffer buffer, Object object) throws IOException {
Map map = (Map)object;
int length = map.size();

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

@ -43,11 +43,14 @@ import java.nio.ByteBuffer;
* TODO
* @author Lars Wesselius
*/
@SuppressWarnings("unchecked")
public class SerializableSerializer extends Serializer {
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 {
throw new UnsupportedOperationException( "Serializable serialization not supported." );
}
}

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

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

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

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

Loading…
Cancel
Save