Makefile.am (core_java_source_files): Add VMObjectStreamClass.java.

* Makefile.am (core_java_source_files): Add VMObjectStreamClass.java.
       (nat_source_files): Add natVMObjectStreamClass.cc.
       * Makefile.in: Regenerated.
       * gcj/javaprims.h (namespace java): Regenerated.
       * java/io/ObjectStreamClass.java (getClassUID): Call
       VMObjectStreamClass.hasClassInitializer().
       (hasClassInitializer): Removed.
       * java/io/VMObjectStreamClass.java: New class.
       * java/io/natVMObjectStreamClass.cc: New file.
       * java/lang/Class.h: Make java::io::VMObjectStreamClass friend class.

From-SVN: r61501
This commit is contained in:
Mark Wielaard 2003-01-20 06:46:28 +00:00 committed by Mark Wielaard
parent d99c740f58
commit 827452ae5c
8 changed files with 102 additions and 33 deletions

View File

@ -1,3 +1,16 @@
2003-01-17 Mark Wielaard <mark@klomp.org>
* Makefile.am (core_java_source_files): Add VMObjectStreamClass.java.
(nat_source_files): Add natVMObjectStreamClass.cc.
* Makefile.in: Regenerated.
* gcj/javaprims.h (namespace java): Regenerated.
* java/io/ObjectStreamClass.java (getClassUID): Call
VMObjectStreamClass.hasClassInitializer().
(hasClassInitializer): Removed.
* java/io/VMObjectStreamClass.java: New class.
* java/io/natVMObjectStreamClass.cc: New file.
* java/lang/Class.h: Make java::io::VMObjectStreamClass friend class.
2003-01-16 Mark Wielaard <mark@klomp.org>
* java/net/SocketImpl.java (toString): Don't explicitly call

View File

@ -1692,6 +1692,7 @@ java/io/StringWriter.java \
java/io/SyncFailedException.java \
java/io/UTFDataFormatException.java \
java/io/UnsupportedEncodingException.java \
java/io/VMObjectStreamClass.java \
java/io/WriteAbortedException.java \
java/io/Writer.java \
java/util/AbstractCollection.java \
@ -2333,6 +2334,7 @@ java/io/natFile.cc \
java/io/natFileDescriptor.cc \
java/io/natObjectInputStream.cc \
java/io/natObjectOutputStream.cc \
java/io/natVMObjectStreamClass.cc \
java/lang/natCharacter.cc \
java/lang/natClass.cc \
java/lang/natClassLoader.cc \

View File

@ -1449,6 +1449,7 @@ java/io/StringWriter.java \
java/io/SyncFailedException.java \
java/io/UTFDataFormatException.java \
java/io/UnsupportedEncodingException.java \
java/io/VMObjectStreamClass.java \
java/io/WriteAbortedException.java \
java/io/Writer.java \
java/util/AbstractCollection.java \
@ -2084,6 +2085,7 @@ java/io/natFile.cc \
java/io/natFileDescriptor.cc \
java/io/natObjectInputStream.cc \
java/io/natObjectOutputStream.cc \
java/io/natVMObjectStreamClass.cc \
java/lang/natCharacter.cc \
java/lang/natClass.cc \
java/lang/natClassLoader.cc \
@ -2252,11 +2254,11 @@ gnu/gcj/runtime/natNameFinder.lo gnu/gcj/runtime/natSharedLibLoader.lo \
gnu/gcj/runtime/natStackTrace.lo gnu/gcj/runtime/natStringBuffer.lo \
gnu/gcj/runtime/natVMClassLoader.lo java/io/natFile.lo \
java/io/natFileDescriptor.lo java/io/natObjectInputStream.lo \
java/io/natObjectOutputStream.lo java/lang/natCharacter.lo \
java/lang/natClass.lo java/lang/natClassLoader.lo \
java/lang/natConcreteProcess.lo java/lang/natDouble.lo \
java/lang/natFloat.lo java/lang/natMath.lo java/lang/natObject.lo \
java/lang/natRuntime.lo java/lang/natString.lo \
java/io/natObjectOutputStream.lo java/io/natVMObjectStreamClass.lo \
java/lang/natCharacter.lo java/lang/natClass.lo \
java/lang/natClassLoader.lo java/lang/natConcreteProcess.lo \
java/lang/natDouble.lo java/lang/natFloat.lo java/lang/natMath.lo \
java/lang/natObject.lo java/lang/natRuntime.lo java/lang/natString.lo \
java/lang/natStringBuffer.lo java/lang/natSystem.lo \
java/lang/natThread.lo java/lang/natVMSecurityManager.lo \
java/lang/ref/natReference.lo java/lang/reflect/natArray.lo \
@ -2350,7 +2352,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 \
@ -2942,10 +2944,12 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/io/SyncFailedException.P \
.deps/java/io/UTFDataFormatException.P \
.deps/java/io/UnsupportedEncodingException.P \
.deps/java/io/VMObjectStreamClass.P \
.deps/java/io/WriteAbortedException.P .deps/java/io/Writer.P \
.deps/java/io/natFile.P .deps/java/io/natFileDescriptor.P \
.deps/java/io/natObjectInputStream.P \
.deps/java/io/natObjectOutputStream.P \
.deps/java/io/natVMObjectStreamClass.P \
.deps/java/lang/AbstractMethodError.P \
.deps/java/lang/ArithmeticException.P \
.deps/java/lang/ArrayIndexOutOfBoundsException.P \

