From da8b0f35dc2d3d4b7a899828f864833322f274d2 Mon Sep 17 00:00:00 2001 From: Ankit <2020csb1072@iitrpr.ac.in> Date: Tue, 19 Mar 2024 18:06:49 +0530 Subject: [PATCH] Added Static method check before executing --- src/main/gov/nasa/jpf/jvm/bytecode/INVOKESTATIC.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/gov/nasa/jpf/jvm/bytecode/INVOKESTATIC.java b/src/main/gov/nasa/jpf/jvm/bytecode/INVOKESTATIC.java index 0ff67ae0..35986aae 100644 --- a/src/main/gov/nasa/jpf/jvm/bytecode/INVOKESTATIC.java +++ b/src/main/gov/nasa/jpf/jvm/bytecode/INVOKESTATIC.java @@ -89,6 +89,12 @@ public Instruction execute (ThreadInfo ti) { return ti.createAndThrowException("java.lang.NoSuchMethodException", cname + '.' + mname); } + // Check if the called method is static + if(!callee.isStatic()) { + return ti.createAndThrowException("java.lang.IncompatibleClassChangeError", + "non-static method called as static"); + } + // this can be actually different than (can be a base) ClassInfo ciCallee = callee.getClassInfo();