diff --git a/libjava/ChangeLog b/libjava/ChangeLog index c1dcf661140f..071d27df61af 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2006-06-22 Tom Tromey + + * java/lang/reflect/natField.cc (getAddr): Allow setting of final + field when it is accessible. + 2006-06-21 Bryce McKinlay * include/win32-threads.h (_Jv_ThreadDesc_t): New typedef. diff --git a/libjava/java/lang/reflect/natField.cc b/libjava/java/lang/reflect/natField.cc index ae68639065b5..487f62ab0e2a 100644 --- a/libjava/java/lang/reflect/natField.cc +++ b/libjava/java/lang/reflect/natField.cc @@ -72,6 +72,10 @@ getAddr (java::lang::reflect::Field* field, jclass caller, jobject obj, // Setting a final field is usually not allowed. if (checkFinal + // As of 1.5, you can set a non-static final field if it is + // accessible. + && (! field->isAccessible() + || (field->getModifiers() & java::lang::reflect::Modifier::STATIC)) && (field->getModifiers() & java::lang::reflect::Modifier::FINAL)) throw new java::lang::IllegalAccessException(JvNewStringUTF ("Field is final"));