From f017673964f6f529ad19837dedbb90cb7ec682b4 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 17 Apr 2008 02:48:04 +0000 Subject: [PATCH] Disallow streaming of non-static inner classes to avoid the inevitable freakoutery as we try to stream the instance's implicit reference to its containing class. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5001 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/io/Streamer.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/java/com/threerings/io/Streamer.java b/src/java/com/threerings/io/Streamer.java index 6dc2bc627..c362e138f 100644 --- a/src/java/com/threerings/io/Streamer.java +++ b/src/java/com/threerings/io/Streamer.java @@ -422,6 +422,13 @@ public class Streamer // keep a handle on the class _target = target; + // if this is a non-anonymous inner class, freak out because we cannot stream those + if (_target.isLocalClass() || _target.isAnonymousClass() || + (_target.isMemberClass() && !Modifier.isStatic(_target.getModifiers()))) { + 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()) {