indexing
	description: "Holds information abouy JNI environment. Potentially many JNI environments can exists at once, but more than one was never tested"

class interface
	JNI_ENVIRONMENT

create

feature 

	destroy_vm
			-- destroy the JVM and reclaim its ressources
			-- !! can only be used in the main thread when it is the
			-- last remaining thread

	find_class (name: STRING): JAVA_CLASS
			-- Load in the Java class with the given name
		require
			name_valid: name /= void

	find_class_by_pointer (classp: POINTER): JAVA_CLASS
			-- Get a Java class Eiffel proxy given pointer to the
			-- Java class. Create a new one if needed
		require
			classp /= default_pointer

	find_class_pointer (name: STRING): POINTER
			-- find class pointer only (used during creation in descendants)
	
feature -- Exception mechanism

	check_for_exceptions
			-- Check if a Java exception occurred, raise Java exception occurred

	throw_custom_exception (jclass: JAVA_CLASS; msg: STRING)
			-- Constructs an exception object from the specified class 'jclass'
			-- with the message specified by 'msg' and causes that exception
			-- to be thrown.

	throw_java_exception (jthrowable: JAVA_OBJECT)
			-- throw the exception 'jthrowable' (must be a java.lang.Throwable object)
	
feature -- Java exception mechanism

	c_check_for_exceptions (lenv: POINTER)
			-- (from JAVA_EXTERNALS)

	c_throw_custom_exception (lenv: POINTER; jclass_id: POINTER; msg: POINTER)
			-- (from JAVA_EXTERNALS)

	c_throw_java_exception (lenv: POINTER; jthrowable: POINTER)
			-- (from JAVA_EXTERNALS)
	
feature -- Thread Mechanism

	attach_current_thread

	detach_current_thread
	
invariant

		-- from ANY
	reflexive_equality: standard_is_equal (Current)
	reflexive_conformance: conforms_to (Current)

end -- class JNI_ENVIRONMENT