зеркало из https://github.com/mozilla/pjs.git
Assignment out of array range should provide a better error message
This commit is contained in:
Родитель
21844be5db
Коммит
3672cf7ea0
|
@ -119,9 +119,12 @@ public class NativeJavaArray extends NativeJavaObject
|
|||
public void put(int index, Scriptable start, Object value) {
|
||||
if (0 <= index && index < length) {
|
||||
Array.set(array, index, Context.jsToJava(value, cls));
|
||||
return;
|
||||
}
|
||||
super.put(index, start, value);
|
||||
else {
|
||||
throw Context.reportRuntimeError2(
|
||||
"msg.java.array.index.out.of.bounds", String.valueOf(index),
|
||||
String.valueOf(length - 1));
|
||||
}
|
||||
}
|
||||
|
||||
public Object getDefaultValue(Class hint) {
|
||||
|
|
|
@ -613,6 +613,9 @@ msg.nonjava.method =\
|
|||
msg.java.member.not.found =\
|
||||
Java class "{0}" has no public instance field or method named "{1}".
|
||||
|
||||
msg.java.array.index.out.of.bounds =\
|
||||
Array index {0} is out of bounds [0..{1}].
|
||||
|
||||
msg.pkg.int =\
|
||||
Java package names may not be numbers.
|
||||
|
||||
|
|
|
@ -309,6 +309,8 @@ msg.nonjava.method =\
|
|||
La m\u00E9thode Java "{0}" a \u00E9t\u00E9 appel\u00E9e avec une valeur ''this'' qui n''est pas un objet Java
|
||||
msg.java.member.not.found =\
|
||||
La classe Java "{0}" ne poss\u00E8de aucun champ ou aucune m\u00E9thode d''instance publique appel\u00E9 "{1}"
|
||||
msg.java.array.index.out.of.bounds =\
|
||||
Array index {0} is out of bounds [0..{1}].
|
||||
msg.pkg.int =\
|
||||
Les noms de package Java ne peuvent pas \u00EAtre des nombres
|
||||
msg.ambig.import =\
|
||||
|
|
Загрузка…
Ссылка в новой задаче