From 1f290d54001e508c65d6b1270c508b92d7af618c Mon Sep 17 00:00:00 2001 From: chiba Date: Wed, 30 Apr 2003 11:48:42 +0000 Subject: fixed an array-access bug. git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@13 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- Readme.html | 3 +++ src/main/javassist/CtClass.java | 2 +- src/main/javassist/compiler/MemberCodeGen.java | 17 +++++++++-------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Readme.html b/Readme.html index 9addaa05..7afd488b 100644 --- a/Readme.html +++ b/Readme.html @@ -462,6 +462,9 @@ software may be used under only the terms of the LGPL. To use them under the MPL, you must obtain a separate package including only Javassist but not the other part of JBoss. +

All the contributors to the original source tree must agree to +the original license term described above. +


Acknowledgments

diff --git a/src/main/javassist/CtClass.java b/src/main/javassist/CtClass.java index 42b7a8f4..04576b49 100644 --- a/src/main/javassist/CtClass.java +++ b/src/main/javassist/CtClass.java @@ -225,7 +225,7 @@ public abstract class CtClass { /** * Returns true if this class extends or implements * clazz. It also returns true if - * this class is the same as clazz. + * this class is the same as clazz. */ public boolean subtypeOf(CtClass clazz) throws NotFoundException { return this == clazz || getName().equals(clazz.getName()); diff --git a/src/main/javassist/compiler/MemberCodeGen.java b/src/main/javassist/compiler/MemberCodeGen.java index ffb76d52..437f1f80 100644 --- a/src/main/javassist/compiler/MemberCodeGen.java +++ b/src/main/javassist/compiler/MemberCodeGen.java @@ -673,20 +673,21 @@ public class MemberCodeGen extends CodeGen { int fi = addFieldrefInfo(f, finfo, type); int i = 0; + int dim = 0; char c = type.charAt(i); + while (c == '[') { + ++dim; + c = type.charAt(++i); + } + + arrayDim = dim; boolean is2byte = (c == 'J' || c == 'D'); exprType = descToType(c); - arrayDim = 0; - if (c == '[') { - i = 1; - while ((c = type.charAt(i)) == '[') - ++i; - - arrayDim = i; - } if (c == 'L') className = type.substring(i + 1, type.indexOf(';', i + 1)); + else + className = null; if (noRead) return fi; -- cgit v1.2.3