From: chiba Date: Sun, 3 Jul 2011 01:37:51 +0000 (+0000) Subject: fixed a bug that the compiler reports an error when "length" is used as a class or... X-Git-Tag: rel_3_17_1_ga~75 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=017837076454aee2343780a1ba29f22fa94eb924;p=javassist.git fixed a bug that the compiler reports an error when "length" is used as a class or package name. git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@583 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- diff --git a/.classpath b/.classpath index 2810d727..cee66ff0 100644 --- a/.classpath +++ b/.classpath @@ -2,7 +2,7 @@ - + diff --git a/src/main/javassist/compiler/TypeChecker.java b/src/main/javassist/compiler/TypeChecker.java index d2cb861c..5f7e5fa3 100644 --- a/src/main/javassist/compiler/TypeChecker.java +++ b/src/main/javassist/compiler/TypeChecker.java @@ -564,7 +564,13 @@ public class TypeChecker extends Visitor implements Opcode, TokenId { if (token == '.') { String member = ((Symbol)expr.oprand2()).get(); if (member.equals("length")) - atArrayLength(expr); + try { + atArrayLength(expr); + } + catch (NoFieldException nfe) { + // length might be a class or package name. + atFieldRead(expr); + } else if (member.equals("class")) atClassObject(expr); // .class else