From 290d7a9ea1868b6af671b3b52e905ce289f9f0b5 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Wed, 23 Apr 2008 19:34:22 +0000 Subject: [PATCH] Freak not out if we fail to determine if our class is local, anonymous or a non-static member. Pre-1.5 VMs can't do all of these things and Retroweaver freaks out at runtime when put to the task. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5018 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/io/Streamer.java | 26 +++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/java/com/threerings/io/Streamer.java b/src/java/com/threerings/io/Streamer.java index 0a3975d49..239175b93 100644 --- a/src/java/com/threerings/io/Streamer.java +++ b/src/java/com/threerings/io/Streamer.java @@ -423,20 +423,22 @@ public class Streamer _target = target; // if this is a non-anonymous inner class, freak out because we cannot stream those + boolean isLocal = false, isAnon = false, isNSMember = false; + // 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 { - if (_target.isLocalClass() || _target.isAnonymousClass() || - (_target.isMemberClass() && !Modifier.isStatic(_target.getModifiers()))) { - throw new IllegalArgumentException( - "Cannot stream non-static inner class: " + _target.getName()); - } - } catch (InternalError ie) { - // The checks on the class's localness are capable of throwing these. If we do, let's - // give better errors than the ones the JVM is willing to give. - log.warning("Internal error in checking localness of class: " + - "[class=" + _target.getName() + "]"); - throw ie; + isLocal = _target.isLocalClass(); + isAnon = _target.isAnonymousClass(); + isNSMember = _target.isMemberClass() && !Modifier.isStatic(_target.getModifiers()); + } catch (Throwable t) { + log.info("Failure checking non-anonymous-innerness of class " + + "[class=" + _target.getName() + ", error=" + t + "]."); } - + if (isLocal || isAnon || isNSMember) { + throw new IllegalArgumentException( + "Cannot stream non-static inner class: " + _target.getName()); + } + // if our target class is an array, we want to get a handle on a streamer delegate that // we'll use to stream our elements if (_target.isArray()) {