From 017837076454aee2343780a1ba29f22fa94eb924 Mon Sep 17 00:00:00 2001 From: chiba Date: Sun, 3 Jul 2011 01:37:51 +0000 Subject: [PATCH] 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 --- .classpath | 2 +- src/main/javassist/compiler/TypeChecker.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) 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 -- 2.39.5