зеркало из 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 {
|
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",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче