Merge pull request #36 from mykmelez/undeclared-method-invocation

throw error if method ref to resolve not declared in class
This commit is contained in:
Andreas Gal 2014-08-05 15:12:12 -07:00
Родитель 5858cba452 64e4fedb8f
Коммит 714f57c4d2
1 изменённых файлов: 4 добавлений и 0 удалений

4
vm.js
Просмотреть файл

@ -134,6 +134,10 @@ VM.execute = function(ctx) {
var methodName = cp[cp[constant.name_and_type_index].name_index].bytes; var methodName = cp[cp[constant.name_and_type_index].name_index].bytes;
var signature = cp[cp[constant.name_and_type_index].signature_index].bytes; var signature = cp[cp[constant.name_and_type_index].signature_index].bytes;
constant = CLASSES.getMethod(classInfo, methodName, signature, op === 0xb8, op !== 0xb8); constant = CLASSES.getMethod(classInfo, methodName, signature, op === 0xb8, op !== 0xb8);
if (!constant) {
ctx.raiseException("java/lang/RuntimeException",
classInfo.className + "." + methodName + "." + signature + " not found");
}
break; break;
default: default:
throw new Error("not support constant type"); throw new Error("not support constant type");