Use a method available since JDK1.1 to determine our innerness and simplify the
logic. If we're inner and we're not static, we have a problem. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5019 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -422,19 +422,15 @@ public class Streamer
|
|||||||
// keep a handle on the class
|
// keep a handle on the class
|
||||||
_target = target;
|
_target = target;
|
||||||
|
|
||||||
// if this is a non-anonymous inner class, freak out because we cannot stream those
|
// if this is a non-static inner class, freak out because we cannot stream those
|
||||||
boolean isLocal = false, isAnon = false, isNSMember = false;
|
boolean isInner = false, isStatic = Modifier.isStatic(_target.getModifiers());
|
||||||
// but don't freak out if we can't find out if this is a non-anonymous inner class;
|
|
||||||
// production code running on old VMs should be left to do its thing
|
|
||||||
try {
|
try {
|
||||||
isLocal = _target.isLocalClass();
|
isInner = (_target.getDeclaringClass() != null);
|
||||||
isAnon = _target.isAnonymousClass();
|
|
||||||
isNSMember = _target.isMemberClass() && !Modifier.isStatic(_target.getModifiers());
|
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
log.info("Failure checking non-anonymous-innerness of class " +
|
log.info("Failure checking innerness of class [class=" + _target.getName() +
|
||||||
"[class=" + _target.getName() + ", error=" + t + "].");
|
", error=" + t + "].");
|
||||||
}
|
}
|
||||||
if (isLocal || isAnon || isNSMember) {
|
if (isInner && !isStatic) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Cannot stream non-static inner class: " + _target.getName());
|
"Cannot stream non-static inner class: " + _target.getName());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user