From 10320e23afd6fc7f4ddca62b603000a33b12f48f Mon Sep 17 00:00:00 2001 From: tromey Date: Fri, 8 Jul 2005 19:13:30 +0000 Subject: 2005-07-06 Colin Walters * verify.cc (class _Jv_BytecodeVerifier) : Don't check for abstract classes or interfaces here; JVM spec says it should throw an exception, so we'll do so later. * interpret.cc (run): Throw an InstantiationException for abstract classes and interfaces. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101788 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/interpret.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libjava/interpret.cc') diff --git a/libjava/interpret.cc b/libjava/interpret.cc index 8b46dc6fa4a..dcda95e64de 100644 --- a/libjava/interpret.cc +++ b/libjava/interpret.cc @@ -30,6 +30,7 @@ details. */ #include #include #include +#include #include #include #include @@ -2942,6 +2943,10 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args, _Jv_InterpMethod *meth) int index = GET2U (); jclass klass = (_Jv_Linker::resolve_pool_entry (meth->defining_class, index)).clazz; + /* VM spec, section 3.11.5 */ + if ((klass->getModifiers() & Modifier::ABSTRACT) + || klass->isInterface()) + throw new java::lang::InstantiationException; jobject res = _Jv_AllocObject (klass); PUSHA (res); -- cgit v1.2.3