harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arc...@apache.org
Subject svn commit: r412122 - in /incubator/harmony/enhanced/jchevm/libjc: jni_native.c reflect.c resolve.c resolve2.c
Date Tue, 06 Jun 2006 13:54:38 GMT
Author: archie
Date: Tue Jun  6 06:54:38 2006
New Revision: 412122

URL: http://svn.apache.org/viewvc?rev=412122&view=rev
Log:
- Fix bug in field resolution: we were failing to find fields declared in
  interfaces of superclasses. Only some compilers (jikes) emit such code.
- Fix exception message for failed field resolution to specify the original
  class being searched rather than java/lang/Object.

Modified:
    incubator/harmony/enhanced/jchevm/libjc/jni_native.c
    incubator/harmony/enhanced/jchevm/libjc/reflect.c
    incubator/harmony/enhanced/jchevm/libjc/resolve.c
    incubator/harmony/enhanced/jchevm/libjc/resolve2.c

Modified: incubator/harmony/enhanced/jchevm/libjc/jni_native.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/jchevm/libjc/jni_native.c?rev=412122&r1=412121&r2=412122&view=diff
==============================================================================
--- incubator/harmony/enhanced/jchevm/libjc/jni_native.c (original)
+++ incubator/harmony/enhanced/jchevm/libjc/jni_native.c Tue Jun  6 06:54:38 2006
@@ -773,6 +773,8 @@
 	/* Search for field */
 	if ((field = _jc_resolve_field(env,
 	    type, name, sig, is_static)) == NULL) {
+		_JC_EX_STORE(env, NoSuchFieldError, "%s.%s (type `%s'%s)",
+		    type->name, name, sig, is_static ? ", static" : "");
 		_jc_post_exception_info(env);
 		goto done;
 	}

Modified: incubator/harmony/enhanced/jchevm/libjc/reflect.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/jchevm/libjc/reflect.c?rev=412122&r1=412121&r2=412122&view=diff
==============================================================================
--- incubator/harmony/enhanced/jchevm/libjc/reflect.c (original)
+++ incubator/harmony/enhanced/jchevm/libjc/reflect.c Tue Jun  6 06:54:38 2006
@@ -120,8 +120,8 @@
 
 fail:
 	/* Not found */
-	_JC_EX_STORE(env, NoSuchFieldError, "%s.%s (type `%s', %sstatic)",
-	    type->name, name, sig, is_static ? "" : "non-");
+	_JC_EX_STORE(env, NoSuchFieldError, "%s.%s (type `%s'%s)",
+	    type->name, name, sig, is_static ? ", static" : "");
 	return NULL;
 }
 

Modified: incubator/harmony/enhanced/jchevm/libjc/resolve.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/jchevm/libjc/resolve.c?rev=412122&r1=412121&r2=412122&view=diff
==============================================================================
--- incubator/harmony/enhanced/jchevm/libjc/resolve.c (original)
+++ incubator/harmony/enhanced/jchevm/libjc/resolve.c Tue Jun  6 06:54:38 2006
@@ -194,9 +194,9 @@
 
 /*
  * Resolve a field per JVMS section 5.4.3.2.
- * Note the static-ness of the field is not checked.
  *
- * Returns NULL and stores a NoSuchFieldError upon failure.
+ * Returns NULL and stores a NoSuchFieldError upon failure
+ * (with the message containing java/lang/Object as the type name).
  */
 _jc_field *
 _jc_resolve_field(_jc_env *env, _jc_type *type,
@@ -222,13 +222,10 @@
 			return field;
 	}
 
-	/* Search for field in superclasses */
-	while (JNI_TRUE) {
-		if ((type = type->superclass) == NULL)
-			break;
-		if ((field = _jc_get_declared_field(env,
-		    type, name, sig, is_static)) != NULL)
-			return field;
+	/* Recurse to superclass */
+	if (type->superclass != NULL) {
+		return _jc_resolve_field(env,
+		    type->superclass, name, sig, is_static);
 	}
 
 	/* Not found */

Modified: incubator/harmony/enhanced/jchevm/libjc/resolve2.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/jchevm/libjc/resolve2.c?rev=412122&r1=412121&r2=412122&view=diff
==============================================================================
--- incubator/harmony/enhanced/jchevm/libjc/resolve2.c (original)
+++ incubator/harmony/enhanced/jchevm/libjc/resolve2.c Tue Jun  6 06:54:38 2006
@@ -688,7 +688,10 @@
 			/* Resolve field */
 			if ((field = _jc_resolve_field(env, type,
 			    ref->name, ref->descriptor, is_static)) == NULL) {
-				env->ex.num = _JC_IncompatibleClassChangeError;
+				_JC_EX_STORE(env, IncompatibleClassChangeError,
+				    "%s.%s (type `%s'%s)", type->name,
+				    ref->name, ref->descriptor,
+				    is_static ? ", static" : "");
 				goto post_fail;
 			}
 



Mime
View raw message