[jboss-cvs] javassist SVN: r583 - in trunk: src/main/javassist/compiler and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Jul 2 21:37:51 EDT 2011


Author: chiba
Date: 2011-07-02 21:37:51 -0400 (Sat, 02 Jul 2011)
New Revision: 583

Modified:
   trunk/.classpath
   trunk/src/main/javassist/compiler/TypeChecker.java
Log:
fixed a bug that the compiler reports an error when "length" is used as a class or package name.

Modified: trunk/.classpath
===================================================================
--- trunk/.classpath	2011-06-21 11:27:56 UTC (rev 582)
+++ trunk/.classpath	2011-07-03 01:37:51 UTC (rev 583)
@@ -2,7 +2,7 @@
 <classpath>
 	<classpathentry excluding="javassist/util/HotSwapper.java" kind="src" path="src/main"/>
 	<classpathentry kind="src" path="src/test"/>
+	<classpathentry kind="lib" path="lib/junit.jar"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="lib" path="lib/junit.jar"/>
 	<classpathentry kind="output" path="eclipse-output/classes"/>
 </classpath>

Modified: trunk/src/main/javassist/compiler/TypeChecker.java
===================================================================
--- trunk/src/main/javassist/compiler/TypeChecker.java	2011-06-21 11:27:56 UTC (rev 582)
+++ trunk/src/main/javassist/compiler/TypeChecker.java	2011-07-03 01:37:51 UTC (rev 583)
@@ -564,7 +564,13 @@
         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



More information about the jboss-cvs-commits mailing list