Makefile.in: Rebuilt.

* Makefile.in: Rebuilt.
	* Makefile.am (java/lang/reflect/Method.h): ObjectInputStream now
	a friend.
	* java/lang/natClass.cc (getSignature): Only look at elements of
	non-null parameters.
	(getPrivateMethod): Removed old FIXME comment.
	* java/io/natObjectInputStream.cc (allocateObject): Removed old
	FIXME comment.
	(callConstructor): Simply use `NULL' for value of parameters.
	(ObjectClass): Removed.
	(ClassClass): Likewise.
	* java/io/ObjectInputStream.java (readObject): Fixed typo.

From-SVN: r47800
This commit is contained in:
Tom Tromey 2001-12-09 00:17:07 +00:00 committed by Tom Tromey
parent 3297bb4667
commit 91c6dda6c7
6 changed files with 69 additions and 36 deletions

View File

@ -1,5 +1,18 @@
2001-12-08 Tom Tromey <tromey@redhat.com>
* Makefile.in: Rebuilt.
* Makefile.am (java/lang/reflect/Method.h): ObjectInputStream now
a friend.
* java/lang/natClass.cc (getSignature): Only look at elements of
non-null parameters.
(getPrivateMethod): Removed old FIXME comment.
* java/io/natObjectInputStream.cc (allocateObject): Removed old
FIXME comment.
(callConstructor): Simply use `NULL' for value of parameters.
(ObjectClass): Removed.
(ClassClass): Likewise.
* java/io/ObjectInputStream.java (readObject): Fixed typo.
* verify.cc (_Jv_BytecodeVerifier::is_assignable_from_slow):
Handle case of array whose component type is not prepared.

View File

@ -313,6 +313,7 @@ java/lang/reflect/Method.h: java/lang/reflect/Method.class
$(GCJH) -classpath $(top_builddir) \
-friend 'jmethodID _Jv_FromReflectedMethod (java::lang::reflect::Method *);' \
-friend 'class java::lang::Class;' \
-friend 'class java::io::ObjectInputStream;' \
-friend 'jobject _Jv_JNI_ToReflectedMethod (_Jv_JNIEnv *, jclass, jmethodID, jboolean);' \
$(basename $<)

View File

