From 1fafa1729301aed1dc57990eb34cf8478507d175 Mon Sep 17 00:00:00 2001 From: Nathan Curtis Date: Mon, 4 Aug 2008 17:58:45 +0000 Subject: [PATCH] Dave added the @SuppressWarnings("unchecked") because his stricker warning system in Eclipse told him (correctly) that some of the null checking there was not needed. If you have that setting off, however, Eclipse warns that the @SuppressWarnings itself is unneeded. So, instead of freaking out Eclipses of one persuasion or the other, lets just clean up the code and add an explanatory comment. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5285 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/io/FieldMarshaller.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/java/com/threerings/io/FieldMarshaller.java b/src/java/com/threerings/io/FieldMarshaller.java index c598cefc7..7c9d1c068 100644 --- a/src/java/com/threerings/io/FieldMarshaller.java +++ b/src/java/com/threerings/io/FieldMarshaller.java @@ -52,7 +52,6 @@ public abstract class FieldMarshaller * Returns a field marshaller appropriate for the supplied field or null if no marshaller * exists for the type contained by the field in question. */ - @SuppressWarnings("null") public static FieldMarshaller getFieldMarshaller (Field field) { if (_marshallers == null) { @@ -71,11 +70,12 @@ public abstract class FieldMarshaller } catch (NoSuchMethodException nsme) { // no problem } - if ((reader != null || writer != null) && (reader == null || writer == null)) { - log.warning("Class contains one but not both custom field reader and writer " + - "[class=" + field.getDeclaringClass().getName() + - ", field=" + field.getName() + ", reader=" + reader + - ", writer=" + writer + "]."); + // To get to this code path, either an exception was thrown when fetching reader or + // when fetching writer... either way writer is guaranteed to be null. + if (reader != null) { + log.warning("Class contains a custom field reader, but not a writer", + "class", field.getDeclaringClass().getName(), "field", field.getName(), + "reader", reader); // fall through to using reflection on the fields... } }