зеркало из https://github.com/mozilla/pjs.git
Treat Java final the same as JavaScript [[READONLY]]. Rhino previously
just threw a RuntimeException.
This commit is contained in:
Родитель
35a63c06cc
Коммит
db3db9ad2f
|
@ -177,8 +177,11 @@ class JavaMembers
|
|||
try {
|
||||
field.set(javaObject, javaValue);
|
||||
} catch (IllegalAccessException accessEx) {
|
||||
throw new RuntimeException("unexpected IllegalAccessException "+
|
||||
"accessing Java field");
|
||||
if ((field.getModifiers() & Modifier.FINAL) != 0) {
|
||||
// treat Java final the same as JavaScript [[READONLY]]
|
||||
return;
|
||||
}
|
||||
throw Context.throwAsScriptRuntimeEx(accessEx);
|
||||
} catch (IllegalArgumentException argEx) {
|
||||
throw Context.reportRuntimeError3(
|
||||
"msg.java.internal.field.type",
|
||||
|
|
Загрузка…
Ссылка в новой задаче