From 19d816cade1433304548903c09a993bb1ba3c1ed Mon Sep 17 00:00:00 2001 From: chiba Date: Sun, 4 Sep 2005 16:57:00 +0000 Subject: [PATCH] improved a message for RuntimeExceptions. git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@203 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- src/main/javassist/CtClass.java | 2 ++ src/main/javassist/CtClassType.java | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/javassist/CtClass.java b/src/main/javassist/CtClass.java index a96701b2..1b3b588b 100644 --- a/src/main/javassist/CtClass.java +++ b/src/main/javassist/CtClass.java @@ -249,6 +249,8 @@ public abstract class CtClass { void freeze() {} + /* Note: this method is overridden by CtClassType + */ void checkModify() throws RuntimeException { if (isFrozen()) throw new RuntimeException(getName() + " class is frozen"); diff --git a/src/main/javassist/CtClassType.java b/src/main/javassist/CtClassType.java index d5989406..a714094c 100644 --- a/src/main/javassist/CtClassType.java +++ b/src/main/javassist/CtClassType.java @@ -257,7 +257,14 @@ class CtClassType extends CtClass { void freeze() { wasFrozen = true; } void checkModify() throws RuntimeException { - super.checkModify(); + if (isFrozen()) { + String msg = getName() + " class is frozen"; + if (wasPruned) + msg += " and pruned"; + + throw new RuntimeException(msg); + } + wasChanged = true; } @@ -1079,6 +1086,8 @@ class CtClassType extends CtClass { } } + /* See also checkModified() + */ private void checkPruned(String method) { if (wasPruned) throw new RuntimeException(method + "(): " + getName() -- 2.39.5