Treat Java final the same as JavaScript [[READONLY]]. Rhino previously

just threw a RuntimeException.
This commit is contained in:
nboyd%atg.com 2007-11-06 22:50:47 +00:00
Родитель 35a63c06cc
Коммит db3db9ad2f
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -177,8 +177,11 @@ class JavaMembers
try { try {
field.set(javaObject, javaValue); field.set(javaObject, javaValue);
} catch (IllegalAccessException accessEx) { } catch (IllegalAccessException accessEx) {
throw new RuntimeException("unexpected IllegalAccessException "+ if ((field.getModifiers() & Modifier.FINAL) != 0) {
"accessing Java field"); // treat Java final the same as JavaScript [[READONLY]]
return;
}
throw Context.throwAsScriptRuntimeEx(accessEx);
} catch (IllegalArgumentException argEx) { } catch (IllegalArgumentException argEx) {
throw Context.reportRuntimeError3( throw Context.reportRuntimeError3(
"msg.java.internal.field.type", "msg.java.internal.field.type",