@ -123,13 +123,19 @@ libgcj_basedir = @libgcj_basedir@
mkinstalldirs = @mkinstalldirs@
AUTOMAKE_OPTIONS = foreign
@TESTSUBDIR_TRUE@SUBDIRS = @TESTSUBDIR_TRUE@$(DIRLTDL) testsuite gcj include
@TESTSUBDIR_FALSE@SUBDIRS = @TESTSUBDIR_FALSE@$(DIRLTDL) gcj include
@USE_LIBDIR_TRUE@toolexeclibdir = @USE_LIBDIR_TRUE@$(libdir)$(MULTISUBDIR)
@USE_LIBDIR_FALSE@toolexeclibdir = @USE_LIBDIR_FALSE@$(toolexecdir)/lib$(MULTISUBDIR)
@USE_LIBDIR_FALSE@toolexecdir = @USE_LIBDIR_FALSE@$(exec_prefix)/$(target_alias)
@XLIB_AWT_TRUE@cond_x_ltlibrary = @XLIB_AWT_TRUE@libgcjx.la
@XLIB_AWT_FALSE@cond_x_ltlibrary =
@TESTSUBDIR_TRUE@SUBDIRS = \
@TESTSUBDIR_TRUE@$(DIRLTDL) testsuite gcj include
@TESTSUBDIR_FALSE@SUBDIRS = \
@TESTSUBDIR_FALSE@$(DIRLTDL) gcj include
@USE_LIBDIR_TRUE@toolexeclibdir = \
@USE_LIBDIR_TRUE@$(libdir)$(MULTISUBDIR)
@USE_LIBDIR_FALSE@toolexeclibdir = \
@USE_LIBDIR_FALSE@$(toolexecdir)/lib$(MULTISUBDIR)
@USE_LIBDIR_FALSE@toolexecdir = \
@USE_LIBDIR_FALSE@$(exec_prefix)/$(target_alias)
@XLIB_AWT_TRUE@cond_x_ltlibrary = \
@XLIB_AWT_TRUE@libgcjx.la
@XLIB_AWT_FALSE@cond_x_ltlibrary = \
toolexeclib_LTLIBRARIES = libgcj.la $(cond_x_ltlibrary)
toolexeclib_DATA = libgcj.spec
@ -137,14 +143,20 @@ data_DATA = libgcj.jar
secdir = $(libdir)/security
@NATIVE_TRUE@bin_PROGRAMS = @NATIVE_TRUE@jv-convert gij rmic rmiregistry
@NATIVE_TRUE@bin_PROGRAMS = \
@NATIVE_TRUE@jv-convert gij rmic rmiregistry
bin_SCRIPTS = addr2name.awk
@CANADIAN_TRUE@@NULL_TARGET_TRUE@ZIP = @CANADIAN_TRUE@@NULL_TARGET_TRUE@$(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar$(EXEEXT)
@CANADIAN_TRUE@@NULL_TARGET_FALSE@ZIP = @CANADIAN_TRUE@@NULL_TARGET_FALSE@jar
@CANADIAN_FALSE@ZIP = @CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar$(EXEEXT)
@CANADIAN_TRUE@GCJH = @CANADIAN_TRUE@gcjh
@CANADIAN_FALSE@GCJH = @CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/gcc/gcjh$(EXEEXT)
@CANADIAN_TRUE@@NULL_TARGET_TRUE@ZIP = \
@CANADIAN_TRUE@@NULL_TARGET_TRUE@$(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar$(EXEEXT)
@CANADIAN_TRUE@@NULL_TARGET_FALSE@ZIP = \
@CANADIAN_TRUE@@NULL_TARGET_FALSE@jar
@CANADIAN_FALSE@ZIP = \
@CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar$(EXEEXT)
@CANADIAN_TRUE@GCJH = \
@CANADIAN_TRUE@gcjh
@CANADIAN_FALSE@GCJH = \
@CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/gcc/gcjh$(EXEEXT)
GCJ_WITH_FLAGS = $(GCJ) --encoding=UTF-8
@ -164,8 +176,10 @@ AM_CXXFLAGS = -fno-rtti -fnon-call-exceptions \
@LIBGCJ_CXXFLAGS@ @X_CFLAGS@ $(WARNINGS) -D_GNU_SOURCE \
-DPREFIX="\"$(prefix)\""
@USING_GCC_TRUE@AM_CFLAGS = @USING_GCC_TRUE@@LIBGCJ_CFLAGS@ $(WARNINGS)
@USING_GCC_FALSE@AM_CFLAGS = @USING_GCC_FALSE@@LIBGCJ_CFLAGS@
@USING_GCC_TRUE@AM_CFLAGS = \
@USING_GCC_TRUE@@LIBGCJ_CFLAGS@ $(WARNINGS)
@USING_GCC_FALSE@AM_CFLAGS = \
@USING_GCC_FALSE@@LIBGCJ_CFLAGS@
JCFLAGS = -g
JC1FLAGS = @LIBGCJ_JAVAFLAGS@ $(GCJFLAGS)
@ -238,7 +252,8 @@ extra_headers = java/lang/Object.h java/lang/Class.h
NM = nm
@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@noinst_PROGRAMS = @NATIVE_TRUE@@MAINTAINER_MODE_TRUE@gen-from-JIS
@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@noinst_PROGRAMS = \
@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@gen-from-JIS
CONVERT_DIR = gnu/gcj/convert
@ -1567,7 +1582,7 @@ libgcj-test.spec.in libgcj.spec.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
TAR = tar
GZIP_ENV = --best
DIST_SUBDIRS = @DIRLTDL@ testsuite gcj include @DIRLTDL@ gcj include
DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
@ -2715,7 +2730,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
@ -3003,6 +3018,7 @@ java/lang/reflect/Method.h: java/lang/reflect/Method.class
$(GCJH) -classpath $(top_builddir) \
-friend 'jmethodID _Jv_FromReflectedMethod (java::lang::reflect::Method *);' \
-friend 'class java::lang::Class;' \
-friend 'class java::io::ObjectInputStream;' \
-friend 'jobject _Jv_JNI_ToReflectedMethod (_Jv_JNIEnv *, jclass, jmethodID, jboolean);' \
$(basename $<)

View File

@ -1,5 +1,5 @@
/* ObjectInputStream.java -- Class used to read serialized objects
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -225,13 +225,13 @@ public class ObjectInputStream extends InputStream
{
dumpElementln ("ARRAY");
ObjectStreamClass osc = (ObjectStreamClass)readObject ();
Class componenetType = osc.forClass ().getComponentType ();
Class componentType = osc.forClass ().getComponentType ();
dumpElement ("ARRAY LENGTH=");
int length = this.realInputStream.readInt ();
dumpElementln (length + "; COMPONENT TYPE=" + componenetType);
Object array = Array.newInstance (componenetType, length);
dumpElementln (length + "; COMPONENT TYPE=" + componentType);
Object array = Array.newInstance (componentType, length);
int handle = assignNewHandle (array);
readArrayElements (array, componenetType);
readArrayElements (array, componentType);
for (int i=0, len=Array.getLength(array); i < len; i++)
dumpElementln (" ELEMENT[" + i + "]=" + Array.get(array, i).toString());
ret_val = processResolution (array, handle);
@ -1295,7 +1295,7 @@ public class ObjectInputStream extends InputStream
// returns a new instance of REAL_CLASS that has been constructed
// only to th level of CONSTRUCTOR_CLASS (a super class of REAL_CLASS)
// only to the level of CONSTRUCTOR_CLASS (a super class of REAL_CLASS)
private Object newObject (Class real_class, Class constructor_class)
{
try

View File

@ -1,6 +1,6 @@
// natObjectInputStream.cc - Native part of ObjectInputStream class.
/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
This ObjectInputStream is part of libgcj.
@ -38,7 +38,6 @@ java::io::ObjectInputStream::allocateObject (jclass klass)
obj = NULL;
else
{
// FIXME: will this work for String?
obj = JvAllocObject (klass);
}
}
@ -51,19 +50,24 @@ java::io::ObjectInputStream::allocateObject (jclass klass)
}
#define ObjectClass java::lang::Object::class$
#define ClassClass java::lang::Class::class$
void
java::io::ObjectInputStream::callConstructor (jclass klass, jobject obj)
{
jstring init_name = JvNewStringLatin1 ("<init>");
// This is a bit inefficient, and a bit of a hack, since we don't
// actually use the Method and since what is returned isn't
// technically a Method. We can't use Method.invoke as it looks up
// the declared method.
JArray<jclass> *arg_types
= (JArray<jclass> *) JvNewObjectArray (0, &ClassClass, NULL);
JArray<jobject> *args
= (JArray<jobject> *) JvNewObjectArray (0, &ObjectClass, NULL);
java::lang::reflect::Method *m = klass->getPrivateMethod (init_name, arg_types);
m->invoke (obj, args);
= (JArray<jclass> *) JvNewObjectArray (0, &java::lang::Class::class$,
NULL);
java::lang::reflect::Method *m = klass->getPrivateMethod (init_name,
arg_types);
// We lie about this being a constructor. If we put `true' here
// then _Jv_CallAnyMethodA would try to allocate the object for us.
jmethodID meth = (jmethodID) ((char *) (klass->methods)
+ m->offset);
_Jv_CallAnyMethodA (obj, JvPrimClass (void), meth, false, arg_types, NULL);
}
java::lang::reflect::Field *

View File

@ -286,10 +286,10 @@ java::lang::Class::getSignature (JArray<jclass> *param_types,
{
java::lang::StringBuffer *buf = new java::lang::StringBuffer ();
buf->append((jchar) '(');
jclass *v = elements (param_types);
// A NULL param_types means "no parameters".
if (param_types != NULL)
{
jclass *v = elements (param_types);
for (int i = 0; i < param_types->length; ++i)
v[i]->getSignature(buf);
}
@ -1399,7 +1399,6 @@ java::lang::Class::getPrivateMethod (jstring name, JArray<jclass> *param_types)
int i = klass->isPrimitive () ? 0 : klass->method_count;
while (--i >= 0)
{
// FIXME: access checks.
if (_Jv_equalUtf8Consts (klass->methods[i].name, utf_name)
&& _Jv_equaln (klass->methods[i].signature, partial_sig, p_len))
{