View File

@ -120,6 +120,7 @@ extern "Java"
class SyncFailedException;
class UTFDataFormatException;
class UnsupportedEncodingException;
class VMObjectStreamClass;
class ValidatorAndPriority;
class WriteAbortedException;
class Writer;

View File

@ -525,7 +525,7 @@ public class ObjectStreamClass implements Serializable
}
// write class initializer method if present
if (hasClassInitializer (cl))
if (VMObjectStreamClass.hasClassInitializer (cl))
{
data_out.writeUTF ("<clinit>");
data_out.writeInt (Modifier.STATIC);
@ -613,31 +613,6 @@ public class ObjectStreamClass implements Serializable
return o;
}
// Returns true if CLAZZ has a static class initializer
// (a.k.a. <clinit>).
private static boolean hasClassInitializer (Class clazz)
{
Method m = null;
try
{
/*
* There exists a problem here, according to the spec
* clazz.getDeclaredMethod ("<clinit>", classArgs);
* will always throw NoSuchMethodException, even if the static
* intializer does exist.
*/
Class classArgs[] = {};
m = clazz.getDeclaredMethod ("<clinit>", classArgs);
}
catch (java.lang.NoSuchMethodException e)
{
}
return m != null;
}
public static final ObjectStreamField[] NO_FIELDS = {};
private static Hashtable classLookupTable = new Hashtable ();

View File

@ -0,0 +1,50 @@
/* VMObjectStreamClass.java -- VM helper functions for ObjectStreamClass
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.io;
import java.lang.reflect.Method;
final class VMObjectStreamClass
{
/**
* Returns true if CLAZZ has a static class initializer
* (a.k.a. <clinit>).
*/
static native boolean hasClassInitializer (Class clazz);
}

View File

@ -0,0 +1,23 @@
// natVMObjectStreamClass.cc - Native part of VMObjectStreamClass class.
/* Copyright (C) 2003 Free Software Foundation
This VMObjectStreamClass is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the ObjectInputStream "LIBGCJ_LICENSE" for
details. */
#include <gcj/cni.h>
#include <jvm.h>
#include <java/io/VMObjectStreamClass.h>
#include <java/lang/Class.h>
jboolean
java::io::VMObjectStreamClass::hasClassInitializer (jclass klass)
{
_Jv_Method *meth = _Jv_GetMethodLocal(klass, gcj::clinit_name,
gcj::void_signature);
return (meth != NULL);
}

View File

@ -1,6 +1,6 @@
// Class.h - Header file for java.lang.Class. -*- c++ -*-
/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@ -364,6 +364,7 @@ private:
friend class _Jv_BytecodeVerifier;
friend class gnu::gcj::runtime::StackTrace;
friend class java::io::VMObjectStreamClass;
// Chain for class pool.
jclass next;