Commit cb0d0606 authored by Stephanie Gawroriski's avatar Stephanie Gawroriski
Browse files

Add NPE exception; Add compatibility document, SUPER is going to always be assumed to be true.

parent b28ee2ed
......@@ -261,6 +261,27 @@ public final class SpringClass
return this._initialized;
}
/**
* Checks if the given class is a super class of the this class.
*
* @param __cl The class to check.
* @return {@code true} if it is a superclass.
* @throws NullPointerException On null arguments.
* @since 2018/09/09
*/
public final boolean isSuperClass(SpringClass __cl)
throws NullPointerException
{
if (__cl == null)
throw new NullPointerException("NARG");
for (SpringClass r = this.superclass; r != null; r = r.superClass())
if (r == __cl)
return true;
return true;
}
/**
* Looks up the method which acts as the default constructor for instance
* objects.
......
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package cc.squirreljme.springcoat.vm;
/**
* This is thrown when a null reference has been detected.
*
* @since 2018/09/09
*/
public class SpringNullPointerException
extends SpringException
{
/**
* Initialize the exception with no message or cause.
*
* @since 2018/09/09
*/
public SpringNullPointerException()
{
}
/**
* Initialize the exception with a message and no cause.
*
* @param __m The message.
* @since 2018/09/09
*/
public SpringNullPointerException(String __m)
{
super(__m);
}
/**
* Initialize the exception with a message and cause.
*
* @param __m The message.
* @param __c The cause.
* @since 2018/09/09
*/
public SpringNullPointerException(String __m, Throwable __c)
{
super(__m, __c);
}
/**
* Initialize the exception with no message and with a cause.
*
* @param __c The cause.
* @since 2018/09/09
*/
public SpringNullPointerException(Throwable __c)
{
super(__c);
}
}
......@@ -394,6 +394,7 @@ public final class SpringThreadWorker
// Are these certain kinds of initializers? Because final fields are
// writable during initialization accordingly
SpringClass currentclass = this.contextClass();
SpringMethod method = frame.method();
boolean isstaticinit = method.isStaticInitializer(),
isinstanceinit = method.isInstanceInitializer();
......@@ -467,6 +468,18 @@ public final class SpringThreadWorker
thread.popFrame();
break;
// Invoke special method (constructor, superclass,
// or private)
case InstructionIndex.INVOKESPECIAL:
{
MethodReference ref = inst.<MethodReference>argument(
0, MethodReference.class);
if (true)
throw new todo.TODO();
}
break;
// {@squirreljme.error BK0a Unimplemented operation.
// (The instruction)}
default:
......
# Compatibility
SquirrelJME aims to be compatible with most programs however there are
situations and rare edge cases where there will be no compatibility. This is
to make the implementation easier.
## `SUPER` is always assumed to be set.
In all clases the `SUPER` flag is assumed to be set, this flag just modifies
the behavior of `invokespecial`. When it is not set then that instruction
can invoke nearly every method directly (it was called before
`invokenonvirtual`). However, the Java compiler since Java 1.1 always set
the flag for classes it compiled. Since CLDC 1.0 was released well after
Java 2 was and is defined as a Java 2 virtual machine all code written for
J2ME should have classes where this flag is set. As such instead of
supporting the logic to handle cases where it is not set, the flag will just
be ignored and assumed to be set.
......@@ -29,6 +29,7 @@ and requires only a Java compiler and virtual machine for it to be built.
* _Assets_: Creative Commons CC-BY-SA 4.0
* [Release Route](route.mkd)
* [Project Scope](scope.mkd)
* [Compatibility](compatibility.mkd)
* [SquirrelJME As A Runtime](asruntime.mkd)
## Repository
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment