summaryrefslogtreecommitdiffstats
path: root/libjava/java/lang
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-09 19:58:05 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-09 19:58:05 +0000
commit65bf3316cf384588453604be6b4f0ed3751a8b0f (patch)
tree996a5f57d4a68c53473382e45cb22f574cb3e4db /libjava/java/lang
parent8fc56618a84446beccd45b80381cdfe0e94050df (diff)
downloadppe42-gcc-65bf3316cf384588453604be6b4f0ed3751a8b0f.tar.gz
ppe42-gcc-65bf3316cf384588453604be6b4f0ed3751a8b0f.zip
Merged gcj-eclipse branch to trunk.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120621 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/lang')
-rw-r--r--libjava/java/lang/AbstractMethodError.h23
-rw-r--r--libjava/java/lang/Appendable.h21
-rw-r--r--libjava/java/lang/ArithmeticException.h23
-rw-r--r--libjava/java/lang/ArrayIndexOutOfBoundsException.h24
-rw-r--r--libjava/java/lang/ArrayStoreException.h23
-rw-r--r--libjava/java/lang/AssertionError.h29
-rw-r--r--libjava/java/lang/Boolean.h40
-rw-r--r--libjava/java/lang/Byte.h51
-rw-r--r--libjava/java/lang/CharSequence.h22
-rw-r--r--libjava/java/lang/Character$Subset.h26
-rw-r--r--libjava/java/lang/Character$UnicodeBlock.h161
-rw-r--r--libjava/java/lang/Character.h175
-rw-r--r--libjava/java/lang/Class.h77
-rw-r--r--libjava/java/lang/Class.java438
-rw-r--r--libjava/java/lang/ClassCastException.h23
-rw-r--r--libjava/java/lang/ClassCircularityError.h23
-rw-r--r--libjava/java/lang/ClassFormatError.h23
-rw-r--r--libjava/java/lang/ClassLoader$AnnotationsKey.h31
-rw-r--r--libjava/java/lang/ClassLoader.h108
-rw-r--r--libjava/java/lang/ClassLoader.java132
-rw-r--r--libjava/java/lang/ClassNotFoundException.h27
-rw-r--r--libjava/java/lang/CloneNotSupportedException.h23
-rw-r--r--libjava/java/lang/Cloneable.h18
-rw-r--r--libjava/java/lang/Comparable.h19
-rw-r--r--libjava/java/lang/Compiler.h24
-rw-r--r--libjava/java/lang/Deprecated.h19
-rw-r--r--libjava/java/lang/Double.h57
-rw-r--r--libjava/java/lang/EcosProcess.h27
-rw-r--r--libjava/java/lang/EcosProcess.java8
-rw-r--r--libjava/java/lang/Enum.h38
-rw-r--r--libjava/java/lang/EnumConstantNotPresentException.h26
-rw-r--r--libjava/java/lang/Error.h25
-rw-r--r--libjava/java/lang/Exception.h25
-rw-r--r--libjava/java/lang/ExceptionInInitializerError.h28
-rw-r--r--libjava/java/lang/Float.h58
-rw-r--r--libjava/java/lang/IllegalAccessError.h23
-rw-r--r--libjava/java/lang/IllegalAccessException.h23
-rw-r--r--libjava/java/lang/IllegalArgumentException.h25
-rw-r--r--libjava/java/lang/IllegalMonitorStateException.h23
-rw-r--r--libjava/java/lang/IllegalStateException.h25
-rw-r--r--libjava/java/lang/IllegalThreadStateException.h23
-rw-r--r--libjava/java/lang/IncompatibleClassChangeError.h23
-rw-r--r--libjava/java/lang/IndexOutOfBoundsException.h23
-rw-r--r--libjava/java/lang/InheritableThreadLocal.h24
-rw-r--r--libjava/java/lang/InstantiationError.h23
-rw-r--r--libjava/java/lang/InstantiationException.h23
-rw-r--r--libjava/java/lang/Integer.h74
-rw-r--r--libjava/java/lang/InternalError.h23
-rw-r--r--libjava/java/lang/InterruptedException.h23
-rw-r--r--libjava/java/lang/Iterable.h19
-rw-r--r--libjava/java/lang/LinkageError.h23
-rw-r--r--libjava/java/lang/Long.h69
-rw-r--r--libjava/java/lang/Math.h68
-rw-r--r--libjava/java/lang/NegativeArraySizeException.h23
-rw-r--r--libjava/java/lang/NoClassDefFoundError.h23
-rw-r--r--libjava/java/lang/NoSuchFieldError.h23
-rw-r--r--libjava/java/lang/NoSuchFieldException.h23
-rw-r--r--libjava/java/lang/NoSuchMethodError.h23
-rw-r--r--libjava/java/lang/NoSuchMethodException.h23
-rw-r--r--libjava/java/lang/NullPointerException.h23
-rw-r--r--libjava/java/lang/Number.h32
-rw-r--r--libjava/java/lang/NumberFormatException.h23
-rw-r--r--libjava/java/lang/OutOfMemoryError.h23
-rw-r--r--libjava/java/lang/Override.h19
-rw-r--r--libjava/java/lang/Package.h62
-rw-r--r--libjava/java/lang/Package.java415
-rw-r--r--libjava/java/lang/PosixProcess$EOFInputStream.h24
-rw-r--r--libjava/java/lang/PosixProcess$ProcessManager.h39
-rw-r--r--libjava/java/lang/PosixProcess.h62
-rw-r--r--libjava/java/lang/PosixProcess.java47
-rw-r--r--libjava/java/lang/Process.h25
-rw-r--r--libjava/java/lang/ProcessBuilder.h37
-rw-r--r--libjava/java/lang/ProcessBuilder.java118
-rw-r--r--libjava/java/lang/Readable.h29
-rw-r--r--libjava/java/lang/Runnable.h19
-rw-r--r--libjava/java/lang/Runtime.h69
-rw-r--r--libjava/java/lang/RuntimeException.h25
-rw-r--r--libjava/java/lang/RuntimePermission.h23
-rw-r--r--libjava/java/lang/SecurityContext.h23
-rw-r--r--libjava/java/lang/SecurityException.h25
-rw-r--r--libjava/java/lang/SecurityManager$1.h26
-rw-r--r--libjava/java/lang/SecurityManager.h84
-rw-r--r--libjava/java/lang/SecurityManager.java1057
-rw-r--r--libjava/java/lang/Short.h54
-rw-r--r--libjava/java/lang/StackOverflowError.h23
-rw-r--r--libjava/java/lang/StackTraceElement.h39
-rw-r--r--libjava/java/lang/StrictMath.h203
-rw-r--r--libjava/java/lang/String$CaseInsensitiveComparator.h24
-rw-r--r--libjava/java/lang/String.h138
-rw-r--r--libjava/java/lang/StringBuffer.h85
-rw-r--r--libjava/java/lang/StringBuilder.h83
-rw-r--r--libjava/java/lang/StringBuilder.java3
-rw-r--r--libjava/java/lang/StringIndexOutOfBoundsException.h24
-rw-r--r--libjava/java/lang/SuppressWarnings.h22
-rw-r--r--libjava/java/lang/System$EnvironmentCollection.h29
-rw-r--r--libjava/java/lang/System$EnvironmentMap.h34
-rw-r--r--libjava/java/lang/System$EnvironmentSet.h21
-rw-r--r--libjava/java/lang/System.h56
-rw-r--r--libjava/java/lang/System.java468
-rw-r--r--libjava/java/lang/Thread$State.h32
-rw-r--r--libjava/java/lang/Thread$UncaughtExceptionHandler.h19
-rw-r--r--libjava/java/lang/Thread.h161
-rw-r--r--libjava/java/lang/Thread.java264
-rw-r--r--libjava/java/lang/ThreadDeath.h22
-rw-r--r--libjava/java/lang/ThreadGroup.h69
-rw-r--r--libjava/java/lang/ThreadLocal.h52
-rw-r--r--libjava/java/lang/ThreadLocal.java179
-rw-r--r--libjava/java/lang/Throwable$StaticData.h21
-rw-r--r--libjava/java/lang/Throwable.h46
-rw-r--r--libjava/java/lang/TypeNotPresentException.h24
-rw-r--r--libjava/java/lang/UnknownError.h23
-rw-r--r--libjava/java/lang/UnsatisfiedLinkError.h23
-rw-r--r--libjava/java/lang/UnsupportedClassVersionError.h23
-rw-r--r--libjava/java/lang/UnsupportedOperationException.h25
-rw-r--r--libjava/java/lang/VMClassLoader.h74
-rw-r--r--libjava/java/lang/VMCompiler.h64
-rw-r--r--libjava/java/lang/VMCompiler.java10
-rw-r--r--libjava/java/lang/VMDouble.h25
-rw-r--r--libjava/java/lang/VMFloat.h23
-rw-r--r--libjava/java/lang/VMSecurityManager.java68
-rw-r--r--libjava/java/lang/VMThrowable.h36
-rw-r--r--libjava/java/lang/VerifyError.h23
-rw-r--r--libjava/java/lang/VirtualMachineError.h23
-rw-r--r--libjava/java/lang/Void.h20
-rw-r--r--libjava/java/lang/Win32Process.h37
-rw-r--r--libjava/java/lang/Win32Process.java8
-rw-r--r--libjava/java/lang/annotation/Annotation.h22
-rw-r--r--libjava/java/lang/annotation/AnnotationFormatError.h24
-rw-r--r--libjava/java/lang/annotation/AnnotationTypeMismatchException.h26
-rw-r--r--libjava/java/lang/annotation/Documented.h19
-rw-r--r--libjava/java/lang/annotation/ElementType.h35
-rw-r--r--libjava/java/lang/annotation/IncompleteAnnotationException.h25
-rw-r--r--libjava/java/lang/annotation/Inherited.h19
-rw-r--r--libjava/java/lang/annotation/Retention.h20
-rw-r--r--libjava/java/lang/annotation/RetentionPolicy.h30
-rw-r--r--libjava/java/lang/annotation/Target.h22
-rw-r--r--libjava/java/lang/instrument/ClassDefinition.h27
-rw-r--r--libjava/java/lang/instrument/ClassFileTransformer.h31
-rw-r--r--libjava/java/lang/instrument/IllegalClassFormatException.h23
-rw-r--r--libjava/java/lang/instrument/Instrumentation.h27
-rw-r--r--libjava/java/lang/instrument/UnmodifiableClassException.h23
-rw-r--r--libjava/java/lang/management/ClassLoadingMXBean.h23
-rw-r--r--libjava/java/lang/management/CompilationMXBean.h21
-rw-r--r--libjava/java/lang/management/GarbageCollectorMXBean.h25
-rw-r--r--libjava/java/lang/management/ManagementFactory.h57
-rw-r--r--libjava/java/lang/management/ManagementPermission.h23
-rw-r--r--libjava/java/lang/management/MemoryMXBean.h24
-rw-r--r--libjava/java/lang/management/MemoryManagerMXBean.h23
-rw-r--r--libjava/java/lang/management/MemoryNotificationInfo.h43
-rw-r--r--libjava/java/lang/management/MemoryPoolMXBean.h38
-rw-r--r--libjava/java/lang/management/MemoryType.h28
-rw-r--r--libjava/java/lang/management/MemoryUsage.h44
-rw-r--r--libjava/java/lang/management/OperatingSystemMXBean.h22
-rw-r--r--libjava/java/lang/management/RuntimeMXBean.h34
-rw-r--r--libjava/java/lang/management/ThreadInfo.h70
-rw-r--r--libjava/java/lang/management/ThreadMXBean.h42
-rw-r--r--libjava/java/lang/management/VMManagementFactory.h25
-rw-r--r--libjava/java/lang/management/VMManagementFactory.java15
-rw-r--r--libjava/java/lang/management/natVMManagementFactory.cc44
-rw-r--r--libjava/java/lang/natClass.cc766
-rw-r--r--libjava/java/lang/natClassLoader.cc66
-rw-r--r--libjava/java/lang/natEcosProcess.cc6
-rw-r--r--libjava/java/lang/natPosixProcess.cc20
-rw-r--r--libjava/java/lang/natRuntime.cc8
-rw-r--r--libjava/java/lang/natThread.cc100
-rw-r--r--libjava/java/lang/natThreadLocal.cc169
-rw-r--r--libjava/java/lang/natVMClassLoader.cc3
-rw-r--r--libjava/java/lang/natVMSecurityManager.cc29
-rw-r--r--libjava/java/lang/natWin32Process.cc16
-rw-r--r--libjava/java/lang/ref/PhantomReference.h20
-rw-r--r--libjava/java/lang/ref/Reference.h45
-rw-r--r--libjava/java/lang/ref/Reference.java20
-rw-r--r--libjava/java/lang/ref/ReferenceQueue.h31
-rw-r--r--libjava/java/lang/ref/SoftReference.h21
-rw-r--r--libjava/java/lang/ref/WeakReference.h20
-rw-r--r--libjava/java/lang/ref/natReference.cc9
-rw-r--r--libjava/java/lang/reflect/AccessibleObject.h36
-rw-r--r--libjava/java/lang/reflect/AnnotatedElement.h24
-rw-r--r--libjava/java/lang/reflect/Array.h46
-rw-r--r--libjava/java/lang/reflect/Constructor.h65
-rw-r--r--libjava/java/lang/reflect/Constructor.java50
-rw-r--r--libjava/java/lang/reflect/Field.h96
-rw-r--r--libjava/java/lang/reflect/Field.java32
-rw-r--r--libjava/java/lang/reflect/GenericArrayType.h19
-rw-r--r--libjava/java/lang/reflect/GenericDeclaration.h21
-rw-r--r--libjava/java/lang/reflect/GenericSignatureFormatError.h22
-rw-r--r--libjava/java/lang/reflect/InvocationHandler.h21
-rw-r--r--libjava/java/lang/reflect/InvocationTargetException.h28
-rw-r--r--libjava/java/lang/reflect/MalformedParameterizedTypeException.h22
-rw-r--r--libjava/java/lang/reflect/Member.h24
-rw-r--r--libjava/java/lang/reflect/Method.h76
-rw-r--r--libjava/java/lang/reflect/Method.java73
-rw-r--r--libjava/java/lang/reflect/Modifier.h58
-rw-r--r--libjava/java/lang/reflect/ParameterizedType.h23
-rw-r--r--libjava/java/lang/reflect/Proxy$ClassFactory.h78
-rw-r--r--libjava/java/lang/reflect/Proxy$ProxyData.h37
-rw-r--r--libjava/java/lang/reflect/Proxy$ProxySignature.h28
-rw-r--r--libjava/java/lang/reflect/Proxy$ProxyType.h28
-rw-r--r--libjava/java/lang/reflect/Proxy.h32
-rw-r--r--libjava/java/lang/reflect/ReflectPermission.h23
-rw-r--r--libjava/java/lang/reflect/Type.h18
-rw-r--r--libjava/java/lang/reflect/TypeVariable.h23
-rw-r--r--libjava/java/lang/reflect/UndeclaredThrowableException.h26
-rw-r--r--libjava/java/lang/reflect/VMProxy.h28
-rw-r--r--libjava/java/lang/reflect/VMProxy.java7
-rw-r--r--libjava/java/lang/reflect/WildcardType.h22
-rw-r--r--libjava/java/lang/reflect/natConstructor.cc21
-rw-r--r--libjava/java/lang/reflect/natField.cc14
-rw-r--r--libjava/java/lang/reflect/natMethod.cc29
-rw-r--r--libjava/java/lang/reflect/natVMProxy.cc394
210 files changed, 9597 insertions, 1889 deletions
diff --git a/libjava/java/lang/AbstractMethodError.h b/libjava/java/lang/AbstractMethodError.h
new file mode 100644
index 00000000000..92a757da238
--- /dev/null
+++ b/libjava/java/lang/AbstractMethodError.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_AbstractMethodError__
+#define __java_lang_AbstractMethodError__
+
+#pragma interface
+
+#include <java/lang/IncompatibleClassChangeError.h>
+
+class java::lang::AbstractMethodError : public ::java::lang::IncompatibleClassChangeError
+{
+
+public:
+ AbstractMethodError();
+ AbstractMethodError(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -1654391082989018462LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_AbstractMethodError__
diff --git a/libjava/java/lang/Appendable.h b/libjava/java/lang/Appendable.h
new file mode 100644
index 00000000000..d304ff9cfd0
--- /dev/null
+++ b/libjava/java/lang/Appendable.h
@@ -0,0 +1,21 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Appendable__
+#define __java_lang_Appendable__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::Appendable : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::lang::Appendable * append(jchar) = 0;
+ virtual ::java::lang::Appendable * append(::java::lang::CharSequence *) = 0;
+ virtual ::java::lang::Appendable * append(::java::lang::CharSequence *, jint, jint) = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_Appendable__
diff --git a/libjava/java/lang/ArithmeticException.h b/libjava/java/lang/ArithmeticException.h
new file mode 100644
index 00000000000..8d784adb7e7
--- /dev/null
+++ b/libjava/java/lang/ArithmeticException.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ArithmeticException__
+#define __java_lang_ArithmeticException__
+
+#pragma interface
+
+#include <java/lang/RuntimeException.h>
+
+class java::lang::ArithmeticException : public ::java::lang::RuntimeException
+{
+
+public:
+ ArithmeticException();
+ ArithmeticException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 2256477558314496007LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_ArithmeticException__
diff --git a/libjava/java/lang/ArrayIndexOutOfBoundsException.h b/libjava/java/lang/ArrayIndexOutOfBoundsException.h
new file mode 100644
index 00000000000..8e65f70f741
--- /dev/null
+++ b/libjava/java/lang/ArrayIndexOutOfBoundsException.h
@@ -0,0 +1,24 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ArrayIndexOutOfBoundsException__
+#define __java_lang_ArrayIndexOutOfBoundsException__
+
+#pragma interface
+
+#include <java/lang/IndexOutOfBoundsException.h>
+
+class java::lang::ArrayIndexOutOfBoundsException : public ::java::lang::IndexOutOfBoundsException
+{
+
+public:
+ ArrayIndexOutOfBoundsException();
+ ArrayIndexOutOfBoundsException(::java::lang::String *);
+ ArrayIndexOutOfBoundsException(jint);
+private:
+ static const jlong serialVersionUID = -5116101128118950844LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_ArrayIndexOutOfBoundsException__
diff --git a/libjava/java/lang/ArrayStoreException.h b/libjava/java/lang/ArrayStoreException.h
new file mode 100644
index 00000000000..8e120d11cbb
--- /dev/null
+++ b/libjava/java/lang/ArrayStoreException.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ArrayStoreException__
+#define __java_lang_ArrayStoreException__
+
+#pragma interface
+
+#include <java/lang/RuntimeException.h>
+
+class java::lang::ArrayStoreException : public ::java::lang::RuntimeException
+{
+
+public:
+ ArrayStoreException();
+ ArrayStoreException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -4522193890499838241LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_ArrayStoreException__
diff --git a/libjava/java/lang/AssertionError.h b/libjava/java/lang/AssertionError.h
new file mode 100644
index 00000000000..0154c04b3f4
--- /dev/null
+++ b/libjava/java/lang/AssertionError.h
@@ -0,0 +1,29 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_AssertionError__
+#define __java_lang_AssertionError__
+
+#pragma interface
+
+#include <java/lang/Error.h>
+
+class java::lang::AssertionError : public ::java::lang::Error
+{
+
+public:
+ AssertionError();
+ AssertionError(::java::lang::Object *);
+ AssertionError(jboolean);
+ AssertionError(jchar);
+ AssertionError(jint);
+ AssertionError(jlong);
+ AssertionError(jfloat);
+ AssertionError(jdouble);
+private:
+ static const jlong serialVersionUID = -5013299493970297370LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_AssertionError__
diff --git a/libjava/java/lang/Boolean.h b/libjava/java/lang/Boolean.h
new file mode 100644
index 00000000000..a8476f7b8b1
--- /dev/null
+++ b/libjava/java/lang/Boolean.h
@@ -0,0 +1,40 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Boolean__
+#define __java_lang_Boolean__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::Boolean : public ::java::lang::Object
+{
+
+public:
+ Boolean(jboolean);
+ Boolean(::java::lang::String *);
+ jboolean booleanValue();
+ static ::java::lang::Boolean * valueOf(jboolean);
+ static ::java::lang::Boolean * valueOf(::java::lang::String *);
+ static ::java::lang::String * toString(jboolean);
+ ::java::lang::String * toString();
+ jint hashCode();
+ jboolean equals(::java::lang::Object *);
+ static jboolean getBoolean(::java::lang::String *);
+ jint target$compareTo(::java::lang::Boolean *);
+ static jboolean parseBoolean(::java::lang::String *);
+ jint compareTo(::java::lang::Object *);
+private:
+ static const jlong serialVersionUID = -3665804199014368530LL;
+public:
+ static ::java::lang::Boolean * TRUE;
+ static ::java::lang::Boolean * FALSE;
+ static ::java::lang::Class * TYPE;
+private:
+ jboolean __attribute__((aligned(__alignof__( ::java::lang::Object)))) value;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Boolean__
diff --git a/libjava/java/lang/Byte.h b/libjava/java/lang/Byte.h
new file mode 100644
index 00000000000..2caccd7be5c
--- /dev/null
+++ b/libjava/java/lang/Byte.h
@@ -0,0 +1,51 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Byte__
+#define __java_lang_Byte__
+
+#pragma interface
+
+#include <java/lang/Number.h>
+#include <gcj/array.h>
+
+
+class java::lang::Byte : public ::java::lang::Number
+{
+
+public:
+ Byte(jbyte);
+ Byte(::java::lang::String *);
+ static ::java::lang::String * toString(jbyte);
+ static jbyte parseByte(::java::lang::String *);
+ static jbyte parseByte(::java::lang::String *, jint);
+ static ::java::lang::Byte * valueOf(::java::lang::String *, jint);
+ static ::java::lang::Byte * valueOf(::java::lang::String *);
+ static ::java::lang::Byte * valueOf(jbyte);
+ static ::java::lang::Byte * decode(::java::lang::String *);
+ jbyte byteValue();
+ jshort shortValue();
+ jint intValue();
+ jlong longValue();
+ jfloat floatValue();
+ jdouble doubleValue();
+ ::java::lang::String * toString();
+ jint hashCode();
+ jboolean equals(::java::lang::Object *);
+ jint target$compareTo(::java::lang::Byte *);
+ jint compareTo(::java::lang::Object *);
+private:
+ static const jlong serialVersionUID = -7183698231559129828LL;
+public:
+ static const jbyte MIN_VALUE = -128;
+ static const jbyte MAX_VALUE = 127;
+ static ::java::lang::Class * TYPE;
+ static const jint SIZE = 8;
+private:
+ static JArray< ::java::lang::Byte * > * byteCache;
+ jbyte __attribute__((aligned(__alignof__( ::java::lang::Number)))) value;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Byte__
diff --git a/libjava/java/lang/CharSequence.h b/libjava/java/lang/CharSequence.h
new file mode 100644
index 00000000000..1348b564d04
--- /dev/null
+++ b/libjava/java/lang/CharSequence.h
@@ -0,0 +1,22 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_CharSequence__
+#define __java_lang_CharSequence__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::CharSequence : public ::java::lang::Object
+{
+
+public:
+ virtual jchar charAt(jint) = 0;
+ virtual jint length() = 0;
+ virtual ::java::lang::CharSequence * subSequence(jint, jint) = 0;
+ virtual ::java::lang::String * toString() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_CharSequence__
diff --git a/libjava/java/lang/Character$Subset.h b/libjava/java/lang/Character$Subset.h
new file mode 100644
index 00000000000..93f2ba1cb34
--- /dev/null
+++ b/libjava/java/lang/Character$Subset.h
@@ -0,0 +1,26 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Character$Subset__
+#define __java_lang_Character$Subset__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::Character$Subset : public ::java::lang::Object
+{
+
+public: // actually protected
+ Character$Subset(::java::lang::String *);
+public:
+ virtual jboolean equals(::java::lang::Object *);
+ virtual jint hashCode();
+ virtual ::java::lang::String * toString();
+private:
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) name;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Character$Subset__
diff --git a/libjava/java/lang/Character$UnicodeBlock.h b/libjava/java/lang/Character$UnicodeBlock.h
new file mode 100644
index 00000000000..43fa6b447e3
--- /dev/null
+++ b/libjava/java/lang/Character$UnicodeBlock.h
@@ -0,0 +1,161 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Character$UnicodeBlock__
+#define __java_lang_Character$UnicodeBlock__
+
+#pragma interface
+
+#include <java/lang/Character$Subset.h>
+#include <gcj/array.h>
+
+
+class java::lang::Character$UnicodeBlock : public ::java::lang::Character$Subset
+{
+
+ Character$UnicodeBlock(jint, jint, ::java::lang::String *, ::java::lang::String *);
+public:
+ static ::java::lang::Character$UnicodeBlock * of(jchar);
+ static ::java::lang::Character$UnicodeBlock * of(jint);
+ static ::java::lang::Character$UnicodeBlock * forName(::java::lang::String *);
+private:
+ jint __attribute__((aligned(__alignof__( ::java::lang::Character$Subset)))) start;
+ jint end;
+ ::java::lang::String * canonicalName;
+ static const jint CANONICAL_NAME = 0;
+ static const jint NO_SPACES_NAME = 1;
+ static const jint CONSTANT_NAME = 2;
+public:
+ static ::java::lang::Character$UnicodeBlock * BASIC_LATIN;
+ static ::java::lang::Character$UnicodeBlock * LATIN_1_SUPPLEMENT;
+ static ::java::lang::Character$UnicodeBlock * LATIN_EXTENDED_A;
+ static ::java::lang::Character$UnicodeBlock * LATIN_EXTENDED_B;
+ static ::java::lang::Character$UnicodeBlock * IPA_EXTENSIONS;
+ static ::java::lang::Character$UnicodeBlock * SPACING_MODIFIER_LETTERS;
+ static ::java::lang::Character$UnicodeBlock * COMBINING_DIACRITICAL_MARKS;
+ static ::java::lang::Character$UnicodeBlock * GREEK;
+ static ::java::lang::Character$UnicodeBlock * CYRILLIC;
+ static ::java::lang::Character$UnicodeBlock * CYRILLIC_SUPPLEMENTARY;
+ static ::java::lang::Character$UnicodeBlock * ARMENIAN;
+ static ::java::lang::Character$UnicodeBlock * HEBREW;
+ static ::java::lang::Character$UnicodeBlock * ARABIC;
+ static ::java::lang::Character$UnicodeBlock * SYRIAC;
+ static ::java::lang::Character$UnicodeBlock * THAANA;
+ static ::java::lang::Character$UnicodeBlock * DEVANAGARI;
+ static ::java::lang::Character$UnicodeBlock * BENGALI;
+ static ::java::lang::Character$UnicodeBlock * GURMUKHI;
+ static ::java::lang::Character$UnicodeBlock * GUJARATI;
+ static ::java::lang::Character$UnicodeBlock * ORIYA;
+ static ::java::lang::Character$UnicodeBlock * TAMIL;
+ static ::java::lang::Character$UnicodeBlock * TELUGU;
+ static ::java::lang::Character$UnicodeBlock * KANNADA;
+ static ::java::lang::Character$UnicodeBlock * MALAYALAM;
+ static ::java::lang::Character$UnicodeBlock * SINHALA;
+ static ::java::lang::Character$UnicodeBlock * THAI;
+ static ::java::lang::Character$UnicodeBlock * LAO;
+ static ::java::lang::Character$UnicodeBlock * TIBETAN;
+ static ::java::lang::Character$UnicodeBlock * MYANMAR;
+ static ::java::lang::Character$UnicodeBlock * GEORGIAN;
+ static ::java::lang::Character$UnicodeBlock * HANGUL_JAMO;
+ static ::java::lang::Character$UnicodeBlock * ETHIOPIC;
+ static ::java::lang::Character$UnicodeBlock * CHEROKEE;
+ static ::java::lang::Character$UnicodeBlock * UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS;
+ static ::java::lang::Character$UnicodeBlock * OGHAM;
+ static ::java::lang::Character$UnicodeBlock * RUNIC;
+ static ::java::lang::Character$UnicodeBlock * TAGALOG;
+ static ::java::lang::Character$UnicodeBlock * HANUNOO;
+ static ::java::lang::Character$UnicodeBlock * BUHID;
+ static ::java::lang::Character$UnicodeBlock * TAGBANWA;
+ static ::java::lang::Character$UnicodeBlock * KHMER;
+ static ::java::lang::Character$UnicodeBlock * MONGOLIAN;
+ static ::java::lang::Character$UnicodeBlock * LIMBU;
+ static ::java::lang::Character$UnicodeBlock * TAI_LE;
+ static ::java::lang::Character$UnicodeBlock * KHMER_SYMBOLS;
+ static ::java::lang::Character$UnicodeBlock * PHONETIC_EXTENSIONS;
+ static ::java::lang::Character$UnicodeBlock * LATIN_EXTENDED_ADDITIONAL;
+ static ::java::lang::Character$UnicodeBlock * GREEK_EXTENDED;
+ static ::java::lang::Character$UnicodeBlock * GENERAL_PUNCTUATION;
+ static ::java::lang::Character$UnicodeBlock * SUPERSCRIPTS_AND_SUBSCRIPTS;
+ static ::java::lang::Character$UnicodeBlock * CURRENCY_SYMBOLS;
+ static ::java::lang::Character$UnicodeBlock * COMBINING_MARKS_FOR_SYMBOLS;
+ static ::java::lang::Character$UnicodeBlock * LETTERLIKE_SYMBOLS;
+ static ::java::lang::Character$UnicodeBlock * NUMBER_FORMS;
+ static ::java::lang::Character$UnicodeBlock * ARROWS;
+ static ::java::lang::Character$UnicodeBlock * MATHEMATICAL_OPERATORS;
+ static ::java::lang::Character$UnicodeBlock * MISCELLANEOUS_TECHNICAL;
+ static ::java::lang::Character$UnicodeBlock * CONTROL_PICTURES;
+ static ::java::lang::Character$UnicodeBlock * OPTICAL_CHARACTER_RECOGNITION;
+ static ::java::lang::Character$UnicodeBlock * ENCLOSED_ALPHANUMERICS;
+ static ::java::lang::Character$UnicodeBlock * BOX_DRAWING;
+ static ::java::lang::Character$UnicodeBlock * BLOCK_ELEMENTS;
+ static ::java::lang::Character$UnicodeBlock * GEOMETRIC_SHAPES;
+ static ::java::lang::Character$UnicodeBlock * MISCELLANEOUS_SYMBOLS;
+ static ::java::lang::Character$UnicodeBlock * DINGBATS;
+ static ::java::lang::Character$UnicodeBlock * MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A;
+ static ::java::lang::Character$UnicodeBlock * SUPPLEMENTAL_ARROWS_A;
+ static ::java::lang::Character$UnicodeBlock * BRAILLE_PATTERNS;
+ static ::java::lang::Character$UnicodeBlock * SUPPLEMENTAL_ARROWS_B;
+ static ::java::lang::Character$UnicodeBlock * MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B;
+ static ::java::lang::Character$UnicodeBlock * SUPPLEMENTAL_MATHEMATICAL_OPERATORS;
+ static ::java::lang::Character$UnicodeBlock * MISCELLANEOUS_SYMBOLS_AND_ARROWS;
+ static ::java::lang::Character$UnicodeBlock * CJK_RADICALS_SUPPLEMENT;
+ static ::java::lang::Character$UnicodeBlock * KANGXI_RADICALS;
+ static ::java::lang::Character$UnicodeBlock * IDEOGRAPHIC_DESCRIPTION_CHARACTERS;
+ static ::java::lang::Character$UnicodeBlock * CJK_SYMBOLS_AND_PUNCTUATION;
+ static ::java::lang::Character$UnicodeBlock * HIRAGANA;
+ static ::java::lang::Character$UnicodeBlock * KATAKANA;
+ static ::java::lang::Character$UnicodeBlock * BOPOMOFO;
+ static ::java::lang::Character$UnicodeBlock * HANGUL_COMPATIBILITY_JAMO;
+ static ::java::lang::Character$UnicodeBlock * KANBUN;
+ static ::java::lang::Character$UnicodeBlock * BOPOMOFO_EXTENDED;
+ static ::java::lang::Character$UnicodeBlock * KATAKANA_PHONETIC_EXTENSIONS;
+ static ::java::lang::Character$UnicodeBlock * ENCLOSED_CJK_LETTERS_AND_MONTHS;
+ static ::java::lang::Character$UnicodeBlock * CJK_COMPATIBILITY;
+ static ::java::lang::Character$UnicodeBlock * CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A;
+ static ::java::lang::Character$UnicodeBlock * YIJING_HEXAGRAM_SYMBOLS;
+ static ::java::lang::Character$UnicodeBlock * CJK_UNIFIED_IDEOGRAPHS;
+ static ::java::lang::Character$UnicodeBlock * YI_SYLLABLES;
+ static ::java::lang::Character$UnicodeBlock * YI_RADICALS;
+ static ::java::lang::Character$UnicodeBlock * HANGUL_SYLLABLES;
+ static ::java::lang::Character$UnicodeBlock * HIGH_SURROGATES;
+ static ::java::lang::Character$UnicodeBlock * HIGH_PRIVATE_USE_SURROGATES;
+ static ::java::lang::Character$UnicodeBlock * LOW_SURROGATES;
+ static ::java::lang::Character$UnicodeBlock * PRIVATE_USE_AREA;
+ static ::java::lang::Character$UnicodeBlock * CJK_COMPATIBILITY_IDEOGRAPHS;
+ static ::java::lang::Character$UnicodeBlock * ALPHABETIC_PRESENTATION_FORMS;
+ static ::java::lang::Character$UnicodeBlock * ARABIC_PRESENTATION_FORMS_A;
+ static ::java::lang::Character$UnicodeBlock * VARIATION_SELECTORS;
+ static ::java::lang::Character$UnicodeBlock * COMBINING_HALF_MARKS;
+ static ::java::lang::Character$UnicodeBlock * CJK_COMPATIBILITY_FORMS;
+ static ::java::lang::Character$UnicodeBlock * SMALL_FORM_VARIANTS;
+ static ::java::lang::Character$UnicodeBlock * ARABIC_PRESENTATION_FORMS_B;
+ static ::java::lang::Character$UnicodeBlock * HALFWIDTH_AND_FULLWIDTH_FORMS;
+ static ::java::lang::Character$UnicodeBlock * SPECIALS;
+ static ::java::lang::Character$UnicodeBlock * LINEAR_B_SYLLABARY;
+ static ::java::lang::Character$UnicodeBlock * LINEAR_B_IDEOGRAMS;
+ static ::java::lang::Character$UnicodeBlock * AEGEAN_NUMBERS;
+ static ::java::lang::Character$UnicodeBlock * OLD_ITALIC;
+ static ::java::lang::Character$UnicodeBlock * GOTHIC;
+ static ::java::lang::Character$UnicodeBlock * UGARITIC;
+ static ::java::lang::Character$UnicodeBlock * DESERET;
+ static ::java::lang::Character$UnicodeBlock * SHAVIAN;
+ static ::java::lang::Character$UnicodeBlock * OSMANYA;
+ static ::java::lang::Character$UnicodeBlock * CYPRIOT_SYLLABARY;
+ static ::java::lang::Character$UnicodeBlock * BYZANTINE_MUSICAL_SYMBOLS;
+ static ::java::lang::Character$UnicodeBlock * MUSICAL_SYMBOLS;
+ static ::java::lang::Character$UnicodeBlock * TAI_XUAN_JING_SYMBOLS;
+ static ::java::lang::Character$UnicodeBlock * MATHEMATICAL_ALPHANUMERIC_SYMBOLS;
+ static ::java::lang::Character$UnicodeBlock * CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B;
+ static ::java::lang::Character$UnicodeBlock * CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT;
+ static ::java::lang::Character$UnicodeBlock * TAGS;
+ static ::java::lang::Character$UnicodeBlock * VARIATION_SELECTORS_SUPPLEMENT;
+ static ::java::lang::Character$UnicodeBlock * SUPPLEMENTARY_PRIVATE_USE_AREA_A;
+ static ::java::lang::Character$UnicodeBlock * SUPPLEMENTARY_PRIVATE_USE_AREA_B;
+ static ::java::lang::Character$UnicodeBlock * SURROGATES_AREA;
+private:
+ static JArray< ::java::lang::Character$UnicodeBlock * > * sets;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Character$UnicodeBlock__
diff --git a/libjava/java/lang/Character.h b/libjava/java/lang/Character.h
new file mode 100644
index 00000000000..ed913ab7c7e
--- /dev/null
+++ b/libjava/java/lang/Character.h
@@ -0,0 +1,175 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Character__
+#define __java_lang_Character__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::Character : public ::java::lang::Object
+{
+
+ static jchar readChar(jchar);
+ static jchar readCodePoint(jint);
+public:
+ Character(jchar);
+ jchar charValue();
+ jint hashCode();
+ jboolean equals(::java::lang::Object *);
+ ::java::lang::String * toString();
+ static ::java::lang::String * toString(jchar);
+ static jboolean isLowerCase(jchar);
+ static jboolean isLowerCase(jint);
+ static jboolean isUpperCase(jchar);
+ static jboolean isUpperCase(jint);
+ static jboolean isTitleCase(jchar);
+ static jboolean isTitleCase(jint);
+ static jboolean isDigit(jchar);
+ static jboolean isDigit(jint);
+ static jboolean isDefined(jchar);
+ static jboolean isDefined(jint);
+ static jboolean isLetter(jchar);
+ static jboolean isLetter(jint);
+ static jboolean isLetterOrDigit(jchar);
+ static jboolean isLetterOrDigit(jint);
+ static jboolean isJavaLetter(jchar);
+ static jboolean isJavaIdentifierStart(jint);
+ static jboolean isJavaLetterOrDigit(jchar);
+ static jboolean isJavaIdentifierStart(jchar);
+ static jboolean isJavaIdentifierPart(jchar);
+ static jboolean isJavaIdentifierPart(jint);
+ static jboolean isUnicodeIdentifierStart(jchar);
+ static jboolean isUnicodeIdentifierStart(jint);
+ static jboolean isUnicodeIdentifierPart(jchar);
+ static jboolean isUnicodeIdentifierPart(jint);
+ static jboolean isIdentifierIgnorable(jchar);
+ static jboolean isIdentifierIgnorable(jint);
+ static jchar toLowerCase(jchar);
+ static jint toLowerCase(jint);
+ static jchar toUpperCase(jchar);
+ static jint toUpperCase(jint);
+ static jchar toTitleCase(jchar);
+ static jint toTitleCase(jint);
+ static jint digit(jchar, jint);
+ static jint digit(jint, jint);
+ static jint getNumericValue(jchar);
+ static jint getNumericValue(jint);
+ static jboolean isSpace(jchar);
+ static jboolean isSpaceChar(jchar);
+ static jboolean isSpaceChar(jint);
+ static jboolean isWhitespace(jchar);
+ static jboolean isWhitespace(jint);
+ static jboolean isISOControl(jchar);
+ static jboolean isISOControl(jint);
+ static jint getType(jchar);
+ static jint getType(jint);
+ static jchar forDigit(jint, jint);
+ static jbyte getDirectionality(jchar);
+ static jbyte getDirectionality(jint);
+ static jboolean isMirrored(jchar);
+ static jboolean isMirrored(jint);
+ jint compareTo(::java::lang::Character *);
+ jint compareTo(::java::lang::Object *);
+ static ::java::lang::Character * valueOf(jchar);
+ static jchar reverseBytes(jchar);
+ static JArray< jchar > * toChars(jint);
+ static jint toChars(jint, JArray< jchar > *, jint);
+ static jint charCount(jint);
+ static jboolean isSupplementaryCodePoint(jint);
+ static jboolean isValidCodePoint(jint);
+ static jboolean isHighSurrogate(jchar);
+ static jboolean isLowSurrogate(jchar);
+ static jboolean isSurrogatePair(jchar, jchar);
+ static jint toCodePoint(jchar, jchar);
+ static jint codePointAt(::java::lang::CharSequence *, jint);
+ static jint codePointAt(JArray< jchar > *, jint);
+ static jint codePointAt(JArray< jchar > *, jint, jint);
+ static jint codePointBefore(JArray< jchar > *, jint);
+ static jint codePointBefore(JArray< jchar > *, jint, jint);
+ static jint codePointBefore(::java::lang::CharSequence *, jint);
+private:
+ jchar __attribute__((aligned(__alignof__( ::java::lang::Object)))) value;
+ static const jlong serialVersionUID = 3786198910865385080LL;
+public:
+ static const jint MIN_RADIX = 2;
+ static const jint MAX_RADIX = 36;
+ static const jchar MIN_VALUE = 0;
+ static const jchar MAX_VALUE = 65535;
+ static ::java::lang::Class * TYPE;
+ static const jint SIZE = 16;
+private:
+ static const jint MAX_CACHE = 127;
+ static JArray< ::java::lang::Character * > * charCache;
+public:
+ static const jbyte UPPERCASE_LETTER = 1;
+ static const jbyte LOWERCASE_LETTER = 2;
+ static const jbyte TITLECASE_LETTER = 3;
+ static const jbyte NON_SPACING_MARK = 6;
+ static const jbyte COMBINING_SPACING_MARK = 8;
+ static const jbyte ENCLOSING_MARK = 7;
+ static const jbyte DECIMAL_DIGIT_NUMBER = 9;
+ static const jbyte LETTER_NUMBER = 10;
+ static const jbyte OTHER_NUMBER = 11;
+ static const jbyte SPACE_SEPARATOR = 12;
+ static const jbyte LINE_SEPARATOR = 13;
+ static const jbyte PARAGRAPH_SEPARATOR = 14;
+ static const jbyte CONTROL = 15;
+ static const jbyte FORMAT = 16;
+ static const jbyte SURROGATE = 19;
+ static const jbyte PRIVATE_USE = 18;
+ static const jbyte UNASSIGNED = 0;
+ static const jbyte MODIFIER_LETTER = 4;
+ static const jbyte OTHER_LETTER = 5;
+ static const jbyte CONNECTOR_PUNCTUATION = 23;
+ static const jbyte DASH_PUNCTUATION = 20;
+ static const jbyte START_PUNCTUATION = 21;
+ static const jbyte END_PUNCTUATION = 22;
+ static const jbyte INITIAL_QUOTE_PUNCTUATION = 29;
+ static const jbyte FINAL_QUOTE_PUNCTUATION = 30;
+ static const jbyte OTHER_PUNCTUATION = 24;
+ static const jbyte MATH_SYMBOL = 25;
+ static const jbyte CURRENCY_SYMBOL = 26;
+ static const jbyte MODIFIER_SYMBOL = 27;
+ static const jbyte OTHER_SYMBOL = 28;
+ static const jbyte DIRECTIONALITY_UNDEFINED = -1;
+ static const jbyte DIRECTIONALITY_LEFT_TO_RIGHT = 0;
+ static const jbyte DIRECTIONALITY_RIGHT_TO_LEFT = 1;
+ static const jbyte DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC = 2;
+ static const jbyte DIRECTIONALITY_EUROPEAN_NUMBER = 3;
+ static const jbyte DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR = 4;
+ static const jbyte DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR = 5;
+ static const jbyte DIRECTIONALITY_ARABIC_NUMBER = 6;
+ static const jbyte DIRECTIONALITY_COMMON_NUMBER_SEPARATOR = 7;
+ static const jbyte DIRECTIONALITY_NONSPACING_MARK = 8;
+ static const jbyte DIRECTIONALITY_BOUNDARY_NEUTRAL = 9;
+ static const jbyte DIRECTIONALITY_PARAGRAPH_SEPARATOR = 10;
+ static const jbyte DIRECTIONALITY_SEGMENT_SEPARATOR = 11;
+ static const jbyte DIRECTIONALITY_WHITESPACE = 12;
+ static const jbyte DIRECTIONALITY_OTHER_NEUTRALS = 13;
+ static const jbyte DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING = 14;
+ static const jbyte DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE = 15;
+ static const jbyte DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING = 16;
+ static const jbyte DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE = 17;
+ static const jbyte DIRECTIONALITY_POP_DIRECTIONAL_FORMAT = 18;
+private:
+ static const jint TYPE_MASK = 31;
+ static const jint NO_BREAK_MASK = 32;
+ static const jint MIRROR_MASK = 64;
+public:
+ static const jint MIN_SUPPLEMENTARY_CODE_POINT = 65536;
+ static const jint MIN_CODE_POINT = 0;
+ static const jint MAX_CODE_POINT = 1114111;
+ static const jchar MIN_HIGH_SURROGATE = 55296;
+ static const jchar MAX_HIGH_SURROGATE = 56319;
+ static const jchar MIN_LOW_SURROGATE = 56320;
+ static const jchar MAX_LOW_SURROGATE = 57343;
+ static const jchar MIN_SURROGATE = 55296;
+ static const jchar MAX_SURROGATE = 57343;
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Character__
diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h
index 82a66fb814b..d0cf5af7e9f 100644
--- a/libjava/java/lang/Class.h
+++ b/libjava/java/lang/Class.h
@@ -192,6 +192,24 @@ struct _Jv_TypeAssertion
_Jv_Utf8Const *op2;
};
+typedef enum
+{
+ JV_CLASS_ATTR,
+ JV_METHOD_ATTR,
+ JV_FIELD_ATTR,
+ JV_DONE_ATTR
+} jv_attr_type;
+
+typedef enum
+{
+ JV_INNER_CLASSES_KIND,
+ JV_ENCLOSING_METHOD_KIND,
+ JV_SIGNATURE_KIND,
+ JV_ANNOTATIONS_KIND,
+ JV_PARAMETER_ANNOTATIONS_KIND,
+ JV_ANNOTATION_DEFAULT_KIND
+} jv_attr_kind;
+
#define JV_PRIMITIVE_VTABLE ((_Jv_VTable *) -1)
#define JV_CLASS(Obj) ((jclass) (*(_Jv_VTable **) Obj)->clas)
@@ -341,6 +359,15 @@ private:
java::lang::reflect::Method *_getMethod (jstring, JArray<jclass> *);
java::lang::reflect::Method *_getDeclaredMethod (jstring, JArray<jclass> *);
+ jstring getReflectionSignature (jint /*jv_attr_type*/ type,
+ jint obj_index);
+ jstring getReflectionSignature (::java::lang::reflect::Method *);
+ jstring getReflectionSignature (::java::lang::reflect::Constructor *);
+ jstring getReflectionSignature (::java::lang::reflect::Field *);
+
+ jstring getClassSignature();
+ jobject getMethodDefaultValue (::java::lang::reflect::Method *);
+
public:
JArray<java::lang::reflect::Field *> *getFields (void);
@@ -403,10 +430,34 @@ public:
JArray<java::lang::reflect::TypeVariable *> *getTypeParameters (void);
+ jint getEnclosingMethodData(void);
java::lang::Class *getEnclosingClass (void);
java::lang::reflect::Constructor *getEnclosingConstructor (void);
java::lang::reflect::Method *getEnclosingMethod (void);
- jboolean isEnum (void);
+ jobjectArray getDeclaredAnnotations(jint, jint, jint);
+ jobjectArray getDeclaredAnnotations(::java::lang::reflect::Method *,
+ jboolean);
+ jobjectArray getDeclaredAnnotations(::java::lang::reflect::Constructor *,
+ jboolean);
+ jobjectArray getDeclaredAnnotations(::java::lang::reflect::Field *);
+ JArray< ::java::lang::annotation::Annotation *> *getDeclaredAnnotationsInternal();
+
+ jboolean isEnum (void)
+ {
+ return (accflags & 0x4000) != 0;
+ }
+ jboolean isSynthetic (void)
+ {
+ return (accflags & 0x1000) != 0;
+ }
+ jboolean isAnnotation (void)
+ {
+ return (accflags & 0x2000) != 0;
+ }
+
+ jboolean isAnonymousClass();
+ jboolean isLocalClass();
+ jboolean isMemberClass();
// FIXME: this probably shouldn't be public.
jint size (void)
@@ -428,6 +479,20 @@ public:
// types. See prims.cc.
Class ();
+ // Given the BC ABI version, return the size of an Class initializer.
+ static jlong initializerSize (jlong ABI)
+ {
+ unsigned long version = ABI & 0xfffff;
+ int abi_rev = version % 100;
+
+ // The reflection_data field was added by abi_rev 1.
+ if (abi_rev == 0)
+ return ((char*)(&::java::lang::Class::class$.reflection_data)
+ - (char*)&::java::lang::Class::class$);
+
+ return sizeof (::java::lang::Class);
+ }
+
static java::lang::Class class$;
private:
@@ -444,6 +509,9 @@ private:
notifyAll ();
}
+ jint findInnerClassAttribute();
+ jint findDeclaredClasses(JArray<jclass> *, jboolean, jint);
+
// Friend functions implemented in natClass.cc.
friend _Jv_Method *::_Jv_GetMethodLocal (jclass klass, _Jv_Utf8Const *name,
_Jv_Utf8Const *signature);
@@ -562,6 +630,11 @@ private:
friend void ::_Jv_CopyClassesToSystemLoader (gnu::gcj::runtime::SystemClassLoader *);
+ friend class java::lang::reflect::Field;
+ friend class java::lang::reflect::Method;
+ friend class java::lang::reflect::Constructor;
+ friend class java::lang::reflect::VMProxy;
+
// Chain for class pool. This also doubles as the ABI version
// number. It is only used for this purpose at class registration
// time, and only for precompiled classes.
@@ -644,6 +717,8 @@ private:
void *aux_info;
// Execution engine.
_Jv_ExecutionEngine *engine;
+ // Reflection data.
+ unsigned char *reflection_data;
};
// Inline functions that are friends of java::lang::Class
diff --git a/libjava/java/lang/Class.java b/libjava/java/lang/Class.java
index f301f358427..a071ee36cd0 100644
--- a/libjava/java/lang/Class.java
+++ b/libjava/java/lang/Class.java
@@ -38,12 +38,14 @@ exception statement from your version. */
package java.lang;
+import gnu.java.lang.reflect.ClassSignatureParser;
import java.io.InputStream;
import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.GenericDeclaration;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
@@ -53,6 +55,11 @@ import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
+import java.util.HashMap;
+import java.util.Collection;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Inherited;
/**
* A Class represents a Java type. There will never be multiple Class
@@ -83,7 +90,8 @@ import java.util.HashSet;
* @since 1.0
* @see ClassLoader
*/
-public final class Class implements Type, GenericDeclaration, Serializable
+public final class Class<T>
+ implements Type, AnnotatedElement, GenericDeclaration, Serializable
{
/**
* Class is non-instantiable from Java code; only the VM can create
@@ -112,7 +120,7 @@ public final class Class implements Type, GenericDeclaration, Serializable
* @throws ExceptionInInitializerError if the class loads, but an exception
* occurs during initialization
*/
- public static native Class forName (String className)
+ public static native Class<?> forName (String className)
throws ClassNotFoundException;
// A private internal method that is called by compiler-generated code.
@@ -147,8 +155,8 @@ public final class Class implements Type, GenericDeclaration, Serializable
* @see ClassLoader
* @since 1.2
*/
- public static native Class forName (String className, boolean initialize,
- ClassLoader loader)
+ public static native Class<?> forName (String className, boolean initialize,
+ ClassLoader loader)
throws ClassNotFoundException;
/**
@@ -163,7 +171,7 @@ public final class Class implements Type, GenericDeclaration, Serializable
* @throws SecurityException if the security check fails
* @since 1.1
*/
- public Class[] getClasses()
+ public Class<?>[] getClasses()
{
memberAccessCheck(Member.PUBLIC);
return internalGetClasses();
@@ -172,16 +180,16 @@ public final class Class implements Type, GenericDeclaration, Serializable
/**
* Like <code>getClasses()</code> but without the security checks.
*/
- private Class[] internalGetClasses()
+ private Class<?>[] internalGetClasses()
{
- ArrayList list = new ArrayList();
+ ArrayList<Class> list = new ArrayList<Class>();
list.addAll(Arrays.asList(getDeclaredClasses(true)));
Class superClass = getSuperclass();
if (superClass != null)
list.addAll(Arrays.asList(superClass.internalGetClasses()));
- return (Class[])list.toArray(new Class[list.size()]);
+ return list.toArray(new Class<?>[list.size()]);
}
-
+
/**
* Get the ClassLoader that loaded this class. If the class was loaded
* by the bootstrap classloader, this method will return null.
@@ -216,7 +224,7 @@ public final class Class implements Type, GenericDeclaration, Serializable
* @see Array
* @since 1.1
*/
- public native Class getComponentType ();
+ public native Class<?> getComponentType ();
/**
* Get a public constructor declared in this class. If the constructor takes
@@ -232,7 +240,7 @@ public final class Class implements Type, GenericDeclaration, Serializable
* @see #getConstructors()
* @since 1.1
*/
- public native Constructor getConstructor(Class[] args)
+ public native Constructor<T> getConstructor(Class<?>... args)
throws NoSuchMethodException;
/**
@@ -247,7 +255,7 @@ public final class Class implements Type, GenericDeclaration, Serializable
* @throws SecurityException if the security check fails
* @since 1.1
*/
- public Constructor[] getConstructors()
+ public Constructor<?>[] getConstructors()
{
memberAccessCheck(Member.PUBLIC);
return getDeclaredConstructors(true);
@@ -267,7 +275,7 @@ public final class Class implements Type, GenericDeclaration, Serializable
* @see #getDeclaredConstructors()
* @since 1.1
*/
- public native Constructor getDeclaredConstructor(Class[] args)
+ public native Constructor<T> getDeclaredConstructor(Class<?>... args)
throws NoSuchMethodException;
/**
@@ -282,13 +290,13 @@ public final class Class implements Type, GenericDeclaration, Serializable
* @throws SecurityException if the security check fails
* @since 1.1
*/
- public Class[] getDeclaredClasses()
+ public Class<?>[] getDeclaredClasses()
{
memberAccessCheck(Member.DECLARED);
return getDeclaredClasses(false);
}
- native Class[] getDeclaredClasses (boolean publicOnly);
+ native Class<?>[] getDeclaredClasses (boolean publicOnly);
/**
* Get all the declared constructors of this class. This returns an array of
@@ -302,13 +310,13 @@ public final class Class implements Type, GenericDeclaration, Serializable
* @throws SecurityException if the security check fails
* @since 1.1
*/
- public Constructor[] getDeclaredConstructors()
+ public Constructor<?>[] getDeclaredConstructors()
{
memberAccessCheck(Member.DECLARED);
return getDeclaredConstructors(false);
}
- native Constructor[] getDeclaredConstructors (boolean publicOnly);
+ native Constructor<?>[] getDeclaredConstructors (boolean publicOnly);
/**
* Get a field declared in this class, where name is its simple name. The
@@ -369,7 +377,7 @@ public final class Class implements Type, GenericDeclaration, Serializable
* @see #getDeclaredMethods()
* @since 1.1
*/
- public Method getDeclaredMethod(String methodName, Class[] args)
+ public Method getDeclaredMethod(String methodName, Class<?>... args)
throws NoSuchMethodException
{
memberAccessCheck(Member.DECLARED);
@@ -409,7 +417,7 @@ public final class Class implements Type, GenericDeclaration, Serializable
* @since 1.1
*/
// This is marked as unimplemented in the JCL book.
- public native Class getDeclaringClass ();
+ public native Class<?> getDeclaringClass ();
private native Field getField (String fieldName, int hash)
throws NoSuchFieldException;
@@ -498,7 +506,7 @@ public final class Class implements Type, GenericDeclaration, Serializable
*
* @return the interfaces this class directly implements
*/
- public native Class[] getInterfaces ();
+ public native Class<?>[] getInterfaces ();
private final native void getSignature(StringBuffer buffer);
private static final native String getSignature(Class[] args,
@@ -528,7 +536,7 @@ public final class Class implements Type, GenericDeclaration, Serializable
* @see #getMethods()
* @since 1.1
*/
- public Method getMethod(String methodName, Class[] args)
+ public Method getMethod(String methodName, Class<?>... args)
throws NoSuchMethodException
{
memberAccessCheck(Member.PUBLIC);
@@ -701,7 +709,7 @@ public final class Class implements Type, GenericDeclaration, Serializable
*
* @return the direct superclass of this class
*/
- public native Class getSuperclass ();
+ public native Class<? super T> getSuperclass ();
/**
* Return whether this class is an array type.
@@ -725,7 +733,7 @@ public final class Class implements Type, GenericDeclaration, Serializable
* @throws NullPointerException if c is null
* @since 1.1
*/
- public native boolean isAssignableFrom (Class c);
+ public native boolean isAssignableFrom (Class<?> c);
/**
* Discover whether an Object is an instance of this Class. Think of it
@@ -783,7 +791,7 @@ public final class Class implements Type, GenericDeclaration, Serializable
* @throws ExceptionInInitializerError if class initialization caused by
* this call fails with an exception
*/
- public native Object newInstance ()
+ public native T newInstance ()
throws InstantiationException, IllegalAccessException;
// We need a native method to retrieve the protection domain, because we
@@ -930,6 +938,123 @@ public final class Class implements Type, GenericDeclaration, Serializable
}
}
+
+ /**
+ * <p>
+ * Casts this class to represent a subclass of the specified class.
+ * This method is useful for `narrowing' the type of a class so that
+ * the class object, and instances of that class, can match the contract
+ * of a more restrictive method. For example, if this class has the
+ * static type of <code>Class&lt;Object&gt;</code>, and a dynamic type of
+ * <code>Class&lt;Rectangle&gt;</code>, then, assuming <code>Shape</code> is
+ * a superclass of <code>Rectangle</code>, this method can be used on
+ * this class with the parameter, <code>Class&lt;Shape&gt;</code>, to retain
+ * the same instance but with the type
+ * <code>Class&lt;? extends Shape&gt;</code>.
+ * </p>
+ * <p>
+ * If this class can be converted to an instance which is parameterised
+ * over a subtype of the supplied type, <code>U</code>, then this method
+ * returns an appropriately cast reference to this object. Otherwise,
+ * a <code>ClassCastException</code> is thrown.
+ * </p>
+ *
+ * @param klass the class object, the parameterized type (<code>U</code>) of
+ * which should be a superclass of the parameterized type of
+ * this instance.
+ * @return a reference to this object, appropriately cast.
+ * @throws ClassCastException if this class can not be converted to one
+ * which represents a subclass of the specified
+ * type, <code>U</code>.
+ * @since 1.5
+ */
+ public <U> Class<? extends U> asSubclass(Class<U> klass)
+ {
+ if (! klass.isAssignableFrom(this))
+ throw new ClassCastException();
+ return (Class<? extends U>) this;
+ }
+
+ /**
+ * Returns the specified object, cast to this <code>Class</code>' type.
+ *
+ * @param obj the object to cast
+ * @throws ClassCastException if obj is not an instance of this class
+ * @since 1.5
+ */
+ public T cast(Object obj)
+ {
+ if (obj != null && ! isInstance(obj))
+ throw new ClassCastException();
+ return (T) obj;
+ }
+
+ /**
+ * Returns the enumeration constants of this class, or
+ * null if this class is not an <code>Enum</code>.
+ *
+ * @return an array of <code>Enum</code> constants
+ * associated with this class, or null if this
+ * class is not an <code>enum</code>.
+ * @since 1.5
+ */
+ public T[] getEnumConstants()
+ {
+ if (isEnum())
+ {
+ try
+ {
+ return (T[]) getMethod("values").invoke(null);
+ }
+ catch (NoSuchMethodException exception)
+ {
+ throw new Error("Enum lacks values() method");
+ }
+ catch (IllegalAccessException exception)
+ {
+ throw new Error("Unable to access Enum class");
+ }
+ catch (InvocationTargetException exception)
+ {
+ throw new
+ RuntimeException("The values method threw an exception",
+ exception);
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Returns true if this class is an <code>Enum</code>.
+ *
+ * @return true if this is an enumeration class.
+ * @since 1.5
+ */
+ public native boolean isEnum();
+
+
+ /**
+ * Returns true if this class is a synthetic class, generated by
+ * the compiler.
+ *
+ * @return true if this is a synthetic class.
+ * @since 1.5
+ */
+ public native boolean isSynthetic();
+
+
+ /**
+ * Returns true if this class is an <code>Annotation</code>.
+ *
+ * @return true if this is an annotation class.
+ * @since 1.5
+ */
+ public native boolean isAnnotation();
+
+
/**
* Returns the simple name for this class, as used in the source
* code. For normal classes, this is the content returned by
@@ -945,25 +1070,22 @@ public final class Class implements Type, GenericDeclaration, Serializable
*/
public String getSimpleName()
{
- // FIXME write real implementation
- return "";
- }
-
- /**
- * Returns all annotations directly defined by this class. If there are
- * no annotations associated with this class, then a zero-length array
- * will be returned. The returned array may be modified by the client
- * code, but this will have no effect on the annotation content of this
- * class, and hence no effect on the return value of this method for
- * future callers.
- *
- * @return the annotations directly defined by this class.
- * @since 1.5
- */
- public Annotation[] getDeclaredAnnotations()
- {
- // FIXME write real implementation
- return new Annotation[0];
+ StringBuffer sb = new StringBuffer();
+ Class klass = this;
+ int arrayCount = 0;
+ while (klass.isArray())
+ {
+ klass = klass.getComponentType();
+ ++arrayCount;
+ }
+ if (! klass.isAnonymousClass())
+ {
+ String fullName = klass.getName();
+ sb.append(fullName, fullName.lastIndexOf(".") + 1, fullName.length());
+ }
+ while (arrayCount-- > 0)
+ sb.append("[]");
+ return sb.toString();
}
/**
@@ -974,12 +1096,7 @@ public final class Class implements Type, GenericDeclaration, Serializable
* a top-level class.
* @since 1.5
*/
- /* FIXME[GENERICS]: Should return Class<?> */
- public Class getEnclosingClass()
- {
- // FIXME write real implementation
- return null;
- }
+ public native Class<?> getEnclosingClass();
/**
* Returns the constructor which immediately encloses this class. If
@@ -992,12 +1109,7 @@ public final class Class implements Type, GenericDeclaration, Serializable
* is returned.
* @since 1.5
*/
- /* FIXME[GENERICS]: Should return Constructor<?> */
- public Constructor getEnclosingConstructor()
- {
- // FIXME write real implementation
- return null;
- }
+ public native Constructor<T> getEnclosingConstructor();
/**
* Returns the method which immediately encloses this class. If
@@ -1010,10 +1122,100 @@ public final class Class implements Type, GenericDeclaration, Serializable
* is returned.
* @since 1.5
*/
- public Method getEnclosingMethod()
+ public native Method getEnclosingMethod();
+
+ private native String getClassSignature();
+
+ /**
+ * <p>
+ * Returns an array of <code>Type</code> objects which represent the
+ * interfaces directly implemented by this class or extended by this
+ * interface.
+ * </p>
+ * <p>
+ * If one of the superinterfaces is a parameterized type, then the
+ * object returned for this interface reflects the actual type
+ * parameters used in the source code. Type parameters are created
+ * using the semantics specified by the <code>ParameterizedType</code>
+ * interface, and only if an instance has not already been created.
+ * </p>
+ * <p>
+ * The order of the interfaces in the array matches the order in which
+ * the interfaces are declared. For classes which represent an array,
+ * an array of two interfaces, <code>Cloneable</code> and
+ * <code>Serializable</code>, is always returned, with the objects in
+ * that order. A class representing a primitive type or void always
+ * returns an array of zero size.
+ * </p>
+ *
+ * @return an array of interfaces implemented or extended by this class.
+ * @throws GenericSignatureFormatError if the generic signature of one
+ * of the interfaces does not comply with that specified by the Java
+ * Virtual Machine specification, 3rd edition.
+ * @throws TypeNotPresentException if any of the superinterfaces refers
+ * to a non-existant type.
+ * @throws MalformedParameterizedTypeException if any of the interfaces
+ * refer to a parameterized type that can not be instantiated for
+ * some reason.
+ * @since 1.5
+ * @see java.lang.reflect.ParameterizedType
+ */
+ public Type[] getGenericInterfaces()
{
- // FIXME write real implementation
- return null;
+ if (isPrimitive())
+ return new Type[0];
+
+ String sig = getClassSignature();
+ if (sig == null)
+ return getInterfaces();
+
+ ClassSignatureParser p = new ClassSignatureParser(this, sig);
+ return p.getInterfaceTypes();
+ }
+
+ /**
+ * <p>
+ * Returns a <code>Type</code> object representing the direct superclass,
+ * whether class, interface, primitive type or void, of this class.
+ * If this class is an array class, then a class instance representing
+ * the <code>Object</code> class is returned. If this class is primitive,
+ * an interface, or a representation of either the <code>Object</code>
+ * class or void, then <code>null</code> is returned.
+ * </p>
+ * <p>
+ * If the superclass is a parameterized type, then the
+ * object returned for this interface reflects the actual type
+ * parameters used in the source code. Type parameters are created
+ * using the semantics specified by the <code>ParameterizedType</code>
+ * interface, and only if an instance has not already been created.
+ * </p>
+ *
+ * @return the superclass of this class.
+ * @throws GenericSignatureFormatError if the generic signature of the
+ * class does not comply with that specified by the Java
+ * Virtual Machine specification, 3rd edition.
+ * @throws TypeNotPresentException if the superclass refers
+ * to a non-existant type.
+ * @throws MalformedParameterizedTypeException if the superclass
+ * refers to a parameterized type that can not be instantiated for
+ * some reason.
+ * @since 1.5
+ * @see java.lang.reflect.ParameterizedType
+ */
+ public Type getGenericSuperclass()
+ {
+ if (isArray())
+ return Object.class;
+
+ if (isPrimitive() || isInterface() || this == Object.class)
+ return null;
+
+ String sig = getClassSignature();
+ if (sig == null)
+ return getSuperclass();
+
+ ClassSignatureParser p = new ClassSignatureParser(this, sig);
+ return p.getSuperclassType();
}
/**
@@ -1022,29 +1224,129 @@ public final class Class implements Type, GenericDeclaration, Serializable
* An array of size zero is returned if this class has no type
* variables.
*
- * @return the type variables associated with this class.
+ * @return the type variables associated with this class.
* @throws GenericSignatureFormatError if the generic signature does
* not conform to the format specified in the Virtual Machine
* specification, version 3.
* @since 1.5
*/
- /* FIXME[GENERICS]: Should return TypeVariable<Class<T>> */
- public TypeVariable[] getTypeParameters()
+ public TypeVariable<Class<T>>[] getTypeParameters()
{
- // FIXME - provide real implementation.
- return new TypeVariable[0];
+ String sig = getClassSignature();
+ if (sig == null)
+ return (TypeVariable<Class<T>>[])new TypeVariable[0];
+
+ ClassSignatureParser p = new ClassSignatureParser(this, sig);
+ return p.getTypeParameters();
}
/**
- * Returns true if this class is an <code>Enum</code>.
+ * Returns this class' annotation for the specified annotation type,
+ * or <code>null</code> if no such annotation exists.
*
- * @return true if this is an enumeration class.
+ * @param annotationClass the type of annotation to look for.
+ * @return this class' annotation for the specified type, or
+ * <code>null</code> if no such annotation exists.
* @since 1.5
*/
- public boolean isEnum()
+ public <A extends Annotation> A getAnnotation(Class<A> annotationClass)
{
- // FIXME - provide real implementation.
- return false;
+ A foundAnnotation = null;
+ Annotation[] annotations = getAnnotations();
+ for (Annotation annotation : annotations)
+ if (annotation.annotationType() == annotationClass)
+ foundAnnotation = (A) annotation;
+ return foundAnnotation;
}
+ /**
+ * Returns all annotations associated with this class. If there are
+ * no annotations associated with this class, then a zero-length array
+ * will be returned. The returned array may be modified by the client
+ * code, but this will have no effect on the annotation content of this
+ * class, and hence no effect on the return value of this method for
+ * future callers.
+ *
+ * @return this class' annotations.
+ * @since 1.5
+ */
+ public Annotation[] getAnnotations()
+ {
+ HashMap<Class, Annotation> map = new HashMap<Class, Annotation>();
+ for (Annotation a : getDeclaredAnnotations())
+ map.put((Class) a.annotationType(), a);
+ for (Class<? super T> s = getSuperclass();
+ s != null;
+ s = s.getSuperclass())
+ {
+ for (Annotation a : s.getDeclaredAnnotations())
+ {
+ Class k = (Class) a.annotationType();
+ if (! map.containsKey(k) && k.isAnnotationPresent(Inherited.class))
+ map.put(k, a);
+ }
+ }
+ Collection<Annotation> v = map.values();
+ return v.toArray(new Annotation[v.size()]);
+ }
+
+ /**
+ * Returns all annotations directly defined by this class. If there are
+ * no annotations associated with this class, then a zero-length array
+ * will be returned. The returned array may be modified by the client
+ * code, but this will have no effect on the annotation content of this
+ * class, and hence no effect on the return value of this method for
+ * future callers.
+ *
+ * @return the annotations directly defined by this class.
+ * @since 1.5
+ */
+ public Annotation[] getDeclaredAnnotations()
+ {
+ Annotation[] result = getDeclaredAnnotationsInternal();
+ if (result == null)
+ result = new Annotation[0];
+ return result;
+ }
+
+ private native Annotation[] getDeclaredAnnotationsInternal();
+
+ /**
+ * Returns true if an annotation for the specified type is associated
+ * with this class. This is primarily a short-hand for using marker
+ * annotations.
+ *
+ * @param annotationClass the type of annotation to look for.
+ * @return true if an annotation exists for the specified type.
+ * @since 1.5
+ */
+ public boolean isAnnotationPresent(Class<? extends Annotation>
+ annotationClass)
+ {
+ return getAnnotation(annotationClass) != null;
+ }
+
+ /**
+ * Returns true if this object represents an anonymous class.
+ *
+ * @return true if this object represents an anonymous class.
+ * @since 1.5
+ */
+ public native boolean isAnonymousClass();
+
+ /**
+ * Returns true if this object represents an local class.
+ *
+ * @return true if this object represents an local class.
+ * @since 1.5
+ */
+ public native boolean isLocalClass();
+
+ /**
+ * Returns true if this object represents an member class.
+ *
+ * @return true if this object represents an member class.
+ * @since 1.5
+ */
+ public native boolean isMemberClass();
}
diff --git a/libjava/java/lang/ClassCastException.h b/libjava/java/lang/ClassCastException.h
new file mode 100644
index 00000000000..55c0bcc8871
--- /dev/null
+++ b/libjava/java/lang/ClassCastException.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ClassCastException__
+#define __java_lang_ClassCastException__
+
+#pragma interface
+
+#include <java/lang/RuntimeException.h>
+
+class java::lang::ClassCastException : public ::java::lang::RuntimeException
+{
+
+public:
+ ClassCastException();
+ ClassCastException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -9223365651070458532LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_ClassCastException__
diff --git a/libjava/java/lang/ClassCircularityError.h b/libjava/java/lang/ClassCircularityError.h
new file mode 100644
index 00000000000..81d6f93adf0
--- /dev/null
+++ b/libjava/java/lang/ClassCircularityError.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ClassCircularityError__
+#define __java_lang_ClassCircularityError__
+
+#pragma interface
+
+#include <java/lang/LinkageError.h>
+
+class java::lang::ClassCircularityError : public ::java::lang::LinkageError
+{
+
+public:
+ ClassCircularityError();
+ ClassCircularityError(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 1054362542914539689LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_ClassCircularityError__
diff --git a/libjava/java/lang/ClassFormatError.h b/libjava/java/lang/ClassFormatError.h
new file mode 100644
index 00000000000..ee6664f5610
--- /dev/null
+++ b/libjava/java/lang/ClassFormatError.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ClassFormatError__
+#define __java_lang_ClassFormatError__
+
+#pragma interface
+
+#include <java/lang/LinkageError.h>
+
+class java::lang::ClassFormatError : public ::java::lang::LinkageError
+{
+
+public:
+ ClassFormatError();
+ ClassFormatError(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -8420114879011949195LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_ClassFormatError__
diff --git a/libjava/java/lang/ClassLoader$AnnotationsKey.h b/libjava/java/lang/ClassLoader$AnnotationsKey.h
new file mode 100644
index 00000000000..1a395b07bd6
--- /dev/null
+++ b/libjava/java/lang/ClassLoader$AnnotationsKey.h
@@ -0,0 +1,31 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ClassLoader$AnnotationsKey__
+#define __java_lang_ClassLoader$AnnotationsKey__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::ClassLoader$AnnotationsKey : public ::java::lang::Object
+{
+
+public:
+ ClassLoader$AnnotationsKey(::java::lang::Class *, jint, jint, jint);
+ jboolean equals(::java::lang::Object *);
+ jint hashCode();
+public: // actually package-private
+ jint __attribute__((aligned(__alignof__( ::java::lang::Object)))) member_type;
+ jint member_index;
+ jint kind_req;
+ ::java::lang::Class * declaringClass;
+ jint hashCode__;
+public:
+ static JArray< ::java::lang::annotation::Annotation * > * NIL;
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_ClassLoader$AnnotationsKey__
diff --git a/libjava/java/lang/ClassLoader.h b/libjava/java/lang/ClassLoader.h
new file mode 100644
index 00000000000..0b82a046786
--- /dev/null
+++ b/libjava/java/lang/ClassLoader.h
@@ -0,0 +1,108 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ClassLoader__
+#define __java_lang_ClassLoader__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URL;
+ }
+ namespace nio
+ {
+ class ByteBuffer;
+ }
+ namespace security
+ {
+ class ProtectionDomain;
+ }
+ }
+}
+
+jclass _Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader);
+void _Jv_RunMain (jclass klass, const char *name, int argc, const char **argv, bool is_jar);
+
+class java::lang::ClassLoader : public ::java::lang::Object
+{
+
+public: // actually package-private
+ virtual JArray< ::java::lang::Object * > * getDeclaredAnnotations(::java::lang::Class *, jint, jint, jint);
+ virtual JArray< ::java::lang::Object * > * putDeclaredAnnotations(::java::lang::Class *, jint, jint, jint, JArray< ::java::lang::Object * > *);
+public: // actually protected
+ ClassLoader();
+ ClassLoader(::java::lang::ClassLoader *);
+public:
+ virtual ::java::lang::Class * loadClass(::java::lang::String *);
+private:
+ ::java::lang::Class * loadClassFromSig(::java::lang::String *);
+public: // actually protected
+ virtual ::java::lang::Class * loadClass(::java::lang::String *, jboolean);
+ virtual ::java::lang::Class * findClass(::java::lang::String *);
+ virtual ::java::lang::Class * defineClass(JArray< jbyte > *, jint, jint);
+ virtual ::java::lang::Class * defineClass(::java::lang::String *, JArray< jbyte > *, jint, jint);
+ virtual ::java::lang::Class * defineClass(::java::lang::String *, JArray< jbyte > *, jint, jint, ::java::security::ProtectionDomain *);
+ virtual ::java::lang::Class * defineClass(::java::lang::String *, ::java::nio::ByteBuffer *, ::java::security::ProtectionDomain *);
+ virtual void resolveClass(::java::lang::Class *);
+ virtual ::java::lang::Class * findSystemClass(::java::lang::String *);
+public:
+ virtual ::java::lang::ClassLoader * getParent();
+public: // actually protected
+ virtual void setSigners(::java::lang::Class *, JArray< ::java::lang::Object * > *);
+ virtual ::java::lang::Class * findLoadedClass(::java::lang::String *);
+public:
+ virtual ::java::net::URL * getResource(::java::lang::String *);
+ virtual ::java::util::Enumeration * getResources(::java::lang::String *);
+public: // actually protected
+ virtual ::java::util::Enumeration * findResources(::java::lang::String *);
+ virtual ::java::net::URL * findResource(::java::lang::String *);
+public:
+ static ::java::net::URL * getSystemResource(::java::lang::String *);
+ static ::java::util::Enumeration * getSystemResources(::java::lang::String *);
+ virtual ::java::io::InputStream * getResourceAsStream(::java::lang::String *);
+ static ::java::io::InputStream * getSystemResourceAsStream(::java::lang::String *);
+ static ::java::lang::ClassLoader * getSystemClassLoader();
+public: // actually protected
+ virtual ::java::lang::Package * definePackage(::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::net::URL *);
+ virtual ::java::lang::Package * getPackage(::java::lang::String *);
+ virtual JArray< ::java::lang::Package * > * getPackages();
+ virtual ::java::lang::String * findLibrary(::java::lang::String *);
+public:
+ virtual void setDefaultAssertionStatus(jboolean);
+ virtual void setPackageAssertionStatus(::java::lang::String *, jboolean);
+ virtual void setClassAssertionStatus(::java::lang::String *, jboolean);
+ virtual void clearAssertionStatus();
+public: // actually package-private
+ virtual jboolean isAncestorOf(::java::lang::ClassLoader *);
+ ::java::util::HashMap * __attribute__((aligned(__alignof__( ::java::lang::Object)))) loadedClasses;
+ ::java::util::HashMap * definedPackages;
+private:
+ ::java::lang::ClassLoader * parent;
+ jboolean initialized;
+public: // actually package-private
+ static ::java::lang::ClassLoader * systemClassLoader;
+private:
+ ::java::util::concurrent::ConcurrentHashMap * declaredAnnotations;
+public: // actually package-private
+ static ::java::security::ProtectionDomain * defaultProtectionDomain;
+ jboolean defaultAssertionStatus;
+ static ::java::util::Map * systemPackageAssertionStatus;
+ ::java::util::Map * packageAssertionStatus;
+ static ::java::util::Map * systemClassAssertionStatus;
+ ::java::util::Map * classAssertionStatus;
+public:
+ static ::java::lang::Class class$;
+
+ friend jclass (::_Jv_FindClass) (_Jv_Utf8Const *name, java::lang::ClassLoader *loader);
+ friend void ::_Jv_RunMain (jclass klass, const char *name, int argc, const char **argv, bool is_jar);
+};
+
+#endif // __java_lang_ClassLoader__
diff --git a/libjava/java/lang/ClassLoader.java b/libjava/java/lang/ClassLoader.java
index bcbfc298bd4..50bd26f36b5 100644
--- a/libjava/java/lang/ClassLoader.java
+++ b/libjava/java/lang/ClassLoader.java
@@ -39,12 +39,14 @@ exception statement from your version. */
package java.lang;
import gnu.classpath.SystemProperties;
+import gnu.classpath.VMStackWalker;
import gnu.java.util.DoubleEnumeration;
import gnu.java.util.EmptyEnumeration;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.nio.ByteBuffer;
import java.security.CodeSource;
import java.security.PermissionCollection;
import java.security.Policy;
@@ -53,6 +55,9 @@ import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.lang.annotation.Annotation;
+
/**
* The ClassLoader is a way of customizing the way Java gets its classes
* and loads them into memory. The verifier and other standard Java things
@@ -157,6 +162,85 @@ public abstract class ClassLoader
static final ClassLoader systemClassLoader =
VMClassLoader.getSystemClassLoader();
+ /**
+ * This cache maps from a Class to its associated annotations. It's
+ * declared here so that when this class loader becomes unreachable,
+ * so will the corresponding cache.
+ */
+
+ private final ConcurrentHashMap<AnnotationsKey,Object[]>
+ declaredAnnotations
+ = new ConcurrentHashMap<AnnotationsKey,Object[]>();
+
+ static final class AnnotationsKey
+ {
+ final int /* jv_attr_type */ member_type;
+ final int member_index;
+ final int /* jv_attr_kind */ kind_req;
+ final Class declaringClass;
+ final int hashCode;
+
+ public AnnotationsKey (Class declaringClass,
+ int member_type,
+ int member_index,
+ int kind_req)
+ {
+ this.member_type = member_type;
+ this.member_index = member_index;
+ this.kind_req = kind_req;
+ this.declaringClass = declaringClass;
+ hashCode = (member_type ^ member_index ^ kind_req
+ ^ declaringClass.hashCode());
+ }
+
+ public boolean equals(Object obj)
+ {
+ AnnotationsKey other = (AnnotationsKey)obj;
+ return (this.member_type == other.member_type
+ && this.member_index == other.member_index
+ && this.kind_req == other.kind_req
+ && this.declaringClass == other.declaringClass);
+ }
+
+ public int hashCode()
+ {
+ return hashCode;
+ }
+
+ public static final Annotation[] NIL = new Annotation[0];
+ }
+
+ final Object[] getDeclaredAnnotations(Class declaringClass,
+ int member_type,
+ int member_index,
+ int kind_req)
+ {
+ Object[] result
+ = declaredAnnotations.get (new AnnotationsKey
+ (declaringClass,
+ member_type,
+ member_index,
+ kind_req));
+ if (result != AnnotationsKey.NIL && result != null)
+ return (Object[])result.clone();
+ return null;
+ }
+
+ final Object[] putDeclaredAnnotations(Class declaringClass,
+ int member_type,
+ int member_index,
+ int kind_req,
+ Object[] annotations)
+ {
+ declaredAnnotations.put
+ (new AnnotationsKey
+ (declaringClass, member_type,
+ member_index, kind_req),
+ annotations == null ? AnnotationsKey.NIL : annotations);
+
+ return annotations == null ? null : (Object[])annotations.clone();
+ }
+
static
{
// Find out if we have to install a default security manager. Note
@@ -487,6 +571,35 @@ public abstract class ClassLoader
}
/**
+ * Helper to define a class using the contents of a byte buffer. If
+ * the domain is null, the default of
+ * <code>Policy.getPolicy().getPermissions(new CodeSource(null,
+ * null))</code> is used. Once a class has been defined in a
+ * package, all further classes in that package must have the same
+ * set of certificates or a SecurityException is thrown.
+ *
+ * @param name the name to give the class. null if unknown
+ * @param buf a byte buffer containing bytes that form a class.
+ * @param domain the ProtectionDomain to give to the class, null for the
+ * default protection domain
+ * @return the class that was defined
+ * @throws ClassFormatError if data is not in proper classfile format
+ * @throws NoClassDefFoundError if the supplied name is not the same as
+ * the one specified by the byte buffer.
+ * @throws SecurityException if name starts with "java.", or if certificates
+ * do not match up
+ * @since 1.5
+ */
+ protected final Class<?> defineClass(String name, ByteBuffer buf,
+ ProtectionDomain domain)
+ throws ClassFormatError
+ {
+ byte[] data = new byte[buf.remaining()];
+ buf.get(data);
+ return defineClass(name, data, 0, data.length, domain);
+ }
+
+ /**
* Links the class, if that has not already been done. Linking basically
* resolves all references to other classes made by this class.
*
@@ -530,8 +643,7 @@ public abstract class ClassLoader
SecurityManager sm = System.getSecurityManager();
if (sm != null)
{
- Class c = VMSecurityManager.getClassContext(ClassLoader.class)[0];
- ClassLoader cl = c.getClassLoader();
+ ClassLoader cl = VMStackWalker.getCallingClassLoader();
if (cl != null && ! cl.isAncestorOf(this))
sm.checkPermission(new RuntimePermission("getClassLoader"));
}
@@ -744,14 +856,15 @@ public abstract class ClassLoader
/**
* Returns the system classloader. The system classloader (also called
- * the application classloader) is the classloader that was used to
+ * the application classloader) is the classloader that is used to
* load the application classes on the classpath (given by the system
* property <code>java.class.path</code>. This is set as the context
* class loader for a thread. The system property
* <code>java.system.class.loader</code>, if defined, is taken to be the
* name of the class to use as the system class loader, which must have
- * a public constructor which takes a ClassLoader as a parent; otherwise this
- * uses gnu.java.lang.SystemClassLoader.
+ * a public constructor which takes a ClassLoader as a parent. The parent
+ * class loader passed in the constructor is the default system class
+ * loader.
*
* <p>Note that this is different from the bootstrap classloader that
* actually loads all the real "system" classes (the bootstrap classloader
@@ -773,8 +886,7 @@ public abstract class ClassLoader
SecurityManager sm = System.getSecurityManager();
if (sm != null)
{
- Class c = VMSecurityManager.getClassContext(ClassLoader.class)[0];
- ClassLoader cl = c.getClassLoader();
+ ClassLoader cl = VMStackWalker.getCallingClassLoader();
if (cl != null && cl != systemClassLoader)
sm.checkPermission(new RuntimePermission("getClassLoader"));
}
@@ -898,7 +1010,7 @@ public abstract class ClassLoader
*
* @param name the (system specific) name of the requested library
* @return the full pathname to the requested library, or null
- * @see Runtime#loadLibrary()
+ * @see Runtime#loadLibrary(String)
* @since 1.2
*/
protected String findLibrary(String name)
@@ -928,7 +1040,7 @@ public abstract class ClassLoader
*
* @param name the package (and subpackages) to affect
* @param enabled true to set the default to enabled
- * @see #setDefaultAssertionStatus(String, boolean)
+ * @see #setDefaultAssertionStatus(boolean)
* @see #setClassAssertionStatus(String, boolean)
* @see #clearAssertionStatus()
* @since 1.4
@@ -949,7 +1061,7 @@ public abstract class ClassLoader
* @param name the class to affect
* @param enabled true to set the default to enabled
* @throws NullPointerException if name is null
- * @see #setDefaultAssertionStatus(String, boolean)
+ * @see #setDefaultAssertionStatus(boolean)
* @see #setPackageAssertionStatus(String, boolean)
* @see #clearAssertionStatus()
* @since 1.4
diff --git a/libjava/java/lang/ClassNotFoundException.h b/libjava/java/lang/ClassNotFoundException.h
new file mode 100644
index 00000000000..c0ab7815807
--- /dev/null
+++ b/libjava/java/lang/ClassNotFoundException.h
@@ -0,0 +1,27 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ClassNotFoundException__
+#define __java_lang_ClassNotFoundException__
+
+#pragma interface
+
+#include <java/lang/Exception.h>
+
+class java::lang::ClassNotFoundException : public ::java::lang::Exception
+{
+
+public:
+ ClassNotFoundException();
+ ClassNotFoundException(::java::lang::String *);
+ ClassNotFoundException(::java::lang::String *, ::java::lang::Throwable *);
+ virtual ::java::lang::Throwable * getException();
+ virtual ::java::lang::Throwable * getCause();
+private:
+ static const jlong serialVersionUID = 9176873029745254542LL;
+ ::java::lang::Throwable * __attribute__((aligned(__alignof__( ::java::lang::Exception)))) ex;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_ClassNotFoundException__
diff --git a/libjava/java/lang/CloneNotSupportedException.h b/libjava/java/lang/CloneNotSupportedException.h
new file mode 100644
index 00000000000..19fa2124a8a
--- /dev/null
+++ b/libjava/java/lang/CloneNotSupportedException.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_CloneNotSupportedException__
+#define __java_lang_CloneNotSupportedException__
+
+#pragma interface
+
+#include <java/lang/Exception.h>
+
+class java::lang::CloneNotSupportedException : public ::java::lang::Exception
+{
+
+public:
+ CloneNotSupportedException();
+ CloneNotSupportedException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 5195511250079656443LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_CloneNotSupportedException__
diff --git a/libjava/java/lang/Cloneable.h b/libjava/java/lang/Cloneable.h
new file mode 100644
index 00000000000..ff5db98d069
--- /dev/null
+++ b/libjava/java/lang/Cloneable.h
@@ -0,0 +1,18 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Cloneable__
+#define __java_lang_Cloneable__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::Cloneable : public ::java::lang::Object
+{
+
+public:
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_Cloneable__
diff --git a/libjava/java/lang/Comparable.h b/libjava/java/lang/Comparable.h
new file mode 100644
index 00000000000..b594e2ddc09
--- /dev/null
+++ b/libjava/java/lang/Comparable.h
@@ -0,0 +1,19 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Comparable__
+#define __java_lang_Comparable__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::Comparable : public ::java::lang::Object
+{
+
+public:
+ virtual jint compareTo(::java::lang::Object *) = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_Comparable__
diff --git a/libjava/java/lang/Compiler.h b/libjava/java/lang/Compiler.h
new file mode 100644
index 00000000000..e21d90300d1
--- /dev/null
+++ b/libjava/java/lang/Compiler.h
@@ -0,0 +1,24 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Compiler__
+#define __java_lang_Compiler__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::Compiler : public ::java::lang::Object
+{
+
+ Compiler();
+public:
+ static jboolean compileClass(::java::lang::Class *);
+ static jboolean compileClasses(::java::lang::String *);
+ static ::java::lang::Object * command(::java::lang::Object *);
+ static void enable();
+ static void disable();
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Compiler__
diff --git a/libjava/java/lang/Deprecated.h b/libjava/java/lang/Deprecated.h
new file mode 100644
index 00000000000..6ab34f11a0e
--- /dev/null
+++ b/libjava/java/lang/Deprecated.h
@@ -0,0 +1,19 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Deprecated__
+#define __java_lang_Deprecated__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::Deprecated : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::lang::Class * annotationType() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_Deprecated__
diff --git a/libjava/java/lang/Double.h b/libjava/java/lang/Double.h
new file mode 100644
index 00000000000..5fb99da4a99
--- /dev/null
+++ b/libjava/java/lang/Double.h
@@ -0,0 +1,57 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Double__
+#define __java_lang_Double__
+
+#pragma interface
+
+#include <java/lang/Number.h>
+
+class java::lang::Double : public ::java::lang::Number
+{
+
+public:
+ Double(jdouble);
+ Double(::java::lang::String *);
+ static ::java::lang::String * toString(jdouble);
+ static ::java::lang::String * toHexString(jdouble);
+ static ::java::lang::Double * valueOf(jdouble);
+ static ::java::lang::Double * valueOf(::java::lang::String *);
+ static jdouble parseDouble(::java::lang::String *);
+ static jboolean isNaN(jdouble);
+ static jboolean isInfinite(jdouble);
+ jboolean isNaN();
+ jboolean isInfinite();
+ ::java::lang::String * toString();
+ jbyte byteValue();
+ jshort shortValue();
+ jint intValue();
+ jlong longValue();
+ jfloat floatValue();
+ jdouble doubleValue();
+ jint hashCode();
+ jboolean equals(::java::lang::Object *);
+ static jlong doubleToLongBits(jdouble);
+ static jlong doubleToRawLongBits(jdouble);
+ static jdouble longBitsToDouble(jlong);
+ jint target$compareTo(::java::lang::Double *);
+ static jint compare(jdouble, jdouble);
+ jint compareTo(::java::lang::Object *);
+private:
+ static const jlong serialVersionUID = -9172774392245257468LL;
+public:
+ static jdouble MAX_VALUE;
+ static jdouble MIN_VALUE;
+ static jdouble NEGATIVE_INFINITY;
+ static jdouble POSITIVE_INFINITY;
+ static jdouble NaN;
+ static const jint SIZE = 64;
+ static ::java::lang::Class * TYPE;
+private:
+ jdouble __attribute__((aligned(__alignof__( ::java::lang::Number)))) value;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Double__
diff --git a/libjava/java/lang/EcosProcess.h b/libjava/java/lang/EcosProcess.h
new file mode 100644
index 00000000000..30fd067e034
--- /dev/null
+++ b/libjava/java/lang/EcosProcess.h
@@ -0,0 +1,27 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_EcosProcess__
+#define __java_lang_EcosProcess__
+
+#pragma interface
+
+#include <java/lang/Process.h>
+#include <gcj/array.h>
+
+
+class java::lang::EcosProcess : public ::java::lang::Process
+{
+
+public:
+ void destroy();
+ jint exitValue();
+ ::java::io::InputStream * getErrorStream();
+ ::java::io::InputStream * getInputStream();
+ ::java::io::OutputStream * getOutputStream();
+ jint waitFor();
+ EcosProcess(JArray< ::java::lang::String * > *, JArray< ::java::lang::String * > *, ::java::io::File *);
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_EcosProcess__
diff --git a/libjava/java/lang/EcosProcess.java b/libjava/java/lang/EcosProcess.java
index aff534a39df..30c8253e67d 100644
--- a/libjava/java/lang/EcosProcess.java
+++ b/libjava/java/lang/EcosProcess.java
@@ -1,6 +1,6 @@
// EcosProcess.java - Subclass of Process for eCos systems.
-/* Copyright (C) 1998, 1999 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2006 Free Software Foundation
This file is part of libgcj.
@@ -22,9 +22,7 @@ import java.io.IOException;
// This is entirely internal to our implementation.
-// This file is copied to `ConcreteProcess.java' before compilation.
-// Hence the class name apparently does not match the file name.
-final class ConcreteProcess extends Process
+final class EcosProcess extends Process
{
// See natEcosProcess.cc to understand why this is native.
public native void destroy ();
@@ -53,7 +51,7 @@ final class ConcreteProcess extends Process
return 0;
}
- public ConcreteProcess (String[] progarray,
+ public EcosProcess (String[] progarray,
String[] envp,
File dir)
throws IOException
diff --git a/libjava/java/lang/Enum.h b/libjava/java/lang/Enum.h
new file mode 100644
index 00000000000..cb3aabc94e4
--- /dev/null
+++ b/libjava/java/lang/Enum.h
@@ -0,0 +1,38 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Enum__
+#define __java_lang_Enum__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::Enum : public ::java::lang::Object
+{
+
+public: // actually protected
+ Enum(::java::lang::String *, jint);
+public:
+ static ::java::lang::Enum * valueOf(::java::lang::Class *, ::java::lang::String *);
+ virtual jboolean equals(::java::lang::Object *);
+ virtual jint hashCode();
+ virtual ::java::lang::String * toString();
+ virtual jint target$compareTo(::java::lang::Enum *);
+public: // actually protected
+ virtual ::java::lang::Object * clone();
+public:
+ virtual ::java::lang::String * name();
+ virtual jint ordinal();
+ virtual ::java::lang::Class * getDeclaringClass();
+ virtual jint compareTo(::java::lang::Object *);
+private:
+ static const jlong serialVersionUID = -4300926546619394005LL;
+public: // actually package-private
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) name__;
+ jint ordinal__;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Enum__
diff --git a/libjava/java/lang/EnumConstantNotPresentException.h b/libjava/java/lang/EnumConstantNotPresentException.h
new file mode 100644
index 00000000000..b3bc11b28c4
--- /dev/null
+++ b/libjava/java/lang/EnumConstantNotPresentException.h
@@ -0,0 +1,26 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_EnumConstantNotPresentException__
+#define __java_lang_EnumConstantNotPresentException__
+
+#pragma interface
+
+#include <java/lang/RuntimeException.h>
+
+class java::lang::EnumConstantNotPresentException : public ::java::lang::RuntimeException
+{
+
+public:
+ EnumConstantNotPresentException(::java::lang::Class *, ::java::lang::String *);
+ virtual ::java::lang::String * constantName();
+ virtual ::java::lang::Class * enumType();
+private:
+ static const jlong serialVersionUID = -6046998521960521108LL;
+ ::java::lang::Class * __attribute__((aligned(__alignof__( ::java::lang::RuntimeException)))) enumType__;
+ ::java::lang::String * constantName__;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_EnumConstantNotPresentException__
diff --git a/libjava/java/lang/Error.h b/libjava/java/lang/Error.h
new file mode 100644
index 00000000000..9cb6019b434
--- /dev/null
+++ b/libjava/java/lang/Error.h
@@ -0,0 +1,25 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Error__
+#define __java_lang_Error__
+
+#pragma interface
+
+#include <java/lang/Throwable.h>
+
+class java::lang::Error : public ::java::lang::Throwable
+{
+
+public:
+ Error();
+ Error(::java::lang::String *);
+ Error(::java::lang::String *, ::java::lang::Throwable *);
+ Error(::java::lang::Throwable *);
+private:
+ static const jlong serialVersionUID = 4980196508277280342LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Error__
diff --git a/libjava/java/lang/Exception.h b/libjava/java/lang/Exception.h
new file mode 100644
index 00000000000..9f3ab43a5db
--- /dev/null
+++ b/libjava/java/lang/Exception.h
@@ -0,0 +1,25 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Exception__
+#define __java_lang_Exception__
+
+#pragma interface
+
+#include <java/lang/Throwable.h>
+
+class java::lang::Exception : public ::java::lang::Throwable
+{
+
+public:
+ Exception();
+ Exception(::java::lang::String *);
+ Exception(::java::lang::String *, ::java::lang::Throwable *);
+ Exception(::java::lang::Throwable *);
+private:
+ static const jlong serialVersionUID = -3387516993124229948LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Exception__
diff --git a/libjava/java/lang/ExceptionInInitializerError.h b/libjava/java/lang/ExceptionInInitializerError.h
new file mode 100644
index 00000000000..89fbaee7ca0
--- /dev/null
+++ b/libjava/java/lang/ExceptionInInitializerError.h
@@ -0,0 +1,28 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ExceptionInInitializerError__
+#define __java_lang_ExceptionInInitializerError__
+
+#pragma interface
+
+#include <java/lang/LinkageError.h>
+
+class java::lang::ExceptionInInitializerError : public ::java::lang::LinkageError
+{
+
+public:
+ ExceptionInInitializerError();
+ ExceptionInInitializerError(::java::lang::String *);
+ ExceptionInInitializerError(::java::lang::Throwable *);
+ virtual ::java::lang::Throwable * getException();
+ virtual ::java::lang::Throwable * getCause();
+public: // actually package-private
+ static const jlong serialVersionUID = 1521711792217232256LL;
+private:
+ ::java::lang::Throwable * __attribute__((aligned(__alignof__( ::java::lang::LinkageError)))) exception;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_ExceptionInInitializerError__
diff --git a/libjava/java/lang/Float.h b/libjava/java/lang/Float.h
new file mode 100644
index 00000000000..87859cb28c0
--- /dev/null
+++ b/libjava/java/lang/Float.h
@@ -0,0 +1,58 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Float__
+#define __java_lang_Float__
+
+#pragma interface
+
+#include <java/lang/Number.h>
+
+class java::lang::Float : public ::java::lang::Number
+{
+
+public:
+ Float(jfloat);
+ Float(jdouble);
+ Float(::java::lang::String *);
+ static ::java::lang::String * toString(jfloat);
+ static ::java::lang::String * toHexString(jfloat);
+ static ::java::lang::Float * valueOf(::java::lang::String *);
+ static ::java::lang::Float * valueOf(jfloat);
+ static jfloat parseFloat(::java::lang::String *);
+ static jboolean isNaN(jfloat);
+ static jboolean isInfinite(jfloat);
+ jboolean isNaN();
+ jboolean isInfinite();
+ ::java::lang::String * toString();
+ jbyte byteValue();
+ jshort shortValue();
+ jint intValue();
+ jlong longValue();
+ jfloat floatValue();
+ jdouble doubleValue();
+ jint hashCode();
+ jboolean equals(::java::lang::Object *);
+ static jint floatToIntBits(jfloat);
+ static jint floatToRawIntBits(jfloat);
+ static jfloat intBitsToFloat(jint);
+ jint target$compareTo(::java::lang::Float *);
+ static jint compare(jfloat, jfloat);
+ jint compareTo(::java::lang::Object *);
+private:
+ static const jlong serialVersionUID = -2671257302660747028LL;
+public:
+ static jfloat MAX_VALUE;
+ static jfloat MIN_VALUE;
+ static jfloat NEGATIVE_INFINITY;
+ static jfloat POSITIVE_INFINITY;
+ static jfloat NaN;
+ static ::java::lang::Class * TYPE;
+ static const jint SIZE = 32;
+private:
+ jfloat __attribute__((aligned(__alignof__( ::java::lang::Number)))) value;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Float__
diff --git a/libjava/java/lang/IllegalAccessError.h b/libjava/java/lang/IllegalAccessError.h
new file mode 100644
index 00000000000..12b8747c4ef
--- /dev/null
+++ b/libjava/java/lang/IllegalAccessError.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_IllegalAccessError__
+#define __java_lang_IllegalAccessError__
+
+#pragma interface
+
+#include <java/lang/IncompatibleClassChangeError.h>
+
+class java::lang::IllegalAccessError : public ::java::lang::IncompatibleClassChangeError
+{
+
+public:
+ IllegalAccessError();
+ IllegalAccessError(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -8988904074992417891LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_IllegalAccessError__
diff --git a/libjava/java/lang/IllegalAccessException.h b/libjava/java/lang/IllegalAccessException.h
new file mode 100644
index 00000000000..c0917475699
--- /dev/null
+++ b/libjava/java/lang/IllegalAccessException.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_IllegalAccessException__
+#define __java_lang_IllegalAccessException__
+
+#pragma interface
+
+#include <java/lang/Exception.h>
+
+class java::lang::IllegalAccessException : public ::java::lang::Exception
+{
+
+public:
+ IllegalAccessException();
+ IllegalAccessException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 6616958222490762034LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_IllegalAccessException__
diff --git a/libjava/java/lang/IllegalArgumentException.h b/libjava/java/lang/IllegalArgumentException.h
new file mode 100644
index 00000000000..187e430c165
--- /dev/null
+++ b/libjava/java/lang/IllegalArgumentException.h
@@ -0,0 +1,25 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_IllegalArgumentException__
+#define __java_lang_IllegalArgumentException__
+
+#pragma interface
+
+#include <java/lang/RuntimeException.h>
+
+class java::lang::IllegalArgumentException : public ::java::lang::RuntimeException
+{
+
+public:
+ IllegalArgumentException();
+ IllegalArgumentException(::java::lang::String *);
+ IllegalArgumentException(::java::lang::String *, ::java::lang::Throwable *);
+ IllegalArgumentException(::java::lang::Throwable *);
+private:
+ static const jlong serialVersionUID = -5365630128856068164LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_IllegalArgumentException__
diff --git a/libjava/java/lang/IllegalMonitorStateException.h b/libjava/java/lang/IllegalMonitorStateException.h
new file mode 100644
index 00000000000..ad9cb590292
--- /dev/null
+++ b/libjava/java/lang/IllegalMonitorStateException.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_IllegalMonitorStateException__
+#define __java_lang_IllegalMonitorStateException__
+
+#pragma interface
+
+#include <java/lang/RuntimeException.h>
+
+class java::lang::IllegalMonitorStateException : public ::java::lang::RuntimeException
+{
+
+public:
+ IllegalMonitorStateException();
+ IllegalMonitorStateException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 3713306369498869069LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_IllegalMonitorStateException__
diff --git a/libjava/java/lang/IllegalStateException.h b/libjava/java/lang/IllegalStateException.h
new file mode 100644
index 00000000000..e79bced810f
--- /dev/null
+++ b/libjava/java/lang/IllegalStateException.h
@@ -0,0 +1,25 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_IllegalStateException__
+#define __java_lang_IllegalStateException__
+
+#pragma interface
+
+#include <java/lang/RuntimeException.h>
+
+class java::lang::IllegalStateException : public ::java::lang::RuntimeException
+{
+
+public:
+ IllegalStateException();
+ IllegalStateException(::java::lang::String *);
+ IllegalStateException(::java::lang::String *, ::java::lang::Throwable *);
+ IllegalStateException(::java::lang::Throwable *);
+private:
+ static const jlong serialVersionUID = -1848914673093119416LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_IllegalStateException__
diff --git a/libjava/java/lang/IllegalThreadStateException.h b/libjava/java/lang/IllegalThreadStateException.h
new file mode 100644
index 00000000000..066eb92cd66
--- /dev/null
+++ b/libjava/java/lang/IllegalThreadStateException.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_IllegalThreadStateException__
+#define __java_lang_IllegalThreadStateException__
+
+#pragma interface
+
+#include <java/lang/IllegalArgumentException.h>
+
+class java::lang::IllegalThreadStateException : public ::java::lang::IllegalArgumentException
+{
+
+public:
+ IllegalThreadStateException();
+ IllegalThreadStateException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -7626246362397460174LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_IllegalThreadStateException__
diff --git a/libjava/java/lang/IncompatibleClassChangeError.h b/libjava/java/lang/IncompatibleClassChangeError.h
new file mode 100644
index 00000000000..ca4099194e8
--- /dev/null
+++ b/libjava/java/lang/IncompatibleClassChangeError.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_IncompatibleClassChangeError__
+#define __java_lang_IncompatibleClassChangeError__
+
+#pragma interface
+
+#include <java/lang/LinkageError.h>
+
+class java::lang::IncompatibleClassChangeError : public ::java::lang::LinkageError
+{
+
+public:
+ IncompatibleClassChangeError();
+ IncompatibleClassChangeError(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -4914975503642802119LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_IncompatibleClassChangeError__
diff --git a/libjava/java/lang/IndexOutOfBoundsException.h b/libjava/java/lang/IndexOutOfBoundsException.h
new file mode 100644
index 00000000000..4cd4184a712
--- /dev/null
+++ b/libjava/java/lang/IndexOutOfBoundsException.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_IndexOutOfBoundsException__
+#define __java_lang_IndexOutOfBoundsException__
+
+#pragma interface
+
+#include <java/lang/RuntimeException.h>
+
+class java::lang::IndexOutOfBoundsException : public ::java::lang::RuntimeException
+{
+
+public:
+ IndexOutOfBoundsException();
+ IndexOutOfBoundsException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 234122996006267687LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_IndexOutOfBoundsException__
diff --git a/libjava/java/lang/InheritableThreadLocal.h b/libjava/java/lang/InheritableThreadLocal.h
new file mode 100644
index 00000000000..9caf6f3df47
--- /dev/null
+++ b/libjava/java/lang/InheritableThreadLocal.h
@@ -0,0 +1,24 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_InheritableThreadLocal__
+#define __java_lang_InheritableThreadLocal__
+
+#pragma interface
+
+#include <java/lang/ThreadLocal.h>
+
+class java::lang::InheritableThreadLocal : public ::java::lang::ThreadLocal
+{
+
+public:
+ InheritableThreadLocal();
+public: // actually protected
+ virtual ::java::lang::Object * childValue(::java::lang::Object *);
+public: // actually package-private
+ static void newChildThread(::java::lang::Thread *);
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_InheritableThreadLocal__
diff --git a/libjava/java/lang/InstantiationError.h b/libjava/java/lang/InstantiationError.h
new file mode 100644
index 00000000000..4b817d2b316
--- /dev/null
+++ b/libjava/java/lang/InstantiationError.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_InstantiationError__
+#define __java_lang_InstantiationError__
+
+#pragma interface
+
+#include <java/lang/IncompatibleClassChangeError.h>
+
+class java::lang::InstantiationError : public ::java::lang::IncompatibleClassChangeError
+{
+
+public:
+ InstantiationError();
+ InstantiationError(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -4885810657349421204LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_InstantiationError__
diff --git a/libjava/java/lang/InstantiationException.h b/libjava/java/lang/InstantiationException.h
new file mode 100644
index 00000000000..805ab3c70dc
--- /dev/null
+++ b/libjava/java/lang/InstantiationException.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_InstantiationException__
+#define __java_lang_InstantiationException__
+
+#pragma interface
+
+#include <java/lang/Exception.h>
+
+class java::lang::InstantiationException : public ::java::lang::Exception
+{
+
+public:
+ InstantiationException();
+ InstantiationException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -8441929162975509110LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_InstantiationException__
diff --git a/libjava/java/lang/Integer.h b/libjava/java/lang/Integer.h
new file mode 100644
index 00000000000..e33c78f2cc2
--- /dev/null
+++ b/libjava/java/lang/Integer.h
@@ -0,0 +1,74 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Integer__
+#define __java_lang_Integer__
+
+#pragma interface
+
+#include <java/lang/Number.h>
+#include <gcj/array.h>
+
+
+class java::lang::Integer : public ::java::lang::Number
+{
+
+public:
+ Integer(jint);
+ Integer(::java::lang::String *);
+ static ::java::lang::String * toString(jint, jint);
+ static ::java::lang::String * toHexString(jint);
+ static ::java::lang::String * toOctalString(jint);
+ static ::java::lang::String * toBinaryString(jint);
+ static ::java::lang::String * toString(jint);
+ static jint parseInt(::java::lang::String *, jint);
+ static jint parseInt(::java::lang::String *);
+ static ::java::lang::Integer * valueOf(::java::lang::String *, jint);
+ static ::java::lang::Integer * valueOf(::java::lang::String *);
+ static ::java::lang::Integer * valueOf(jint);
+ jbyte byteValue();
+ jshort shortValue();
+ jint intValue();
+ jlong longValue();
+ jfloat floatValue();
+ jdouble doubleValue();
+ ::java::lang::String * toString();
+ jint hashCode();
+ jboolean equals(::java::lang::Object *);
+ static ::java::lang::Integer * getInteger(::java::lang::String *);
+ static ::java::lang::Integer * getInteger(::java::lang::String *, jint);
+ static ::java::lang::Integer * getInteger(::java::lang::String *, ::java::lang::Integer *);
+ static ::java::lang::Integer * decode(::java::lang::String *);
+ jint target$compareTo(::java::lang::Integer *);
+ static jint bitCount(jint);
+ static jint rotateLeft(jint, jint);
+ static jint rotateRight(jint, jint);
+ static jint highestOneBit(jint);
+ static jint numberOfLeadingZeros(jint);
+ static jint lowestOneBit(jint);
+ static jint numberOfTrailingZeros(jint);
+ static jint signum(jint);
+ static jint reverseBytes(jint);
+ static jint reverse(jint);
+public: // actually package-private
+ static ::java::lang::String * toUnsignedString(jint, jint);
+ static jint parseInt(::java::lang::String *, jint, jboolean);
+public:
+ jint compareTo(::java::lang::Object *);
+private:
+ static const jlong serialVersionUID = 1360826667806852920LL;
+public:
+ static const jint MIN_VALUE = -2147483647 - 1;
+ static const jint MAX_VALUE = 2147483647;
+ static ::java::lang::Class * TYPE;
+ static const jint SIZE = 32;
+private:
+ static const jint MIN_CACHE = -128;
+ static const jint MAX_CACHE = 127;
+ static JArray< ::java::lang::Integer * > * intCache;
+ jint __attribute__((aligned(__alignof__( ::java::lang::Number)))) value;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Integer__
diff --git a/libjava/java/lang/InternalError.h b/libjava/java/lang/InternalError.h
new file mode 100644
index 00000000000..b0477bbe640
--- /dev/null
+++ b/libjava/java/lang/InternalError.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_InternalError__
+#define __java_lang_InternalError__
+
+#pragma interface
+
+#include <java/lang/VirtualMachineError.h>
+
+class java::lang::InternalError : public ::java::lang::VirtualMachineError
+{
+
+public:
+ InternalError();
+ InternalError(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -9062593416125562365LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_InternalError__
diff --git a/libjava/java/lang/InterruptedException.h b/libjava/java/lang/InterruptedException.h
new file mode 100644
index 00000000000..c452de6b5e5
--- /dev/null
+++ b/libjava/java/lang/InterruptedException.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_InterruptedException__
+#define __java_lang_InterruptedException__
+
+#pragma interface
+
+#include <java/lang/Exception.h>
+
+class java::lang::InterruptedException : public ::java::lang::Exception
+{
+
+public:
+ InterruptedException();
+ InterruptedException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 6700697376100628473LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_InterruptedException__
diff --git a/libjava/java/lang/Iterable.h b/libjava/java/lang/Iterable.h
new file mode 100644
index 00000000000..3bdb2543b3b
--- /dev/null
+++ b/libjava/java/lang/Iterable.h
@@ -0,0 +1,19 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Iterable__
+#define __java_lang_Iterable__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::Iterable : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::util::Iterator * iterator() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_Iterable__
diff --git a/libjava/java/lang/LinkageError.h b/libjava/java/lang/LinkageError.h
new file mode 100644
index 00000000000..4368d8b9ff8
--- /dev/null
+++ b/libjava/java/lang/LinkageError.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_LinkageError__
+#define __java_lang_LinkageError__
+
+#pragma interface
+
+#include <java/lang/Error.h>
+
+class java::lang::LinkageError : public ::java::lang::Error
+{
+
+public:
+ LinkageError();
+ LinkageError(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 3579600108157160122LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_LinkageError__
diff --git a/libjava/java/lang/Long.h b/libjava/java/lang/Long.h
new file mode 100644
index 00000000000..da04281a659
--- /dev/null
+++ b/libjava/java/lang/Long.h
@@ -0,0 +1,69 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Long__
+#define __java_lang_Long__
+
+#pragma interface
+
+#include <java/lang/Number.h>
+
+class java::lang::Long : public ::java::lang::Number
+{
+
+public:
+ Long(jlong);
+ Long(::java::lang::String *);
+ static ::java::lang::String * toString(jlong, jint);
+ static ::java::lang::String * toHexString(jlong);
+ static ::java::lang::String * toOctalString(jlong);
+ static ::java::lang::String * toBinaryString(jlong);
+ static ::java::lang::String * toString(jlong);
+ static jlong parseLong(::java::lang::String *, jint);
+ static jlong parseLong(::java::lang::String *);
+ static ::java::lang::Long * valueOf(::java::lang::String *, jint);
+ static ::java::lang::Long * valueOf(::java::lang::String *);
+ static ::java::lang::Long * valueOf(jlong);
+ static ::java::lang::Long * decode(::java::lang::String *);
+ jbyte byteValue();
+ jshort shortValue();
+ jint intValue();
+ jlong longValue();
+ jfloat floatValue();
+ jdouble doubleValue();
+ ::java::lang::String * toString();
+ jint hashCode();
+ jboolean equals(::java::lang::Object *);
+ static ::java::lang::Long * getLong(::java::lang::String *);
+ static ::java::lang::Long * getLong(::java::lang::String *, jlong);
+ static ::java::lang::Long * getLong(::java::lang::String *, ::java::lang::Long *);
+ jint target$compareTo(::java::lang::Long *);
+ static jint bitCount(jlong);
+ static jlong rotateLeft(jlong, jint);
+ static jlong rotateRight(jlong, jint);
+ static jlong highestOneBit(jlong);
+ static jint numberOfLeadingZeros(jlong);
+ static jlong lowestOneBit(jlong);
+ static jint numberOfTrailingZeros(jlong);
+ static jint signum(jlong);
+ static jlong reverseBytes(jlong);
+ static jlong reverse(jlong);
+private:
+ static ::java::lang::String * toUnsignedString(jlong, jint);
+ static jlong parseLong(::java::lang::String *, jint, jboolean);
+public:
+ jint compareTo(::java::lang::Object *);
+private:
+ static const jlong serialVersionUID = 4290774380558885855LL;
+public:
+ static const jlong MIN_VALUE = -9223372036854775807LL - 1;
+ static const jlong MAX_VALUE = 9223372036854775807LL;
+ static ::java::lang::Class * TYPE;
+ static const jint SIZE = 64;
+private:
+ jlong __attribute__((aligned(__alignof__( ::java::lang::Number)))) value;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Long__
diff --git a/libjava/java/lang/Math.h b/libjava/java/lang/Math.h
new file mode 100644
index 00000000000..32707e9f8cd
--- /dev/null
+++ b/libjava/java/lang/Math.h
@@ -0,0 +1,68 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Math__
+#define __java_lang_Math__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::Math : public ::java::lang::Object
+{
+
+ Math();
+public:
+ static jint abs(jint);
+ static jlong abs(jlong);
+ static jfloat abs(jfloat);
+ static jdouble abs(jdouble);
+ static jint min(jint, jint);
+ static jlong min(jlong, jlong);
+ static jfloat min(jfloat, jfloat);
+ static jdouble min(jdouble, jdouble);
+ static jint max(jint, jint);
+ static jlong max(jlong, jlong);
+ static jfloat max(jfloat, jfloat);
+ static jdouble max(jdouble, jdouble);
+ static jdouble sin(jdouble);
+ static jdouble cos(jdouble);
+ static jdouble tan(jdouble);
+ static jdouble asin(jdouble);
+ static jdouble acos(jdouble);
+ static jdouble atan(jdouble);
+ static jdouble atan2(jdouble, jdouble);
+ static jdouble exp(jdouble);
+ static jdouble log(jdouble);
+ static jdouble sqrt(jdouble);
+ static jdouble pow(jdouble, jdouble);
+ static jdouble IEEEremainder(jdouble, jdouble);
+ static jdouble ceil(jdouble);
+ static jdouble floor(jdouble);
+ static jdouble rint(jdouble);
+ static jint round(jfloat);
+ static jlong round(jdouble);
+ static jdouble random();
+ static jdouble toRadians(jdouble);
+ static jdouble toDegrees(jdouble);
+ static jdouble cbrt(jdouble);
+ static jdouble cosh(jdouble);
+ static jdouble expm1(jdouble);
+ static jdouble hypot(jdouble, jdouble);
+ static jdouble log10(jdouble);
+ static jdouble log1p(jdouble);
+ static jdouble signum(jdouble);
+ static jfloat signum(jfloat);
+ static jdouble sinh(jdouble);
+ static jdouble tanh(jdouble);
+ static jdouble ulp(jdouble);
+ static jfloat ulp(jfloat);
+private:
+ static ::java::util::Random * rand;
+public:
+ static jdouble E;
+ static jdouble PI;
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Math__
diff --git a/libjava/java/lang/NegativeArraySizeException.h b/libjava/java/lang/NegativeArraySizeException.h
new file mode 100644
index 00000000000..e05f7c51563
--- /dev/null
+++ b/libjava/java/lang/NegativeArraySizeException.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_NegativeArraySizeException__
+#define __java_lang_NegativeArraySizeException__
+
+#pragma interface
+
+#include <java/lang/RuntimeException.h>
+
+class java::lang::NegativeArraySizeException : public ::java::lang::RuntimeException
+{
+
+public:
+ NegativeArraySizeException();
+ NegativeArraySizeException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -8960118058596991861LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_NegativeArraySizeException__
diff --git a/libjava/java/lang/NoClassDefFoundError.h b/libjava/java/lang/NoClassDefFoundError.h
new file mode 100644
index 00000000000..90790a7b9e5
--- /dev/null
+++ b/libjava/java/lang/NoClassDefFoundError.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_NoClassDefFoundError__
+#define __java_lang_NoClassDefFoundError__
+
+#pragma interface
+
+#include <java/lang/LinkageError.h>
+
+class java::lang::NoClassDefFoundError : public ::java::lang::LinkageError
+{
+
+public:
+ NoClassDefFoundError();
+ NoClassDefFoundError(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 9095859863287012458LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_NoClassDefFoundError__
diff --git a/libjava/java/lang/NoSuchFieldError.h b/libjava/java/lang/NoSuchFieldError.h
new file mode 100644
index 00000000000..65f444e8394
--- /dev/null
+++ b/libjava/java/lang/NoSuchFieldError.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_NoSuchFieldError__
+#define __java_lang_NoSuchFieldError__
+
+#pragma interface
+
+#include <java/lang/IncompatibleClassChangeError.h>
+
+class java::lang::NoSuchFieldError : public ::java::lang::IncompatibleClassChangeError
+{
+
+public:
+ NoSuchFieldError();
+ NoSuchFieldError(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -3456430195886129035LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_NoSuchFieldError__
diff --git a/libjava/java/lang/NoSuchFieldException.h b/libjava/java/lang/NoSuchFieldException.h
new file mode 100644
index 00000000000..36fe841ed74
--- /dev/null
+++ b/libjava/java/lang/NoSuchFieldException.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_NoSuchFieldException__
+#define __java_lang_NoSuchFieldException__
+
+#pragma interface
+
+#include <java/lang/Exception.h>
+
+class java::lang::NoSuchFieldException : public ::java::lang::Exception
+{
+
+public:
+ NoSuchFieldException();
+ NoSuchFieldException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -6143714805279938260LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_NoSuchFieldException__
diff --git a/libjava/java/lang/NoSuchMethodError.h b/libjava/java/lang/NoSuchMethodError.h
new file mode 100644
index 00000000000..5db0a040e22
--- /dev/null
+++ b/libjava/java/lang/NoSuchMethodError.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_NoSuchMethodError__
+#define __java_lang_NoSuchMethodError__
+
+#pragma interface
+
+#include <java/lang/IncompatibleClassChangeError.h>
+
+class java::lang::NoSuchMethodError : public ::java::lang::IncompatibleClassChangeError
+{
+
+public:
+ NoSuchMethodError();
+ NoSuchMethodError(::java::lang::String *);
+public: // actually package-private
+ static const jlong serialVersionUID = -3765521442372831335LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_NoSuchMethodError__
diff --git a/libjava/java/lang/NoSuchMethodException.h b/libjava/java/lang/NoSuchMethodException.h
new file mode 100644
index 00000000000..dc905d67f48
--- /dev/null
+++ b/libjava/java/lang/NoSuchMethodException.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_NoSuchMethodException__
+#define __java_lang_NoSuchMethodException__
+
+#pragma interface
+
+#include <java/lang/Exception.h>
+
+class java::lang::NoSuchMethodException : public ::java::lang::Exception
+{
+
+public:
+ NoSuchMethodException();
+ NoSuchMethodException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 5034388446362600923LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_NoSuchMethodException__
diff --git a/libjava/java/lang/NullPointerException.h b/libjava/java/lang/NullPointerException.h
new file mode 100644
index 00000000000..4af582cf43e
--- /dev/null
+++ b/libjava/java/lang/NullPointerException.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_NullPointerException__
+#define __java_lang_NullPointerException__
+
+#pragma interface
+
+#include <java/lang/RuntimeException.h>
+
+class java::lang::NullPointerException : public ::java::lang::RuntimeException
+{
+
+public:
+ NullPointerException();
+ NullPointerException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 5162710183389028792LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_NullPointerException__
diff --git a/libjava/java/lang/Number.h b/libjava/java/lang/Number.h
new file mode 100644
index 00000000000..65ba9201988
--- /dev/null
+++ b/libjava/java/lang/Number.h
@@ -0,0 +1,32 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Number__
+#define __java_lang_Number__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::Number : public ::java::lang::Object
+{
+
+public:
+ Number();
+ virtual jint intValue() = 0;
+ virtual jlong longValue() = 0;
+ virtual jfloat floatValue() = 0;
+ virtual jdouble doubleValue() = 0;
+ virtual jbyte byteValue();
+ virtual jshort shortValue();
+private:
+ static const jlong serialVersionUID = -8742448824652078965LL;
+public: // actually package-private
+ static JArray< jchar > * digits;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Number__
diff --git a/libjava/java/lang/NumberFormatException.h b/libjava/java/lang/NumberFormatException.h
new file mode 100644
index 00000000000..34bd4d678c2
--- /dev/null
+++ b/libjava/java/lang/NumberFormatException.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_NumberFormatException__
+#define __java_lang_NumberFormatException__
+
+#pragma interface
+
+#include <java/lang/IllegalArgumentException.h>
+
+class java::lang::NumberFormatException : public ::java::lang::IllegalArgumentException
+{
+
+public:
+ NumberFormatException();
+ NumberFormatException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -2848938806368998894LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_NumberFormatException__
diff --git a/libjava/java/lang/OutOfMemoryError.h b/libjava/java/lang/OutOfMemoryError.h
new file mode 100644
index 00000000000..7fac1f5a090
--- /dev/null
+++ b/libjava/java/lang/OutOfMemoryError.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_OutOfMemoryError__
+#define __java_lang_OutOfMemoryError__
+
+#pragma interface
+
+#include <java/lang/VirtualMachineError.h>
+
+class java::lang::OutOfMemoryError : public ::java::lang::VirtualMachineError
+{
+
+public:
+ OutOfMemoryError();
+ OutOfMemoryError(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 8228564086184010517LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_OutOfMemoryError__
diff --git a/libjava/java/lang/Override.h b/libjava/java/lang/Override.h
new file mode 100644
index 00000000000..e6424ee6a00
--- /dev/null
+++ b/libjava/java/lang/Override.h
@@ -0,0 +1,19 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Override__
+#define __java_lang_Override__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::Override : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::lang::Class * annotationType() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_Override__
diff --git a/libjava/java/lang/Package.h b/libjava/java/lang/Package.h
new file mode 100644
index 00000000000..6d12d9f3687
--- /dev/null
+++ b/libjava/java/lang/Package.h
@@ -0,0 +1,62 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Package__
+#define __java_lang_Package__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URL;
+ }
+ }
+}
+
+class java::lang::Package : public ::java::lang::Object
+{
+
+public: // actually package-private
+ Package(::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::net::URL *);
+ Package(::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::net::URL *, ::java::lang::ClassLoader *);
+public:
+ virtual ::java::lang::String * getName();
+ virtual ::java::lang::String * getSpecificationTitle();
+ virtual ::java::lang::String * getSpecificationVersion();
+ virtual ::java::lang::String * getSpecificationVendor();
+ virtual ::java::lang::String * getImplementationTitle();
+ virtual ::java::lang::String * getImplementationVersion();
+ virtual ::java::lang::String * getImplementationVendor();
+ virtual jboolean isSealed();
+ virtual jboolean isSealed(::java::net::URL *);
+ virtual jboolean isCompatibleWith(::java::lang::String *);
+ static ::java::lang::Package * getPackage(::java::lang::String *);
+ static JArray< ::java::lang::Package * > * getPackages();
+ virtual jint hashCode();
+ virtual ::java::lang::String * toString();
+ virtual ::java::lang::annotation::Annotation * getAnnotation(::java::lang::Class *);
+ virtual JArray< ::java::lang::annotation::Annotation * > * getAnnotations();
+ virtual JArray< ::java::lang::annotation::Annotation * > * getDeclaredAnnotations();
+ virtual jboolean isAnnotationPresent(::java::lang::Class *);
+private:
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) name;
+ ::java::lang::String * implTitle;
+ ::java::lang::String * implVendor;
+ ::java::lang::String * implVersion;
+ ::java::lang::String * specTitle;
+ ::java::lang::String * specVendor;
+ ::java::lang::String * specVersion;
+ ::java::net::URL * sealed;
+ ::java::lang::ClassLoader * loader;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Package__
diff --git a/libjava/java/lang/Package.java b/libjava/java/lang/Package.java
deleted file mode 100644
index 892380f9aa8..00000000000
--- a/libjava/java/lang/Package.java
+++ /dev/null
@@ -1,415 +0,0 @@
-/* Package.java -- information about a package
- Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006
- 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., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 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.lang;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
-import java.net.URL;
-import java.util.NoSuchElementException;
-import java.util.StringTokenizer;
-
-
-/**
- * Everything you ever wanted to know about a package. This class makes it
- * possible to attach specification and implementation information to a
- * package as explained in the
- * <a href="http://java.sun.com/products/jdk/1.3/docs/guide/versioning/spec/VersioningSpecification.html#PackageVersionSpecification">Package Versioning Specification</a>
- * section of the
- * <a href="http://java.sun.com/products/jdk/1.3/docs/guide/versioning/spec/VersioningSpecification.html">Product Versioning Specification</a>.
- * It also allows packages to be sealed with respect to the originating URL.
- *
- * <p>The most useful method is the <code>isCompatibleWith()</code> method that
- * compares a desired version of a specification with the version of the
- * specification as implemented by a package. A package is considered
- * compatible with another version if the version of the specification is
- * equal or higher then the requested version. Version numbers are represented
- * as strings of positive numbers separated by dots (e.g. "1.2.0").
- * The first number is called the major number, the second the minor,
- * the third the micro, etc. A version is considered higher then another
- * version if it has a bigger major number then the another version or when
- * the major numbers of the versions are equal if it has a bigger minor number
- * then the other version, etc. (If a version has no minor, micro, etc numbers
- * then they are considered the be 0.)
- *
- * @author Mark Wielaard (mark@klomp.org)
- * @see ClassLoader#definePackage(String, String, String, String, String,
- * String, String, URL)
- * @since 1.2
- * @status updated to 1.5
- */
-public class Package
- implements AnnotatedElement
-{
- /** The name of the Package */
- private final String name;
-
- /** The name if the implementation */
- private final String implTitle;
-
- /** The vendor that wrote this implementation */
- private final String implVendor;
-
- /** The version of this implementation */
- private final String implVersion;
-
- /** The name of the specification */
- private final String specTitle;
-
- /** The name of the specification designer */
- private final String specVendor;
-
- /** The version of this specification */
- private final String specVersion;
-
- /** If sealed the origin of the package classes, otherwise null */
- private final URL sealed;
-
- /** The class loader that defined this package */
- private ClassLoader loader;
-
- /** @deprecated Please use the other constructor that takes the class loader
- * that defines the Package.
- */
- Package(String name,
- String specTitle, String specVendor, String specVersion,
- String implTitle, String implVendor, String implVersion, URL sealed)
- {
- this(name, specTitle, specVendor, specVersion, implTitle, implVendor,
- implVersion, sealed, null);
- }
-
- /**
- * A package local constructor for the Package class. All parameters except
- * the <code>name</code> of the package may be <code>null</code>.
- * There are no public constructors defined for Package; this is a package
- * local constructor that is used by java.lang.Classloader.definePackage().
- *
- * @param name The name of the Package
- * @param specTitle The name of the specification
- * @param specVendor The name of the specification designer
- * @param specVersion The version of this specification
- * @param implTitle The name of the implementation
- * @param implVendor The vendor that wrote this implementation
- * @param implVersion The version of this implementation
- * @param sealed If sealed the origin of the package classes
- */
- Package(String name,
- String specTitle, String specVendor, String specVersion,
- String implTitle, String implVendor, String implVersion, URL sealed,
- ClassLoader loader)
- {
- if (name == null)
- throw new IllegalArgumentException("null Package name");
-
- this.name = name;
- this.implTitle = implTitle;
- this.implVendor = implVendor;
- this.implVersion = implVersion;
- this.specTitle = specTitle;
- this.specVendor = specVendor;
- this.specVersion = specVersion;
- this.sealed = sealed;
- this.loader = loader;
- }
-
- /**
- * Returns the Package name in dot-notation.
- *
- * @return the non-null package name
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * Returns the name of the specification, or null if unknown.
- *
- * @return the specification title
- */
- public String getSpecificationTitle()
- {
- return specTitle;
- }
-
- /**
- * Returns the version of the specification, or null if unknown.
- *
- * @return the specification version
- */
- public String getSpecificationVersion()
- {
- return specVersion;
- }
-
- /**
- * Returns the name of the specification designer, or null if unknown.
- *
- * @return the specification vendor
- */
- public String getSpecificationVendor()
- {
- return specVendor;
- }
-
- /**
- * Returns the name of the implementation, or null if unknown.
- *
- * @return the implementation title
- */
- public String getImplementationTitle()
- {
- return implTitle;
- }
-
- /**
- * Returns the version of this implementation, or null if unknown.
- *
- * @return the implementation version
- */
- public String getImplementationVersion()
- {
- return implVersion;
- }
-
- /**
- * Returns the vendor that wrote this implementation, or null if unknown.
- *
- * @return the implementation vendor
- */
- public String getImplementationVendor()
- {
- return implVendor;
- }
-
- /**
- * Returns true if this Package is sealed.
- *
- * @return true if the package is sealed
- */
- public boolean isSealed()
- {
- return sealed != null;
- }
-
- /**
- * Returns true if this Package is sealed and the origin of the classes is
- * the given URL.
- *
- * @param url the URL to test
- * @return true if the package is sealed by this URL
- * @throws NullPointerException if url is null
- */
- public boolean isSealed(URL url)
- {
- return url.equals(sealed);
- }
-
- /**
- * Checks if the version of the specification is higher or at least as high
- * as the desired version. Comparison is done by sequentially comparing
- * dotted decimal numbers from the parameter and from
- * <code>getSpecificationVersion</code>.
- *
- * @param version the (minimal) desired version of the specification
- *
- * @return true if the version is compatible, false otherwise
- *
- * @throws NumberFormatException if either version string is invalid
- * @throws NullPointerException if either version string is null
- */
- public boolean isCompatibleWith(String version)
- {
- StringTokenizer versionTokens = new StringTokenizer(version, ".");
- StringTokenizer specTokens = new StringTokenizer(specVersion, ".");
- try
- {
- while (versionTokens.hasMoreElements())
- {
- int vers = Integer.parseInt(versionTokens.nextToken());
- int spec = Integer.parseInt(specTokens.nextToken());
- if (spec < vers)
- return false;
- else if (spec > vers)
- return true;
- // They must be equal, next Token please!
- }
- }
- catch (NoSuchElementException e)
- {
- // This must have been thrown by spec.nextToken() so return false.
- return false;
- }
- // They must have been exactly the same version.
- // Or the specVersion has more subversions. That is also good.
- return true;
- }
-
- /**
- * Returns the named package if it is known by the callers class loader.
- * It may return null if the package is unknown, when there is no
- * information on that particular package available or when the callers
- * classloader is null.
- *
- * @param name the name of the desired package
- * @return the package by that name in the current ClassLoader
- */
- public static Package getPackage(String name)
- {
- // Get the caller's classloader
- ClassLoader cl = VMSecurityManager.currentClassLoader(Package.class);
- return cl != null ? cl.getPackage(name) : VMClassLoader.getPackage(name);
- }
-
- /**
- * Returns all the packages that are known to the callers class loader.
- * It may return an empty array if the classloader of the caller is null.
- *
- * @return an array of all known packages
- */
- public static Package[] getPackages()
- {
- // Get the caller's classloader
- Class c = VMSecurityManager.getClassContext(Package.class)[1];
- ClassLoader cl = c.getClassLoader();
- return cl != null ? cl.getPackages() : VMClassLoader.getPackages();
- }
-
- /**
- * Returns the hashCode of the name of this package.
- *
- * @return the hash code
- */
- public int hashCode()
- {
- return name.hashCode();
- }
-
- /**
- * Returns a string representation of this package. It is specified to
- * be <code>"package " + getName() + (getSpecificationTitle() == null
- * ? "" : ", " + getSpecificationTitle()) + (getSpecificationVersion()
- * == null ? "" : ", version " + getSpecificationVersion())</code>.
- *
- * @return the string representation of the package
- */
- public String toString()
- {
- return ("package " + name + (specTitle == null ? "" : ", " + specTitle)
- + (specVersion == null ? "" : ", version " + specVersion));
- }
-
- /**
- * Returns this package's annotation for the specified annotation type,
- * or <code>null</code> if no such annotation exists.
- *
- * @param annotationClass the type of annotation to look for.
- * @return this package's annotation for the specified type, or
- * <code>null</code> if no such annotation exists.
- * @since 1.5
- */
- /* FIXME[GENERICS]: <T extends Annotation> T getAnnotation(Class <T>) */
- public Annotation getAnnotation(Class annotationClass)
- {
- Annotation foundAnnotation = null;
- Annotation[] annotations = getAnnotations();
- for (int i = 0; i < annotations.length; i++)
- if (annotations[i].annotationType() == annotationClass)
- foundAnnotation = annotations[i];
- return foundAnnotation;
- }
-
- /**
- * Returns all annotations associated with this package. If there are
- * no annotations associated with this package, then a zero-length array
- * will be returned. The returned array may be modified by the client
- * code, but this will have no effect on the annotation content of this
- * package, and hence no effect on the return value of this method for
- * future callers.
- *
- * @return this package' annotations.
- * @since 1.5
- */
- public Annotation[] getAnnotations()
- {
- /** All a package's annotations are declared within it. */
- return getDeclaredAnnotations();
- }
-
- /**
- * Returns all annotations directly defined by this package. If there are
- * no annotations associated with this package, then a zero-length array
- * will be returned. The returned array may be modified by the client
- * code, but this will have no effect on the annotation content of this
- * package, and hence no effect on the return value of this method for
- * future callers.
- *
- * @return the annotations directly defined by this package.
- * @since 1.5
- */
- public Annotation[] getDeclaredAnnotations()
- {
- try
- {
- Class pkgInfo = Class.forName(name + ".package-info", false, loader);
- return pkgInfo.getDeclaredAnnotations();
- }
- catch (ClassNotFoundException _)
- {
- return new Annotation[0];
- }
- }
-
- /**
- * Returns true if an annotation for the specified type is associated
- * with this package. This is primarily a short-hand for using marker
- * annotations.
- *
- * @param annotationClass the type of annotation to look for.
- * @return true if an annotation exists for the specified type.
- * @since 1.5
- */
- /* FIXME[GENERICS]: Signature is Class<? extends Annotation> */
- public boolean isAnnotationPresent(Class
- annotationClass)
- {
- return getAnnotation(annotationClass) != null;
- }
-
-} // class Package
diff --git a/libjava/java/lang/PosixProcess$EOFInputStream.h b/libjava/java/lang/PosixProcess$EOFInputStream.h
new file mode 100644
index 00000000000..bda16533a3f
--- /dev/null
+++ b/libjava/java/lang/PosixProcess$EOFInputStream.h
@@ -0,0 +1,24 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_PosixProcess$EOFInputStream__
+#define __java_lang_PosixProcess$EOFInputStream__
+
+#pragma interface
+
+#include <java/io/InputStream.h>
+
+class java::lang::PosixProcess$EOFInputStream : public ::java::io::InputStream
+{
+
+public: // actually package-private
+ PosixProcess$EOFInputStream();
+public:
+ virtual jint read();
+public: // actually package-private
+ static ::java::lang::PosixProcess$EOFInputStream * instance;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_PosixProcess$EOFInputStream__
diff --git a/libjava/java/lang/PosixProcess$ProcessManager.h b/libjava/java/lang/PosixProcess$ProcessManager.h
new file mode 100644
index 00000000000..d8d0d594232
--- /dev/null
+++ b/libjava/java/lang/PosixProcess$ProcessManager.h
@@ -0,0 +1,39 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_PosixProcess$ProcessManager__
+#define __java_lang_PosixProcess$ProcessManager__
+
+#pragma interface
+
+#include <java/lang/Thread.h>
+
+class java::lang::PosixProcess$ProcessManager : public ::java::lang::Thread
+{
+
+public: // actually package-private
+ PosixProcess$ProcessManager();
+private:
+ ::java::lang::PosixProcess * removeProcessFromMap(jlong);
+public: // actually package-private
+ virtual void addProcessToMap(::java::lang::PosixProcess *);
+ virtual void startExecuting(::java::lang::PosixProcess *);
+ virtual void waitUntilReady();
+public:
+ virtual void run();
+private:
+ void init();
+ void waitForSignal();
+ jboolean reap();
+ void signalReaper();
+public: // actually package-private
+ ::java::util::List * __attribute__((aligned(__alignof__( ::java::lang::Thread)))) queue;
+private:
+ ::java::util::Map * pidToProcess;
+ jboolean ready;
+ jlong reaperPID;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_PosixProcess$ProcessManager__
diff --git a/libjava/java/lang/PosixProcess.h b/libjava/java/lang/PosixProcess.h
new file mode 100644
index 00000000000..62539ceb2ac
--- /dev/null
+++ b/libjava/java/lang/PosixProcess.h
@@ -0,0 +1,62 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_PosixProcess__
+#define __java_lang_PosixProcess__
+
+#pragma interface
+
+#include <java/lang/Process.h>
+#include <gcj/array.h>
+
+
+class java::lang::PosixProcess : public ::java::lang::Process
+{
+
+public:
+ void destroy();
+private:
+ void nativeDestroy();
+public:
+ jint exitValue();
+public: // actually package-private
+ void processTerminationCleanup();
+public:
+ ::java::io::InputStream * getErrorStream();
+ ::java::io::InputStream * getInputStream();
+ ::java::io::OutputStream * getOutputStream();
+ jint waitFor();
+public: // actually package-private
+ void spawn(::java::lang::PosixProcess$ProcessManager *);
+private:
+ void nativeSpawn();
+public: // actually package-private
+ PosixProcess(JArray< ::java::lang::String * > *, JArray< ::java::lang::String * > *, ::java::io::File *);
+ static jlong access$0(::java::lang::PosixProcess *);
+ static ::java::lang::Object * access$1();
+ static void access$2(::java::lang::PosixProcess$ProcessManager *);
+private:
+ JArray< ::java::lang::String * > * __attribute__((aligned(__alignof__( ::java::lang::Process)))) progarray;
+ JArray< ::java::lang::String * > * envp;
+ ::java::io::File * dir;
+ ::java::lang::Throwable * exception;
+ jlong pid;
+public: // actually package-private
+ static const jint STATE_WAITING_TO_START = 0;
+ static const jint STATE_RUNNING = 1;
+ static const jint STATE_TERMINATED = 2;
+ jint state;
+ jint status;
+private:
+ ::java::io::InputStream * errorStream;
+ ::java::io::InputStream * inputStream;
+ ::java::io::OutputStream * outputStream;
+ ::java::io::InputStream * returnedErrorStream;
+ ::java::io::InputStream * returnedInputStream;
+ static ::java::lang::Object * queueLock;
+ static ::java::lang::PosixProcess$ProcessManager * processManager;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_PosixProcess__
diff --git a/libjava/java/lang/PosixProcess.java b/libjava/java/lang/PosixProcess.java
index fbd6c4c8a49..23e1da9d698 100644
--- a/libjava/java/lang/PosixProcess.java
+++ b/libjava/java/lang/PosixProcess.java
@@ -1,5 +1,5 @@
// PosixProcess.java - Subclass of Process for POSIX systems.
-/* Copyright (C) 1998, 1999, 2004 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2004, 2006 Free Software Foundation
This file is part of libgcj.
@@ -25,19 +25,15 @@ import java.util.Map;
* @author David Daney <ddaney@avtrex.com> Rewrote using
* ProcessManager
*/
-
-// This is entirely internal to our implementation.
-// This file is copied to `ConcreteProcess.java' before compilation.
-// Hence the class name apparently does not match the file name.
-final class ConcreteProcess extends Process
+final class PosixProcess extends Process
{
static class ProcessManager extends Thread
{
/**
- * A list of {@link ConcreteProcess ConcreteProcesses} to be
+ * A list of {@link PosixProcess PosixProcesses} to be
* started. The queueLock object is used as the lock Object
* for all process related operations. To avoid dead lock
- * ensure queueLock is obtained before ConcreteProcess.
+ * ensure queueLock is obtained before PosixProcess.
*/
List queue = new LinkedList();
private Map pidToProcess = new HashMap();
@@ -52,37 +48,37 @@ final class ConcreteProcess extends Process
}
/**
- * Get the ConcreteProcess object with the given pid and
+ * Get the PosixProcess object with the given pid and
* remove it from the map. This method is called from the
* native code for {@link #reap()). The mapping is removed so
- * the ConcreteProcesses can be GCed after they terminate.
+ * the PosixProcesses can be GCed after they terminate.
*
* @param p The pid of the process.
*/
- private ConcreteProcess removeProcessFromMap(long p)
+ private PosixProcess removeProcessFromMap(long p)
{
- return (ConcreteProcess) pidToProcess.remove(new Long(p));
+ return (PosixProcess) pidToProcess.remove(new Long(p));
}
/**
- * Put the given ConcreteProcess in the map using the Long
+ * Put the given PosixProcess in the map using the Long
* value of its pid as the key.
*
- * @param p The ConcreteProcess.
+ * @param p The PosixProcess.
*/
- void addProcessToMap(ConcreteProcess p)
+ void addProcessToMap(PosixProcess p)
{
pidToProcess.put(new Long(p.pid), p);
}
/**
- * Queue up the ConcreteProcess and awake the ProcessManager.
- * The ProcessManager will start the ConcreteProcess from its
+ * Queue up the PosixProcess and awake the ProcessManager.
+ * The ProcessManager will start the PosixProcess from its
* thread so it can be reaped when it terminates.
*
- * @param p The ConcreteProcess.
+ * @param p The PosixProcess.
*/
- void startExecuting(ConcreteProcess p)
+ void startExecuting(PosixProcess p)
{
synchronized (queueLock)
{
@@ -154,7 +150,7 @@ final class ConcreteProcess extends Process
}
while (queue.size() > 0)
{
- ConcreteProcess p = (ConcreteProcess) queue.remove(0);
+ PosixProcess p = (PosixProcess) queue.remove(0);
p.spawn(this);
}
}
@@ -353,10 +349,7 @@ final class ConcreteProcess extends Process
*/
private native void nativeSpawn();
- // This file is copied to `ConcreteProcess.java' before
- // compilation. Hence the constructor name apparently does not
- // match the file name.
- ConcreteProcess(String[] progarray, String[] envp, File dir)
+ PosixProcess(String[] progarray, String[] envp, File dir)
throws IOException
{
// Check to ensure there is something to run, and avoid
@@ -378,7 +371,7 @@ final class ConcreteProcess extends Process
processManager.waitUntilReady();
}
- // Queue this ConcreteProcess for starting by the ProcessManager.
+ // Queue this PosixProcess for starting by the ProcessManager.
processManager.startExecuting(this);
}
@@ -428,8 +421,8 @@ final class ConcreteProcess extends Process
/** The process id. This is cast to a pid_t on the native side. */
private long pid;
- // FIXME: Why doesn't the friend declaration in ConcreteProcess.h
- // allow ConcreteProcess$ProcessManager native code access these
+ // FIXME: Why doesn't the friend declaration in PosixProcess.h
+ // allow PosixProcess$ProcessManager native code access these
// when they are private?
/** Before the process is forked. */
diff --git a/libjava/java/lang/Process.h b/libjava/java/lang/Process.h
new file mode 100644
index 00000000000..f363feb50ef
--- /dev/null
+++ b/libjava/java/lang/Process.h
@@ -0,0 +1,25 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Process__
+#define __java_lang_Process__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::Process : public ::java::lang::Object
+{
+
+public:
+ Process();
+ virtual ::java::io::OutputStream * getOutputStream() = 0;
+ virtual ::java::io::InputStream * getInputStream() = 0;
+ virtual ::java::io::InputStream * getErrorStream() = 0;
+ virtual jint waitFor() = 0;
+ virtual jint exitValue() = 0;
+ virtual void destroy() = 0;
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Process__
diff --git a/libjava/java/lang/ProcessBuilder.h b/libjava/java/lang/ProcessBuilder.h
new file mode 100644
index 00000000000..fd6029df0e5
--- /dev/null
+++ b/libjava/java/lang/ProcessBuilder.h
@@ -0,0 +1,37 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ProcessBuilder__
+#define __java_lang_ProcessBuilder__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::ProcessBuilder : public ::java::lang::Object
+{
+
+public:
+ ProcessBuilder(::java::util::List *);
+ ProcessBuilder(JArray< ::java::lang::String * > *);
+ ::java::util::List * command();
+ ::java::lang::ProcessBuilder * command(::java::util::List *);
+ ::java::lang::ProcessBuilder * command(JArray< ::java::lang::String * > *);
+ ::java::io::File * directory();
+ ::java::lang::ProcessBuilder * directory(::java::io::File *);
+ ::java::util::Map * environment();
+ jboolean redirectErrorStream();
+ ::java::lang::ProcessBuilder * redirectErrorStream(jboolean);
+ ::java::lang::Process * start();
+private:
+ ::java::io::File * __attribute__((aligned(__alignof__( ::java::lang::Object)))) directory__;
+ ::java::util::List * command__;
+ ::java::util::Map * environment__;
+ jboolean redirect;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_ProcessBuilder__
diff --git a/libjava/java/lang/ProcessBuilder.java b/libjava/java/lang/ProcessBuilder.java
new file mode 100644
index 00000000000..440e5e0b48d
--- /dev/null
+++ b/libjava/java/lang/ProcessBuilder.java
@@ -0,0 +1,118 @@
+/* ProcessBuilder.java - Represent spawned system process
+ Copyright (C) 2005, 2006 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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 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.lang;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+public final class ProcessBuilder
+{
+ private File directory = new File(System.getProperty("user.dir"));
+ private List<String> command;
+ // FIXME: make a copy.
+ private Map<String, String> environment = System.getenv();
+ private boolean redirect = false;
+
+ public ProcessBuilder(List<String> command)
+ {
+ this.command = command;
+ }
+
+ public ProcessBuilder(String... command)
+ {
+ this.command = Arrays.asList(command);
+ }
+
+ public List<String> command()
+ {
+ return command;
+ }
+
+ public ProcessBuilder command(List<String> command)
+ {
+ this.command = command;
+ return this;
+ }
+
+ public ProcessBuilder command(String... command)
+ {
+ this.command = Arrays.asList(command);
+ return this;
+ }
+
+ public File directory()
+ {
+ return directory;
+ }
+
+ public ProcessBuilder directory(File directory)
+ {
+ this.directory = directory;
+ return this;
+ }
+
+ public Map<String, String> environment()
+ {
+ return environment;
+ }
+
+ public boolean redirectErrorStream()
+ {
+ return redirect;
+ }
+
+ public ProcessBuilder redirectErrorStream(boolean redirect)
+ {
+ this.redirect = redirect;
+ return this;
+ }
+
+ public Process start() throws IOException
+ {
+ SecurityManager sm = SecurityManager.current; // Be thread-safe!
+ if (sm != null)
+ sm.checkExec(command.get(0));
+ // return VMProcess.exec(command, environment, directory, redirect);
+ // FIXME
+ return null;
+ }
+}
diff --git a/libjava/java/lang/Readable.h b/libjava/java/lang/Readable.h
new file mode 100644
index 00000000000..d8e7d2185c3
--- /dev/null
+++ b/libjava/java/lang/Readable.h
@@ -0,0 +1,29 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Readable__
+#define __java_lang_Readable__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace nio
+ {
+ class CharBuffer;
+ }
+ }
+}
+
+class java::lang::Readable : public ::java::lang::Object
+{
+
+public:
+ virtual jint read(::java::nio::CharBuffer *) = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_Readable__
diff --git a/libjava/java/lang/Runnable.h b/libjava/java/lang/Runnable.h
new file mode 100644
index 00000000000..ba5985cbf13
--- /dev/null
+++ b/libjava/java/lang/Runnable.h
@@ -0,0 +1,19 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Runnable__
+#define __java_lang_Runnable__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::Runnable : public ::java::lang::Object
+{
+
+public:
+ virtual void run() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_Runnable__
diff --git a/libjava/java/lang/Runtime.h b/libjava/java/lang/Runtime.h
new file mode 100644
index 00000000000..4679cc0b146
--- /dev/null
+++ b/libjava/java/lang/Runtime.h
@@ -0,0 +1,69 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Runtime__
+#define __java_lang_Runtime__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::Runtime : public ::java::lang::Object
+{
+
+ Runtime();
+public:
+ static ::java::lang::Runtime * getRuntime();
+ virtual void exit(jint);
+public: // actually package-private
+ static void exitNoChecksAccessor(jint);
+private:
+ void exitNoChecks(jint);
+public: // actually package-private
+ virtual jboolean runShutdownHooks();
+public:
+ virtual void addShutdownHook(::java::lang::Thread *);
+ virtual jboolean removeShutdownHook(::java::lang::Thread *);
+ virtual void halt(jint);
+ static void runFinalizersOnExit(jboolean);
+ virtual ::java::lang::Process * exec(::java::lang::String *);
+ virtual ::java::lang::Process * exec(::java::lang::String *, JArray< ::java::lang::String * > *);
+ virtual ::java::lang::Process * exec(::java::lang::String *, JArray< ::java::lang::String * > *, ::java::io::File *);
+ virtual ::java::lang::Process * exec(JArray< ::java::lang::String * > *);
+ virtual ::java::lang::Process * exec(JArray< ::java::lang::String * > *, JArray< ::java::lang::String * > *);
+ virtual ::java::lang::Process * exec(JArray< ::java::lang::String * > *, JArray< ::java::lang::String * > *, ::java::io::File *);
+ virtual jint availableProcessors();
+ virtual jlong freeMemory();
+ virtual jlong totalMemory();
+ virtual jlong maxMemory();
+ virtual void gc();
+ virtual void runFinalization();
+ virtual void traceInstructions(jboolean);
+ virtual void traceMethodCalls(jboolean);
+ virtual void load(::java::lang::String *);
+ virtual void loadLibrary(::java::lang::String *);
+ virtual ::java::io::InputStream * getLocalizedInputStream(::java::io::InputStream *);
+ virtual ::java::io::OutputStream * getLocalizedOutputStream(::java::io::OutputStream *);
+public: // actually package-private
+ virtual void exitInternal(jint);
+ virtual void _load(::java::lang::String *, jboolean);
+ virtual jboolean loadLibraryInternal(::java::lang::String *);
+private:
+ static void init();
+ void runFinalizationForExit();
+public: // actually package-private
+ static ::java::lang::String * nativeGetLibname(::java::lang::String *, ::java::lang::String *);
+ virtual ::java::lang::Process * execInternal(JArray< ::java::lang::String * > *, JArray< ::java::lang::String * > *, ::java::io::File *);
+private:
+ JArray< ::java::lang::String * > * __attribute__((aligned(__alignof__( ::java::lang::Object)))) libpath;
+ ::java::lang::Thread * exitSequence;
+ ::java::util::Set * shutdownHooks;
+ jboolean finalizeOnExit;
+ static ::java::lang::Runtime * current;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Runtime__
diff --git a/libjava/java/lang/RuntimeException.h b/libjava/java/lang/RuntimeException.h
new file mode 100644
index 00000000000..0bce089c7e4
--- /dev/null
+++ b/libjava/java/lang/RuntimeException.h
@@ -0,0 +1,25 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_RuntimeException__
+#define __java_lang_RuntimeException__
+
+#pragma interface
+
+#include <java/lang/Exception.h>
+
+class java::lang::RuntimeException : public ::java::lang::Exception
+{
+
+public:
+ RuntimeException();
+ RuntimeException(::java::lang::String *);
+ RuntimeException(::java::lang::String *, ::java::lang::Throwable *);
+ RuntimeException(::java::lang::Throwable *);
+private:
+ static const jlong serialVersionUID = -7034897190745766939LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_RuntimeException__
diff --git a/libjava/java/lang/RuntimePermission.h b/libjava/java/lang/RuntimePermission.h
new file mode 100644
index 00000000000..8b48175454e
--- /dev/null
+++ b/libjava/java/lang/RuntimePermission.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_RuntimePermission__
+#define __java_lang_RuntimePermission__
+
+#pragma interface
+
+#include <java/security/BasicPermission.h>
+
+class java::lang::RuntimePermission : public ::java::security::BasicPermission
+{
+
+public:
+ RuntimePermission(::java::lang::String *);
+ RuntimePermission(::java::lang::String *, ::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 7399184964622342223LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_RuntimePermission__
diff --git a/libjava/java/lang/SecurityContext.h b/libjava/java/lang/SecurityContext.h
new file mode 100644
index 00000000000..e7b0e595deb
--- /dev/null
+++ b/libjava/java/lang/SecurityContext.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_SecurityContext__
+#define __java_lang_SecurityContext__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::SecurityContext : public ::java::lang::Object
+{
+
+public: // actually package-private
+ SecurityContext(JArray< ::java::lang::Class * > *);
+ JArray< ::java::lang::Class * > * __attribute__((aligned(__alignof__( ::java::lang::Object)))) classes;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_SecurityContext__
diff --git a/libjava/java/lang/SecurityException.h b/libjava/java/lang/SecurityException.h
new file mode 100644
index 00000000000..3b19ba203e1
--- /dev/null
+++ b/libjava/java/lang/SecurityException.h
@@ -0,0 +1,25 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_SecurityException__
+#define __java_lang_SecurityException__
+
+#pragma interface
+
+#include <java/lang/RuntimeException.h>
+
+class java::lang::SecurityException : public ::java::lang::RuntimeException
+{
+
+public:
+ SecurityException();
+ SecurityException(::java::lang::String *);
+ SecurityException(::java::lang::String *, ::java::lang::Throwable *);
+ SecurityException(::java::lang::Throwable *);
+private:
+ static const jlong serialVersionUID = 6878364983674394167LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_SecurityException__
diff --git a/libjava/java/lang/SecurityManager$1.h b/libjava/java/lang/SecurityManager$1.h
new file mode 100644
index 00000000000..21df4f767ed
--- /dev/null
+++ b/libjava/java/lang/SecurityManager$1.h
@@ -0,0 +1,26 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_SecurityManager$1__
+#define __java_lang_SecurityManager$1__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::SecurityManager$1 : public ::java::lang::Object
+{
+
+public: // actually package-private
+ SecurityManager$1(::java::lang::SecurityManager *, ::java::lang::String *);
+public:
+ ::java::lang::Object * run();
+public: // actually package-private
+ ::java::lang::SecurityManager * __attribute__((aligned(__alignof__( ::java::lang::Object)))) this$0;
+private:
+ ::java::lang::String * val$restriction;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_SecurityManager$1__
diff --git a/libjava/java/lang/SecurityManager.h b/libjava/java/lang/SecurityManager.h
new file mode 100644
index 00000000000..28ef484c3ce
--- /dev/null
+++ b/libjava/java/lang/SecurityManager.h
@@ -0,0 +1,84 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_SecurityManager__
+#define __java_lang_SecurityManager__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class InetAddress;
+ }
+ namespace security
+ {
+ class Permission;
+ }
+ }
+}
+
+class java::lang::SecurityManager : public ::java::lang::Object
+{
+
+public:
+ SecurityManager();
+ virtual jboolean getInCheck();
+public: // actually protected
+ virtual JArray< ::java::lang::Class * > * getClassContext();
+ virtual ::java::lang::ClassLoader * currentClassLoader();
+ virtual ::java::lang::Class * currentLoadedClass();
+ virtual jint classDepth(::java::lang::String *);
+ virtual jint classLoaderDepth();
+ virtual jboolean inClass(::java::lang::String *);
+ virtual jboolean inClassLoader();
+public:
+ virtual ::java::lang::Object * getSecurityContext();
+ virtual void checkPermission(::java::security::Permission *);
+ virtual void checkPermission(::java::security::Permission *, ::java::lang::Object *);
+ virtual void checkCreateClassLoader();
+ virtual void checkAccess(::java::lang::Thread *);
+ virtual void checkAccess(::java::lang::ThreadGroup *);
+ virtual void checkExit(jint);
+ virtual void checkExec(::java::lang::String *);
+ virtual void checkLink(::java::lang::String *);
+ virtual void checkRead(::java::io::FileDescriptor *);
+ virtual void checkRead(::java::lang::String *);
+ virtual void checkRead(::java::lang::String *, ::java::lang::Object *);
+ virtual void checkWrite(::java::io::FileDescriptor *);
+ virtual void checkWrite(::java::lang::String *);
+ virtual void checkDelete(::java::lang::String *);
+ virtual void checkConnect(::java::lang::String *, jint);
+ virtual void checkConnect(::java::lang::String *, jint, ::java::lang::Object *);
+ virtual void checkListen(jint);
+ virtual void checkAccept(::java::lang::String *, jint);
+ virtual void checkMulticast(::java::net::InetAddress *);
+ virtual void checkMulticast(::java::net::InetAddress *, jbyte);
+ virtual void checkPropertiesAccess();
+ virtual void checkPropertyAccess(::java::lang::String *);
+ virtual jboolean checkTopLevelWindow(::java::lang::Object *);
+ virtual void checkPrintJobAccess();
+ virtual void checkSystemClipboardAccess();
+ virtual void checkAwtEventQueueAccess();
+ virtual void checkPackageAccess(::java::lang::String *);
+ virtual void checkPackageDefinition(::java::lang::String *);
+ virtual void checkSetFactory();
+ virtual void checkMemberAccess(::java::lang::Class *, jint);
+ virtual void checkSecurityAccess(::java::lang::String *);
+ virtual ::java::lang::ThreadGroup * getThreadGroup();
+public: // actually package-private
+ virtual void checkPackageList(::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
+ static volatile ::java::lang::SecurityManager * current;
+public: // actually protected
+ jboolean __attribute__((aligned(__alignof__( ::java::lang::Object)))) inCheck;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_SecurityManager__
diff --git a/libjava/java/lang/SecurityManager.java b/libjava/java/lang/SecurityManager.java
deleted file mode 100644
index c803c5b8554..00000000000
--- a/libjava/java/lang/SecurityManager.java
+++ /dev/null
@@ -1,1057 +0,0 @@
-/* SecurityManager.java -- security checks for privileged actions
- Copyright (C) 1998, 1999, 2001, 2002, 2005, 2006
- 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., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 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.lang;
-
-import java.awt.AWTPermission;
-import java.io.File;
-import java.io.FileDescriptor;
-import java.io.FilePermission;
-import java.lang.reflect.Member;
-import java.net.InetAddress;
-import java.net.SocketPermission;
-import java.security.AccessController;
-import java.security.AccessControlContext;
-import java.security.AllPermission;
-import java.security.Permission;
-import java.security.PrivilegedAction;
-import java.security.Security;
-import java.security.SecurityPermission;
-import java.util.PropertyPermission;
-import java.util.StringTokenizer;
-
-/**
- * SecurityManager is a class you can extend to create your own Java
- * security policy. By default, there is no SecurityManager installed in
- * 1.1, which means that all things are permitted to all people. The security
- * manager, if set, is consulted before doing anything with potentially
- * dangerous results, and throws a <code>SecurityException</code> if the
- * action is forbidden.
- *
- * <p>A typical check is as follows, just before the dangerous operation:<br>
- * <pre>
- * SecurityManager sm = System.getSecurityManager();
- * if (sm != null)
- * sm.checkABC(<em>argument</em>, ...);
- * </pre>
- * Note that this is thread-safe, by caching the security manager in a local
- * variable rather than risking a NullPointerException if the mangager is
- * changed between the check for null and before the permission check.
- *
- * <p>The special method <code>checkPermission</code> is a catchall, and
- * the default implementation calls
- * <code>AccessController.checkPermission</code>. In fact, all the other
- * methods default to calling checkPermission.
- *
- * <p>Sometimes, the security check needs to happen from a different context,
- * such as when called from a worker thread. In such cases, use
- * <code>getSecurityContext</code> to take a snapshot that can be passed
- * to the worker thread:<br>
- * <pre>
- * Object context = null;
- * SecurityManager sm = System.getSecurityManager();
- * if (sm != null)
- * context = sm.getSecurityContext(); // defaults to an AccessControlContext
- * // now, in worker thread
- * if (sm != null)
- * sm.checkPermission(permission, context);
- * </pre>
- *
- * <p>Permissions fall into these categories: File, Socket, Net, Security,
- * Runtime, Property, AWT, Reflect, and Serializable. Each of these
- * permissions have a property naming convention, that follows a hierarchical
- * naming convention, to make it easy to grant or deny several permissions
- * at once. Some permissions also take a list of permitted actions, such
- * as "read" or "write", to fine-tune control even more. The permission
- * <code>java.security.AllPermission</code> grants all permissions.
- *
- * <p>The default methods in this class deny all things to all people. You
- * must explicitly grant permission for anything you want to be legal when
- * subclassing this class.
- *
- * @author John Keiser
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see ClassLoader
- * @see SecurityException
- * @see #checkTopLevelWindow(Object)
- * @see System#getSecurityManager()
- * @see System#setSecurityManager(SecurityManager)
- * @see AccessController
- * @see AccessControlContext
- * @see AccessControlException
- * @see Permission
- * @see BasicPermission
- * @see java.io.FilePermission
- * @see java.net.SocketPermission
- * @see java.util.PropertyPermission
- * @see RuntimePermission
- * @see java.awt.AWTPermission
- * @see Policy
- * @see SecurityPermission
- * @see ProtectionDomain
- * @since 1.0
- * @status still missing 1.4 functionality
- */
-public class SecurityManager
-{
- /**
- * The current security manager. This is located here instead of in
- * System, to avoid security problems, as well as bootstrap issues.
- * Make sure to access it in a thread-safe manner; it is package visible
- * to avoid overhead in java.lang.
- */
- static volatile SecurityManager current;
-
- /**
- * Tells whether or not the SecurityManager is currently performing a
- * security check.
- * @deprecated Use {@link #checkPermission(Permission)} instead.
- */
- protected boolean inCheck;
-
- /**
- * Construct a new security manager. There may be a security check, of
- * <code>RuntimePermission("createSecurityManager")</code>.
- *
- * @throws SecurityException if permission is denied
- */
- public SecurityManager()
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- sm.checkPermission(new RuntimePermission("createSecurityManager"));
- }
-
- /**
- * Tells whether or not the SecurityManager is currently performing a
- * security check.
- *
- * @return true if the SecurityManager is in a security check
- * @see #inCheck
- * @deprecated use {@link #checkPermission(Permission)} instead
- */
- public boolean getInCheck()
- {
- return inCheck;
- }
-
- /**
- * Get a list of all the classes currently executing methods on the Java
- * stack. getClassContext()[0] is the currently executing method (ie. the
- * class that CALLED getClassContext, not SecurityManager).
- *
- * @return an array of classes on the Java execution stack
- */
- protected Class[] getClassContext()
- {
- return VMSecurityManager.getClassContext(SecurityManager.class);
- }
-
- /**
- * Find the ClassLoader of the first non-system class on the execution
- * stack. A non-system class is one whose ClassLoader is not equal to
- * {@link ClassLoader#getSystemClassLoader()} or its ancestors. This
- * will return null in three cases:
- *
- * <ul>
- * <li>All methods on the stack are from system classes</li>
- * <li>All methods on the stack up to the first "privileged" caller, as
- * created by {@link AccessController#doPrivileged(PrivilegedAction)},
- * are from system classes</li>
- * <li>A check of <code>java.security.AllPermission</code> succeeds.</li>
- * </ul>
- *
- * @return the most recent non-system ClassLoader on the execution stack
- * @deprecated use {@link #checkPermission(Permission)} instead
- */
- protected ClassLoader currentClassLoader()
- {
- return VMSecurityManager.currentClassLoader(SecurityManager.class);
- }
-
- /**
- * Find the first non-system class on the execution stack. A non-system
- * class is one whose ClassLoader is not equal to
- * {@link ClassLoader#getSystemClassLoader()} or its ancestors. This
- * will return null in three cases:
- *
- * <ul>
- * <li>All methods on the stack are from system classes</li>
- * <li>All methods on the stack up to the first "privileged" caller, as
- * created by {@link AccessController#doPrivileged(PrivilegedAction)},
- * are from system classes</li>
- * <li>A check of <code>java.security.AllPermission</code> succeeds.</li>
- * </ul>
- *
- * @return the most recent non-system Class on the execution stack
- * @deprecated use {@link #checkPermission(Permission)} instead
- */
- protected Class currentLoadedClass()
- {
- int i = classLoaderDepth();
- return i >= 0 ? getClassContext()[i] : null;
- }
-
- /**
- * Get the depth of a particular class on the execution stack.
- *
- * @param className the fully-qualified name to search for
- * @return the index of the class on the stack, or -1
- * @deprecated use {@link #checkPermission(Permission)} instead
- */
- protected int classDepth(String className)
- {
- Class[] c = getClassContext();
- for (int i = 0; i < c.length; i++)
- if (className.equals(c[i].getName()))
- return i;
- return -1;
- }
-
- /**
- * Get the depth on the execution stack of the most recent non-system class.
- * A non-system class is one whose ClassLoader is not equal to
- * {@link ClassLoader#getSystemClassLoader()} or its ancestors. This
- * will return -1 in three cases:
- *
- * <ul>
- * <li>All methods on the stack are from system classes</li>
- * <li>All methods on the stack up to the first "privileged" caller, as
- * created by {@link AccessController#doPrivileged(PrivilegedAction)},
- * are from system classes</li>
- * <li>A check of <code>java.security.AllPermission</code> succeeds.</li>
- * </ul>
- *
- * @return the index of the most recent non-system Class on the stack
- * @deprecated use {@link #checkPermission(Permission)} instead
- */
- protected int classLoaderDepth()
- {
- try
- {
- checkPermission(new AllPermission());
- }
- catch (SecurityException e)
- {
- Class[] c = getClassContext();
- for (int i = 0; i < c.length; i++)
- if (c[i].getClassLoader() != null)
- // XXX Check if c[i] is AccessController, or a system class.
- return i;
- }
- return -1;
- }
-
- /**
- * Tell whether the specified class is on the execution stack.
- *
- * @param className the fully-qualified name of the class to find
- * @return whether the specified class is on the execution stack
- * @deprecated use {@link #checkPermission(Permission)} instead
- */
- protected boolean inClass(String className)
- {
- return classDepth(className) != -1;
- }
-
- /**
- * Tell whether there is a class loaded with an explicit ClassLoader on
- * the stack.
- *
- * @return whether a class with an explicit ClassLoader is on the stack
- * @deprecated use {@link #checkPermission(Permission)} instead
- */
- protected boolean inClassLoader()
- {
- return classLoaderDepth() != -1;
- }
-
- /**
- * Get an implementation-dependent Object that contains enough information
- * about the current environment to be able to perform standard security
- * checks later. This is used by trusted methods that need to verify that
- * their callers have sufficient access to perform certain operations.
- *
- * <p>Currently the only methods that use this are checkRead() and
- * checkConnect(). The default implementation returns an
- * <code>AccessControlContext</code>.
- *
- * @return a security context
- * @see #checkConnect(String, int, Object)
- * @see #checkRead(String, Object)
- * @see AccessControlContext
- * @see AccessController#getContext()
- */
- public Object getSecurityContext()
- {
- return AccessController.getContext();
- }
-
- /**
- * Check if the current thread is allowed to perform an operation that
- * requires the specified <code>Permission</code>. This defaults to
- * <code>AccessController.checkPermission</code>.
- *
- * @param perm the <code>Permission</code> required
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if perm is null
- * @since 1.2
- */
- public void checkPermission(Permission perm)
- {
- AccessController.checkPermission(perm);
- }
-
- /**
- * Check if the current thread is allowed to perform an operation that
- * requires the specified <code>Permission</code>. This is done in a
- * context previously returned by <code>getSecurityContext()</code>. The
- * default implementation expects context to be an AccessControlContext,
- * and it calls <code>AccessControlContext.checkPermission(perm)</code>.
- *
- * @param perm the <code>Permission</code> required
- * @param context a security context
- * @throws SecurityException if permission is denied, or if context is
- * not an AccessControlContext
- * @throws NullPointerException if perm is null
- * @see #getSecurityContext()
- * @see AccessControlContext#checkPermission(Permission)
- * @since 1.2
- */
- public void checkPermission(Permission perm, Object context)
- {
- if (! (context instanceof AccessControlContext))
- throw new SecurityException("Missing context");
- ((AccessControlContext) context).checkPermission(perm);
- }
-
- /**
- * Check if the current thread is allowed to create a ClassLoader. This
- * method is called from ClassLoader.ClassLoader(), and checks
- * <code>RuntimePermission("createClassLoader")</code>. If you override
- * this, you should call <code>super.checkCreateClassLoader()</code> rather
- * than throwing an exception.
- *
- * @throws SecurityException if permission is denied
- * @see ClassLoader#ClassLoader()
- */
- public void checkCreateClassLoader()
- {
- checkPermission(new RuntimePermission("createClassLoader"));
- }
-
- /**
- * Check if the current thread is allowed to modify another Thread. This is
- * called by Thread.stop(), suspend(), resume(), interrupt(), destroy(),
- * setPriority(), setName(), and setDaemon(). The default implementation
- * checks <code>RuntimePermission("modifyThread")</code> on system threads
- * (ie. threads in ThreadGroup with a null parent), and returns silently on
- * other threads.
- *
- * <p>If you override this, you must do two things. First, call
- * <code>super.checkAccess(t)</code>, to make sure you are not relaxing
- * requirements. Second, if the calling thread has
- * <code>RuntimePermission("modifyThread")</code>, return silently, so that
- * core classes (the Classpath library!) can modify any thread.
- *
- * @param thread the other Thread to check
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if thread is null
- * @see Thread#stop()
- * @see Thread#suspend()
- * @see Thread#resume()
- * @see Thread#setPriority(int)
- * @see Thread#setName(String)
- * @see Thread#setDaemon(boolean)
- */
- public void checkAccess(Thread thread)
- {
- if (thread.getThreadGroup() != null
- && thread.getThreadGroup().getParent() == null)
- checkPermission(new RuntimePermission("modifyThread"));
- }
-
- /**
- * Check if the current thread is allowed to modify a ThreadGroup. This is
- * called by Thread.Thread() (to add a thread to the ThreadGroup),
- * ThreadGroup.ThreadGroup() (to add this ThreadGroup to a parent),
- * ThreadGroup.stop(), suspend(), resume(), interrupt(), destroy(),
- * setDaemon(), and setMaxPriority(). The default implementation
- * checks <code>RuntimePermission("modifyThread")</code> on the system group
- * (ie. the one with a null parent), and returns silently on other groups.
- *
- * <p>If you override this, you must do two things. First, call
- * <code>super.checkAccess(t)</code>, to make sure you are not relaxing
- * requirements. Second, if the calling thread has
- * <code>RuntimePermission("modifyThreadGroup")</code>, return silently,
- * so that core classes (the Classpath library!) can modify any thread.
- *
- * @param g the ThreadGroup to check
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if g is null
- * @see Thread#Thread()
- * @see ThreadGroup#ThreadGroup(String)
- * @see ThreadGroup#stop()
- * @see ThreadGroup#suspend()
- * @see ThreadGroup#resume()
- * @see ThreadGroup#interrupt()
- * @see ThreadGroup#setDaemon(boolean)
- * @see ThreadGroup#setMaxPriority(int)
- */
- public void checkAccess(ThreadGroup g)
- {
- if (g.getParent() == null)
- checkPermission(new RuntimePermission("modifyThreadGroup"));
- }
-
- /**
- * Check if the current thread is allowed to exit the JVM with the given
- * status. This method is called from Runtime.exit() and Runtime.halt().
- * The default implementation checks
- * <code>RuntimePermission("exitVM")</code>. If you override this, call
- * <code>super.checkExit</code> rather than throwing an exception.
- *
- * @param status the status to exit with
- * @throws SecurityException if permission is denied
- * @see Runtime#exit(int)
- * @see Runtime#halt(int)
- */
- public void checkExit(int status)
- {
- checkPermission(new RuntimePermission("exitVM"));
- }
-
- /**
- * Check if the current thread is allowed to execute the given program. This
- * method is called from Runtime.exec(). If the name is an absolute path,
- * the default implementation checks
- * <code>FilePermission(program, "execute")</code>, otherwise it checks
- * <code>FilePermission("&lt;&lt;ALL FILES&gt;&gt;", "execute")</code>. If
- * you override this, call <code>super.checkExec</code> rather than
- * throwing an exception.
- *
- * @param program the name of the program to exec
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if program is null
- * @see Runtime#exec(String[], String[], File)
- */
- public void checkExec(String program)
- {
- if (! program.equals(new File(program).getAbsolutePath()))
- program = "<<ALL FILES>>";
- checkPermission(new FilePermission(program, "execute"));
- }
-
- /**
- * Check if the current thread is allowed to link in the given native
- * library. This method is called from Runtime.load() (and hence, by
- * loadLibrary() as well). The default implementation checks
- * <code>RuntimePermission("loadLibrary." + filename)</code>. If you
- * override this, call <code>super.checkLink</code> rather than throwing
- * an exception.
- *
- * @param filename the full name of the library to load
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if filename is null
- * @see Runtime#load(String)
- */
- public void checkLink(String filename)
- {
- // Use the toString() hack to do the null check.
- checkPermission(new RuntimePermission("loadLibrary."
- + filename.toString()));
- }
-
- /**
- * Check if the current thread is allowed to read the given file using the
- * FileDescriptor. This method is called from
- * FileInputStream.FileInputStream(). The default implementation checks
- * <code>RuntimePermission("readFileDescriptor")</code>. If you override
- * this, call <code>super.checkRead</code> rather than throwing an
- * exception.
- *
- * @param desc the FileDescriptor representing the file to access
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if desc is null
- * @see FileInputStream#FileInputStream(FileDescriptor)
- */
- public void checkRead(FileDescriptor desc)
- {
- if (desc == null)
- throw new NullPointerException();
- checkPermission(new RuntimePermission("readFileDescriptor"));
- }
-
- /**
- * Check if the current thread is allowed to read the given file. This
- * method is called from FileInputStream.FileInputStream(),
- * RandomAccessFile.RandomAccessFile(), File.exists(), canRead(), isFile(),
- * isDirectory(), lastModified(), length() and list(). The default
- * implementation checks <code>FilePermission(filename, "read")</code>. If
- * you override this, call <code>super.checkRead</code> rather than
- * throwing an exception.
- *
- * @param filename the full name of the file to access
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if filename is null
- * @see File
- * @see FileInputStream#FileInputStream(String)
- * @see RandomAccessFile#RandomAccessFile(String, String)
- */
- public void checkRead(String filename)
- {
- checkPermission(new FilePermission(filename, "read"));
- }
-
- /**
- * Check if the current thread is allowed to read the given file. using the
- * given security context. The context must be a result of a previous call
- * to <code>getSecurityContext()</code>. The default implementation checks
- * <code>AccessControlContext.checkPermission(new FilePermission(filename,
- * "read"))</code>. If you override this, call <code>super.checkRead</code>
- * rather than throwing an exception.
- *
- * @param filename the full name of the file to access
- * @param context the context to determine access for
- * @throws SecurityException if permission is denied, or if context is
- * not an AccessControlContext
- * @throws NullPointerException if filename is null
- * @see #getSecurityContext()
- * @see AccessControlContext#checkPermission(Permission)
- */
- public void checkRead(String filename, Object context)
- {
- if (! (context instanceof AccessControlContext))
- throw new SecurityException("Missing context");
- AccessControlContext ac = (AccessControlContext) context;
- ac.checkPermission(new FilePermission(filename, "read"));
- }
-
- /**
- * Check if the current thread is allowed to write the given file using the
- * FileDescriptor. This method is called from
- * FileOutputStream.FileOutputStream(). The default implementation checks
- * <code>RuntimePermission("writeFileDescriptor")</code>. If you override
- * this, call <code>super.checkWrite</code> rather than throwing an
- * exception.
- *
- * @param desc the FileDescriptor representing the file to access
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if desc is null
- * @see FileOutputStream#FileOutputStream(FileDescriptor)
- */
- public void checkWrite(FileDescriptor desc)
- {
- if (desc == null)
- throw new NullPointerException();
- checkPermission(new RuntimePermission("writeFileDescriptor"));
- }
-
- /**
- * Check if the current thread is allowed to write the given file. This
- * method is called from FileOutputStream.FileOutputStream(),
- * RandomAccessFile.RandomAccessFile(), File.canWrite(), mkdir(), and
- * renameTo(). The default implementation checks
- * <code>FilePermission(filename, "write")</code>. If you override this,
- * call <code>super.checkWrite</code> rather than throwing an exception.
- *
- * @param filename the full name of the file to access
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if filename is null
- * @see File
- * @see File#canWrite()
- * @see File#mkdir()
- * @see File#renameTo(File)
- * @see FileOutputStream#FileOutputStream(String)
- * @see RandomAccessFile#RandomAccessFile(String, String)
- */
- public void checkWrite(String filename)
- {
- checkPermission(new FilePermission(filename, "write"));
- }
-
- /**
- * Check if the current thread is allowed to delete the given file. This
- * method is called from File.delete(). The default implementation checks
- * <code>FilePermission(filename, "delete")</code>. If you override this,
- * call <code>super.checkDelete</code> rather than throwing an exception.
- *
- * @param filename the full name of the file to delete
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if filename is null
- * @see File#delete()
- */
- public void checkDelete(String filename)
- {
- checkPermission(new FilePermission(filename, "delete"));
- }
-
- /**
- * Check if the current thread is allowed to connect to a given host on a
- * given port. This method is called from Socket.Socket(). A port number
- * of -1 indicates the caller is attempting to determine an IP address, so
- * the default implementation checks
- * <code>SocketPermission(host, "resolve")</code>. Otherwise, the default
- * implementation checks
- * <code>SocketPermission(host + ":" + port, "connect")</code>. If you
- * override this, call <code>super.checkConnect</code> rather than throwing
- * an exception.
- *
- * @param host the host to connect to
- * @param port the port to connect on
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if host is null
- * @see Socket#Socket()
- */
- public void checkConnect(String host, int port)
- {
- if (port == -1)
- checkPermission(new SocketPermission(host, "resolve"));
- else
- // Use the toString() hack to do the null check.
- checkPermission(new SocketPermission(host.toString() + ":" + port,
- "connect"));
- }
-
- /**
- * Check if the current thread is allowed to connect to a given host on a
- * given port, using the given security context. The context must be a
- * result of a previous call to <code>getSecurityContext</code>. A port
- * number of -1 indicates the caller is attempting to determine an IP
- * address, so the default implementation checks
- * <code>AccessControlContext.checkPermission(new SocketPermission(host,
- * "resolve"))</code>. Otherwise, the default implementation checks
- * <code>AccessControlContext.checkPermission(new SocketPermission(host
- * + ":" + port, "connect"))</code>. If you override this, call
- * <code>super.checkConnect</code> rather than throwing an exception.
- *
- * @param host the host to connect to
- * @param port the port to connect on
- * @param context the context to determine access for
- *
- * @throws SecurityException if permission is denied, or if context is
- * not an AccessControlContext
- * @throws NullPointerException if host is null
- *
- * @see #getSecurityContext()
- * @see AccessControlContext#checkPermission(Permission)
- */
- public void checkConnect(String host, int port, Object context)
- {
- if (! (context instanceof AccessControlContext))
- throw new SecurityException("Missing context");
- AccessControlContext ac = (AccessControlContext) context;
- if (port == -1)
- ac.checkPermission(new SocketPermission(host, "resolve"));
- else
- // Use the toString() hack to do the null check.
- ac.checkPermission(new SocketPermission(host.toString() + ":" + port,
- "connect"));
- }
-
- /**
- * Check if the current thread is allowed to listen to a specific port for
- * data. This method is called by ServerSocket.ServerSocket(). The default
- * implementation checks
- * <code>SocketPermission("localhost:" + (port == 0 ? "1024-" : "" + port),
- * "listen")</code>. If you override this, call
- * <code>super.checkListen</code> rather than throwing an exception.
- *
- * @param port the port to listen on
- * @throws SecurityException if permission is denied
- * @see ServerSocket#ServerSocket(int)
- */
- public void checkListen(int port)
- {
- checkPermission(new SocketPermission("localhost:"
- + (port == 0 ? "1024-" : "" +port),
- "listen"));
- }
-
- /**
- * Check if the current thread is allowed to accept a connection from a
- * particular host on a particular port. This method is called by
- * ServerSocket.implAccept(). The default implementation checks
- * <code>SocketPermission(host + ":" + port, "accept")</code>. If you
- * override this, call <code>super.checkAccept</code> rather than throwing
- * an exception.
- *
- * @param host the host which wishes to connect
- * @param port the port the connection will be on
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if host is null
- * @see ServerSocket#accept()
- */
- public void checkAccept(String host, int port)
- {
- // Use the toString() hack to do the null check.
- checkPermission(new SocketPermission(host.toString() + ":" + port,
- "accept"));
- }
-
- /**
- * Check if the current thread is allowed to read and write multicast to
- * a particular address. The default implementation checks
- * <code>SocketPermission(addr.getHostAddress(), "accept,connect")</code>.
- * If you override this, call <code>super.checkMulticast</code> rather than
- * throwing an exception.
- *
- * @param addr the address to multicast to
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if host is null
- * @since 1.1
- */
- public void checkMulticast(InetAddress addr)
- {
- checkPermission(new SocketPermission(addr.getHostAddress(),
- "accept,connect"));
- }
-
- /**
- *Check if the current thread is allowed to read and write multicast to
- * a particular address with a particular ttl (time-to-live) value. The
- * default implementation ignores ttl, and checks
- * <code>SocketPermission(addr.getHostAddress(), "accept,connect")</code>.
- * If you override this, call <code>super.checkMulticast</code> rather than
- * throwing an exception.
- *
- * @param addr the address to multicast to
- * @param ttl value in use for multicast send
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if host is null
- * @since 1.1
- * @deprecated use {@link #checkPermission(Permission)} instead
- */
- public void checkMulticast(InetAddress addr, byte ttl)
- {
- checkPermission(new SocketPermission(addr.getHostAddress(),
- "accept,connect"));
- }
-
- /**
- * Check if the current thread is allowed to read or write all the system
- * properties at once. This method is called by System.getProperties()
- * and setProperties(). The default implementation checks
- * <code>PropertyPermission("*", "read,write")</code>. If you override
- * this, call <code>super.checkPropertiesAccess</code> rather than
- * throwing an exception.
- *
- * @throws SecurityException if permission is denied
- * @see System#getProperties()
- * @see System#setProperties(Properties)
- */
- public void checkPropertiesAccess()
- {
- checkPermission(new PropertyPermission("*", "read,write"));
- }
-
- /**
- * Check if the current thread is allowed to read a particular system
- * property (writes are checked directly via checkPermission). This method
- * is called by System.getProperty() and setProperty(). The default
- * implementation checks <code>PropertyPermission(key, "read")</code>. If
- * you override this, call <code>super.checkPropertyAccess</code> rather
- * than throwing an exception.
- *
- * @param key the key of the property to check
- *
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if key is null
- * @throws IllegalArgumentException if key is ""
- *
- * @see System#getProperty(String)
- */
- public void checkPropertyAccess(String key)
- {
- checkPermission(new PropertyPermission(key, "read"));
- }
-
- /**
- * Check if the current thread is allowed to create a top-level window. If
- * it is not, the operation should still go through, but some sort of
- * nonremovable warning should be placed on the window to show that it
- * is untrusted. This method is called by Window.Window(). The default
- * implementation checks
- * <code>AWTPermission("showWindowWithoutWarningBanner")</code>, and returns
- * true if no exception was thrown. If you override this, use
- * <code>return super.checkTopLevelWindow</code> rather than returning
- * false.
- *
- * @param window the window to create
- * @return true if there is permission to show the window without warning
- * @throws NullPointerException if window is null
- * @see java.awt.Window#Window(java.awt.Frame)
- */
- public boolean checkTopLevelWindow(Object window)
- {
- if (window == null)
- throw new NullPointerException();
- try
- {
- checkPermission(new AWTPermission("showWindowWithoutWarningBanner"));
- return true;
- }
- catch (SecurityException e)
- {
- return false;
- }
- }
-
- /**
- * Check if the current thread is allowed to create a print job. This
- * method is called by Toolkit.getPrintJob(). The default implementation
- * checks <code>RuntimePermission("queuePrintJob")</code>. If you override
- * this, call <code>super.checkPrintJobAccess</code> rather than throwing
- * an exception.
- *
- * @throws SecurityException if permission is denied
- * @see java.awt.Toolkit#getPrintJob(java.awt.Frame, String, Properties)
- * @since 1.1
- */
- public void checkPrintJobAccess()
- {
- checkPermission(new RuntimePermission("queuePrintJob"));
- }
-
- /**
- * Check if the current thread is allowed to use the system clipboard. This
- * method is called by Toolkit.getSystemClipboard(). The default
- * implementation checks <code>AWTPermission("accessClipboard")</code>. If
- * you override this, call <code>super.checkSystemClipboardAccess</code>
- * rather than throwing an exception.
- *
- * @throws SecurityException if permission is denied
- * @see java.awt.Toolkit#getSystemClipboard()
- * @since 1.1
- */
- public void checkSystemClipboardAccess()
- {
- checkPermission(new AWTPermission("accessClipboard"));
- }
-
- /**
- * Check if the current thread is allowed to use the AWT event queue. This
- * method is called by Toolkit.getSystemEventQueue(). The default
- * implementation checks <code>AWTPermission("accessEventQueue")</code>.
- * you override this, call <code>super.checkAwtEventQueueAccess</code>
- * rather than throwing an exception.
- *
- * @throws SecurityException if permission is denied
- * @see java.awt.Toolkit#getSystemEventQueue()
- * @since 1.1
- */
- public void checkAwtEventQueueAccess()
- {
- checkPermission(new AWTPermission("accessEventQueue"));
- }
-
- /**
- * Check if the current thread is allowed to access the specified package
- * at all. This method is called by ClassLoader.loadClass() in user-created
- * ClassLoaders. The default implementation gets a list of all restricted
- * packages, via <code>Security.getProperty("package.access")</code>. Then,
- * if packageName starts with or equals any restricted package, it checks
- * <code>RuntimePermission("accessClassInPackage." + packageName)</code>.
- * If you override this, you should call
- * <code>super.checkPackageAccess</code> before doing anything else.
- *
- * @param packageName the package name to check access to
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if packageName is null
- * @see ClassLoader#loadClass(String, boolean)
- * @see Security#getProperty(String)
- */
- public void checkPackageAccess(String packageName)
- {
- checkPackageList(packageName, "package.access", "accessClassInPackage.");
- }
-
- /**
- * Check if the current thread is allowed to define a class into the
- * specified package. This method is called by ClassLoader.loadClass() in
- * user-created ClassLoaders. The default implementation gets a list of all
- * restricted packages, via
- * <code>Security.getProperty("package.definition")</code>. Then, if
- * packageName starts with or equals any restricted package, it checks
- * <code>RuntimePermission("defineClassInPackage." + packageName)</code>.
- * If you override this, you should call
- * <code>super.checkPackageDefinition</code> before doing anything else.
- *
- * @param packageName the package name to check access to
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if packageName is null
- * @see ClassLoader#loadClass(String, boolean)
- * @see Security#getProperty(String)
- */
- public void checkPackageDefinition(String packageName)
- {
- checkPackageList(packageName, "package.definition", "defineClassInPackage.");
- }
-
- /**
- * Check if the current thread is allowed to set the current socket factory.
- * This method is called by Socket.setSocketImplFactory(),
- * ServerSocket.setSocketFactory(), and URL.setURLStreamHandlerFactory().
- * The default implementation checks
- * <code>RuntimePermission("setFactory")</code>. If you override this, call
- * <code>super.checkSetFactory</code> rather than throwing an exception.
- *
- * @throws SecurityException if permission is denied
- * @see Socket#setSocketImplFactory(SocketImplFactory)
- * @see ServerSocket#setSocketFactory(SocketImplFactory)
- * @see URL#setURLStreamHandlerFactory(URLStreamHandlerFactory)
- */
- public void checkSetFactory()
- {
- checkPermission(new RuntimePermission("setFactory"));
- }
-
- /**
- * Check if the current thread is allowed to get certain types of Methods,
- * Fields and Constructors from a Class object. This method is called by
- * Class.getMethod[s](), Class.getField[s](), Class.getConstructor[s],
- * Class.getDeclaredMethod[s](), Class.getDeclaredField[s](), and
- * Class.getDeclaredConstructor[s](). The default implementation allows
- * PUBLIC access, and access to classes defined by the same classloader as
- * the code performing the reflection. Otherwise, it checks
- * <code>RuntimePermission("accessDeclaredMembers")</code>. If you override
- * this, do not call <code>super.checkMemberAccess</code>, as this would
- * mess up the stack depth check that determines the ClassLoader requesting
- * the access.
- *
- * @param c the Class to check
- * @param memberType either DECLARED or PUBLIC
- * @throws SecurityException if permission is denied, including when
- * memberType is not DECLARED or PUBLIC
- * @throws NullPointerException if c is null
- * @see Class
- * @see Member#DECLARED
- * @see Member#PUBLIC
- * @since 1.1
- */
- public void checkMemberAccess(Class c, int memberType)
- {
- if (c == null)
- throw new NullPointerException();
- if (memberType == Member.PUBLIC)
- return;
- // XXX Allow access to classes created by same classloader before next
- // check.
- checkPermission(new RuntimePermission("accessDeclaredMembers"));
- }
-
- /**
- * Test whether a particular security action may be taken. The default
- * implementation checks <code>SecurityPermission(action)</code>. If you
- * override this, call <code>super.checkSecurityAccess</code> rather than
- * throwing an exception.
- *
- * @param action the desired action to take
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if action is null
- * @throws IllegalArgumentException if action is ""
- * @since 1.1
- */
- public void checkSecurityAccess(String action)
- {
- checkPermission(new SecurityPermission(action));
- }
-
- /**
- * Get the ThreadGroup that a new Thread should belong to by default. Called
- * by Thread.Thread(). The default implementation returns the current
- * ThreadGroup of the current Thread. <STRONG>Spec Note:</STRONG> it is not
- * clear whether the new Thread is guaranteed to pass the
- * checkAccessThreadGroup() test when using this ThreadGroup, but I presume
- * so.
- *
- * @return the ThreadGroup to put the new Thread into
- * @since 1.1
- */
- public ThreadGroup getThreadGroup()
- {
- return Thread.currentThread().getThreadGroup();
- }
-
- /**
- * Helper that checks a comma-separated list of restricted packages, from
- * <code>Security.getProperty("package.definition")</code>, for the given
- * package access permission. If packageName starts with or equals any
- * restricted package, it checks
- * <code>RuntimePermission(permission + packageName)</code>.
- *
- * @param packageName the package name to check access to
- * @param restriction "package.access" or "package.definition"
- * @param permission the base permission, including the '.'
- * @throws SecurityException if permission is denied
- * @throws NullPointerException if packageName is null
- * @see #checkPackageAccess(String)
- * @see #checkPackageDefinition(String)
- */
- void checkPackageList(String packageName, final String restriction,
- String permission)
- {
- if (packageName == null)
- throw new NullPointerException();
-
- String list = (String)AccessController.doPrivileged(new PrivilegedAction()
- {
- public Object run()
- {
- return Security.getProperty(restriction);
- }
- });
-
- if (list == null || list.equals(""))
- return;
-
- String packageNamePlusDot = packageName + ".";
-
- StringTokenizer st = new StringTokenizer(list, ",");
- while (st.hasMoreTokens())
- {
- if (packageNamePlusDot.startsWith(st.nextToken()))
- {
- Permission p = new RuntimePermission(permission + packageName);
- checkPermission(p);
- return;
- }
- }
- }
-}
diff --git a/libjava/java/lang/Short.h b/libjava/java/lang/Short.h
new file mode 100644
index 00000000000..42671174cfc
--- /dev/null
+++ b/libjava/java/lang/Short.h
@@ -0,0 +1,54 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Short__
+#define __java_lang_Short__
+
+#pragma interface
+
+#include <java/lang/Number.h>
+#include <gcj/array.h>
+
+
+class java::lang::Short : public ::java::lang::Number
+{
+
+public:
+ Short(jshort);
+ Short(::java::lang::String *);
+ static ::java::lang::String * toString(jshort);
+ static jshort parseShort(::java::lang::String *);
+ static jshort parseShort(::java::lang::String *, jint);
+ static ::java::lang::Short * valueOf(::java::lang::String *, jint);
+ static ::java::lang::Short * valueOf(::java::lang::String *);
+ static ::java::lang::Short * valueOf(jshort);
+ static ::java::lang::Short * decode(::java::lang::String *);
+ jbyte byteValue();
+ jshort shortValue();
+ jint intValue();
+ jlong longValue();
+ jfloat floatValue();
+ jdouble doubleValue();
+ ::java::lang::String * toString();
+ jint hashCode();
+ jboolean equals(::java::lang::Object *);
+ jint target$compareTo(::java::lang::Short *);
+ static jshort reverseBytes(jshort);
+ jint compareTo(::java::lang::Object *);
+private:
+ static const jlong serialVersionUID = 7515723908773894738LL;
+public:
+ static const jshort MIN_VALUE = -32768;
+ static const jshort MAX_VALUE = 32767;
+ static ::java::lang::Class * TYPE;
+ static const jint SIZE = 16;
+private:
+ static const jint MIN_CACHE = -128;
+ static const jint MAX_CACHE = 127;
+ static JArray< ::java::lang::Short * > * shortCache;
+ jshort __attribute__((aligned(__alignof__( ::java::lang::Number)))) value;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Short__
diff --git a/libjava/java/lang/StackOverflowError.h b/libjava/java/lang/StackOverflowError.h
new file mode 100644
index 00000000000..6d1e06f6594
--- /dev/null
+++ b/libjava/java/lang/StackOverflowError.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_StackOverflowError__
+#define __java_lang_StackOverflowError__
+
+#pragma interface
+
+#include <java/lang/VirtualMachineError.h>
+
+class java::lang::StackOverflowError : public ::java::lang::VirtualMachineError
+{
+
+public:
+ StackOverflowError();
+ StackOverflowError(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 8609175038441759607LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_StackOverflowError__
diff --git a/libjava/java/lang/StackTraceElement.h b/libjava/java/lang/StackTraceElement.h
new file mode 100644
index 00000000000..7adf3dc31f5
--- /dev/null
+++ b/libjava/java/lang/StackTraceElement.h
@@ -0,0 +1,39 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_StackTraceElement__
+#define __java_lang_StackTraceElement__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::StackTraceElement : public ::java::lang::Object
+{
+
+public: // actually package-private
+ StackTraceElement(::java::lang::String *, jint, ::java::lang::String *, ::java::lang::String *, jboolean);
+public:
+ StackTraceElement(::java::lang::String *, ::java::lang::String *, ::java::lang::String *, jint);
+ ::java::lang::String * getFileName();
+ jint getLineNumber();
+ ::java::lang::String * getClassName();
+ ::java::lang::String * getMethodName();
+ jboolean isNativeMethod();
+ ::java::lang::String * toString();
+ jboolean equals(::java::lang::Object *);
+ jint hashCode();
+private:
+ static jboolean equals(::java::lang::Object *, ::java::lang::Object *);
+ static jint hashCode(::java::lang::Object *);
+ static const jlong serialVersionUID = 6992337162326171013LL;
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) fileName;
+ jint lineNumber;
+ ::java::lang::String * declaringClass;
+ ::java::lang::String * methodName;
+ jboolean isNative;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_StackTraceElement__
diff --git a/libjava/java/lang/StrictMath.h b/libjava/java/lang/StrictMath.h
new file mode 100644
index 00000000000..d37d5d66848
--- /dev/null
+++ b/libjava/java/lang/StrictMath.h
@@ -0,0 +1,203 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_StrictMath__
+#define __java_lang_StrictMath__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::StrictMath : public ::java::lang::Object
+{
+
+ StrictMath();
+public:
+ static jint abs(jint);
+ static jlong abs(jlong);
+ static jfloat abs(jfloat);
+ static jdouble abs(jdouble);
+ static jint min(jint, jint);
+ static jlong min(jlong, jlong);
+ static jfloat min(jfloat, jfloat);
+ static jdouble min(jdouble, jdouble);
+ static jint max(jint, jint);
+ static jlong max(jlong, jlong);
+ static jfloat max(jfloat, jfloat);
+ static jdouble max(jdouble, jdouble);
+ static jdouble sin(jdouble);
+ static jdouble cos(jdouble);
+ static jdouble tan(jdouble);
+ static jdouble asin(jdouble);
+ static jdouble acos(jdouble);
+ static jdouble atan(jdouble);
+ static jdouble atan2(jdouble, jdouble);
+ static jdouble sinh(jdouble);
+ static jdouble cosh(jdouble);
+ static jdouble tanh(jdouble);
+private:
+ static jlong getLowDWord(jlong);
+ static jlong getHighDWord(jlong);
+ static jdouble buildDouble(jlong, jlong);
+public:
+ static jdouble cbrt(jdouble);
+ static jdouble exp(jdouble);
+ static jdouble expm1(jdouble);
+ static jdouble log(jdouble);
+ static jdouble sqrt(jdouble);
+ static jdouble pow(jdouble, jdouble);
+ static jdouble IEEEremainder(jdouble, jdouble);
+ static jdouble ceil(jdouble);
+ static jdouble floor(jdouble);
+ static jdouble rint(jdouble);
+ static jint round(jfloat);
+ static jlong round(jdouble);
+ static jdouble random();
+ static jdouble toRadians(jdouble);
+ static jdouble toDegrees(jdouble);
+private:
+ static jint remPiOver2(jdouble, JArray< jdouble > *);
+ static jint remPiOver2(JArray< jdouble > *, JArray< jdouble > *, jint, jint);
+ static jdouble scale(jdouble, jint);
+ static jdouble sin(jdouble, jdouble);
+ static jdouble cos(jdouble, jdouble);
+ static jdouble tan(jdouble, jdouble, jboolean);
+public:
+ static jdouble signum(jdouble);
+ static jfloat signum(jfloat);
+ static jdouble ulp(jdouble);
+ static jfloat ulp(jfloat);
+private:
+ static ::java::util::Random * rand;
+public:
+ static jdouble E;
+ static jdouble PI;
+private:
+ static jdouble TWO_16;
+ static jdouble TWO_20;
+ static jdouble TWO_24;
+ static jdouble TWO_27;
+ static jdouble TWO_28;
+ static jdouble TWO_29;
+ static jdouble TWO_31;
+ static jdouble TWO_49;
+ static jdouble TWO_52;
+ static jdouble TWO_54;
+ static jdouble TWO_57;
+ static jdouble TWO_60;
+ static jdouble TWO_64;
+ static jdouble TWO_66;
+ static jdouble TWO_1023;
+ static JArray< jint > * TWO_OVER_PI;
+ static JArray< jdouble > * PI_OVER_TWO;
+ static jdouble PI_L;
+ static jdouble PIO2_1;
+ static jdouble PIO2_1L;
+ static jdouble PIO2_2;
+ static jdouble PIO2_2L;
+ static jdouble PIO2_3;
+ static jdouble PIO2_3L;
+ static jdouble SQRT_1_5;
+ static jdouble SQRT_2;
+ static jdouble SQRT_3;
+ static jdouble EXP_LIMIT_H;
+ static jdouble EXP_LIMIT_L;
+ static jdouble CP;
+ static jdouble CP_H;
+ static jdouble CP_L;
+ static jdouble LN2;
+ static jdouble LN2_H;
+ static jdouble LN2_L;
+ static jdouble INV_LN2;
+ static jdouble INV_LN2_H;
+ static jdouble INV_LN2_L;
+ static jdouble LG1;
+ static jdouble LG2;
+ static jdouble LG3;
+ static jdouble LG4;
+ static jdouble LG5;
+ static jdouble LG6;
+ static jdouble LG7;
+ static jdouble L1;
+ static jdouble L2;
+ static jdouble L3;
+ static jdouble L4;
+ static jdouble L5;
+ static jdouble L6;
+ static jdouble P1;
+ static jdouble P2;
+ static jdouble P3;
+ static jdouble P4;
+ static jdouble P5;
+ static jdouble DP_H;
+ static jdouble DP_L;
+ static jdouble OVT;
+ static jdouble S1;
+ static jdouble S2;
+ static jdouble S3;
+ static jdouble S4;
+ static jdouble S5;
+ static jdouble S6;
+ static jdouble C1;
+ static jdouble C2;
+ static jdouble C3;
+ static jdouble C4;
+ static jdouble C5;
+ static jdouble C6;
+ static jdouble T0;
+ static jdouble T1;
+ static jdouble T2;
+ static jdouble T3;
+ static jdouble T4;
+ static jdouble T5;
+ static jdouble T6;
+ static jdouble T7;
+ static jdouble T8;
+ static jdouble T9;
+ static jdouble T10;
+ static jdouble T11;
+ static jdouble T12;
+ static jdouble PS0;
+ static jdouble PS1;
+ static jdouble PS2;
+ static jdouble PS3;
+ static jdouble PS4;
+ static jdouble PS5;
+ static jdouble QS1;
+ static jdouble QS2;
+ static jdouble QS3;
+ static jdouble QS4;
+ static jdouble ATAN_0_5H;
+ static jdouble ATAN_0_5L;
+ static jdouble ATAN_1_5H;
+ static jdouble ATAN_1_5L;
+ static jdouble AT0;
+ static jdouble AT1;
+ static jdouble AT2;
+ static jdouble AT3;
+ static jdouble AT4;
+ static jdouble AT5;
+ static jdouble AT6;
+ static jdouble AT7;
+ static jdouble AT8;
+ static jdouble AT9;
+ static jdouble AT10;
+ static const jint CBRT_B1 = 715094163;
+ static const jint CBRT_B2 = 696219795;
+ static jdouble CBRT_C;
+ static jdouble CBRT_D;
+ static jdouble CBRT_E;
+ static jdouble CBRT_F;
+ static jdouble CBRT_G;
+ static jdouble EXPM1_Q1;
+ static jdouble EXPM1_Q2;
+ static jdouble EXPM1_Q3;
+ static jdouble EXPM1_Q4;
+ static jdouble EXPM1_Q5;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_StrictMath__
diff --git a/libjava/java/lang/String$CaseInsensitiveComparator.h b/libjava/java/lang/String$CaseInsensitiveComparator.h
new file mode 100644
index 00000000000..11c0ea557b7
--- /dev/null
+++ b/libjava/java/lang/String$CaseInsensitiveComparator.h
@@ -0,0 +1,24 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_String$CaseInsensitiveComparator__
+#define __java_lang_String$CaseInsensitiveComparator__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::String$CaseInsensitiveComparator : public ::java::lang::Object
+{
+
+public: // actually package-private
+ String$CaseInsensitiveComparator();
+public:
+ jint compare(::java::lang::Object *, ::java::lang::Object *);
+private:
+ static const jlong serialVersionUID = 8575799808933029326LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_String$CaseInsensitiveComparator__
diff --git a/libjava/java/lang/String.h b/libjava/java/lang/String.h
new file mode 100644
index 00000000000..44be2741c30
--- /dev/null
+++ b/libjava/java/lang/String.h
@@ -0,0 +1,138 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_String__
+#define __java_lang_String__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace gnu
+ {
+ namespace gcj
+ {
+ namespace runtime
+ {
+ class StringBuffer;
+ }
+ }
+ }
+}
+
+jchar* _Jv_GetStringChars (jstring str);
+jstring* _Jv_StringFindSlot (jchar*, jint, jint);
+jstring* _Jv_StringGetSlot (jstring);
+jstring _Jv_NewStringUtf8Const (_Jv_Utf8Const* str);
+jstring _Jv_NewStringLatin1 (const char*, jsize);
+jstring _Jv_AllocString (jsize);
+
+class java::lang::String : public ::java::lang::Object
+{
+
+public:
+ String();
+ String(::java::lang::String *);
+ String(JArray< jchar > *);
+ String(JArray< jchar > *, jint, jint);
+ String(JArray< jbyte > *, jint, jint, jint);
+ String(JArray< jbyte > *, jint);
+ String(JArray< jbyte > *, jint, jint, ::java::lang::String *);
+ String(JArray< jbyte > *, ::java::lang::String *);
+ String(JArray< jbyte > *, jint, jint);
+ String(JArray< jbyte > *);
+ String(::java::lang::StringBuffer *);
+ String(::java::lang::StringBuilder *);
+public: // actually package-private
+ String(JArray< jchar > *, jint, jint, jboolean);
+ String(::gnu::gcj::runtime::StringBuffer *);
+public:
+ jint length();
+ jchar charAt(jint);
+ jint codePointAt(jint);
+ jint codePointBefore(jint);
+ void getChars(jint, jint, JArray< jchar > *, jint);
+ void getBytes(jint, jint, JArray< jbyte > *, jint);
+ JArray< jbyte > * getBytes(::java::lang::String *);
+ JArray< jbyte > * getBytes();
+ jboolean equals(::java::lang::Object *);
+ jboolean contentEquals(::java::lang::StringBuffer *);
+ jboolean contentEquals(::java::lang::CharSequence *);
+ jboolean equalsIgnoreCase(::java::lang::String *);
+ jint compareTo(::java::lang::String *);
+ jint compareTo(::java::lang::Object *);
+ jint compareToIgnoreCase(::java::lang::String *);
+ jboolean regionMatches(jint, ::java::lang::String *, jint, jint);
+ jboolean regionMatches(jboolean, jint, ::java::lang::String *, jint, jint);
+ jboolean startsWith(::java::lang::String *, jint);
+ jboolean startsWith(::java::lang::String *);
+ jboolean endsWith(::java::lang::String *);
+ jint hashCode();
+ jint indexOf(jint);
+ jint indexOf(jint, jint);
+ jint lastIndexOf(jint);
+ jint lastIndexOf(jint, jint);
+ jint indexOf(::java::lang::String *);
+ jint indexOf(::java::lang::String *, jint);
+ jint lastIndexOf(::java::lang::String *);
+ jint lastIndexOf(::java::lang::String *, jint);
+ ::java::lang::String * substring(jint);
+ ::java::lang::String * substring(jint, jint);
+ ::java::lang::CharSequence * subSequence(jint, jint);
+ ::java::lang::String * concat(::java::lang::String *);
+ ::java::lang::String * replace(jchar, jchar);
+ jboolean matches(::java::lang::String *);
+ ::java::lang::String * replaceFirst(::java::lang::String *, ::java::lang::String *);
+ ::java::lang::String * replaceAll(::java::lang::String *, ::java::lang::String *);
+ JArray< ::java::lang::String * > * split(::java::lang::String *, jint);
+ JArray< ::java::lang::String * > * split(::java::lang::String *);
+ ::java::lang::String * toLowerCase(::java::util::Locale *);
+ ::java::lang::String * toLowerCase();
+ ::java::lang::String * toUpperCase(::java::util::Locale *);
+ ::java::lang::String * toUpperCase();
+ ::java::lang::String * trim();
+ ::java::lang::String * toString();
+ JArray< jchar > * toCharArray();
+ static ::java::lang::String * valueOf(::java::lang::Object *);
+ static ::java::lang::String * valueOf(JArray< jchar > *);
+ static ::java::lang::String * valueOf(JArray< jchar > *, jint, jint);
+ static ::java::lang::String * copyValueOf(JArray< jchar > *, jint, jint);
+ static ::java::lang::String * copyValueOf(JArray< jchar > *);
+ static ::java::lang::String * valueOf(jboolean);
+ static ::java::lang::String * valueOf(jchar);
+ static ::java::lang::String * valueOf(jint);
+ static ::java::lang::String * valueOf(jlong);
+ static ::java::lang::String * valueOf(jfloat);
+ static ::java::lang::String * valueOf(jdouble);
+ ::java::lang::String * intern();
+ jint codePointCount(jint, jint);
+ jboolean contains(::java::lang::CharSequence *);
+ ::java::lang::String * replace(::java::lang::CharSequence *, ::java::lang::CharSequence *);
+private:
+ void init(JArray< jchar > *, jint, jint, jboolean);
+ void init(JArray< jbyte > *, jint, jint, jint);
+ void init(JArray< jbyte > *, jint, jint, ::java::lang::String *);
+ void init(::gnu::gcj::runtime::StringBuffer *);
+ static const jlong serialVersionUID = -6849794470754667710LL;
+ ::java::lang::Object * __attribute__((aligned(__alignof__( ::java::lang::Object)))) data;
+ jint boffset;
+public: // actually package-private
+ jint count;
+private:
+ jint cachedHashCode;
+public:
+ static ::java::util::Comparator * CASE_INSENSITIVE_ORDER;
+ static ::java::lang::Class class$;
+
+ friend jchar* ::_Jv_GetStringChars (jstring str);
+ friend jstring* ::_Jv_StringFindSlot (jchar*, jint, jint);
+ friend jstring* ::_Jv_StringGetSlot (jstring);
+ friend jstring (::_Jv_NewStringUtf8Const) (_Jv_Utf8Const* str);
+ friend jstring (::_Jv_NewStringLatin1) (const char*, jsize);
+ friend jstring (::_Jv_AllocString) (jsize);
+};
+
+#endif // __java_lang_String__
diff --git a/libjava/java/lang/StringBuffer.h b/libjava/java/lang/StringBuffer.h
new file mode 100644
index 00000000000..93951f471f6
--- /dev/null
+++ b/libjava/java/lang/StringBuffer.h
@@ -0,0 +1,85 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_StringBuffer__
+#define __java_lang_StringBuffer__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::StringBuffer : public ::java::lang::Object
+{
+
+public:
+ StringBuffer();
+ StringBuffer(jint);
+ StringBuffer(::java::lang::String *);
+ StringBuffer(::java::lang::CharSequence *);
+ jint length();
+ jint capacity();
+ void ensureCapacity(jint);
+ void setLength(jint);
+ jchar charAt(jint);
+ jint codePointAt(jint);
+ jint codePointBefore(jint);
+ void getChars(jint, jint, JArray< jchar > *, jint);
+ void setCharAt(jint, jchar);
+ ::java::lang::StringBuffer * append(::java::lang::Object *);
+ ::java::lang::StringBuffer * append(::java::lang::String *);
+ ::java::lang::StringBuffer * append(::java::lang::StringBuffer *);
+ ::java::lang::StringBuffer * append(::java::lang::CharSequence *);
+ ::java::lang::StringBuffer * append(::java::lang::CharSequence *, jint, jint);
+ ::java::lang::StringBuffer * append(JArray< jchar > *);
+ ::java::lang::StringBuffer * append(JArray< jchar > *, jint, jint);
+ ::java::lang::StringBuffer * append(jboolean);
+ ::java::lang::StringBuffer * append(jchar);
+ ::java::lang::StringBuffer * appendCodePoint(jint);
+ ::java::lang::StringBuffer * append(jint);
+ ::java::lang::StringBuffer * append(jlong);
+ ::java::lang::StringBuffer * append(jfloat);
+ ::java::lang::StringBuffer * append(jdouble);
+ ::java::lang::StringBuffer * delete$(jint, jint);
+ ::java::lang::StringBuffer * deleteCharAt(jint);
+ ::java::lang::StringBuffer * replace(jint, jint, ::java::lang::String *);
+ ::java::lang::String * substring(jint);
+ ::java::lang::CharSequence * subSequence(jint, jint);
+ ::java::lang::String * substring(jint, jint);
+ ::java::lang::StringBuffer * insert(jint, JArray< jchar > *, jint, jint);
+ ::java::lang::StringBuffer * insert(jint, ::java::lang::Object *);
+ ::java::lang::StringBuffer * insert(jint, ::java::lang::String *);
+ ::java::lang::StringBuffer * insert(jint, ::java::lang::CharSequence *);
+ ::java::lang::StringBuffer * insert(jint, ::java::lang::CharSequence *, jint, jint);
+ ::java::lang::StringBuffer * insert(jint, JArray< jchar > *);
+ ::java::lang::StringBuffer * insert(jint, jboolean);
+ ::java::lang::StringBuffer * insert(jint, jchar);
+ ::java::lang::StringBuffer * insert(jint, jint);
+ ::java::lang::StringBuffer * insert(jint, jlong);
+ ::java::lang::StringBuffer * insert(jint, jfloat);
+ ::java::lang::StringBuffer * insert(jint, jdouble);
+ jint indexOf(::java::lang::String *);
+ jint indexOf(::java::lang::String *, jint);
+ jint lastIndexOf(::java::lang::String *);
+ jint lastIndexOf(::java::lang::String *, jint);
+ ::java::lang::StringBuffer * reverse();
+ ::java::lang::String * toString();
+ void trimToSize();
+ jint codePointCount(jint, jint);
+ jint offsetByCodePoints(jint, jint);
+private:
+ void ensureCapacity_unsynchronized(jint);
+ jboolean regionMatches(jint, ::java::lang::String *);
+ static const jlong serialVersionUID = 3388685877147921107LL;
+public: // actually package-private
+ jint __attribute__((aligned(__alignof__( ::java::lang::Object)))) count;
+ JArray< jchar > * value;
+ jboolean shared;
+private:
+ static const jint DEFAULT_CAPACITY = 16;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_StringBuffer__
diff --git a/libjava/java/lang/StringBuilder.h b/libjava/java/lang/StringBuilder.h
new file mode 100644
index 00000000000..d4912bf0cb4
--- /dev/null
+++ b/libjava/java/lang/StringBuilder.h
@@ -0,0 +1,83 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_StringBuilder__
+#define __java_lang_StringBuilder__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::StringBuilder : public ::java::lang::Object
+{
+
+public:
+ StringBuilder();
+ StringBuilder(jint);
+ StringBuilder(::java::lang::String *);
+ StringBuilder(::java::lang::CharSequence *);
+ jint length();
+ jint capacity();
+ void ensureCapacity(jint);
+ void setLength(jint);
+ jchar charAt(jint);
+ void getChars(jint, jint, JArray< jchar > *, jint);
+ void setCharAt(jint, jchar);
+ ::java::lang::StringBuilder * append(::java::lang::Object *);
+ ::java::lang::StringBuilder * append(::java::lang::String *);
+ ::java::lang::StringBuilder * append(::java::lang::StringBuffer *);
+ ::java::lang::StringBuilder * append(JArray< jchar > *);
+ ::java::lang::StringBuilder * append(JArray< jchar > *, jint, jint);
+ ::java::lang::StringBuilder * append(jboolean);
+ ::java::lang::StringBuilder * target$append(jchar);
+ ::java::lang::StringBuilder * target$append(::java::lang::CharSequence *);
+ ::java::lang::StringBuilder * target$append(::java::lang::CharSequence *, jint, jint);
+ ::java::lang::StringBuilder * appendCodePoint(jint);
+ ::java::lang::StringBuilder * append(jint);
+ ::java::lang::StringBuilder * append(jlong);
+ ::java::lang::StringBuilder * append(jfloat);
+ ::java::lang::StringBuilder * append(jdouble);
+ ::java::lang::StringBuilder * delete$(jint, jint);
+ ::java::lang::StringBuilder * deleteCharAt(jint);
+ ::java::lang::StringBuilder * replace(jint, jint, ::java::lang::String *);
+ ::java::lang::String * substring(jint);
+ ::java::lang::CharSequence * subSequence(jint, jint);
+ ::java::lang::String * substring(jint, jint);
+ ::java::lang::StringBuilder * insert(jint, JArray< jchar > *, jint, jint);
+ ::java::lang::StringBuilder * insert(jint, ::java::lang::Object *);
+ ::java::lang::StringBuilder * insert(jint, ::java::lang::String *);
+ ::java::lang::StringBuilder * insert(jint, ::java::lang::CharSequence *);
+ ::java::lang::StringBuilder * insert(jint, ::java::lang::CharSequence *, jint, jint);
+ ::java::lang::StringBuilder * insert(jint, JArray< jchar > *);
+ ::java::lang::StringBuilder * insert(jint, jboolean);
+ ::java::lang::StringBuilder * insert(jint, jchar);
+ ::java::lang::StringBuilder * insert(jint, jint);
+ ::java::lang::StringBuilder * insert(jint, jlong);
+ ::java::lang::StringBuilder * insert(jint, jfloat);
+ ::java::lang::StringBuilder * insert(jint, jdouble);
+ jint indexOf(::java::lang::String *);
+ jint indexOf(::java::lang::String *, jint);
+ jint lastIndexOf(::java::lang::String *);
+ jint lastIndexOf(::java::lang::String *, jint);
+ ::java::lang::StringBuilder * reverse();
+ ::java::lang::String * toString();
+private:
+ jboolean regionMatches(jint, ::java::lang::String *);
+public:
+ ::java::lang::Appendable * append(::java::lang::CharSequence *, jint, jint);
+ ::java::lang::Appendable * append(::java::lang::CharSequence *);
+ ::java::lang::Appendable * append(jchar);
+private:
+ static const jlong serialVersionUID = 4383685877147921099LL;
+public: // actually package-private
+ jint __attribute__((aligned(__alignof__( ::java::lang::Object)))) count;
+ JArray< jchar > * value;
+private:
+ static const jint DEFAULT_CAPACITY = 16;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_StringBuilder__
diff --git a/libjava/java/lang/StringBuilder.java b/libjava/java/lang/StringBuilder.java
index 5990a6d8dd5..5f33b2ed53a 100644
--- a/libjava/java/lang/StringBuilder.java
+++ b/libjava/java/lang/StringBuilder.java
@@ -74,9 +74,8 @@ import java.io.Serializable;
*
* @since 1.5
*/
-// FIX15: Implement Appendable when co-variant methods are available
public final class StringBuilder
- implements Serializable, CharSequence
+ implements Serializable, CharSequence, Appendable
{
// Implementation note: if you change this class, you usually will
// want to change StringBuffer as well.
diff --git a/libjava/java/lang/StringIndexOutOfBoundsException.h b/libjava/java/lang/StringIndexOutOfBoundsException.h
new file mode 100644
index 00000000000..e3669a0d366
--- /dev/null
+++ b/libjava/java/lang/StringIndexOutOfBoundsException.h
@@ -0,0 +1,24 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_StringIndexOutOfBoundsException__
+#define __java_lang_StringIndexOutOfBoundsException__
+
+#pragma interface
+
+#include <java/lang/IndexOutOfBoundsException.h>
+
+class java::lang::StringIndexOutOfBoundsException : public ::java::lang::IndexOutOfBoundsException
+{
+
+public:
+ StringIndexOutOfBoundsException();
+ StringIndexOutOfBoundsException(::java::lang::String *);
+ StringIndexOutOfBoundsException(jint);
+private:
+ static const jlong serialVersionUID = -6762910422159637258LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_StringIndexOutOfBoundsException__
diff --git a/libjava/java/lang/SuppressWarnings.h b/libjava/java/lang/SuppressWarnings.h
new file mode 100644
index 00000000000..3f28104d9ad
--- /dev/null
+++ b/libjava/java/lang/SuppressWarnings.h
@@ -0,0 +1,22 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_SuppressWarnings__
+#define __java_lang_SuppressWarnings__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::SuppressWarnings : public ::java::lang::Object
+{
+
+public:
+ virtual JArray< ::java::lang::String * > * value() = 0;
+ virtual ::java::lang::Class * annotationType() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_SuppressWarnings__
diff --git a/libjava/java/lang/System$EnvironmentCollection.h b/libjava/java/lang/System$EnvironmentCollection.h
new file mode 100644
index 00000000000..8392e1782ba
--- /dev/null
+++ b/libjava/java/lang/System$EnvironmentCollection.h
@@ -0,0 +1,29 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_System$EnvironmentCollection__
+#define __java_lang_System$EnvironmentCollection__
+
+#pragma interface
+
+#include <java/util/AbstractCollection.h>
+
+class java::lang::System$EnvironmentCollection : public ::java::util::AbstractCollection
+{
+
+public:
+ System$EnvironmentCollection(::java::util::Collection *);
+ virtual jboolean contains(::java::lang::Object *);
+ virtual jboolean containsAll(::java::util::Collection *);
+ virtual ::java::util::Iterator * iterator();
+ virtual jboolean remove(::java::lang::Object *);
+ virtual jboolean removeAll(::java::util::Collection *);
+ virtual jboolean retainAll(::java::util::Collection *);
+ virtual jint size();
+public: // actually protected
+ ::java::util::Collection * __attribute__((aligned(__alignof__( ::java::util::AbstractCollection)))) c;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_System$EnvironmentCollection__
diff --git a/libjava/java/lang/System$EnvironmentMap.h b/libjava/java/lang/System$EnvironmentMap.h
new file mode 100644
index 00000000000..ee4582b43fb
--- /dev/null
+++ b/libjava/java/lang/System$EnvironmentMap.h
@@ -0,0 +1,34 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_System$EnvironmentMap__
+#define __java_lang_System$EnvironmentMap__
+
+#pragma interface
+
+#include <java/util/HashMap.h>
+
+class java::lang::System$EnvironmentMap : public ::java::util::HashMap
+{
+
+public: // actually package-private
+ System$EnvironmentMap();
+public:
+ virtual jboolean containsKey(::java::lang::Object *);
+ virtual jboolean containsValue(::java::lang::Object *);
+ virtual ::java::util::Set * entrySet();
+ virtual ::java::lang::String * target$get(::java::lang::Object *);
+ virtual ::java::util::Set * keySet();
+ virtual ::java::lang::String * target$remove(::java::lang::Object *);
+ virtual ::java::util::Collection * values();
+ virtual ::java::lang::Object * get(::java::lang::Object *);
+ virtual ::java::lang::Object * remove(::java::lang::Object *);
+private:
+ ::java::util::Set * __attribute__((aligned(__alignof__( ::java::util::HashMap)))) entries;
+ ::java::util::Set * keys;
+ ::java::util::Collection * values__;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_System$EnvironmentMap__
diff --git a/libjava/java/lang/System$EnvironmentSet.h b/libjava/java/lang/System$EnvironmentSet.h
new file mode 100644
index 00000000000..9a1e1a65dee
--- /dev/null
+++ b/libjava/java/lang/System$EnvironmentSet.h
@@ -0,0 +1,21 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_System$EnvironmentSet__
+#define __java_lang_System$EnvironmentSet__
+
+#pragma interface
+
+#include <java/lang/System$EnvironmentCollection.h>
+
+class java::lang::System$EnvironmentSet : public ::java::lang::System$EnvironmentCollection
+{
+
+public:
+ System$EnvironmentSet(::java::util::Set *);
+ virtual jboolean equals(::java::lang::Object *);
+ virtual jint hashCode();
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_System$EnvironmentSet__
diff --git a/libjava/java/lang/System.h b/libjava/java/lang/System.h
new file mode 100644
index 00000000000..5a759678328
--- /dev/null
+++ b/libjava/java/lang/System.h
@@ -0,0 +1,56 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_System__
+#define __java_lang_System__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::System : public ::java::lang::Object
+{
+
+ System();
+public:
+ static void setIn(::java::io::InputStream *);
+ static void setOut(::java::io::PrintStream *);
+ static void setErr(::java::io::PrintStream *);
+ static void setSecurityManager(::java::lang::SecurityManager *);
+ static ::java::lang::SecurityManager * getSecurityManager();
+ static jlong currentTimeMillis();
+ static jlong nanoTime();
+ static void arraycopy(::java::lang::Object *, jint, ::java::lang::Object *, jint, jint);
+ static jint identityHashCode(::java::lang::Object *);
+ static ::java::util::Properties * getProperties();
+ static void setProperties(::java::util::Properties *);
+ static ::java::lang::String * getProperty(::java::lang::String *);
+ static ::java::lang::String * getProperty(::java::lang::String *, ::java::lang::String *);
+ static ::java::lang::String * setProperty(::java::lang::String *, ::java::lang::String *);
+ static ::java::lang::String * clearProperty(::java::lang::String *);
+ static ::java::lang::String * getenv(::java::lang::String *);
+ static ::java::util::Map * getenv();
+ static void exit(jint);
+ static void gc();
+ static void runFinalization();
+ static void runFinalizersOnExit(jboolean);
+ static void load(::java::lang::String *);
+ static void loadLibrary(::java::lang::String *);
+ static ::java::lang::String * mapLibraryName(::java::lang::String *);
+private:
+ static void setIn0(::java::io::InputStream *);
+ static void setOut0(::java::io::PrintStream *);
+ static void setErr0(::java::io::PrintStream *);
+public: // actually package-private
+ static ::java::lang::String * getenv0(::java::lang::String *);
+public:
+ static ::java::io::InputStream * in;
+ static ::java::io::PrintStream * out;
+ static ::java::io::PrintStream * err;
+private:
+ static ::java::util::Map * environmentMap;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_System__
diff --git a/libjava/java/lang/System.java b/libjava/java/lang/System.java
index 6b125c90a2a..587e637e974 100644
--- a/libjava/java/lang/System.java
+++ b/libjava/java/lang/System.java
@@ -48,6 +48,15 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.PrintStream;
+import java.util.AbstractCollection;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.Properties;
import java.util.PropertyPermission;
@@ -103,6 +112,11 @@ public final class System
= new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.err)), true);
/**
+ * A cached copy of the environment variable map.
+ */
+ private static Map<String,String> environmentMap;
+
+ /**
* This class is uninstantiable.
*/
private System()
@@ -394,6 +408,29 @@ public final class System
}
/**
+ * Remove a single system property by name. A security check may be
+ * performed, <code>checkPropertyAccess(key, "write")</code>.
+ *
+ * @param key the name of the system property to remove
+ * @return the previous value, or null
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if key is null
+ * @throws IllegalArgumentException if key is ""
+ * @since 1.5
+ */
+ public static String clearProperty(String key)
+ {
+ SecurityManager sm = SecurityManager.current; // Be thread-safe.
+ if (sm != null)
+ sm.checkPermission(new PropertyPermission(key, "write"));
+ // This handles both the null pointer exception and the illegal
+ // argument exception.
+ if (key.length() == 0)
+ throw new IllegalArgumentException("key can't be empty");
+ return SystemProperties.remove(key);
+ }
+
+ /**
* Gets the value of an environment variable.
*
* @param name the name of the environment variable
@@ -416,6 +453,59 @@ public final class System
}
/**
+ * <p>
+ * Returns an unmodifiable view of the system environment variables.
+ * If the underlying system does not support environment variables,
+ * an empty map is returned.
+ * </p>
+ * <p>
+ * The returned map is read-only and does not accept queries using
+ * null keys or values, or those of a type other than <code>String</code>.
+ * Attempts to modify the map will throw an
+ * <code>UnsupportedOperationException</code>, while attempts
+ * to pass in a null value will throw a
+ * <code>NullPointerException</code>. Types other than <code>String</code>
+ * throw a <code>ClassCastException</code>.
+ * </p>
+ * <p>
+ * As the returned map is generated using data from the underlying
+ * platform, it may not comply with the <code>equals()</code>
+ * and <code>hashCode()</code> contracts. It is also likely that
+ * the keys of this map will be case-sensitive.
+ * </p>
+ * <p>
+ * Use of this method may require a security check for the
+ * RuntimePermission "getenv.*".
+ * </p>
+ *
+ * @return a map of the system environment variables.
+ * @throws SecurityException if the checkPermission method of
+ * an installed security manager prevents access to
+ * the system environment variables.
+ * @since 1.5
+ */
+ public static Map<String, String> getenv()
+ {
+ SecurityManager sm = SecurityManager.current; // Be thread-safe.
+ if (sm != null)
+ sm.checkPermission(new RuntimePermission("getenv.*"));
+ if (environmentMap == null)
+ {
+ // List<String> environ = (List<String>)VMSystem.environ();
+ // FIXME
+ List<String> environ = new ArrayList<String>();
+ Map<String,String> variables = new EnvironmentMap();
+ for (String pair : environ)
+ {
+ String[] parts = pair.split("=");
+ variables.put(parts[0], parts[1]);
+ }
+ environmentMap = Collections.unmodifiableMap(variables);
+ }
+ return environmentMap;
+ }
+
+ /**
* Terminate the Virtual Machine. This just calls
* <code>Runtime.getRuntime().exit(status)</code>, and never returns.
* Obviously, a security check is in order, <code>checkExit</code>.
@@ -557,4 +647,382 @@ public final class System
* @see #getenv(String)
*/
static native String getenv0(String name);
+
+
+ /**
+ * This is a specialised <code>Collection</code>, providing
+ * the necessary provisions for the collections used by the
+ * environment variable map. Namely, it prevents
+ * querying anything but <code>String</code>s.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ */
+ private static class EnvironmentCollection
+ extends AbstractCollection<String>
+ {
+
+ /**
+ * The wrapped collection.
+ */
+ protected Collection<String> c;
+
+ /**
+ * Constructs a new environment collection, which
+ * wraps the elements of the supplied collection.
+ *
+ * @param coll the collection to use as a base for
+ * this collection.
+ */
+ public EnvironmentCollection(Collection<String> coll)
+ {
+ c = coll;
+ }
+
+ /**
+ * Blocks queries containing a null object or an object which
+ * isn't of type <code>String</code>. All other queries
+ * are forwarded to the underlying collection.
+ *
+ * @param obj the object to look for.
+ * @return true if the object exists in the collection.
+ * @throws NullPointerException if the specified object is null.
+ * @throws ClassCastException if the specified object is not a String.
+ */
+ public boolean contains(Object obj)
+ {
+ if (obj == null)
+ throw new
+ NullPointerException("This collection does not support " +
+ "null values.");
+ if (!(obj instanceof String))
+ throw new
+ ClassCastException("This collection only supports Strings.");
+ return c.contains(obj);
+ }
+
+ /**
+ * Blocks queries where the collection contains a null object or
+ * an object which isn't of type <code>String</code>. All other
+ * queries are forwarded to the underlying collection.
+ *
+ * @param coll the collection of objects to look for.
+ * @return true if the collection contains all elements in the collection.
+ * @throws NullPointerException if the collection is null.
+ * @throws NullPointerException if any collection entry is null.
+ * @throws ClassCastException if any collection entry is not a String.
+ */
+ public boolean containsAll(Collection<?> coll)
+ {
+ for (Object o: coll)
+ {
+ if (o == null)
+ throw new
+ NullPointerException("This collection does not support " +
+ "null values.");
+ if (!(o instanceof String))
+ throw new
+ ClassCastException("This collection only supports Strings.");
+ }
+ return c.containsAll(coll);
+ }
+
+ /**
+ * This returns an iterator over the map elements, with the
+ * same provisions as for the collection and underlying map.
+ *
+ * @return an iterator over the map elements.
+ */
+ public Iterator<String> iterator()
+ {
+ return c.iterator();
+ }
+
+ /**
+ * Blocks the removal of elements from the collection.
+ *
+ * @return true if the removal was sucessful.
+ * @throws NullPointerException if the collection is null.
+ * @throws NullPointerException if any collection entry is null.
+ * @throws ClassCastException if any collection entry is not a String.
+ */
+ public boolean remove(Object key)
+ {
+ if (key == null)
+ throw new
+ NullPointerException("This collection does not support " +
+ "null values.");
+ if (!(key instanceof String))
+ throw new
+ ClassCastException("This collection only supports Strings.");
+ return c.contains(key);
+ }
+
+ /**
+ * Blocks the removal of all elements in the specified
+ * collection from the collection.
+ *
+ * @param coll the collection of elements to remove.
+ * @return true if the elements were removed.
+ * @throws NullPointerException if the collection is null.
+ * @throws NullPointerException if any collection entry is null.
+ * @throws ClassCastException if any collection entry is not a String.
+ */
+ public boolean removeAll(Collection<?> coll)
+ {
+ for (Object o: coll)
+ {
+ if (o == null)
+ throw new
+ NullPointerException("This collection does not support " +
+ "null values.");
+ if (!(o instanceof String))
+ throw new
+ ClassCastException("This collection only supports Strings.");
+ }
+ return c.removeAll(coll);
+ }
+
+ /**
+ * Blocks the retention of all elements in the specified
+ * collection from the collection.
+ *
+ * @param c the collection of elements to retain.
+ * @return true if the other elements were removed.
+ * @throws NullPointerException if the collection is null.
+ * @throws NullPointerException if any collection entry is null.
+ * @throws ClassCastException if any collection entry is not a String.
+ */
+ public boolean retainAll(Collection<?> coll)
+ {
+ for (Object o: coll)
+ {
+ if (o == null)
+ throw new
+ NullPointerException("This collection does not support " +
+ "null values.");
+ if (!(o instanceof String))
+ throw new
+ ClassCastException("This collection only supports Strings.");
+ }
+ return c.containsAll(coll);
+ }
+
+ /**
+ * This simply calls the same method on the wrapped
+ * collection.
+ *
+ * @return the size of the underlying collection.
+ */
+ public int size()
+ {
+ return c.size();
+ }
+
+ } // class EnvironmentCollection<String>
+
+ /**
+ * This is a specialised <code>HashMap</code>, which
+ * prevents the addition or querying of anything other than
+ * <code>String</code> objects.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ */
+ private static class EnvironmentMap
+ extends HashMap<String,String>
+ {
+
+ /**
+ * Cache the entry set.
+ */
+ private transient Set<Map.Entry<String,String>> entries;
+
+ /**
+ * Cache the key set.
+ */
+ private transient Set<String> keys;
+
+ /**
+ * Cache the value collection.
+ */
+ private transient Collection<String> values;
+
+ /**
+ * Constructs a new empty <code>EnvironmentMap</code>.
+ */
+ EnvironmentMap()
+ {
+ super();
+ }
+
+ /**
+ * Blocks queries containing a null key or one which is not
+ * of type <code>String</code>. All other queries
+ * are forwarded to the superclass.
+ *
+ * @param key the key to look for in the map.
+ * @return true if the key exists in the map.
+ * @throws NullPointerException if the specified key is null.
+ */
+ public boolean containsKey(Object key)
+ {
+ if (key == null)
+ throw new
+ NullPointerException("This map does not support null keys.");
+ if (!(key instanceof String))
+ throw new
+ ClassCastException("This map only allows queries using Strings.");
+ return super.containsKey(key);
+ }
+
+ /**
+ * Blocks queries using a null or non-<code>String</code> value.
+ * All other queries are forwarded to the superclass.
+ *
+ * @param value the value to look for in the map.
+ * @return true if the value exists in the map.
+ * @throws NullPointerException if the specified value is null.
+ */
+ public boolean containsValue(Object value)
+ {
+ if (value == null)
+ throw new
+ NullPointerException("This map does not support null values.");
+ if (!(value instanceof String))
+ throw new
+ ClassCastException("This map only allows queries using Strings.");
+ return super.containsValue(value);
+ }
+
+ /**
+ * Returns a set view of the map entries, with the same
+ * provisions as for the underlying map.
+ *
+ * @return a set containing the map entries.
+ */
+ public Set<Map.Entry<String,String>> entrySet()
+ {
+ if (entries == null)
+ entries = super.entrySet();
+ return entries;
+ }
+
+ /**
+ * Blocks queries containing a null or non-<code>String</code> key.
+ * All other queries are passed on to the superclass.
+ *
+ * @param key the key to retrieve the value for.
+ * @return the value associated with the given key.
+ * @throws NullPointerException if the specified key is null.
+ * @throws ClassCastException if the specified key is not a String.
+ */
+ public String get(Object key)
+ {
+ if (key == null)
+ throw new
+ NullPointerException("This map does not support null keys.");
+ if (!(key instanceof String))
+ throw new
+ ClassCastException("This map only allows queries using Strings.");
+ return super.get(key);
+ }
+
+ /**
+ * Returns a set view of the keys, with the same
+ * provisions as for the underlying map.
+ *
+ * @return a set containing the keys.
+ */
+ public Set<String> keySet()
+ {
+ if (keys == null)
+ keys = new EnvironmentSet(super.keySet());
+ return keys;
+ }
+
+ /**
+ * Removes a key-value pair from the map. The queried key may not
+ * be null or of a type other than a <code>String</code>.
+ *
+ * @param key the key of the entry to remove.
+ * @return the removed value.
+ * @throws NullPointerException if the specified key is null.
+ * @throws ClassCastException if the specified key is not a String.
+ */
+ public String remove(Object key)
+ {
+ if (key == null)
+ throw new
+ NullPointerException("This map does not support null keys.");
+ if (!(key instanceof String))
+ throw new
+ ClassCastException("This map only allows queries using Strings.");
+ return super.remove(key);
+ }
+
+ /**
+ * Returns a collection view of the values, with the same
+ * provisions as for the underlying map.
+ *
+ * @return a collection containing the values.
+ */
+ public Collection<String> values()
+ {
+ if (values == null)
+ values = new EnvironmentCollection(super.values());
+ return values;
+ }
+
+ }
+
+ /**
+ * This is a specialised <code>Set</code>, providing
+ * the necessary provisions for the collections used by the
+ * environment variable map. Namely, it prevents
+ * modifications and the use of queries with null
+ * or non-<code>String</code> values.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ */
+ private static class EnvironmentSet
+ extends EnvironmentCollection
+ implements Set<String>
+ {
+
+ /**
+ * Constructs a new environment set, which
+ * wraps the elements of the supplied set.
+ *
+ * @param set the set to use as a base for
+ * this set.
+ */
+ public EnvironmentSet(Set<String> set)
+ {
+ super(set);
+ }
+
+ /**
+ * This simply calls the same method on the wrapped
+ * collection.
+ *
+ * @param obj the object to compare with.
+ * @return true if the two objects are equal.
+ */
+ public boolean equals(Object obj)
+ {
+ return c.equals(obj);
+ }
+
+ /**
+ * This simply calls the same method on the wrapped
+ * collection.
+ *
+ * @return the hashcode of the collection.
+ */
+ public int hashCode()
+ {
+ return c.hashCode();
+ }
+
+ } // class EnvironmentSet<String>
+
} // class System
diff --git a/libjava/java/lang/Thread$State.h b/libjava/java/lang/Thread$State.h
new file mode 100644
index 00000000000..4620c722436
--- /dev/null
+++ b/libjava/java/lang/Thread$State.h
@@ -0,0 +1,32 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Thread$State__
+#define __java_lang_Thread$State__
+
+#pragma interface
+
+#include <java/lang/Enum.h>
+#include <gcj/array.h>
+
+
+class java::lang::Thread$State : public ::java::lang::Enum
+{
+
+ Thread$State(::java::lang::String *, jint);
+public:
+ static JArray< ::java::lang::Thread$State * > * values();
+ static ::java::lang::Thread$State * valueOf(::java::lang::String *);
+ static ::java::lang::Thread$State * BLOCKED;
+ static ::java::lang::Thread$State * NEW;
+ static ::java::lang::Thread$State * RUNNABLE;
+ static ::java::lang::Thread$State * TERMINATED;
+ static ::java::lang::Thread$State * TIMED_WAITING;
+ static ::java::lang::Thread$State * WAITING;
+private:
+ static JArray< ::java::lang::Thread$State * > * ENUM$VALUES;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Thread$State__
diff --git a/libjava/java/lang/Thread$UncaughtExceptionHandler.h b/libjava/java/lang/Thread$UncaughtExceptionHandler.h
new file mode 100644
index 00000000000..88d2b5b902f
--- /dev/null
+++ b/libjava/java/lang/Thread$UncaughtExceptionHandler.h
@@ -0,0 +1,19 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Thread$UncaughtExceptionHandler__
+#define __java_lang_Thread$UncaughtExceptionHandler__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::Thread$UncaughtExceptionHandler : public ::java::lang::Object
+{
+
+public:
+ virtual void uncaughtException(::java::lang::Thread *, ::java::lang::Throwable *) = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_Thread$UncaughtExceptionHandler__
diff --git a/libjava/java/lang/Thread.h b/libjava/java/lang/Thread.h
new file mode 100644
index 00000000000..c3556f0684d
--- /dev/null
+++ b/libjava/java/lang/Thread.h
@@ -0,0 +1,161 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Thread__
+#define __java_lang_Thread__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace gnu
+ {
+ namespace gcj
+ {
+ class RawData;
+ class RawDataManaged;
+ }
+ namespace java
+ {
+ namespace util
+ {
+ class WeakIdentityHashMap;
+ }
+ }
+ }
+}
+
+class _Jv_JNIEnv;
+#define _JV_NOT_OWNER 1
+#define _JV_INTERRUPTED 2
+_Jv_JNIEnv * _Jv_GetCurrentJNIEnv ();
+void _Jv_SetCurrentJNIEnv (_Jv_JNIEnv *env);
+void _Jv_ThreadRun (java::lang::Thread* thread);
+jint _Jv_AttachCurrentThread(java::lang::Thread* thread);
+java::lang::Thread* _Jv_AttachCurrentThread (jstring name, java::lang::ThreadGroup* group);
+java::lang::Thread* _Jv_AttachCurrentThreadAsDaemon (jstring name, java::lang::ThreadGroup* group);
+jint _Jv_DetachCurrentThread ();
+struct _Jv_Thread_t;
+_Jv_Thread_t* _Jv_ThreadGetData (java::lang::Thread* thread);
+
+class java::lang::Thread : public ::java::lang::Object
+{
+
+public:
+ Thread();
+ Thread(::java::lang::Runnable *);
+ Thread(::java::lang::String *);
+ Thread(::java::lang::ThreadGroup *, ::java::lang::Runnable *);
+ Thread(::java::lang::ThreadGroup *, ::java::lang::String *);
+ Thread(::java::lang::Runnable *, ::java::lang::String *);
+ Thread(::java::lang::ThreadGroup *, ::java::lang::Runnable *, ::java::lang::String *);
+ Thread(::java::lang::ThreadGroup *, ::java::lang::Runnable *, ::java::lang::String *, jlong);
+private:
+ Thread(::java::lang::Thread *, ::java::lang::ThreadGroup *, ::java::lang::Runnable *, ::java::lang::String *);
+public:
+ static jint activeCount();
+ virtual void checkAccess();
+ virtual jint countStackFrames();
+ static ::java::lang::Thread * currentThread();
+ virtual void destroy();
+ static void dumpStack();
+ static jint enumerate(JArray< ::java::lang::Thread * > *);
+ virtual ::java::lang::String * getName();
+ virtual jint getPriority();
+ virtual ::java::lang::ThreadGroup * getThreadGroup();
+ static jboolean holdsLock(::java::lang::Object *);
+ virtual void interrupt();
+ static jboolean interrupted();
+ virtual jboolean isInterrupted();
+ virtual jboolean isAlive();
+ virtual jboolean isDaemon();
+ virtual void join();
+ virtual void join(jlong);
+ virtual void join(jlong, jint);
+ virtual void resume();
+private:
+ void finish_();
+ jboolean isInterrupted(jboolean);
+public:
+ virtual void run();
+ virtual void setDaemon(jboolean);
+ virtual ::java::lang::ClassLoader * getContextClassLoader();
+ virtual void setContextClassLoader(::java::lang::ClassLoader *);
+ virtual void setName(::java::lang::String *);
+ static void yield();
+ static void sleep(jlong);
+ static void sleep(jlong, jint);
+ virtual void start();
+ virtual void stop();
+ virtual void stop(::java::lang::Throwable *);
+ virtual void suspend();
+ virtual void setPriority(jint);
+ virtual ::java::lang::String * toString();
+private:
+ void initialize_native();
+ static ::java::lang::String * gen_name();
+public: // actually package-private
+ static ::java::util::Map * getThreadLocals();
+public:
+ virtual void setUncaughtExceptionHandler(::java::lang::Thread$UncaughtExceptionHandler *);
+ virtual ::java::lang::Thread$UncaughtExceptionHandler * getUncaughtExceptionHandler();
+ static void setDefaultUncaughtExceptionHandler(::java::lang::Thread$UncaughtExceptionHandler *);
+ static ::java::lang::Thread$UncaughtExceptionHandler * getDefaultUncaughtExceptionHandler();
+ virtual jlong getId();
+ virtual ::java::lang::Thread$State * getState();
+ static ::java::util::Map * getAllStackTraces();
+ virtual JArray< ::java::lang::StackTraceElement * > * getStackTrace();
+ static const jint MIN_PRIORITY = 1;
+ static const jint NORM_PRIORITY = 5;
+ static const jint MAX_PRIORITY = 10;
+public: // actually package-private
+ ::java::lang::ThreadGroup * __attribute__((aligned(__alignof__( ::java::lang::Object)))) group;
+private:
+ ::java::lang::Runnable * runnable;
+public: // actually package-private
+ ::java::lang::String * name;
+private:
+ jboolean daemon;
+ jint priority;
+public: // actually package-private
+ jboolean interrupt_flag;
+private:
+ static const jbyte THREAD_DEAD = 0;
+ static const jbyte THREAD_ALIVE = 1;
+ static const jbyte THREAD_SIGNALED = 2;
+ jboolean startable_flag;
+ ::java::lang::ClassLoader * contextClassLoader;
+ jlong threadId;
+ static jlong nextThreadId;
+ static jlong totalThreadsCreated;
+ static ::java::lang::Thread$UncaughtExceptionHandler * defaultHandler;
+public: // actually package-private
+ ::gnu::java::util::WeakIdentityHashMap * locals;
+ ::java::lang::Thread$UncaughtExceptionHandler * exceptionHandler;
+private:
+ ::java::lang::Object * parkBlocker;
+public: // actually package-private
+ static const jbyte THREAD_PARK_RUNNING = 0;
+ static const jbyte THREAD_PARK_PERMIT = 1;
+ static const jbyte THREAD_PARK_PARKED = 2;
+ static const jbyte THREAD_PARK_DEAD = 3;
+ ::java::lang::Object * accessControlState;
+ ::gnu::gcj::RawData * interp_frame;
+ volatile jint state;
+ ::gnu::gcj::RawDataManaged * data;
+public:
+ static ::java::lang::Class class$;
+
+ friend _Jv_JNIEnv * ::_Jv_GetCurrentJNIEnv ();
+ friend void ::_Jv_SetCurrentJNIEnv (_Jv_JNIEnv *env);
+ friend void ::_Jv_ThreadRun (java::lang::Thread* thread);
+ friend jint (::_Jv_AttachCurrentThread) (java::lang::Thread* thread);
+ friend java::lang::Thread* ::_Jv_AttachCurrentThread (jstring name, java::lang::ThreadGroup* group);
+ friend java::lang::Thread* ::_Jv_AttachCurrentThreadAsDaemon (jstring name, java::lang::ThreadGroup* group);
+ friend jint (::_Jv_DetachCurrentThread) ();
+};
+
+#endif // __java_lang_Thread__
diff --git a/libjava/java/lang/Thread.java b/libjava/java/lang/Thread.java
index 2b7fb2aec01..9666482040a 100644
--- a/libjava/java/lang/Thread.java
+++ b/libjava/java/lang/Thread.java
@@ -36,12 +36,18 @@ 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.lang;
+import gnu.classpath.VMStackWalker;
import gnu.gcj.RawData;
import gnu.gcj.RawDataManaged;
import gnu.java.util.WeakIdentityHashMap;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+
+import java.util.HashMap;
import java.util.Map;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
@@ -83,6 +89,7 @@ import java.util.Map;
* @author Tom Tromey
* @author John Keiser
* @author Eric Blake (ebb9@email.byu.edu)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @see Runnable
* @see Runtime#exit(int)
* @see #run()
@@ -121,7 +128,15 @@ public class Thread implements Runnable
private int priority;
boolean interrupt_flag;
- private boolean alive_flag;
+
+ /** A thread is either alive, dead, or being sent a signal; if it is
+ being sent a signal, it is also alive. Thus, if you want to
+ know if a thread is alive, it is sufficient to test
+ alive_status != THREAD_DEAD. */
+ private static final byte THREAD_DEAD = 0;
+ private static final byte THREAD_ALIVE = 1;
+ private static final byte THREAD_SIGNALED = 2;
+
private boolean startable_flag;
/** The context classloader for this Thread. */
@@ -133,6 +148,9 @@ public class Thread implements Runnable
/** The next thread ID to use. */
private static long nextThreadId;
+ /** Used to generate the next thread ID to use. */
+ private static long totalThreadsCreated;
+
/** The default exception handler. */
private static UncaughtExceptionHandler defaultHandler;
@@ -144,6 +162,19 @@ public class Thread implements Runnable
/** The uncaught exception handler. */
UncaughtExceptionHandler exceptionHandler;
+ /** This object is recorded while the thread is blocked to permit
+ * monitoring and diagnostic tools to identify the reasons that
+ * threads are blocked.
+ */
+ private Object parkBlocker;
+
+ /** Used by Unsafe.park and Unsafe.unpark. Se Unsafe for a full
+ description. */
+ static final byte THREAD_PARK_RUNNING = 0;
+ static final byte THREAD_PARK_PERMIT = 1;
+ static final byte THREAD_PARK_PARKED = 2;
+ static final byte THREAD_PARK_DEAD = 3;
+
/** The access control state for this thread. Package accessible
* for use by java.security.VMAccessControlState's native method.
*/
@@ -152,8 +183,11 @@ public class Thread implements Runnable
// This describes the top-most interpreter frame for this thread.
RawData interp_frame;
+ // Current state.
+ volatile int state;
+
// Our native data - points to an instance of struct natThread.
- private RawDataManaged data;
+ RawDataManaged data;
/**
* Allocates a new <code>Thread</code> object. This constructor has
@@ -368,7 +402,6 @@ public class Thread implements Runnable
data = null;
interrupt_flag = false;
- alive_flag = false;
startable_flag = true;
synchronized (Thread.class)
@@ -438,7 +471,10 @@ public class Thread implements Runnable
public native int countStackFrames();
/**
- * Get the currently executing Thread.
+ * Get the currently executing Thread. In the situation that the
+ * currently running thread was created by native code and doesn't
+ * have an associated Thread object yet, a new Thread object is
+ * constructed and associated with the native thread.
*
* @return the currently executing Thread
*/
@@ -447,6 +483,19 @@ public class Thread implements Runnable
/**
* Originally intended to destroy this thread, this method was never
* implemented by Sun, and is hence a no-op.
+ *
+ * @deprecated This method was originally intended to simply destroy
+ * the thread without performing any form of cleanup operation.
+ * However, it was never implemented. It is now deprecated
+ * for the same reason as <code>suspend()</code>,
+ * <code>stop()</code> and <code>resume()</code>; namely,
+ * it is prone to deadlocks. If a thread is destroyed while
+ * it still maintains a lock on a resource, then this resource
+ * will remain locked and any attempts by other threads to
+ * access the resource will result in a deadlock. Thus, even
+ * an implemented version of this method would be still be
+ * deprecated, due to its unsafe nature.
+ * @throws NoSuchMethodError as this method was never implemented.
*/
public void destroy()
{
@@ -579,10 +628,7 @@ public class Thread implements Runnable
*
* @return whether this Thread is alive
*/
- public final synchronized boolean isAlive()
- {
- return alive_flag;
- }
+ public final native boolean isAlive();
/**
* Tell whether this is a daemon Thread or not.
@@ -638,7 +684,9 @@ public class Thread implements Runnable
throws InterruptedException;
/**
- * Resume a suspended thread.
+ * Resume this Thread. If the thread is not suspended, this method does
+ * nothing. To mirror suspend(), there may be a security check:
+ * <code>checkAccess</code>.
*
* @throws SecurityException if you cannot resume the Thread
* @see #checkAccess()
@@ -713,7 +761,7 @@ public class Thread implements Runnable
*
* @return the context class loader
* @throws SecurityException when permission is denied
- * @see setContextClassLoader(ClassLoader)
+ * @see #setContextClassLoader(ClassLoader)
* @since 1.2
*/
public synchronized ClassLoader getContextClassLoader()
@@ -721,24 +769,15 @@ public class Thread implements Runnable
if (contextClassLoader == null)
contextClassLoader = ClassLoader.getSystemClassLoader();
+ // Check if we may get the classloader
SecurityManager sm = System.getSecurityManager();
- // FIXME: we can't currently find the caller's class loader.
- ClassLoader callers = null;
- if (sm != null && callers != null)
+ if (contextClassLoader != null && sm != null)
{
- // See if the caller's class loader is the same as or an
- // ancestor of this thread's class loader.
- while (callers != null && callers != contextClassLoader)
- {
- // FIXME: should use some internal version of getParent
- // that avoids security checks.
- callers = callers.getParent();
- }
-
- if (callers != contextClassLoader)
- sm.checkPermission(new RuntimePermission("getClassLoader"));
+ // Get the calling classloader
+ ClassLoader cl = VMStackWalker.getCallingClassLoader();
+ if (cl != null && !cl.isAncestorOf(contextClassLoader))
+ sm.checkPermission(new RuntimePermission("getClassLoader"));
}
-
return contextClassLoader;
}
@@ -751,7 +790,7 @@ public class Thread implements Runnable
*
* @param classloader the new context class loader
* @throws SecurityException when permission is denied
- * @see getContextClassLoader()
+ * @see #getContextClassLoader()
* @since 1.2
*/
public synchronized void setContextClassLoader(ClassLoader classloader)
@@ -781,8 +820,10 @@ public class Thread implements Runnable
}
/**
- * Causes the currently executing thread object to temporarily pause
- * and allow other threads to execute.
+ * Yield to another thread. The Thread will not lose any locks it holds
+ * during this time. There are no guarantees which thread will be
+ * next to run, and it could even be this one, but most VMs will choose
+ * the highest priority thread that has been waiting longest.
*/
public static native void yield();
@@ -793,8 +834,10 @@ public class Thread implements Runnable
* choose the highest priority thread that has been waiting longest.
*
* @param ms the number of milliseconds to sleep, or 0 for forever
- * @throws InterruptedException if the Thread is interrupted; it's
- * <i>interrupted status</i> will be cleared
+ * @throws InterruptedException if the Thread is (or was) interrupted;
+ * it's <i>interrupted status</i> will be cleared
+ * @throws IllegalArgumentException if ms is negative
+ * @see #interrupt()
* @see #notify()
* @see #wait(long)
*/
@@ -808,18 +851,21 @@ public class Thread implements Runnable
* time. The Thread will not lose any locks it has during this time. There
* are no guarantees which thread will be next to run, but most VMs will
* choose the highest priority thread that has been waiting longest.
- *
- * <p>Note that 1,000,000 nanoseconds == 1 millisecond, but most VMs do
- * not offer that fine a grain of timing resolution. Besides, there is
- * no guarantee that this thread can start up immediately when time expires,
- * because some other thread may be active. So don't expect real-time
- * performance.
+ * <p>
+ * Note that 1,000,000 nanoseconds == 1 millisecond, but most VMs
+ * do not offer that fine a grain of timing resolution. When ms is
+ * zero and ns is non-zero the Thread will sleep for at least one
+ * milli second. There is no guarantee that this thread can start up
+ * immediately when time expires, because some other thread may be
+ * active. So don't expect real-time performance.
*
* @param ms the number of milliseconds to sleep, or 0 for forever
* @param ns the number of extra nanoseconds to sleep (0-999999)
- * @throws InterruptedException if the Thread is interrupted; it's
- * <i>interrupted status</i> will be cleared
- * @throws IllegalArgumentException if ns is invalid
+ * @throws InterruptedException if the Thread is (or was) interrupted;
+ * it's <i>interrupted status</i> will be cleared
+ * @throws IllegalArgumentException if ms or ns is negative
+ * or ns is larger than 999999.
+ * @see #interrupt()
* @see #notify()
* @see #wait(long, int)
*/
@@ -870,10 +916,11 @@ public class Thread implements Runnable
/**
* Cause this Thread to stop abnormally and throw the specified exception.
- * If you stop a Thread that has not yet started, it will stop immediately
- * when it is actually started. <b>WARNING</b>This bypasses Java security,
- * and can throw a checked exception which the call stack is unprepared to
- * handle. Do not abuse this power.
+ * If you stop a Thread that has not yet started, the stop is ignored
+ * (contrary to what the JDK documentation says).
+ * <b>WARNING</b>This bypasses Java security, and can throw a checked
+ * exception which the call stack is unprepared to handle. Do not abuse
+ * this power.
*
* <p>This is inherently unsafe, as it can interrupt synchronized blocks and
* leave data in bad states. Hence, there is a security check:
@@ -996,6 +1043,7 @@ public class Thread implements Runnable
*/
public UncaughtExceptionHandler getUncaughtExceptionHandler()
{
+ // FIXME: if thread is dead, should return null...
return exceptionHandler != null ? exceptionHandler : group;
}
@@ -1094,7 +1142,7 @@ public class Thread implements Runnable
* @author Andrew John Hughes <gnu_andrew@member.fsf.org>
* @since 1.5
* @see Thread#getUncaughtExceptionHandler()
- * @see Thread#setUncaughtExceptionHander(java.lang.Thread.UncaughtExceptionHandler)
+ * @see Thread#setUncaughtExceptionHandler(UncaughtExceptionHandler)
* @see Thread#getDefaultUncaughtExceptionHandler()
* @see
* Thread#setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)
@@ -1113,6 +1161,32 @@ public class Thread implements Runnable
void uncaughtException(Thread thr, Throwable exc);
}
+ /**
+ * <p>
+ * Represents the current state of a thread, according to the VM rather
+ * than the operating system. It can be one of the following:
+ * </p>
+ * <ul>
+ * <li>NEW -- The thread has just been created but is not yet running.</li>
+ * <li>RUNNABLE -- The thread is currently running or can be scheduled
+ * to run.</li>
+ * <li>BLOCKED -- The thread is blocked waiting on an I/O operation
+ * or to obtain a lock.</li>
+ * <li>WAITING -- The thread is waiting indefinitely for another thread
+ * to do something.</li>
+ * <li>TIMED_WAITING -- The thread is waiting for a specific amount of time
+ * for another thread to do something.</li>
+ * <li>TERMINATED -- The thread has exited.</li>
+ * </ul>
+ *
+ * @since 1.5
+ */
+ public enum State
+ {
+ BLOCKED, NEW, RUNNABLE, TERMINATED, TIMED_WAITING, WAITING;
+ }
+
+
/**
* Returns the current state of the thread. This
* is designed for monitoring thread behaviour, rather
@@ -1120,9 +1194,103 @@ public class Thread implements Runnable
*
* @return the current thread state.
*/
- public String getState()
+ public native State getState();
+
+ /**
+ * <p>
+ * Returns a map of threads to stack traces for each
+ * live thread. The keys of the map are {@link Thread}
+ * objects, which map to arrays of {@link StackTraceElement}s.
+ * The results obtained from Calling this method are
+ * equivalent to calling {@link getStackTrace()} on each
+ * thread in succession. Threads may be executing while
+ * this takes place, and the results represent a snapshot
+ * of the thread at the time its {@link getStackTrace()}
+ * method is called.
+ * </p>
+ * <p>
+ * The stack trace information contains the methods called
+ * by the thread, with the most recent method forming the
+ * first element in the array. The array will be empty
+ * if the virtual machine can not obtain information on the
+ * thread.
+ * </p>
+ * <p>
+ * To execute this method, the current security manager
+ * (if one exists) must allow both the
+ * <code>"getStackTrace"</code> and
+ * <code>"modifyThreadGroup"</code> {@link RuntimePermission}s.
+ * </p>
+ *
+ * @return a map of threads to arrays of {@link StackTraceElement}s.
+ * @throws SecurityException if a security manager exists, and
+ * prevents either or both the runtime
+ * permissions specified above.
+ * @since 1.5
+ * @see #getStackTrace()
+ */
+ public static Map<Thread, StackTraceElement[]> getAllStackTraces()
{
- // FIXME - Provide real implementation.
- return "NEW";
+ ThreadGroup group = currentThread().group;
+ while (group.getParent() != null)
+ group = group.getParent();
+ int arraySize = group.activeCount();
+ Thread[] threadList = new Thread[arraySize];
+ int filled = group.enumerate(threadList);
+ while (filled == arraySize)
+ {
+ arraySize *= 2;
+ threadList = new Thread[arraySize];
+ filled = group.enumerate(threadList);
+ }
+ Map traces = new HashMap();
+ for (int a = 0; a < filled; ++a)
+ traces.put(threadList[a],
+ threadList[a].getStackTrace());
+ return traces;
}
+
+ /**
+ * <p>
+ * Returns an array of {@link StackTraceElement}s
+ * representing the current stack trace of this thread.
+ * The first element of the array is the most recent
+ * method called, and represents the top of the stack.
+ * The elements continue in this order, with the last
+ * element representing the bottom of the stack.
+ * </p>
+ * <p>
+ * A zero element array is returned for threads which
+ * have not yet started (and thus have not yet executed
+ * any methods) or for those which have terminated.
+ * Where the virtual machine can not obtain a trace for
+ * the thread, an empty array is also returned. The
+ * virtual machine may also omit some methods from the
+ * trace in non-zero arrays.
+ * </p>
+ * <p>
+ * To execute this method, the current security manager
+ * (if one exists) must allow both the
+ * <code>"getStackTrace"</code> and
+ * <code>"modifyThreadGroup"</code> {@link RuntimePermission}s.
+ * </p>
+ *
+ * @return a stack trace for this thread.
+ * @throws SecurityException if a security manager exists, and
+ * prevents the use of the
+ * <code>"getStackTrace"</code>
+ * permission.
+ * @since 1.5
+ * @see #getAllStackTraces()
+ */
+ public StackTraceElement[] getStackTrace()
+ {
+ SecurityManager sm = SecurityManager.current; // Be thread-safe.
+ if (sm != null)
+ sm.checkPermission(new RuntimePermission("getStackTrace"));
+ ThreadMXBean bean = ManagementFactory.getThreadMXBean();
+ ThreadInfo info = bean.getThreadInfo(getId(), Integer.MAX_VALUE);
+ return info.getStackTrace();
+ }
+
}
diff --git a/libjava/java/lang/ThreadDeath.h b/libjava/java/lang/ThreadDeath.h
new file mode 100644
index 00000000000..d06ce3458b3
--- /dev/null
+++ b/libjava/java/lang/ThreadDeath.h
@@ -0,0 +1,22 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ThreadDeath__
+#define __java_lang_ThreadDeath__
+
+#pragma interface
+
+#include <java/lang/Error.h>
+
+class java::lang::ThreadDeath : public ::java::lang::Error
+{
+
+public:
+ ThreadDeath();
+private:
+ static const jlong serialVersionUID = -4417128565033088268LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_ThreadDeath__
diff --git a/libjava/java/lang/ThreadGroup.h b/libjava/java/lang/ThreadGroup.h
new file mode 100644
index 00000000000..a197ca16eb6
--- /dev/null
+++ b/libjava/java/lang/ThreadGroup.h
@@ -0,0 +1,69 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ThreadGroup__
+#define __java_lang_ThreadGroup__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::ThreadGroup : public ::java::lang::Object
+{
+
+ ThreadGroup();
+public:
+ ThreadGroup(::java::lang::String *);
+ ThreadGroup(::java::lang::ThreadGroup *, ::java::lang::String *);
+ virtual ::java::lang::String * getName();
+ virtual ::java::lang::ThreadGroup * getParent();
+ virtual jint getMaxPriority();
+ virtual jboolean isDaemon();
+ virtual jboolean isDestroyed();
+ virtual void setDaemon(jboolean);
+ virtual void setMaxPriority(jint);
+ virtual jboolean parentOf(::java::lang::ThreadGroup *);
+ virtual void checkAccess();
+ virtual jint activeCount();
+ virtual jint enumerate(JArray< ::java::lang::Thread * > *);
+ virtual jint enumerate(JArray< ::java::lang::Thread * > *, jboolean);
+ virtual jint activeGroupCount();
+ virtual jint enumerate(JArray< ::java::lang::ThreadGroup * > *);
+ virtual jint enumerate(JArray< ::java::lang::ThreadGroup * > *, jboolean);
+ virtual void stop();
+ virtual void interrupt();
+ virtual void suspend();
+ virtual void resume();
+ virtual void destroy();
+ virtual void list();
+ virtual void uncaughtException(::java::lang::Thread *, ::java::lang::Throwable *);
+ virtual jboolean allowThreadSuspension(jboolean);
+ virtual ::java::lang::String * toString();
+private:
+ jint enumerate(JArray< ::java::lang::Thread * > *, jint, jboolean);
+ jint enumerate(JArray< ::java::lang::ThreadGroup * > *, jint, jboolean);
+ void list(::java::lang::String *);
+public: // actually package-private
+ virtual void addThread(::java::lang::Thread *);
+ virtual void removeThread(::java::lang::Thread *);
+ virtual void removeGroup(::java::lang::ThreadGroup *);
+ static ::java::lang::Thread * getThreadFromId(jlong);
+private:
+ ::java::lang::Thread * getThreadFromIdImpl(jlong);
+public: // actually package-private
+ static ::java::lang::ThreadGroup * root;
+ static jboolean had_uncaught_exception;
+ ::java::lang::ThreadGroup * __attribute__((aligned(__alignof__( ::java::lang::Object)))) parent;
+ ::java::lang::String * name;
+private:
+ ::java::util::Vector * threads;
+ ::java::util::Vector * groups;
+ jboolean daemon_flag;
+ jint maxpri;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_ThreadGroup__
diff --git a/libjava/java/lang/ThreadLocal.h b/libjava/java/lang/ThreadLocal.h
new file mode 100644
index 00000000000..4bea9318516
--- /dev/null
+++ b/libjava/java/lang/ThreadLocal.h
@@ -0,0 +1,52 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ThreadLocal__
+#define __java_lang_ThreadLocal__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace gnu
+ {
+ namespace gcj
+ {
+ class RawData;
+ }
+ }
+}
+
+class java::lang::ThreadLocal : public ::java::lang::Object
+{
+
+public:
+ ThreadLocal();
+public: // actually protected
+ virtual ::java::lang::Object * initialValue();
+public:
+ virtual ::java::lang::Object * get();
+private:
+ ::java::lang::Object * internalGet();
+public:
+ virtual void set(::java::lang::Object *);
+private:
+ void internalSet(::java::lang::Object *);
+public:
+ virtual void remove();
+private:
+ void internalRemove();
+public: // actually protected
+ virtual void finalize();
+private:
+ void constructNative();
+public: // actually package-private
+ static ::java::lang::Object * sentinel;
+private:
+ ::gnu::gcj::RawData * __attribute__((aligned(__alignof__( ::java::lang::Object)))) TLSPointer;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_ThreadLocal__
diff --git a/libjava/java/lang/ThreadLocal.java b/libjava/java/lang/ThreadLocal.java
new file mode 100644
index 00000000000..6558c94c999
--- /dev/null
+++ b/libjava/java/lang/ThreadLocal.java
@@ -0,0 +1,179 @@
+/* ThreadLocal -- a variable with a unique value per thread
+ Copyright (C) 2000, 2002, 2003, 2006 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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 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.lang;
+
+import java.util.Map;
+
+
+/**
+ * ThreadLocal objects have a different state associated with every
+ * Thread that accesses them. Every access to the ThreadLocal object
+ * (through the <code>get()</code> and <code>set()</code> methods)
+ * only affects the state of the object as seen by the currently
+ * executing Thread.
+ *
+ * <p>The first time a ThreadLocal object is accessed on a particular
+ * Thread, the state for that Thread's copy of the local variable is set by
+ * executing the method <code>initialValue()</code>.
+ * </p>
+ *
+ * <p>An example how you can use this:
+ * </p>
+ *
+ * <pre>
+ * class Connection
+ * {
+ * private static ThreadLocal owner = new ThreadLocal()
+ * {
+ * public Object initialValue()
+ * {
+ * return("nobody");
+ * }
+ * };
+ * ...
+ * }
+ * </pre>
+ *
+ * <p>Now all instances of connection can see who the owner of the currently
+ * executing Thread is by calling <code>owner.get()</code>. By default any
+ * Thread would be associated with 'nobody'. But the Connection object could
+ * offer a method that changes the owner associated with the Thread on
+ * which the method was called by calling <code>owner.put("somebody")</code>.
+ * (Such an owner changing method should then be guarded by security checks.)
+ * </p>
+ *
+ * <p>When a Thread is garbage collected all references to values of
+ * the ThreadLocal objects associated with that Thread are removed.
+ * </p>
+ *
+ * @author Mark Wielaard (mark@klomp.org)
+ * @author Eric Blake (ebb9@email.byu.edu)
+ * @since 1.2
+ * @status updated to 1.5
+ */
+public class ThreadLocal<T>
+{
+ /**
+ * Placeholder to distinguish between uninitialized and null set by the
+ * user. Do not expose this to the public. Package visible for use by
+ * InheritableThreadLocal
+ */
+ static final Object sentinel = new Object();
+
+ /**
+ * Creates a ThreadLocal object without associating any value to it yet.
+ */
+ public ThreadLocal()
+ {
+ constructNative();
+ }
+
+ /**
+ * Called once per thread on the first invocation of get(), if set() was
+ * not already called. The default implementation returns <code>null</code>.
+ * Often, this method is overridden to create the appropriate initial object
+ * for the current thread's view of the ThreadLocal.
+ *
+ * @return the initial value of the variable in this thread
+ */
+ protected T initialValue()
+ {
+ return null;
+ }
+
+ /**
+ * Gets the value associated with the ThreadLocal object for the currently
+ * executing Thread. If this is the first time the current thread has called
+ * get(), and it has not already called set(), the value is obtained by
+ * <code>initialValue()</code>.
+ *
+ * @return the value of the variable in this thread
+ */
+ public native T get();
+
+ private final Object internalGet()
+ {
+ Map<ThreadLocal<T>,T> map = (Map<ThreadLocal<T>,T>) Thread.getThreadLocals();
+ // Note that we don't have to synchronize, as only this thread will
+ // ever modify the map.
+ T value = map.get(this);
+ if (value == null)
+ {
+ value = initialValue();
+ map.put(this, (T) (value == null ? sentinel : value));
+ }
+ return value == (T) sentinel ? null : value;
+ }
+
+ /**
+ * Sets the value associated with the ThreadLocal object for the currently
+ * executing Thread. This overrides any existing value associated with the
+ * current Thread and prevents <code>initialValue()</code> from being
+ * called if this is the first access to this ThreadLocal in this Thread.
+ *
+ * @param value the value to set this thread's view of the variable to
+ */
+ public native void set(T value);
+
+ private final void internalSet(Object value)
+ {
+ Map map = Thread.getThreadLocals();
+ // Note that we don't have to synchronize, as only this thread will
+ // ever modify the map.
+ map.put(this, value == null ? sentinel : value);
+ }
+
+ /**
+ * Removes the value associated with the ThreadLocal object for the
+ * currently executing Thread.
+ * @since 1.5
+ */
+ public native void remove();
+
+ private final void internalRemove()
+ {
+ Map map = Thread.getThreadLocals();
+ map.remove(this);
+ }
+
+ protected native void finalize () throws Throwable;
+
+ private native void constructNative();
+
+ private gnu.gcj.RawData TLSPointer;
+}
diff --git a/libjava/java/lang/Throwable$StaticData.h b/libjava/java/lang/Throwable$StaticData.h
new file mode 100644
index 00000000000..6bb0912de2d
--- /dev/null
+++ b/libjava/java/lang/Throwable$StaticData.h
@@ -0,0 +1,21 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Throwable$StaticData__
+#define __java_lang_Throwable$StaticData__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::Throwable$StaticData : public ::java::lang::Object
+{
+
+ Throwable$StaticData();
+public: // actually package-private
+ static ::java::lang::String * nl;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Throwable$StaticData__
diff --git a/libjava/java/lang/Throwable.h b/libjava/java/lang/Throwable.h
new file mode 100644
index 00000000000..0b8fdca68e7
--- /dev/null
+++ b/libjava/java/lang/Throwable.h
@@ -0,0 +1,46 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Throwable__
+#define __java_lang_Throwable__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::Throwable : public ::java::lang::Object
+{
+
+public:
+ Throwable();
+ Throwable(::java::lang::String *);
+ Throwable(::java::lang::String *, ::java::lang::Throwable *);
+ Throwable(::java::lang::Throwable *);
+ virtual ::java::lang::String * getMessage();
+ virtual ::java::lang::String * getLocalizedMessage();
+ virtual ::java::lang::Throwable * getCause();
+ virtual ::java::lang::Throwable * initCause(::java::lang::Throwable *);
+ virtual ::java::lang::String * toString();
+ virtual void printStackTrace();
+ virtual void printStackTrace(::java::io::PrintStream *);
+ virtual void printStackTrace(::java::io::PrintWriter *);
+private:
+ ::java::lang::String * stackTraceString();
+ static void stackTraceStringBuffer(::java::lang::StringBuffer *, ::java::lang::String *, JArray< ::java::lang::StackTraceElement * > *, jint);
+public:
+ virtual ::java::lang::Throwable * fillInStackTrace();
+ virtual JArray< ::java::lang::StackTraceElement * > * getStackTrace();
+ virtual void setStackTrace(JArray< ::java::lang::StackTraceElement * > *);
+private:
+ static const jlong serialVersionUID = -3042686055658047285LL;
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) detailMessage;
+ ::java::lang::Throwable * cause;
+ JArray< ::java::lang::StackTraceElement * > * stackTrace;
+ ::java::lang::VMThrowable * vmState;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Throwable__
diff --git a/libjava/java/lang/TypeNotPresentException.h b/libjava/java/lang/TypeNotPresentException.h
new file mode 100644
index 00000000000..076f0a6d43f
--- /dev/null
+++ b/libjava/java/lang/TypeNotPresentException.h
@@ -0,0 +1,24 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_TypeNotPresentException__
+#define __java_lang_TypeNotPresentException__
+
+#pragma interface
+
+#include <java/lang/RuntimeException.h>
+
+class java::lang::TypeNotPresentException : public ::java::lang::RuntimeException
+{
+
+public:
+ TypeNotPresentException(::java::lang::String *, ::java::lang::Throwable *);
+ virtual ::java::lang::String * typeName();
+private:
+ static const jlong serialVersionUID = -5101214195716534496LL;
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::RuntimeException)))) typeName__;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_TypeNotPresentException__
diff --git a/libjava/java/lang/UnknownError.h b/libjava/java/lang/UnknownError.h
new file mode 100644
index 00000000000..2ed851aae57
--- /dev/null
+++ b/libjava/java/lang/UnknownError.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_UnknownError__
+#define __java_lang_UnknownError__
+
+#pragma interface
+
+#include <java/lang/VirtualMachineError.h>
+
+class java::lang::UnknownError : public ::java::lang::VirtualMachineError
+{
+
+public:
+ UnknownError();
+ UnknownError(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 2524784860676771849LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_UnknownError__
diff --git a/libjava/java/lang/UnsatisfiedLinkError.h b/libjava/java/lang/UnsatisfiedLinkError.h
new file mode 100644
index 00000000000..a560313fe21
--- /dev/null
+++ b/libjava/java/lang/UnsatisfiedLinkError.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_UnsatisfiedLinkError__
+#define __java_lang_UnsatisfiedLinkError__
+
+#pragma interface
+
+#include <java/lang/LinkageError.h>
+
+class java::lang::UnsatisfiedLinkError : public ::java::lang::LinkageError
+{
+
+public:
+ UnsatisfiedLinkError();
+ UnsatisfiedLinkError(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -4019343241616879428LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_UnsatisfiedLinkError__
diff --git a/libjava/java/lang/UnsupportedClassVersionError.h b/libjava/java/lang/UnsupportedClassVersionError.h
new file mode 100644
index 00000000000..afa5b1875da
--- /dev/null
+++ b/libjava/java/lang/UnsupportedClassVersionError.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_UnsupportedClassVersionError__
+#define __java_lang_UnsupportedClassVersionError__
+
+#pragma interface
+
+#include <java/lang/ClassFormatError.h>
+
+class java::lang::UnsupportedClassVersionError : public ::java::lang::ClassFormatError
+{
+
+public:
+ UnsupportedClassVersionError();
+ UnsupportedClassVersionError(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -7123279212883497373LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_UnsupportedClassVersionError__
diff --git a/libjava/java/lang/UnsupportedOperationException.h b/libjava/java/lang/UnsupportedOperationException.h
new file mode 100644
index 00000000000..ce808bdedde
--- /dev/null
+++ b/libjava/java/lang/UnsupportedOperationException.h
@@ -0,0 +1,25 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_UnsupportedOperationException__
+#define __java_lang_UnsupportedOperationException__
+
+#pragma interface
+
+#include <java/lang/RuntimeException.h>
+
+class java::lang::UnsupportedOperationException : public ::java::lang::RuntimeException
+{
+
+public:
+ UnsupportedOperationException();
+ UnsupportedOperationException(::java::lang::String *);
+ UnsupportedOperationException(::java::lang::String *, ::java::lang::Throwable *);
+ UnsupportedOperationException(::java::lang::Throwable *);
+private:
+ static const jlong serialVersionUID = -1242599979055084673LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_UnsupportedOperationException__
diff --git a/libjava/java/lang/VMClassLoader.h b/libjava/java/lang/VMClassLoader.h
new file mode 100644
index 00000000000..dce7092bfce
--- /dev/null
+++ b/libjava/java/lang/VMClassLoader.h
@@ -0,0 +1,74 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_VMClassLoader__
+#define __java_lang_VMClassLoader__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace gnu
+ {
+ namespace gcj
+ {
+ namespace runtime
+ {
+ class BootClassLoader;
+ }
+ }
+ }
+ namespace java
+ {
+ namespace net
+ {
+ class URL;
+ }
+ namespace security
+ {
+ class Permission;
+ class ProtectionDomain;
+ }
+ }
+}
+
+class java::lang::VMClassLoader : public ::java::lang::Object
+{
+
+public: // actually package-private
+ VMClassLoader();
+ static ::java::lang::Class * defineClass(::java::lang::ClassLoader *, ::java::lang::String *, JArray< jbyte > *, jint, jint, ::java::security::ProtectionDomain *);
+ static void resolveClass(::java::lang::Class *);
+ static ::java::lang::Class * loadClass(::java::lang::String *, jboolean);
+ static ::java::net::URL * getResource(::java::lang::String *);
+ static ::java::util::Enumeration * getResources(::java::lang::String *);
+ static ::java::lang::Package * getPackage(::java::lang::String *);
+ static JArray< ::java::lang::Package * > * getPackages();
+ static void definePackageForNative(::java::lang::String *);
+ static ::java::lang::Class * getPrimitiveClass(jchar);
+ static jboolean defaultAssertionStatus();
+ static ::java::util::Map * packageAssertionStatus();
+ static ::java::util::Map * classAssertionStatus();
+ static ::java::lang::ClassLoader * getSystemClassLoaderInternal();
+ static void initBootLoader(::java::lang::String *);
+ static void initialize(::java::lang::String *);
+ static ::java::lang::Class * nativeFindClass(::java::lang::String *);
+ static ::java::lang::ClassLoader * getSystemClassLoader();
+ static ::java::security::Permission * protectionDomainPermission;
+ static ::java::security::ProtectionDomain * unknownProtectionDomain;
+ static ::java::util::HashMap * definedPackages;
+ static ::gnu::gcj::runtime::BootClassLoader * bootLoader;
+private:
+ static ::java::util::HashSet * tried_libraries;
+ static jint lib_control;
+ static const jint LIB_FULL = 0;
+ static const jint LIB_CACHE = 1;
+ static const jint LIB_NEVER = 2;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_VMClassLoader__
diff --git a/libjava/java/lang/VMCompiler.h b/libjava/java/lang/VMCompiler.h
new file mode 100644
index 00000000000..e81f694e196
--- /dev/null
+++ b/libjava/java/lang/VMCompiler.h
@@ -0,0 +1,64 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_VMCompiler__
+#define __java_lang_VMCompiler__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace gnu
+ {
+ namespace java
+ {
+ namespace security
+ {
+ namespace hash
+ {
+ class MD5;
+ }
+ }
+ }
+ }
+ namespace java
+ {
+ namespace security
+ {
+ class ProtectionDomain;
+ }
+ }
+}
+
+class java::lang::VMCompiler : public ::java::lang::Object
+{
+
+public:
+ static jboolean precompiles();
+private:
+ VMCompiler();
+ static ::java::lang::Class * loadSharedLibrary(::java::lang::ClassLoader *, ::java::lang::String *, ::java::security::ProtectionDomain *, ::java::lang::String *);
+public:
+ static ::java::lang::Class * compileClass(::java::lang::ClassLoader *, ::java::lang::String *, JArray< jbyte > *, jint, jint, ::java::security::ProtectionDomain *);
+ static jboolean compileClass(::java::lang::Class *);
+ static jboolean compileClasses(::java::lang::String *);
+ static ::java::lang::Object * command(::java::lang::Object *);
+ static void enable();
+ static void disable();
+ static jboolean useCompiler;
+ static jboolean canUseCompiler;
+ static ::java::lang::String * gcjJitCompiler;
+ static ::java::lang::String * gcjJitCompilerOptions;
+ static ::java::lang::String * gcjJitTmpdir;
+private:
+ static ::java::util::WeakHashMap * sharedHelperMap;
+ static ::java::util::Vector * precompiledMapFiles;
+ static ::gnu::java::security::hash::MD5 * md5Digest;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_VMCompiler__
diff --git a/libjava/java/lang/VMCompiler.java b/libjava/java/lang/VMCompiler.java
index 789445e4f56..0e4701c8409 100644
--- a/libjava/java/lang/VMCompiler.java
+++ b/libjava/java/lang/VMCompiler.java
@@ -73,6 +73,11 @@ final class VMCompiler
// Temporary directory to use.
public static String gcjJitTmpdir;
+ public static boolean precompiles()
+ {
+ return (canUseCompiler & useCompiler);
+ }
+
// This maps a ClassLoader to a set of SharedLibHelper objects that
// it has used. We do things this way to ensure that a
// SharedLibHelper is collected if and only if the ClassLoader is.
@@ -186,8 +191,7 @@ final class VMCompiler
int offset, int len,
ProtectionDomain domain)
{
- if (precompiledMapFiles == null
- && (! useCompiler || ! canUseCompiler))
+ if (precompiledMapFiles == null && !precompiles())
return null;
byte digest[];
@@ -232,7 +236,7 @@ final class VMCompiler
}
}
- if (! useCompiler || ! canUseCompiler)
+ if (!precompiles())
return null;
try
diff --git a/libjava/java/lang/VMDouble.h b/libjava/java/lang/VMDouble.h
new file mode 100644
index 00000000000..76b6d50208a
--- /dev/null
+++ b/libjava/java/lang/VMDouble.h
@@ -0,0 +1,25 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_VMDouble__
+#define __java_lang_VMDouble__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::VMDouble : public ::java::lang::Object
+{
+
+public: // actually package-private
+ VMDouble();
+public:
+ static jlong doubleToLongBits(jdouble);
+ static jlong doubleToRawLongBits(jdouble);
+ static jdouble longBitsToDouble(jlong);
+ static ::java::lang::String * toString(jdouble, jboolean);
+ static jdouble parseDouble(::java::lang::String *);
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_VMDouble__
diff --git a/libjava/java/lang/VMFloat.h b/libjava/java/lang/VMFloat.h
new file mode 100644
index 00000000000..58e7ba9bbcc
--- /dev/null
+++ b/libjava/java/lang/VMFloat.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_VMFloat__
+#define __java_lang_VMFloat__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::VMFloat : public ::java::lang::Object
+{
+
+public: // actually package-private
+ VMFloat();
+ static jint floatToIntBits(jfloat);
+ static jint floatToRawIntBits(jfloat);
+ static jfloat intBitsToFloat(jint);
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_VMFloat__
diff --git a/libjava/java/lang/VMSecurityManager.java b/libjava/java/lang/VMSecurityManager.java
deleted file mode 100644
index 25aeb7c4964..00000000000
--- a/libjava/java/lang/VMSecurityManager.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * java.lang.SecurityManager: part of the Java Class Libraries project.
- * Copyright (C) 1998, 2001, 2002, 2005 Free Software Foundation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-package java.lang;
-
-import java.net.*;
-import java.util.*;
-import java.io.*;
-
-/**
- ** VMSecurityManager is a helper class for SecurityManager the VM must
- ** implement.
- **
- ** @author John Keiser
- ** @version 1.1.0, 31 May 1998
- **/
-class VMSecurityManager
-{
- /** Get a list of all the classes currently executing
- ** methods on the Java stack. getClassContext()[0] is
- ** the currently executing method
- ** <STRONG>Spec Note:</STRONG> does not say whether
- ** the stack will include the getClassContext() call or
- ** the one just before it.
- **
- ** @return an array containing all the methods on classes
- ** on the Java execution stack.
- **/
- static native Class[] getClassContext(Class caller);
-
- /** Get the current ClassLoader--the one nearest to the
- ** top of the stack.
- ** @return the current ClassLoader.
- **/
- static ClassLoader currentClassLoader(Class caller)
- {
- // The docs above are wrong. See the online docs.
- // FIXME this implementation is a bit wrong too -- the docs say we
- // must also consider ancestors of the system class loader.
- ClassLoader systemClassLoader = ClassLoader.systemClassLoader;
- Class[] classStack = getClassContext (caller);
- for (int i = 0; i < classStack.length; i++)
- {
- ClassLoader loader = classStack[i].getClassLoader();
- if (loader != null && loader != systemClassLoader)
- return loader;
- }
-
- return null;
- }
-}
diff --git a/libjava/java/lang/VMThrowable.h b/libjava/java/lang/VMThrowable.h
new file mode 100644
index 00000000000..1991b6cd8dd
--- /dev/null
+++ b/libjava/java/lang/VMThrowable.h
@@ -0,0 +1,36 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_VMThrowable__
+#define __java_lang_VMThrowable__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace gnu
+ {
+ namespace gcj
+ {
+ class RawDataManaged;
+ }
+ }
+}
+
+class java::lang::VMThrowable : public ::java::lang::Object
+{
+
+ VMThrowable();
+public: // actually package-private
+ static ::java::lang::VMThrowable * fillInStackTrace(::java::lang::Throwable *);
+ JArray< ::java::lang::StackTraceElement * > * getStackTrace(::java::lang::Throwable *);
+private:
+ ::gnu::gcj::RawDataManaged * __attribute__((aligned(__alignof__( ::java::lang::Object)))) data;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_VMThrowable__
diff --git a/libjava/java/lang/VerifyError.h b/libjava/java/lang/VerifyError.h
new file mode 100644
index 00000000000..54aafd27ee2
--- /dev/null
+++ b/libjava/java/lang/VerifyError.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_VerifyError__
+#define __java_lang_VerifyError__
+
+#pragma interface
+
+#include <java/lang/LinkageError.h>
+
+class java::lang::VerifyError : public ::java::lang::LinkageError
+{
+
+public:
+ VerifyError();
+ VerifyError(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 7001962396098498785LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_VerifyError__
diff --git a/libjava/java/lang/VirtualMachineError.h b/libjava/java/lang/VirtualMachineError.h
new file mode 100644
index 00000000000..9eb04ceaabb
--- /dev/null
+++ b/libjava/java/lang/VirtualMachineError.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_VirtualMachineError__
+#define __java_lang_VirtualMachineError__
+
+#pragma interface
+
+#include <java/lang/Error.h>
+
+class java::lang::VirtualMachineError : public ::java::lang::Error
+{
+
+public:
+ VirtualMachineError();
+ VirtualMachineError(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 4161983926571568670LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_VirtualMachineError__
diff --git a/libjava/java/lang/Void.h b/libjava/java/lang/Void.h
new file mode 100644
index 00000000000..be277b02aaa
--- /dev/null
+++ b/libjava/java/lang/Void.h
@@ -0,0 +1,20 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Void__
+#define __java_lang_Void__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::Void : public ::java::lang::Object
+{
+
+ Void();
+public:
+ static ::java::lang::Class * TYPE;
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Void__
diff --git a/libjava/java/lang/Win32Process.h b/libjava/java/lang/Win32Process.h
new file mode 100644
index 00000000000..0b49c6e9c33
--- /dev/null
+++ b/libjava/java/lang/Win32Process.h
@@ -0,0 +1,37 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_Win32Process__
+#define __java_lang_Win32Process__
+
+#pragma interface
+
+#include <java/lang/Process.h>
+#include <gcj/array.h>
+
+
+class java::lang::Win32Process : public ::java::lang::Process
+{
+
+public:
+ void destroy();
+ jint exitValue();
+ ::java::io::InputStream * getErrorStream();
+ ::java::io::InputStream * getInputStream();
+ ::java::io::OutputStream * getOutputStream();
+ jint waitFor();
+ Win32Process(JArray< ::java::lang::String * > *, JArray< ::java::lang::String * > *, ::java::io::File *);
+private:
+ jboolean hasExited();
+ void startProcess(JArray< ::java::lang::String * > *, JArray< ::java::lang::String * > *, ::java::io::File *);
+ void cleanup();
+ ::java::io::OutputStream * __attribute__((aligned(__alignof__( ::java::lang::Process)))) outputStream;
+ ::java::io::InputStream * inputStream;
+ ::java::io::InputStream * errorStream;
+ jint procHandle;
+ jint exitCode;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_Win32Process__
diff --git a/libjava/java/lang/Win32Process.java b/libjava/java/lang/Win32Process.java
index b0ef487c204..7d9e40fce4a 100644
--- a/libjava/java/lang/Win32Process.java
+++ b/libjava/java/lang/Win32Process.java
@@ -1,6 +1,6 @@
// Win32Process.java - Subclass of Process for Win32 systems.
-/* Copyright (C) 2002, 2003 Free Software Foundation
+/* Copyright (C) 2002, 2003, 2006 Free Software Foundation
This file is part of libgcj.
@@ -22,9 +22,7 @@ import java.io.IOException;
// This is entirely internal to our implementation.
-// This file is copied to `ConcreteProcess.java' before compilation.
-// Hence the class name apparently does not match the file name.
-final class ConcreteProcess extends Process
+final class Win32Process extends Process
{
public native void destroy ();
@@ -53,7 +51,7 @@ final class ConcreteProcess extends Process
public native int waitFor () throws InterruptedException;
- public ConcreteProcess (String[] progarray,
+ public Win32Process (String[] progarray,
String[] envp,
File dir)
throws IOException
diff --git a/libjava/java/lang/annotation/Annotation.h b/libjava/java/lang/annotation/Annotation.h
new file mode 100644
index 00000000000..9c9c3d7ab3b
--- /dev/null
+++ b/libjava/java/lang/annotation/Annotation.h
@@ -0,0 +1,22 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_annotation_Annotation__
+#define __java_lang_annotation_Annotation__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::annotation::Annotation : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::lang::Class * annotationType() = 0;
+ virtual jboolean equals(::java::lang::Object *) = 0;
+ virtual jint hashCode() = 0;
+ virtual ::java::lang::String * toString() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_annotation_Annotation__
diff --git a/libjava/java/lang/annotation/AnnotationFormatError.h b/libjava/java/lang/annotation/AnnotationFormatError.h
new file mode 100644
index 00000000000..f5c43b24151
--- /dev/null
+++ b/libjava/java/lang/annotation/AnnotationFormatError.h
@@ -0,0 +1,24 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_annotation_AnnotationFormatError__
+#define __java_lang_annotation_AnnotationFormatError__
+
+#pragma interface
+
+#include <java/lang/Error.h>
+
+class java::lang::annotation::AnnotationFormatError : public ::java::lang::Error
+{
+
+public:
+ AnnotationFormatError(::java::lang::String *);
+ AnnotationFormatError(::java::lang::String *, ::java::lang::Throwable *);
+ AnnotationFormatError(::java::lang::Throwable *);
+private:
+ static const jlong serialVersionUID = -4256701562333669892LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_annotation_AnnotationFormatError__
diff --git a/libjava/java/lang/annotation/AnnotationTypeMismatchException.h b/libjava/java/lang/annotation/AnnotationTypeMismatchException.h
new file mode 100644
index 00000000000..082d9f6a3c7
--- /dev/null
+++ b/libjava/java/lang/annotation/AnnotationTypeMismatchException.h
@@ -0,0 +1,26 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_annotation_AnnotationTypeMismatchException__
+#define __java_lang_annotation_AnnotationTypeMismatchException__
+
+#pragma interface
+
+#include <java/lang/RuntimeException.h>
+
+class java::lang::annotation::AnnotationTypeMismatchException : public ::java::lang::RuntimeException
+{
+
+public:
+ AnnotationTypeMismatchException(::java::lang::reflect::Method *, ::java::lang::String *);
+ virtual ::java::lang::reflect::Method * element();
+ virtual ::java::lang::String * foundType();
+private:
+ static const jlong serialVersionUID = 8125925355765570191LL;
+ ::java::lang::reflect::Method * __attribute__((aligned(__alignof__( ::java::lang::RuntimeException)))) element__;
+ ::java::lang::String * foundType__;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_annotation_AnnotationTypeMismatchException__
diff --git a/libjava/java/lang/annotation/Documented.h b/libjava/java/lang/annotation/Documented.h
new file mode 100644
index 00000000000..d2a920dc72a
--- /dev/null
+++ b/libjava/java/lang/annotation/Documented.h
@@ -0,0 +1,19 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_annotation_Documented__
+#define __java_lang_annotation_Documented__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::annotation::Documented : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::lang::Class * annotationType() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_annotation_Documented__
diff --git a/libjava/java/lang/annotation/ElementType.h b/libjava/java/lang/annotation/ElementType.h
new file mode 100644
index 00000000000..c475967ab5d
--- /dev/null
+++ b/libjava/java/lang/annotation/ElementType.h
@@ -0,0 +1,35 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_annotation_ElementType__
+#define __java_lang_annotation_ElementType__
+
+#pragma interface
+
+#include <java/lang/Enum.h>
+#include <gcj/array.h>
+
+
+class java::lang::annotation::ElementType : public ::java::lang::Enum
+{
+
+ ElementType(::java::lang::String *, jint);
+public:
+ static JArray< ::java::lang::annotation::ElementType * > * values();
+ static ::java::lang::annotation::ElementType * valueOf(::java::lang::String *);
+ static ::java::lang::annotation::ElementType * ANNOTATION_TYPE;
+ static ::java::lang::annotation::ElementType * CONSTRUCTOR;
+ static ::java::lang::annotation::ElementType * FIELD;
+ static ::java::lang::annotation::ElementType * LOCAL_VARIABLE;
+ static ::java::lang::annotation::ElementType * METHOD;
+ static ::java::lang::annotation::ElementType * PACKAGE;
+ static ::java::lang::annotation::ElementType * PARAMETER;
+ static ::java::lang::annotation::ElementType * TYPE;
+private:
+ static const jlong serialVersionUID = 2798216111136361587LL;
+ static JArray< ::java::lang::annotation::ElementType * > * ENUM$VALUES;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_annotation_ElementType__
diff --git a/libjava/java/lang/annotation/IncompleteAnnotationException.h b/libjava/java/lang/annotation/IncompleteAnnotationException.h
new file mode 100644
index 00000000000..aff0f7e0b37
--- /dev/null
+++ b/libjava/java/lang/annotation/IncompleteAnnotationException.h
@@ -0,0 +1,25 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_annotation_IncompleteAnnotationException__
+#define __java_lang_annotation_IncompleteAnnotationException__
+
+#pragma interface
+
+#include <java/lang/RuntimeException.h>
+
+class java::lang::annotation::IncompleteAnnotationException : public ::java::lang::RuntimeException
+{
+
+public:
+ IncompleteAnnotationException(::java::lang::Class *, ::java::lang::String *);
+ virtual ::java::lang::Class * annotationType();
+ virtual ::java::lang::String * elementName();
+private:
+ ::java::lang::Class * __attribute__((aligned(__alignof__( ::java::lang::RuntimeException)))) annotationType__;
+ ::java::lang::String * elementName__;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_annotation_IncompleteAnnotationException__
diff --git a/libjava/java/lang/annotation/Inherited.h b/libjava/java/lang/annotation/Inherited.h
new file mode 100644
index 00000000000..b1ebc883eca
--- /dev/null
+++ b/libjava/java/lang/annotation/Inherited.h
@@ -0,0 +1,19 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_annotation_Inherited__
+#define __java_lang_annotation_Inherited__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::annotation::Inherited : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::lang::Class * annotationType() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_annotation_Inherited__
diff --git a/libjava/java/lang/annotation/Retention.h b/libjava/java/lang/annotation/Retention.h
new file mode 100644
index 00000000000..42fb4a542b6
--- /dev/null
+++ b/libjava/java/lang/annotation/Retention.h
@@ -0,0 +1,20 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_annotation_Retention__
+#define __java_lang_annotation_Retention__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::annotation::Retention : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::lang::annotation::RetentionPolicy * value() = 0;
+ virtual ::java::lang::Class * annotationType() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_annotation_Retention__
diff --git a/libjava/java/lang/annotation/RetentionPolicy.h b/libjava/java/lang/annotation/RetentionPolicy.h
new file mode 100644
index 00000000000..5d642601dc6
--- /dev/null
+++ b/libjava/java/lang/annotation/RetentionPolicy.h
@@ -0,0 +1,30 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_annotation_RetentionPolicy__
+#define __java_lang_annotation_RetentionPolicy__
+
+#pragma interface
+
+#include <java/lang/Enum.h>
+#include <gcj/array.h>
+
+
+class java::lang::annotation::RetentionPolicy : public ::java::lang::Enum
+{
+
+ RetentionPolicy(::java::lang::String *, jint);
+public:
+ static JArray< ::java::lang::annotation::RetentionPolicy * > * values();
+ static ::java::lang::annotation::RetentionPolicy * valueOf(::java::lang::String *);
+ static ::java::lang::annotation::RetentionPolicy * CLASS;
+ static ::java::lang::annotation::RetentionPolicy * RUNTIME;
+ static ::java::lang::annotation::RetentionPolicy * SOURCE;
+private:
+ static const jlong serialVersionUID = -1700821648800605045LL;
+ static JArray< ::java::lang::annotation::RetentionPolicy * > * ENUM$VALUES;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_annotation_RetentionPolicy__
diff --git a/libjava/java/lang/annotation/Target.h b/libjava/java/lang/annotation/Target.h
new file mode 100644
index 00000000000..96ac5178821
--- /dev/null
+++ b/libjava/java/lang/annotation/Target.h
@@ -0,0 +1,22 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_annotation_Target__
+#define __java_lang_annotation_Target__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::annotation::Target : public ::java::lang::Object
+{
+
+public:
+ virtual JArray< ::java::lang::annotation::ElementType * > * value() = 0;
+ virtual ::java::lang::Class * annotationType() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_annotation_Target__
diff --git a/libjava/java/lang/instrument/ClassDefinition.h b/libjava/java/lang/instrument/ClassDefinition.h
new file mode 100644
index 00000000000..b9106ed8eee
--- /dev/null
+++ b/libjava/java/lang/instrument/ClassDefinition.h
@@ -0,0 +1,27 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_instrument_ClassDefinition__
+#define __java_lang_instrument_ClassDefinition__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::instrument::ClassDefinition : public ::java::lang::Object
+{
+
+public:
+ ClassDefinition(::java::lang::Class *, JArray< jbyte > *);
+ ::java::lang::Class * getDefinitionClass();
+ JArray< jbyte > * getDefinitionClassFile();
+private:
+ ::java::lang::Class * __attribute__((aligned(__alignof__( ::java::lang::Object)))) theClass;
+ JArray< jbyte > * theClassFile;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_instrument_ClassDefinition__
diff --git a/libjava/java/lang/instrument/ClassFileTransformer.h b/libjava/java/lang/instrument/ClassFileTransformer.h
new file mode 100644
index 00000000000..cda1510b0a6
--- /dev/null
+++ b/libjava/java/lang/instrument/ClassFileTransformer.h
@@ -0,0 +1,31 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_instrument_ClassFileTransformer__
+#define __java_lang_instrument_ClassFileTransformer__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace security
+ {
+ class ProtectionDomain;
+ }
+ }
+}
+
+class java::lang::instrument::ClassFileTransformer : public ::java::lang::Object
+{
+
+public:
+ virtual JArray< jbyte > * transform(::java::lang::ClassLoader *, ::java::lang::String *, ::java::lang::Class *, ::java::security::ProtectionDomain *, JArray< jbyte > *) = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_instrument_ClassFileTransformer__
diff --git a/libjava/java/lang/instrument/IllegalClassFormatException.h b/libjava/java/lang/instrument/IllegalClassFormatException.h
new file mode 100644
index 00000000000..c1b8783e777
--- /dev/null
+++ b/libjava/java/lang/instrument/IllegalClassFormatException.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_instrument_IllegalClassFormatException__
+#define __java_lang_instrument_IllegalClassFormatException__
+
+#pragma interface
+
+#include <java/lang/Exception.h>
+
+class java::lang::instrument::IllegalClassFormatException : public ::java::lang::Exception
+{
+
+public:
+ IllegalClassFormatException();
+ IllegalClassFormatException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -3841736710924794009LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_instrument_IllegalClassFormatException__
diff --git a/libjava/java/lang/instrument/Instrumentation.h b/libjava/java/lang/instrument/Instrumentation.h
new file mode 100644
index 00000000000..d131d0c6948
--- /dev/null
+++ b/libjava/java/lang/instrument/Instrumentation.h
@@ -0,0 +1,27 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_instrument_Instrumentation__
+#define __java_lang_instrument_Instrumentation__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::instrument::Instrumentation : public ::java::lang::Object
+{
+
+public:
+ virtual void addTransformer(::java::lang::instrument::ClassFileTransformer *) = 0;
+ virtual jboolean removeTransformer(::java::lang::instrument::ClassFileTransformer *) = 0;
+ virtual jboolean isRedefineClassesSupported() = 0;
+ virtual void redefineClasses(JArray< ::java::lang::instrument::ClassDefinition * > *) = 0;
+ virtual JArray< ::java::lang::Class * > * getAllLoadedClasses() = 0;
+ virtual JArray< ::java::lang::Class * > * getInitiatedClasses(::java::lang::ClassLoader *) = 0;
+ virtual jlong getObjectSize(::java::lang::Object *) = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_instrument_Instrumentation__
diff --git a/libjava/java/lang/instrument/UnmodifiableClassException.h b/libjava/java/lang/instrument/UnmodifiableClassException.h
new file mode 100644
index 00000000000..e5fac3cdd41
--- /dev/null
+++ b/libjava/java/lang/instrument/UnmodifiableClassException.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_instrument_UnmodifiableClassException__
+#define __java_lang_instrument_UnmodifiableClassException__
+
+#pragma interface
+
+#include <java/lang/Exception.h>
+
+class java::lang::instrument::UnmodifiableClassException : public ::java::lang::Exception
+{
+
+public:
+ UnmodifiableClassException();
+ UnmodifiableClassException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 1716652643585309178LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_instrument_UnmodifiableClassException__
diff --git a/libjava/java/lang/management/ClassLoadingMXBean.h b/libjava/java/lang/management/ClassLoadingMXBean.h
new file mode 100644
index 00000000000..371b63d3dd0
--- /dev/null
+++ b/libjava/java/lang/management/ClassLoadingMXBean.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_management_ClassLoadingMXBean__
+#define __java_lang_management_ClassLoadingMXBean__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::management::ClassLoadingMXBean : public ::java::lang::Object
+{
+
+public:
+ virtual jint getLoadedClassCount() = 0;
+ virtual jlong getTotalLoadedClassCount() = 0;
+ virtual jlong getUnloadedClassCount() = 0;
+ virtual jboolean isVerbose() = 0;
+ virtual void setVerbose(jboolean) = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_management_ClassLoadingMXBean__
diff --git a/libjava/java/lang/management/CompilationMXBean.h b/libjava/java/lang/management/CompilationMXBean.h
new file mode 100644
index 00000000000..bbd1e0a210e
--- /dev/null
+++ b/libjava/java/lang/management/CompilationMXBean.h
@@ -0,0 +1,21 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_management_CompilationMXBean__
+#define __java_lang_management_CompilationMXBean__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::management::CompilationMXBean : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::lang::String * getName() = 0;
+ virtual jboolean isCompilationTimeMonitoringSupported() = 0;
+ virtual jlong getTotalCompilationTime() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_management_CompilationMXBean__
diff --git a/libjava/java/lang/management/GarbageCollectorMXBean.h b/libjava/java/lang/management/GarbageCollectorMXBean.h
new file mode 100644
index 00000000000..35222cab065
--- /dev/null
+++ b/libjava/java/lang/management/GarbageCollectorMXBean.h
@@ -0,0 +1,25 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_management_GarbageCollectorMXBean__
+#define __java_lang_management_GarbageCollectorMXBean__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::management::GarbageCollectorMXBean : public ::java::lang::Object
+{
+
+public:
+ virtual jlong getCollectionCount() = 0;
+ virtual jlong getCollectionTime() = 0;
+ virtual JArray< ::java::lang::String * > * getMemoryPoolNames() = 0;
+ virtual ::java::lang::String * getName() = 0;
+ virtual jboolean isValid() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_management_GarbageCollectorMXBean__
diff --git a/libjava/java/lang/management/ManagementFactory.h b/libjava/java/lang/management/ManagementFactory.h
new file mode 100644
index 00000000000..a315333be05
--- /dev/null
+++ b/libjava/java/lang/management/ManagementFactory.h
@@ -0,0 +1,57 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_management_ManagementFactory__
+#define __java_lang_management_ManagementFactory__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace javax
+ {
+ namespace management
+ {
+ class MBeanServer;
+ }
+ }
+}
+
+class java::lang::management::ManagementFactory : public ::java::lang::Object
+{
+
+ ManagementFactory();
+public:
+ static ::java::lang::management::OperatingSystemMXBean * getOperatingSystemMXBean();
+ static ::java::lang::management::RuntimeMXBean * getRuntimeMXBean();
+ static ::java::lang::management::ClassLoadingMXBean * getClassLoadingMXBean();
+ static ::java::lang::management::ThreadMXBean * getThreadMXBean();
+ static ::java::lang::management::MemoryMXBean * getMemoryMXBean();
+ static ::java::lang::management::CompilationMXBean * getCompilationMXBean();
+ static ::java::util::List * getMemoryPoolMXBeans();
+ static ::java::util::List * getMemoryManagerMXBeans();
+ static ::java::util::List * getGarbageCollectorMXBeans();
+ static ::javax::management::MBeanServer * getPlatformMBeanServer();
+ static ::java::lang::String * CLASS_LOADING_MXBEAN_NAME;
+ static ::java::lang::String * COMPILATION_MXBEAN_NAME;
+ static ::java::lang::String * GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE;
+ static ::java::lang::String * MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE;
+ static ::java::lang::String * MEMORY_MXBEAN_NAME;
+ static ::java::lang::String * MEMORY_POOL_MXBEAN_DOMAIN_TYPE;
+ static ::java::lang::String * OPERATING_SYSTEM_MXBEAN_NAME;
+ static ::java::lang::String * RUNTIME_MXBEAN_NAME;
+ static ::java::lang::String * THREAD_MXBEAN_NAME;
+private:
+ static ::java::lang::management::OperatingSystemMXBean * osBean;
+ static ::java::lang::management::RuntimeMXBean * runtimeBean;
+ static ::java::lang::management::ClassLoadingMXBean * classLoadingBean;
+ static ::java::lang::management::ThreadMXBean * threadBean;
+ static ::java::lang::management::MemoryMXBean * memoryBean;
+ static ::java::lang::management::CompilationMXBean * compilationBean;
+ static ::javax::management::MBeanServer * platformServer;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_management_ManagementFactory__
diff --git a/libjava/java/lang/management/ManagementPermission.h b/libjava/java/lang/management/ManagementPermission.h
new file mode 100644
index 00000000000..4ac4a4fef4f
--- /dev/null
+++ b/libjava/java/lang/management/ManagementPermission.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_management_ManagementPermission__
+#define __java_lang_management_ManagementPermission__
+
+#pragma interface
+
+#include <java/security/BasicPermission.h>
+
+class java::lang::management::ManagementPermission : public ::java::security::BasicPermission
+{
+
+public:
+ ManagementPermission(::java::lang::String *);
+ ManagementPermission(::java::lang::String *, ::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 1897496590799378737LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_management_ManagementPermission__
diff --git a/libjava/java/lang/management/MemoryMXBean.h b/libjava/java/lang/management/MemoryMXBean.h
new file mode 100644
index 00000000000..2fb70add22e
--- /dev/null
+++ b/libjava/java/lang/management/MemoryMXBean.h
@@ -0,0 +1,24 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_management_MemoryMXBean__
+#define __java_lang_management_MemoryMXBean__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::management::MemoryMXBean : public ::java::lang::Object
+{
+
+public:
+ virtual void gc() = 0;
+ virtual ::java::lang::management::MemoryUsage * getHeapMemoryUsage() = 0;
+ virtual ::java::lang::management::MemoryUsage * getNonHeapMemoryUsage() = 0;
+ virtual jint getObjectPendingFinalizationCount() = 0;
+ virtual jboolean isVerbose() = 0;
+ virtual void setVerbose(jboolean) = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_management_MemoryMXBean__
diff --git a/libjava/java/lang/management/MemoryManagerMXBean.h b/libjava/java/lang/management/MemoryManagerMXBean.h
new file mode 100644
index 00000000000..6509205a9b0
--- /dev/null
+++ b/libjava/java/lang/management/MemoryManagerMXBean.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_management_MemoryManagerMXBean__
+#define __java_lang_management_MemoryManagerMXBean__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::management::MemoryManagerMXBean : public ::java::lang::Object
+{
+
+public:
+ virtual JArray< ::java::lang::String * > * getMemoryPoolNames() = 0;
+ virtual ::java::lang::String * getName() = 0;
+ virtual jboolean isValid() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_management_MemoryManagerMXBean__
diff --git a/libjava/java/lang/management/MemoryNotificationInfo.h b/libjava/java/lang/management/MemoryNotificationInfo.h
new file mode 100644
index 00000000000..07cfefff3bb
--- /dev/null
+++ b/libjava/java/lang/management/MemoryNotificationInfo.h
@@ -0,0 +1,43 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_management_MemoryNotificationInfo__
+#define __java_lang_management_MemoryNotificationInfo__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace javax
+ {
+ namespace management
+ {
+ namespace openmbean
+ {
+ class CompositeData;
+ }
+ }
+ }
+}
+
+class java::lang::management::MemoryNotificationInfo : public ::java::lang::Object
+{
+
+public:
+ MemoryNotificationInfo(::java::lang::String *, ::java::lang::management::MemoryUsage *, jlong);
+ static ::java::lang::management::MemoryNotificationInfo * from(::javax::management::openmbean::CompositeData *);
+ virtual jlong getCount();
+ virtual ::java::lang::String * getPoolName();
+ virtual ::java::lang::management::MemoryUsage * getUsage();
+ static ::java::lang::String * MEMORY_THRESHOLD_EXCEEDED;
+ static ::java::lang::String * MEMORY_COLLECTION_THRESHOLD_EXCEEDED;
+private:
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) poolName;
+ ::java::lang::management::MemoryUsage * usage;
+ jlong count;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_management_MemoryNotificationInfo__
diff --git a/libjava/java/lang/management/MemoryPoolMXBean.h b/libjava/java/lang/management/MemoryPoolMXBean.h
new file mode 100644
index 00000000000..4209d573a9d
--- /dev/null
+++ b/libjava/java/lang/management/MemoryPoolMXBean.h
@@ -0,0 +1,38 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_management_MemoryPoolMXBean__
+#define __java_lang_management_MemoryPoolMXBean__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::management::MemoryPoolMXBean : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::lang::management::MemoryUsage * getCollectionUsage() = 0;
+ virtual jlong getCollectionUsageThreshold() = 0;
+ virtual jlong getCollectionUsageThresholdCount() = 0;
+ virtual JArray< ::java::lang::String * > * getMemoryManagerNames() = 0;
+ virtual ::java::lang::String * getName() = 0;
+ virtual ::java::lang::management::MemoryUsage * getPeakUsage() = 0;
+ virtual ::java::lang::management::MemoryType * getType() = 0;
+ virtual ::java::lang::management::MemoryUsage * getUsage() = 0;
+ virtual jlong getUsageThreshold() = 0;
+ virtual jlong getUsageThresholdCount() = 0;
+ virtual jboolean isCollectionUsageThresholdExceeded() = 0;
+ virtual jboolean isCollectionUsageThresholdSupported() = 0;
+ virtual jboolean isUsageThresholdExceeded() = 0;
+ virtual jboolean isUsageThresholdSupported() = 0;
+ virtual jboolean isValid() = 0;
+ virtual void resetPeakUsage() = 0;
+ virtual void setCollectionUsageThreshold(jlong) = 0;
+ virtual void setUsageThreshold(jlong) = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_management_MemoryPoolMXBean__
diff --git a/libjava/java/lang/management/MemoryType.h b/libjava/java/lang/management/MemoryType.h
new file mode 100644
index 00000000000..b93587d308a
--- /dev/null
+++ b/libjava/java/lang/management/MemoryType.h
@@ -0,0 +1,28 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_management_MemoryType__
+#define __java_lang_management_MemoryType__
+
+#pragma interface
+
+#include <java/lang/Enum.h>
+#include <gcj/array.h>
+
+
+class java::lang::management::MemoryType : public ::java::lang::Enum
+{
+
+ MemoryType(::java::lang::String *, jint);
+public:
+ static JArray< ::java::lang::management::MemoryType * > * values();
+ static ::java::lang::management::MemoryType * valueOf(::java::lang::String *);
+ static ::java::lang::management::MemoryType * HEAP;
+ static ::java::lang::management::MemoryType * NON_HEAP;
+private:
+ static JArray< ::java::lang::management::MemoryType * > * ENUM$VALUES;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_management_MemoryType__
diff --git a/libjava/java/lang/management/MemoryUsage.h b/libjava/java/lang/management/MemoryUsage.h
new file mode 100644
index 00000000000..3b126f8183e
--- /dev/null
+++ b/libjava/java/lang/management/MemoryUsage.h
@@ -0,0 +1,44 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_management_MemoryUsage__
+#define __java_lang_management_MemoryUsage__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace javax
+ {
+ namespace management
+ {
+ namespace openmbean
+ {
+ class CompositeData;
+ }
+ }
+ }
+}
+
+class java::lang::management::MemoryUsage : public ::java::lang::Object
+{
+
+public:
+ MemoryUsage(jlong, jlong, jlong, jlong);
+ static ::java::lang::management::MemoryUsage * from(::javax::management::openmbean::CompositeData *);
+ virtual jlong getCommitted();
+ virtual jlong getInit();
+ virtual jlong getMax();
+ virtual jlong getUsed();
+ virtual ::java::lang::String * toString();
+private:
+ jlong __attribute__((aligned(__alignof__( ::java::lang::Object)))) init;
+ jlong used;
+ jlong committed;
+ jlong maximum;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_management_MemoryUsage__
diff --git a/libjava/java/lang/management/OperatingSystemMXBean.h b/libjava/java/lang/management/OperatingSystemMXBean.h
new file mode 100644
index 00000000000..adb562cf516
--- /dev/null
+++ b/libjava/java/lang/management/OperatingSystemMXBean.h
@@ -0,0 +1,22 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_management_OperatingSystemMXBean__
+#define __java_lang_management_OperatingSystemMXBean__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::management::OperatingSystemMXBean : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::lang::String * getArch() = 0;
+ virtual jint getAvailableProcessors() = 0;
+ virtual ::java::lang::String * getName() = 0;
+ virtual ::java::lang::String * getVersion() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_management_OperatingSystemMXBean__
diff --git a/libjava/java/lang/management/RuntimeMXBean.h b/libjava/java/lang/management/RuntimeMXBean.h
new file mode 100644
index 00000000000..c2666744020
--- /dev/null
+++ b/libjava/java/lang/management/RuntimeMXBean.h
@@ -0,0 +1,34 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_management_RuntimeMXBean__
+#define __java_lang_management_RuntimeMXBean__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::management::RuntimeMXBean : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::lang::String * getBootClassPath() = 0;
+ virtual ::java::lang::String * getClassPath() = 0;
+ virtual ::java::util::List * getInputArguments() = 0;
+ virtual ::java::lang::String * getLibraryPath() = 0;
+ virtual ::java::lang::String * getManagementSpecVersion() = 0;
+ virtual ::java::lang::String * getName() = 0;
+ virtual ::java::lang::String * getSpecName() = 0;
+ virtual ::java::lang::String * getSpecVendor() = 0;
+ virtual ::java::lang::String * getSpecVersion() = 0;
+ virtual jlong getStartTime() = 0;
+ virtual ::java::util::Map * getSystemProperties() = 0;
+ virtual jlong getUptime() = 0;
+ virtual ::java::lang::String * getVmName() = 0;
+ virtual ::java::lang::String * getVmVendor() = 0;
+ virtual ::java::lang::String * getVmVersion() = 0;
+ virtual jboolean isBootClassPathSupported() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_management_RuntimeMXBean__
diff --git a/libjava/java/lang/management/ThreadInfo.h b/libjava/java/lang/management/ThreadInfo.h
new file mode 100644
index 00000000000..a06b99ce4cc
--- /dev/null
+++ b/libjava/java/lang/management/ThreadInfo.h
@@ -0,0 +1,70 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_management_ThreadInfo__
+#define __java_lang_management_ThreadInfo__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace javax
+ {
+ namespace management
+ {
+ namespace openmbean
+ {
+ class CompositeData;
+ class CompositeType;
+ class OpenType;
+ }
+ }
+ }
+}
+
+class java::lang::management::ThreadInfo : public ::java::lang::Object
+{
+
+ ThreadInfo(::java::lang::Thread *, jlong, jlong, ::java::lang::Object *, ::java::lang::Thread *, jlong, jlong, jboolean, jboolean, JArray< ::java::lang::StackTraceElement * > *);
+ ThreadInfo(jlong, ::java::lang::String *, ::java::lang::Thread$State *, jlong, jlong, ::java::lang::String *, jlong, ::java::lang::String *, jlong, jlong, jboolean, jboolean, JArray< ::java::lang::StackTraceElement * > *);
+public: // actually package-private
+ static void checkAttribute(::javax::management::openmbean::CompositeType *, ::java::lang::String *, ::javax::management::openmbean::OpenType *);
+public:
+ static ::java::lang::management::ThreadInfo * from(::javax::management::openmbean::CompositeData *);
+ virtual jlong getBlockedCount();
+ virtual jlong getBlockedTime();
+ virtual ::java::lang::String * getLockName();
+ virtual jlong getLockOwnerId();
+ virtual ::java::lang::String * getLockOwnerName();
+ virtual JArray< ::java::lang::StackTraceElement * > * getStackTrace();
+ virtual jlong getThreadId();
+ virtual ::java::lang::String * getThreadName();
+ virtual ::java::lang::Thread$State * getThreadState();
+ virtual jlong getWaitedCount();
+ virtual jlong getWaitedTime();
+ virtual jboolean isInNative();
+ virtual jboolean isSuspended();
+ virtual ::java::lang::String * toString();
+private:
+ jlong __attribute__((aligned(__alignof__( ::java::lang::Object)))) threadId;
+ ::java::lang::String * threadName;
+ ::java::lang::Thread$State * threadState;
+ jlong blockedCount;
+ jlong blockedTime;
+ ::java::lang::String * lockName;
+ jlong lockOwnerId;
+ ::java::lang::String * lockOwnerName;
+ jlong waitedCount;
+ jlong waitedTime;
+ jboolean isInNative__;
+ jboolean isSuspended__;
+ JArray< ::java::lang::StackTraceElement * > * trace;
+ static ::java::lang::management::ThreadMXBean * bean;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_management_ThreadInfo__
diff --git a/libjava/java/lang/management/ThreadMXBean.h b/libjava/java/lang/management/ThreadMXBean.h
new file mode 100644
index 00000000000..a160b088149
--- /dev/null
+++ b/libjava/java/lang/management/ThreadMXBean.h
@@ -0,0 +1,42 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_management_ThreadMXBean__
+#define __java_lang_management_ThreadMXBean__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::management::ThreadMXBean : public ::java::lang::Object
+{
+
+public:
+ virtual JArray< jlong > * findMonitorDeadlockedThreads() = 0;
+ virtual JArray< jlong > * getAllThreadIds() = 0;
+ virtual jlong getCurrentThreadCpuTime() = 0;
+ virtual jlong getCurrentThreadUserTime() = 0;
+ virtual jint getDaemonThreadCount() = 0;
+ virtual jint getPeakThreadCount() = 0;
+ virtual jint getThreadCount() = 0;
+ virtual jlong getThreadCpuTime(jlong) = 0;
+ virtual ::java::lang::management::ThreadInfo * getThreadInfo(jlong) = 0;
+ virtual JArray< ::java::lang::management::ThreadInfo * > * getThreadInfo(JArray< jlong > *) = 0;
+ virtual ::java::lang::management::ThreadInfo * getThreadInfo(jlong, jint) = 0;
+ virtual JArray< ::java::lang::management::ThreadInfo * > * getThreadInfo(JArray< jlong > *, jint) = 0;
+ virtual jlong getThreadUserTime(jlong) = 0;
+ virtual jlong getTotalStartedThreadCount() = 0;
+ virtual jboolean isCurrentThreadCpuTimeSupported() = 0;
+ virtual jboolean isThreadContentionMonitoringEnabled() = 0;
+ virtual jboolean isThreadContentionMonitoringSupported() = 0;
+ virtual jboolean isThreadCpuTimeEnabled() = 0;
+ virtual jboolean isThreadCpuTimeSupported() = 0;
+ virtual void resetPeakThreadCount() = 0;
+ virtual void setThreadContentionMonitoringEnabled(jboolean) = 0;
+ virtual void setThreadCpuTimeEnabled(jboolean) = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_management_ThreadMXBean__
diff --git a/libjava/java/lang/management/VMManagementFactory.h b/libjava/java/lang/management/VMManagementFactory.h
new file mode 100644
index 00000000000..e712cbfc871
--- /dev/null
+++ b/libjava/java/lang/management/VMManagementFactory.h
@@ -0,0 +1,25 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_management_VMManagementFactory__
+#define __java_lang_management_VMManagementFactory__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::management::VMManagementFactory : public ::java::lang::Object
+{
+
+public: // actually package-private
+ VMManagementFactory();
+ static JArray< ::java::lang::String * > * getMemoryPoolNames();
+ static JArray< ::java::lang::String * > * getMemoryManagerNames();
+ static JArray< ::java::lang::String * > * getGarbageCollectorNames();
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_management_VMManagementFactory__
diff --git a/libjava/java/lang/management/VMManagementFactory.java b/libjava/java/lang/management/VMManagementFactory.java
index 6a906c730db..f10497014b4 100644
--- a/libjava/java/lang/management/VMManagementFactory.java
+++ b/libjava/java/lang/management/VMManagementFactory.java
@@ -54,10 +54,7 @@ final class VMManagementFactory
*
* @return a list of memory pool names.
*/
- static String[] getMemoryPoolNames()
- {
- return new String[0];
- }
+ static native String[] getMemoryPoolNames();
/**
* Return a list of the names of the currently available
@@ -66,10 +63,7 @@ final class VMManagementFactory
*
* @return a list of memory manager names.
*/
- static String[] getMemoryManagerNames()
- {
- return new String[0];
- }
+ static native String[] getMemoryManagerNames();
/**
* Return a list of the names of the currently available
@@ -77,8 +71,5 @@ final class VMManagementFactory
*
* @return a list of garbage collector names.
*/
- static String[] getGarbageCollectorNames()
- {
- return new String[0];
- }
+ static native String[] getGarbageCollectorNames();
}
diff --git a/libjava/java/lang/management/natVMManagementFactory.cc b/libjava/java/lang/management/natVMManagementFactory.cc
new file mode 100644
index 00000000000..35a418bb338
--- /dev/null
+++ b/libjava/java/lang/management/natVMManagementFactory.cc
@@ -0,0 +1,44 @@
+/* Copyright (C) 2006 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+/**
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ * @date Tue 08 Aug 2006 */
+/* Implemented for our sole pool, the heap, and our sole memory
+ * manager/garbage collector, Boehm GC.
+ * Status: Believed complete and correct.
+ */
+
+#include <config.h>
+
+#include <gcj/cni.h>
+#include <java/lang/String.h>
+#include <java/lang/management/VMManagementFactory.h>
+
+JArray< ::java::lang::String *> *
+java::lang::management::VMManagementFactory::getMemoryPoolNames ()
+{
+ return (JArray<jstring>*)
+ JvNewObjectArray(1, &java::lang::String::class$, JvNewStringLatin1("Heap"));
+}
+
+
+JArray< ::java::lang::String *> *
+java::lang::management::VMManagementFactory::getMemoryManagerNames ()
+{
+ return (JArray<jstring>*)
+ JvNewObjectArray(0, &java::lang::String::class$, NULL);
+}
+
+
+JArray< ::java::lang::String *> *
+java::lang::management::VMManagementFactory::getGarbageCollectorNames ()
+{
+ return (JArray<jstring>*)
+ JvNewObjectArray(1, &java::lang::String::class$, JvNewStringLatin1("BoehmGC"));
+}
diff --git a/libjava/java/lang/natClass.cc b/libjava/java/lang/natClass.cc
index 491faa7989a..cf07e8642fe 100644
--- a/libjava/java/lang/natClass.cc
+++ b/libjava/java/lang/natClass.cc
@@ -56,6 +56,21 @@ details. */
#include <gcj/method.h>
#include <gnu/gcj/RawData.h>
#include <java/lang/VerifyError.h>
+#include <java/lang/InternalError.h>
+#include <java/lang/TypeNotPresentException.h>
+#include <java/lang/Byte.h>
+#include <java/lang/Short.h>
+#include <java/lang/Integer.h>
+#include <java/lang/Float.h>
+#include <java/lang/Double.h>
+#include <java/lang/Long.h>
+#include <java/lang/Character.h>
+#include <java/lang/Boolean.h>
+#include <java/lang/annotation/Annotation.h>
+#include <java/util/HashMap.h>
+#include <java/util/Map.h>
+#include <sun/reflect/annotation/AnnotationInvocationHandler.h>
+#include <java/lang/Enum.h>
#include <java-cpool.h>
#include <java-interp.h>
@@ -426,25 +441,6 @@ java::lang::Class::getName (void)
}
JArray<jclass> *
-java::lang::Class::getDeclaredClasses (jboolean /*publicOnly*/)
-{
- // Until we have inner classes, it always makes sense to return an
- // empty array.
- JArray<jclass> *result
- = (JArray<jclass> *) JvNewObjectArray (0, &java::lang::Class::class$,
- NULL);
- return result;
-}
-
-jclass
-java::lang::Class::getDeclaringClass (void)
-{
- // Until we have inner classes, it makes sense to always return
- // NULL.
- return NULL;
-}
-
-JArray<jclass> *
java::lang::Class::getInterfaces (void)
{
jobjectArray r = JvNewObjectArray (interface_count, getClass (), NULL);
@@ -851,6 +847,738 @@ java::lang::Class::setSigners(JArray<jobject> *s)
+static unsigned char
+read_u1 (unsigned char *&p)
+{
+ return *p++;
+}
+
+static unsigned char
+read_u1 (unsigned char *&p, unsigned char *next)
+{
+ if (next - p < 1)
+ throw new java::lang::InternalError();
+ return *p++;
+}
+
+static unsigned int
+read_u2 (unsigned char *&p)
+{
+ unsigned int b1 = *p++;
+ unsigned int b2 = *p++;
+ return (b1 << 8) | b2;
+}
+
+static unsigned int
+read_u2 (unsigned char *&p, unsigned char *next)
+{
+ if (next - p < 2)
+ throw new java::lang::InternalError();
+ return read_u2 (p);
+}
+
+static int
+read_4 (unsigned char *&p)
+{
+ int b1 = *p++;
+ int b2 = *p++;
+ int b3 = *p++;
+ int b4 = *p++;
+ return (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
+}
+
+jstring
+java::lang::Class::getReflectionSignature (jint /*jv_attr_type*/ type,
+ jint obj_index)
+{
+ // We just re-parse the bytecode for this data each time. If
+ // necessary we can cache results, but I suspect this is not
+ // performance sensitive.
+ unsigned char *bytes = reflection_data;
+ if (bytes == NULL)
+ return NULL;
+ while (true)
+ {
+ int kind = read_u1 (bytes);
+ if (kind == JV_DONE_ATTR)
+ return NULL;
+ int len = read_4 (bytes);
+ unsigned char *next = bytes + len;
+ if (kind != type)
+ {
+ bytes = next;
+ continue;
+ }
+ if (type != JV_CLASS_ATTR)
+ {
+ unsigned short index = read_u2 (bytes, next);
+ if (index != obj_index)
+ {
+ bytes = next;
+ continue;
+ }
+ }
+ int nt = read_u1 (bytes, next);
+ if (nt != JV_SIGNATURE_KIND)
+ {
+ bytes = next;
+ continue;
+ }
+ unsigned int cpool_idx = read_u2 (bytes, next);
+ if (cpool_idx >= (unsigned int) constants.size
+ || constants.tags[cpool_idx] != JV_CONSTANT_Utf8)
+ {
+ // We just ignore errors for now. It isn't clear what is
+ // best to do here, as an encoding error here means a bug
+ // either in the compiler or in defineclass.cc.
+ return NULL;
+ }
+ return _Jv_NewStringUtf8Const (constants.data[cpool_idx].utf8);
+ }
+}
+
+jstring
+java::lang::Class::getReflectionSignature (::java::lang::reflect::Constructor *c)
+{
+ _Jv_Method *meth = _Jv_FromReflectedConstructor (c);
+ unsigned short meth_index = meth - methods;
+ return getReflectionSignature (JV_METHOD_ATTR, meth_index);
+}
+
+jstring
+java::lang::Class::getReflectionSignature (::java::lang::reflect::Method *m)
+{
+ _Jv_Method *meth = _Jv_FromReflectedMethod (m);
+ unsigned short meth_index = meth - methods;
+ return getReflectionSignature (JV_METHOD_ATTR, meth_index);
+}
+
+jstring
+java::lang::Class::getReflectionSignature (::java::lang::reflect::Field *f)
+{
+ _Jv_Field *fld = _Jv_FromReflectedField (f);
+ unsigned short fld_index = fld - fields;
+ return getReflectionSignature (JV_FIELD_ATTR, fld_index);
+}
+
+jstring
+java::lang::Class::getClassSignature()
+{
+ return getReflectionSignature (JV_CLASS_ATTR, 0);
+}
+
+jint
+java::lang::Class::getEnclosingMethodData()
+{
+ unsigned char *bytes = reflection_data;
+ if (bytes == NULL)
+ return 0;
+ while (true)
+ {
+ int kind = read_u1 (bytes);
+ if (kind == JV_DONE_ATTR)
+ return 0;
+ int len = read_4 (bytes);
+ unsigned char *next = bytes + len;
+ if (kind != JV_CLASS_ATTR)
+ {
+ bytes = next;
+ continue;
+ }
+ int type = read_u1 (bytes, next);
+ if (type != JV_ENCLOSING_METHOD_KIND)
+ {
+ bytes = next;
+ continue;
+ }
+ int class_index = read_u2 (bytes, next);
+ int method_index = read_u2 (bytes, next);
+ _Jv_word result;
+ _Jv_storeIndexes (&result, class_index, method_index);
+ return result.i;
+ }
+}
+
+jclass
+java::lang::Class::getEnclosingClass()
+{
+ _Jv_word indexes;
+ indexes.i = getEnclosingMethodData();
+ if (indexes.i == 0)
+ return NULL;
+ _Jv_ushort class_index, method_index;
+ _Jv_loadIndexes (&indexes, class_index, method_index);
+ return _Jv_Linker::resolve_pool_entry (this, class_index).clazz;
+}
+
+::java::lang::reflect::Method *
+java::lang::Class::getEnclosingMethod()
+{
+ _Jv_word indexes;
+ indexes.i = getEnclosingMethodData();
+ if (indexes.i == 0)
+ return NULL;
+ _Jv_ushort class_index, method_index;
+ _Jv_loadIndexes (&indexes, class_index, method_index);
+ jclass found_class;
+ _Jv_Method *method = _Jv_Linker::resolve_method_entry (this, found_class,
+ class_index,
+ method_index,
+ false, false);
+ using namespace java::lang::reflect;
+ Method *rmethod = new Method ();
+ rmethod->offset = (char *) method - (char *) found_class->methods;
+ rmethod->declaringClass = found_class;
+ return rmethod;
+}
+
+::java::lang::reflect::Constructor *
+java::lang::Class::getEnclosingConstructor()
+{
+ _Jv_word indexes;
+ indexes.i = getEnclosingMethodData();
+ if (indexes.i == 0)
+ return NULL;
+ _Jv_ushort class_index, method_index;
+ _Jv_loadIndexes (&indexes, class_index, method_index);
+ jclass found_class;
+ _Jv_Method *method = _Jv_Linker::resolve_method_entry (this, found_class,
+ class_index,
+ method_index,
+ false, false);
+ using namespace java::lang::reflect;
+ Constructor *cons = new Constructor ();
+ cons->offset = (char *) method - (char *) found_class->methods;
+ cons->declaringClass = this;
+ return cons;
+}
+
+static void
+check_constant (_Jv_Constants *pool, jint cpool_index, jint type)
+{
+ if (cpool_index <= 0 || cpool_index >= pool->size)
+ throw new InternalError(JvNewStringLatin1("invalid constant pool index"));
+ if ((pool->tags[cpool_index] &
+ ~(JV_CONSTANT_ResolvedFlag|JV_CONSTANT_LazyFlag)) != type)
+ {
+ ::java::lang::StringBuffer *sb = new ::java::lang::StringBuffer();
+ sb->append(JvNewStringLatin1("expected pool constant "));
+ sb->append(type);
+ sb->append(JvNewStringLatin1(" but got "));
+ sb->append(jint (pool->tags[cpool_index]));
+ throw new InternalError(sb->toString());
+ }
+}
+
+// Forward declaration
+static ::java::lang::annotation::Annotation *
+parseAnnotation(jclass klass, _Jv_Constants *pool,
+ unsigned char *&bytes, unsigned char *last);
+
+static jobject
+parseAnnotationElement(jclass klass, _Jv_Constants *pool,
+ unsigned char *&bytes, unsigned char *last)
+{
+ int tag = read_u1 (bytes, last);
+ jobject result;
+ switch (tag)
+ {
+ case 'B':
+ {
+ int cindex = read_u2 (bytes, last);
+ check_constant (pool, cindex, JV_CONSTANT_Integer);
+ result = Byte::valueOf (pool->data[cindex].i);
+ }
+ break;
+ case 'C':
+ {
+ int cindex = read_u2 (bytes, last);
+ check_constant (pool, cindex, JV_CONSTANT_Integer);
+ result = Character::valueOf (pool->data[cindex].i);
+ }
+ break;
+ case 'S':
+ {
+ int cindex = read_u2 (bytes, last);
+ check_constant (pool, cindex, JV_CONSTANT_Integer);
+ result = Short::valueOf (pool->data[cindex].i);
+ }
+ break;
+ case 'Z':
+ {
+ int cindex = read_u2 (bytes, last);
+ check_constant (pool, cindex, JV_CONSTANT_Integer);
+ result = Boolean::valueOf (jboolean (pool->data[cindex].i));
+ }
+ break;
+ case 'I':
+ {
+ int cindex = read_u2 (bytes, last);
+ check_constant (pool, cindex, JV_CONSTANT_Integer);
+ result = Integer::valueOf (pool->data[cindex].i);
+ }
+ break;
+ case 'D':
+ {
+ int cindex = read_u2 (bytes, last);
+ check_constant (pool, cindex, JV_CONSTANT_Double);
+ _Jv_word2 word;
+ memcpy (&word, &pool->data[cindex], 2 * sizeof (_Jv_word));
+ result = Double::valueOf (word.d);
+ }
+ break;
+ case 'F':
+ {
+ int cindex = read_u2 (bytes, last);
+ check_constant (pool, cindex, JV_CONSTANT_Float);
+ result = Float::valueOf (pool->data[cindex].f);
+ }
+ break;
+ case 'J':
+ {
+ int cindex = read_u2 (bytes, last);
+ check_constant (pool, cindex, JV_CONSTANT_Double);
+ _Jv_word2 word;
+ memcpy (&word, &pool->data[cindex], 2 * sizeof (_Jv_word));
+ result = Long::valueOf (word.l);
+ }
+ break;
+ case 's':
+ {
+ int cindex = read_u2 (bytes, last);
+ // Despite what the JVM spec says, compilers generate a Utf8
+ // constant here, not a String.
+ check_constant (pool, cindex, JV_CONSTANT_Utf8);
+ result = pool->data[cindex].utf8->toString();
+ }
+ break;
+ case 'e':
+ {
+ int type_name_index = read_u2 (bytes, last);
+ check_constant (pool, type_name_index, JV_CONSTANT_Utf8);
+ int const_name_index = read_u2 (bytes, last);
+ check_constant (pool, const_name_index, JV_CONSTANT_Utf8);
+
+ _Jv_Utf8Const *u_name = pool->data[type_name_index].utf8;
+ _Jv_Utf8Const *e_name = pool->data[const_name_index].utf8;
+
+ // FIXME: throw correct exceptions at the correct times.
+ jclass e_class = _Jv_FindClassFromSignature(u_name->chars(),
+ klass->getClassLoaderInternal());
+ result = ::java::lang::Enum::valueOf(e_class, e_name->toString());
+ }
+ break;
+ case 'c':
+ {
+ int cindex = read_u2 (bytes, last);
+ check_constant (pool, cindex, JV_CONSTANT_Utf8);
+ _Jv_Utf8Const *u_name = pool->data[cindex].utf8;
+ jclass anno_class
+ = _Jv_FindClassFromSignatureNoException(u_name->chars(),
+ klass->getClassLoaderInternal());
+ // FIXME: not correct: we should lazily do this when trying to
+ // read the element. This means that
+ // AnnotationInvocationHandler needs to have a special case.
+ if (! anno_class)
+ // FIXME: original exception...
+ throw new TypeNotPresentException(u_name->toString(), NULL);
+ result = anno_class;
+ }
+ break;
+ case '@':
+ result = parseAnnotation (klass, pool, bytes, last);
+ break;
+ case '[':
+ {
+ int n_array_elts = read_u2 (bytes, last);
+ jobjectArray aresult = _Jv_NewObjectArray (n_array_elts,
+ &Object::class$, NULL);
+ jobject *elts = elements (aresult);
+ for (int i = 0; i < n_array_elts; ++i)
+ elts[i] = parseAnnotationElement(klass, pool, bytes, last);
+ result = aresult;
+ }
+ break;
+ default:
+ throw new java::lang::InternalError();
+ }
+ return result;
+}
+
+static ::java::lang::annotation::Annotation *
+parseAnnotation(jclass klass, _Jv_Constants *pool,
+ unsigned char *&bytes, unsigned char *last)
+{
+ int type_index = read_u2 (bytes, last);
+ check_constant (pool, type_index, JV_CONSTANT_Utf8);
+
+ _Jv_Utf8Const *u_name = pool->data[type_index].utf8;
+ jclass anno_class = _Jv_FindClassFromSignatureNoException(u_name->chars(),
+ klass->getClassLoaderInternal());
+ // FIXME: what to do if anno_class==NULL?
+
+ ::java::util::HashMap *hmap = new ::java::util::HashMap();
+ int npairs = read_u2 (bytes, last);
+ for (int i = 0; i < npairs; ++i)
+ {
+ int name_index = read_u2 (bytes, last);
+ check_constant (pool, name_index, JV_CONSTANT_Utf8);
+ jstring name = _Jv_NewStringUtf8Const (pool->data[name_index].utf8);
+ jobject value = parseAnnotationElement (klass, pool, bytes, last);
+ // FIXME: any checks needed for name?
+ hmap->put(name, value);
+ }
+ using namespace ::sun::reflect::annotation;
+ return AnnotationInvocationHandler::create (anno_class,
+ (::java::util::Map *) hmap);
+}
+
+static jobjectArray
+parseAnnotations(jclass klass, _Jv_Constants *pool,
+ unsigned char *&bytes, unsigned char *last)
+{
+ int num = read_u2 (bytes, last);
+ jobjectArray result = _Jv_NewObjectArray (num,
+ &::java::lang::annotation::Annotation::class$,
+ NULL);
+ jobject *elts = elements (result);
+ for (int i = 0; i < num; ++i)
+ elts[i] = parseAnnotation(klass, pool, bytes, last);
+ return result;
+}
+
+static jobjectArray
+parseParameterAnnotations(jclass klass, _Jv_Constants *pool,
+ unsigned char *&bytes, unsigned char *last)
+{
+ jclass anno = &::java::lang::annotation::Annotation::class$;
+ jclass annoary = _Jv_GetArrayClass (anno, anno->getClassLoaderInternal());
+
+ // FIXME: something should check the number of params versus the
+ // method
+ int n_params = read_u1 (bytes, last);
+ jobjectArray result = _Jv_NewObjectArray (n_params, annoary, NULL);
+ jobject *elts = elements (result);
+ for (int i = 0; i < n_params; ++i)
+ elts[i] = parseAnnotations(klass, pool, bytes, last);
+ return result;
+}
+
+jobject
+java::lang::Class::getMethodDefaultValue(::java::lang::reflect::Method *meth)
+{
+ // FIXME: could cache the value here...
+
+ unsigned char *bytes = reflection_data;
+ if (bytes == NULL)
+ return 0;
+
+ unsigned short meth_index = _Jv_FromReflectedMethod (meth) - methods;
+
+ while (true)
+ {
+ int type = read_u1 (bytes);
+ if (type == JV_DONE_ATTR)
+ return NULL;
+ int len = read_4 (bytes);
+ unsigned char *next = bytes + len;
+ if (type != JV_METHOD_ATTR)
+ {
+ bytes = next;
+ continue;
+ }
+ int kind = read_u1 (bytes, next);
+ if (kind != JV_ANNOTATION_DEFAULT_KIND)
+ {
+ bytes = next;
+ continue;
+ }
+ int index = read_u2 (bytes, next);
+ if (meth_index != index)
+ {
+ bytes = next;
+ continue;
+ }
+
+ // FIXME: could cache here. If we do then we have to clone any
+ // array result.
+ return parseAnnotationElement(this, &this->constants, bytes, next);
+ }
+}
+
+jobjectArray
+java::lang::Class::getDeclaredAnnotations(jint /* jv_attr_type */ member_type,
+ jint member_index,
+ jint /* jv_attr_kind */ kind_req)
+{
+ using namespace java::lang::annotation;
+ jobjectArray result;
+
+ unsigned char *bytes = reflection_data;
+ if (bytes == NULL)
+ return 0;
+
+ ClassLoader *trueLoader = loader;
+ if (trueLoader == NULL)
+ trueLoader = (ClassLoader *)VMClassLoader::bootLoader;
+
+ result = (loader->getDeclaredAnnotations
+ (this, member_type, member_index, kind_req));
+ if (result)
+ return result;
+
+ for (;;)
+ {
+ int type = read_u1 (bytes);
+ if (type == JV_DONE_ATTR)
+ return NULL;
+ int len = read_4 (bytes);
+ unsigned char *next = bytes + len;
+ if (type != member_type)
+ {
+ bytes = next;
+ continue;
+ }
+ int kind = read_u1 (bytes, next);
+ if (kind != kind_req)
+ {
+ bytes = next;
+ continue;
+ }
+ if (member_type != JV_CLASS_ATTR)
+ {
+ int index = read_u2 (bytes, next);
+ if (member_index != index)
+ {
+ bytes = next;
+ continue;
+ }
+ }
+
+ if (kind_req == JV_PARAMETER_ANNOTATIONS_KIND)
+ result = ((parseParameterAnnotations
+ (this, &this->constants, bytes, next)));
+ else
+ result = ((parseAnnotations (this, &this->constants, bytes, next)));
+ break;
+ }
+
+ return (loader->putDeclaredAnnotations
+ (this, member_type, member_index, kind_req, result));
+}
+
+jobjectArray
+java::lang::Class::getDeclaredAnnotations(::java::lang::reflect::Method *meth,
+ jboolean is_param)
+{
+ unsigned short meth_index = _Jv_FromReflectedMethod (meth) - methods;
+ return getDeclaredAnnotations(JV_METHOD_ATTR, meth_index,
+ (is_param
+ ? JV_PARAMETER_ANNOTATIONS_KIND
+ : JV_ANNOTATIONS_KIND));
+}
+
+jobjectArray
+java::lang::Class::getDeclaredAnnotations(::java::lang::reflect::Constructor *cons,
+ jboolean is_param)
+{
+ unsigned short meth_index = _Jv_FromReflectedConstructor (cons) - methods;
+ return getDeclaredAnnotations(JV_METHOD_ATTR, meth_index,
+ (is_param
+ ? JV_PARAMETER_ANNOTATIONS_KIND
+ : JV_ANNOTATIONS_KIND));
+}
+
+jobjectArray
+java::lang::Class::getDeclaredAnnotations(::java::lang::reflect::Field *fld)
+{
+ unsigned short field_index = _Jv_FromReflectedField (fld) - fields;
+ return getDeclaredAnnotations(JV_FIELD_ATTR, field_index,
+ JV_ANNOTATIONS_KIND);
+}
+
+JArray< ::java::lang::annotation::Annotation *> *
+java::lang::Class::getDeclaredAnnotationsInternal()
+{
+ return (JArray< ::java::lang::annotation::Annotation *> *) getDeclaredAnnotations(JV_CLASS_ATTR, 0, JV_ANNOTATIONS_KIND);
+}
+
+static jclass
+resolve_class_constant (jclass klass, _Jv_Constants *pool, int cpool_index)
+{
+ check_constant (pool, cpool_index, JV_CONSTANT_Class);
+ // FIXME: what is the correct thing to do with an exception here?
+ return _Jv_Linker::resolve_pool_entry (klass, cpool_index, false).clazz;
+}
+
+jint
+java::lang::Class::findInnerClassAttribute()
+{
+ unsigned char *bytes = reflection_data;
+ if (bytes == NULL)
+ return -1;
+ while (true)
+ {
+ int type = read_u1 (bytes);
+ if (type == JV_DONE_ATTR)
+ break;
+ // After the type but before the length.
+ unsigned char *save = bytes;
+ int len = read_4 (bytes);
+ unsigned char *next = bytes + len;
+ if (type != JV_CLASS_ATTR)
+ {
+ bytes = next;
+ continue;
+ }
+ int kind = read_u1 (bytes, next);
+ if (kind != JV_INNER_CLASSES_KIND)
+ {
+ bytes = next;
+ continue;
+ }
+ return save - reflection_data;
+ }
+ return -1;
+}
+
+jint
+java::lang::Class::findDeclaredClasses(JArray<jclass> *result,
+ jboolean publicOnly,
+ jint offset)
+{
+ unsigned char *bytes = reflection_data + offset;
+ int len = read_4 (bytes);
+ unsigned char *next = bytes + len;
+ // Skip a byte.
+ read_u1 (bytes, next);
+ int n_classes = read_u2 (bytes, next);
+ int count = 0;
+ for (int i = 0; i < n_classes; ++i)
+ {
+ int inner_class_index = read_u2 (bytes, next);
+ int outer_class_index = read_u2 (bytes, next);
+ /*int inner_name_index = */ read_u2 (bytes, next);
+ int inner_flags = read_u2 (bytes, next);
+
+ if (inner_class_index == 0 || outer_class_index == 0)
+ continue;
+ if (resolve_class_constant (this, &constants, outer_class_index) == this)
+ {
+ jclass inner = resolve_class_constant (this, &constants,
+ inner_class_index);
+ if (! publicOnly
+ || ((inner_flags
+ & java::lang::reflect::Modifier::PUBLIC) != 0))
+ {
+ if (result)
+ {
+ jclass *elts = elements (result);
+ elts[count] = inner;
+ }
+ ++count;
+ }
+ }
+ }
+
+ return count;
+}
+
+JArray<jclass> *
+java::lang::Class::getDeclaredClasses (jboolean publicOnly)
+{
+ int offset = findInnerClassAttribute();
+ int count;
+ if (offset == -1)
+ {
+ // No InnerClasses attribute, so no declared classes.
+ count = 0;
+ }
+ else
+ count = findDeclaredClasses(NULL, publicOnly, offset);
+ JArray<jclass> *result
+ = (JArray<jclass> *) JvNewObjectArray (count, &java::lang::Class::class$,
+ NULL);
+ if (count > 0)
+ findDeclaredClasses(result, publicOnly, offset);
+ return result;
+}
+
+jclass
+java::lang::Class::getDeclaringClass (void)
+{
+ int offset = findInnerClassAttribute();
+ if (offset == -1)
+ return NULL;
+
+ unsigned char *bytes = reflection_data + offset;
+ int len = read_4 (bytes);
+ unsigned char *next = bytes + len;
+ // Skip a byte.
+ read_u1 (bytes, next);
+ int n_classes = read_u2 (bytes, next);
+ for (int i = 0; i < n_classes; ++i)
+ {
+ int inner_class_index = read_u2 (bytes, next);
+ int outer_class_index = read_u2 (bytes, next);
+ /*int inner_name_index = */read_u2 (bytes, next);
+ /*int inner_flags = */read_u2 (bytes, next);
+
+ if (inner_class_index == 0 || outer_class_index == 0)
+ continue;
+ if (resolve_class_constant (this, &constants, inner_class_index) == this)
+ return resolve_class_constant (this, &constants, outer_class_index);
+ }
+
+ return NULL;
+}
+
+jboolean
+java::lang::Class::isAnonymousClass()
+{
+ int offset = findInnerClassAttribute();
+ if (offset == -1)
+ return false;
+
+ unsigned char *bytes = reflection_data + offset;
+ int len = read_4 (bytes);
+ unsigned char *next = bytes + len;
+ // Skip a byte.
+ read_u1 (bytes, next);
+ int n_classes = read_u2 (bytes, next);
+ for (int i = 0; i < n_classes; ++i)
+ {
+ int inner_class_index = read_u2 (bytes, next);
+ /*int outer_class_index = */read_u2 (bytes, next);
+ int inner_name_index = read_u2 (bytes, next);
+ /*int inner_flags = */read_u2 (bytes, next);
+
+ if (inner_class_index == 0)
+ continue;
+ if (resolve_class_constant (this, &constants, inner_class_index) == this)
+ return inner_name_index == 0;
+ }
+
+ return false;
+}
+
+jboolean
+java::lang::Class::isLocalClass()
+{
+ _Jv_word indexes;
+ indexes.i = getEnclosingMethodData();
+ return indexes.i != 0;
+}
+
+jboolean
+java::lang::Class::isMemberClass()
+{
+ // FIXME: is this correct?
+ return !isLocalClass() && getDeclaringClass() != NULL;
+}
+
+
+
//
// Some class-related convenience functions.
//
diff --git a/libjava/java/lang/natClassLoader.cc b/libjava/java/lang/natClassLoader.cc
index b05c0b1045b..9c1a6a258ec 100644
--- a/libjava/java/lang/natClassLoader.cc
+++ b/libjava/java/lang/natClassLoader.cc
@@ -180,6 +180,41 @@ _Jv_UnregisterInitiatingLoader (jclass klass, java::lang::ClassLoader *loader)
// _Jv_RegisterNewClasses() are of Type 2.
+// Check that the file we're trying to load has been compiled with a
+// compatible version of gcj. In previous versions of libgcj we
+// silently failed to register classes of an incompatible ABI version,
+// but this was totally bogus.
+void
+_Jv_CheckABIVersion (unsigned long value)
+{
+ // We are compatible with GCJ 4.0.0 BC-ABI classes. This release used a
+ // different format for the version ID string.
+ if (value == OLD_GCJ_40_BC_ABI_VERSION)
+ return;
+
+ // The 20 low-end bits are used for the version number.
+ unsigned long version = value & 0xfffff;
+
+ if (value & FLAG_BINARYCOMPAT_ABI)
+ {
+ int abi_rev = version % 100;
+ int abi_ver = version - abi_rev;
+ // We are compatible with abi_rev 0 and 1.
+ if (abi_ver == GCJ_40_BC_ABI_VERSION && abi_rev <= 1)
+ return;
+ }
+ else
+ {
+ // C++ ABI
+ if (version == GCJ_CXX_ABI_VERSION)
+ return;
+ }
+
+ throw new ::java::lang::ClassFormatError
+ (JvNewStringLatin1 ("Library compiled with later ABI version than"
+ " this version of libgcj supports"));
+}
+
// This function is called many times during startup, before main() is
// run. At that point in time we know for certain we are running
// single-threaded, so we don't need to lock when adding classes to the
@@ -194,8 +229,8 @@ _Jv_RegisterClasses (const jclass *classes)
{
jclass klass = *classes;
- if (_Jv_CheckABIVersion ((unsigned long) klass->next_or_version))
- (*_Jv_RegisterClassHook) (klass);
+ _Jv_CheckABIVersion ((unsigned long) klass->next_or_version);
+ (*_Jv_RegisterClassHook) (klass);
}
}
@@ -211,32 +246,37 @@ _Jv_RegisterClasses_Counted (const jclass * classes, size_t count)
{
jclass klass = classes[i];
- if (_Jv_CheckABIVersion ((unsigned long) klass->next_or_version))
- (*_Jv_RegisterClassHook) (klass);
+ _Jv_CheckABIVersion ((unsigned long) klass->next_or_version);
+ (*_Jv_RegisterClassHook) (klass);
}
}
// Create a class on the heap from an initializer struct.
-jclass
+inline jclass
_Jv_NewClassFromInitializer (const char *class_initializer)
{
+ const unsigned long version
+ = ((unsigned long)
+ ((::java::lang::Class *)class_initializer)->next_or_version);
+ _Jv_CheckABIVersion (version);
+
/* We create an instance of java::lang::Class and copy all of its
fields except the first word (the vtable pointer) from
CLASS_INITIALIZER. This first word is pre-initialized by
_Jv_AllocObj, and we don't want to overwrite it. */
-
+
jclass new_class
- = (jclass)_Jv_AllocObj (sizeof (java::lang::Class),
- &java::lang::Class::class$);
+ = (jclass)_Jv_AllocObj (sizeof (::java::lang::Class),
+ &::java::lang::Class::class$);
const char *src = class_initializer + sizeof (void*);
char *dst = (char*)new_class + sizeof (void*);
- size_t len = sizeof (*new_class) - sizeof (void*);
+ size_t len = (::java::lang::Class::initializerSize (version)
+ - sizeof (void*));
memcpy (dst, src, len);
-
+
new_class->engine = &_Jv_soleIndirectCompiledEngine;
-
- if (_Jv_CheckABIVersion ((unsigned long) new_class->next_or_version))
- (*_Jv_RegisterClassHook) (new_class);
+
+ (*_Jv_RegisterClassHook) (new_class);
return new_class;
}
diff --git a/libjava/java/lang/natEcosProcess.cc b/libjava/java/lang/natEcosProcess.cc
index 9cfb19e702d..7d8edfb0e9c 100644
--- a/libjava/java/lang/natEcosProcess.cc
+++ b/libjava/java/lang/natEcosProcess.cc
@@ -1,6 +1,6 @@
// natEcosProcess.cc - Native side of eCos processes.
-/* Copyright (C) 1998, 1999 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2006 Free Software Foundation
This file is part of libgcj.
@@ -17,9 +17,9 @@ details. */
#include <gcj/cni.h>
#include <jvm.h>
-#include <java/lang/ConcreteProcess.h>
+#include <java/lang/EcosProcess.h>
void
-java::lang::ConcreteProcess::destroy (void)
+java::lang::EcosProcess::destroy (void)
{
}
diff --git a/libjava/java/lang/natPosixProcess.cc b/libjava/java/lang/natPosixProcess.cc
index 94344fc8e61..498647036c5 100644
--- a/libjava/java/lang/natPosixProcess.cc
+++ b/libjava/java/lang/natPosixProcess.cc
@@ -27,8 +27,8 @@ details. */
#include <gcj/cni.h>
#include <jvm.h>
-#include <java/lang/ConcreteProcess$ProcessManager.h>
-#include <java/lang/ConcreteProcess.h>
+#include <java/lang/PosixProcess$ProcessManager.h>
+#include <java/lang/PosixProcess.h>
#include <java/lang/IllegalThreadStateException.h>
#include <java/lang/InternalError.h>
#include <java/lang/InterruptedException.h>
@@ -98,7 +98,7 @@ sigchld_handler (int)
// Get ready to enter the main reaper thread loop.
void
-java::lang::ConcreteProcess$ProcessManager::init ()
+java::lang::PosixProcess$ProcessManager::init ()
{
using namespace java::lang;
// Remenber our PID so other threads can kill us.
@@ -124,7 +124,7 @@ error:
}
void
-java::lang::ConcreteProcess$ProcessManager::waitForSignal ()
+java::lang::PosixProcess$ProcessManager::waitForSignal ()
{
// Wait for SIGCHLD
sigset_t mask;
@@ -145,7 +145,7 @@ java::lang::ConcreteProcess$ProcessManager::waitForSignal ()
return;
}
-jboolean java::lang::ConcreteProcess$ProcessManager::reap ()
+jboolean java::lang::PosixProcess$ProcessManager::reap ()
{
using namespace java::lang;
@@ -168,7 +168,7 @@ jboolean java::lang::ConcreteProcess$ProcessManager::reap ()
return true; // No children to wait for.
// Look up the process in our pid map.
- ConcreteProcess * process = removeProcessFromMap ((jlong) pid);
+ PosixProcess * process = removeProcessFromMap ((jlong) pid);
// Note that if process==NULL, then we have an unknown child.
// This is not common, but can happen, and isn't an error.
@@ -176,7 +176,7 @@ jboolean java::lang::ConcreteProcess$ProcessManager::reap ()
{
JvSynchronize sync (process);
process->status = WIFEXITED (status) ? WEXITSTATUS (status) : -1;
- process->state = ConcreteProcess::STATE_TERMINATED;
+ process->state = PosixProcess::STATE_TERMINATED;
process->processTerminationCleanup();
process->notifyAll ();
}
@@ -187,7 +187,7 @@ error:
}
void
-java::lang::ConcreteProcess$ProcessManager::signalReaper ()
+java::lang::PosixProcess$ProcessManager::signalReaper ()
{
int c = pthread_kill ((pthread_t) reaperPID, SIGCHLD);
if (c == 0)
@@ -197,7 +197,7 @@ java::lang::ConcreteProcess$ProcessManager::signalReaper ()
}
void
-java::lang::ConcreteProcess::nativeDestroy ()
+java::lang::PosixProcess::nativeDestroy ()
{
int c = kill ((pid_t) pid, SIGKILL);
if (c == 0)
@@ -207,7 +207,7 @@ java::lang::ConcreteProcess::nativeDestroy ()
}
void
-java::lang::ConcreteProcess::nativeSpawn ()
+java::lang::PosixProcess::nativeSpawn ()
{
using namespace java::io;
diff --git a/libjava/java/lang/natRuntime.cc b/libjava/java/lang/natRuntime.cc
index 5cca1b072a3..ecaf7d314a2 100644
--- a/libjava/java/lang/natRuntime.cc
+++ b/libjava/java/lang/natRuntime.cc
@@ -26,9 +26,13 @@ details. */
#include <java/util/TimeZone.h>
#include <java/lang/StringBuffer.h>
#include <java/lang/Process.h>
-#include <java/lang/ConcreteProcess.h>
#include <java/lang/ClassLoader.h>
+// It is convenient and safe to simply include all of these.
+#include <java/lang/Win32Process.h>
+#include <java/lang/EcosProcess.h>
+#include <java/lang/PosixProcess.h>
+
#include <jni.h>
#ifdef HAVE_PWD_H
@@ -286,7 +290,7 @@ java::lang::Runtime::execInternal (jstringArray cmd,
jstringArray env,
java::io::File *dir)
{
- return new java::lang::ConcreteProcess (cmd, env, dir);
+ return new _Jv_platform_process (cmd, env, dir);
}
jint
diff --git a/libjava/java/lang/natThread.cc b/libjava/java/lang/natThread.cc
index facce30fa2e..2472d4d3005 100644
--- a/libjava/java/lang/natThread.cc
+++ b/libjava/java/lang/natThread.cc
@@ -18,6 +18,8 @@ details. */
#include <gnu/gcj/RawDataManaged.h>
#include <java/lang/Thread.h>
+#include <java/lang/Thread$State.h>
+#include <java/lang/Thread$UncaughtExceptionHandler.h>
#include <java/lang/ThreadGroup.h>
#include <java/lang/IllegalArgumentException.h>
#include <java/lang/IllegalThreadStateException.h>
@@ -32,24 +34,6 @@ details. */
-// This structure is used to represent all the data the native side
-// needs. An object of this type is assigned to the `data' member of
-// the Thread class.
-struct natThread
-{
- // These are used to interrupt sleep and join calls. We can share a
- // condition variable here since it only ever gets notified when the thread
- // exits.
- _Jv_Mutex_t join_mutex;
- _Jv_ConditionVariable_t join_cond;
-
- // This is private data for the thread system layer.
- _Jv_Thread_t *thread;
-
- // Each thread has its own JNI object.
- JNIEnv *jni_env;
-};
-
static void finalize_native (jobject ptr);
// This is called from the constructor to initialize the native side
@@ -59,6 +43,9 @@ java::lang::Thread::initialize_native (void)
{
natThread *nt = (natThread *) _Jv_AllocBytes (sizeof (natThread));
+ state = JV_NEW;
+ nt->alive_flag = THREAD_DEAD;
+
data = (gnu::gcj::RawDataManaged *) nt;
// Register a finalizer to clean up the native thread resources.
@@ -66,6 +53,9 @@ java::lang::Thread::initialize_native (void)
_Jv_MutexInit (&nt->join_mutex);
_Jv_CondInit (&nt->join_cond);
+
+ nt->park_helper.init();
+
nt->thread = _Jv_ThreadInitData (this);
// FIXME: if JNI_ENV is set we will want to free it. It is
// malloc()d.
@@ -83,7 +73,9 @@ finalize_native (jobject ptr)
#ifdef _Jv_HaveMutexDestroy
_Jv_MutexDestroy (&nt->join_mutex);
#endif
- _Jv_FreeJNIEnv(nt->jni_env);
+ _Jv_FreeJNIEnv((JNIEnv*)nt->jni_env);
+
+ nt->park_helper.destroy();
}
jint
@@ -111,14 +103,34 @@ java::lang::Thread::holdsLock (jobject obj)
return !_Jv_ObjectCheckMonitor (obj);
}
+jboolean
+java::lang::Thread::isAlive (void)
+{
+ natThread *nt = (natThread *) data;
+ return nt->alive_flag != (obj_addr_t)THREAD_DEAD;
+}
+
void
java::lang::Thread::interrupt (void)
{
checkAccess ();
+
natThread *nt = (natThread *) data;
- JvSynchronize sync (this);
- if (alive_flag)
- _Jv_ThreadInterrupt (nt->thread);
+
+ // If a thread is in state ALIVE, we atomically set it to state
+ // SIGNALED and send it a signal. Once we've sent it the signal, we
+ // set its state back to ALIVE.
+ if (compare_and_swap
+ (&nt->alive_flag, Thread::THREAD_ALIVE, Thread::THREAD_SIGNALED))
+ {
+ _Jv_ThreadInterrupt (nt->thread);
+ compare_and_swap
+ (&nt->alive_flag, THREAD_SIGNALED, Thread::THREAD_ALIVE);
+
+ // Even though we've interrupted this thread, it might still be
+ // parked.
+ nt->park_helper.unpark ();
+ }
}
void
@@ -197,8 +209,10 @@ java::lang::Thread::sleep (jlong millis, jint nanos)
void
java::lang::Thread::finish_ ()
{
+ __sync_synchronize();
natThread *nt = (natThread *) data;
+ nt->park_helper.deactivate ();
group->removeThread (this);
#ifdef ENABLE_JVMPI
@@ -226,7 +240,8 @@ java::lang::Thread::finish_ ()
{
JvSynchronize sync (this);
- alive_flag = false;
+ nt->alive_flag = THREAD_DEAD;
+ state = JV_TERMINATED;
}
_Jv_CondNotifyAll (&nt->join_cond, &nt->join_mutex);
@@ -307,7 +322,7 @@ _Jv_ThreadRun (java::lang::Thread* thread)
// this results in an uncaught exception, that is ignored.
try
{
- thread->group->uncaughtException (thread, t);
+ thread->getUncaughtExceptionHandler()->uncaughtException (thread, t);
}
catch (java::lang::Throwable *f)
{
@@ -334,9 +349,10 @@ java::lang::Thread::start (void)
if (!startable_flag)
throw new IllegalThreadStateException;
- alive_flag = true;
- startable_flag = false;
natThread *nt = (natThread *) data;
+ nt->alive_flag = THREAD_ALIVE;
+ startable_flag = false;
+ state = JV_RUNNABLE;
_Jv_ThreadStart (this, nt->thread, (_Jv_ThreadStartFunc *) &_Jv_ThreadRun);
}
@@ -392,13 +408,40 @@ java::lang::Thread::yield (void)
_Jv_ThreadYield ();
}
+::java::lang::Thread$State *
+java::lang::Thread::getState()
+{
+ _Jv_InitClass(&::java::lang::Thread$State::class$);
+
+ switch (state)
+ {
+ case JV_BLOCKED:
+ return ::java::lang::Thread$State::BLOCKED;
+ case JV_NEW:
+ return ::java::lang::Thread$State::NEW;
+
+ case JV_RUNNABLE:
+ return ::java::lang::Thread$State::RUNNABLE;
+ case JV_TERMINATED:
+ return ::java::lang::Thread$State::TERMINATED;
+ case JV_TIMED_WAITING:
+ return ::java::lang::Thread$State::TIMED_WAITING;
+ case JV_WAITING:
+ return ::java::lang::Thread$State::WAITING;
+ }
+
+ // We don't really need a default, but this makes the compiler
+ // happy.
+ return ::java::lang::Thread$State::RUNNABLE;
+}
+
JNIEnv *
_Jv_GetCurrentJNIEnv ()
{
java::lang::Thread *t = _Jv_ThreadCurrent ();
if (t == NULL)
return NULL;
- return ((natThread *) t->data)->jni_env;
+ return (JNIEnv *)((natThread *) t->data)->jni_env;
}
void
@@ -419,8 +462,9 @@ _Jv_AttachCurrentThread(java::lang::Thread* thread)
if (thread == NULL || thread->startable_flag == false)
return -1;
thread->startable_flag = false;
- thread->alive_flag = true;
natThread *nt = (natThread *) thread->data;
+ nt->alive_flag = ::java::lang::Thread::THREAD_ALIVE;
+ thread->state = JV_RUNNABLE;
_Jv_ThreadRegister (nt->thread);
return 0;
}
diff --git a/libjava/java/lang/natThreadLocal.cc b/libjava/java/lang/natThreadLocal.cc
new file mode 100644
index 00000000000..cd61f4a623f
--- /dev/null
+++ b/libjava/java/lang/natThreadLocal.cc
@@ -0,0 +1,169 @@
+// natThreadLocal.cc - Native part of ThreadLocal class.
+
+// Fast thread local storage for systems that support the __thread
+// variable attribute.
+
+/* Copyright (C) 2006 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include <gcj/cni.h>
+#include <jvm.h>
+#include <java-threads.h>
+
+#include <gnu/gcj/RawDataManaged.h>
+#include <java/lang/ThreadLocal.h>
+#include <java/lang/IllegalArgumentException.h>
+#include <java/lang/IllegalThreadStateException.h>
+#include <java/lang/InterruptedException.h>
+#include <java/util/Map.h>
+
+#include <jni.h>
+
+/* We would like to have fast thread local variables that behave in
+ the same way as C and C++ thread local variables. This would mean
+ having an field attribute "thread" (like static, final, etc.).
+ However, this is not compatible with java semantics, which we wish
+ to support transparently. The problems we must overcome are:
+
+ * In Java, ThreadLocal variables are not statically allocated: they
+ are objects, created at runtime.
+
+ * Class ThreadLocal is not final and neither are its methods, so it
+ is possible to create a subclass of ThreadLocal that overrides
+ any method.
+
+ * __thread variables in DSOs are not visible to the garbage
+ collector, so we must ensure that we keep a copy of every thread
+ local variable somewhere on the heap.
+
+ * Once a ThreadLocal instance has been created and assigned to a
+ static field, that field may be reassigned to a different
+ ThreadLocal instance or null.
+
+ So, we can't simply replace get() and set() with accesses of a
+ __thread variable.
+
+ So, we create a pthread_key in each ThreadLocal object and use that
+ as a kind of "look-aside cache". When a ThreadLocal is set, we
+ also set the corresponding thread-specific value. When the
+ ThreadLocal is collected, we delete the key.
+
+ This scheme is biased towards efficiency when get() is called much
+ more frequently than set(). It is slightly internaler than the
+ all-Java solution using the underlying map in the set() case.
+ However, get() is very much more frequently invoked than set().
+
+*/
+
+
+#ifdef _POSIX_PTHREAD_SEMANTICS
+
+class tls_t
+{
+public:
+ pthread_key_t key;
+};
+
+void
+java::lang::ThreadLocal::constructNative (void)
+{
+ tls_t *tls = (tls_t *)_Jv_Malloc (sizeof (tls_t));
+ if (pthread_key_create (&tls->key, NULL) == 0)
+ TLSPointer = (::gnu::gcj::RawData *)tls;
+ else
+ _Jv_Free (tls);
+}
+
+void
+java::lang::ThreadLocal::set (::java::lang::Object *value)
+{
+ if (TLSPointer != NULL)
+ {
+ tls_t* tls = (tls_t*)TLSPointer;
+ pthread_setspecific (tls->key, value);
+ }
+
+ internalSet (value);
+}
+
+::java::lang::Object *
+java::lang::ThreadLocal::get (void)
+{
+ if (TLSPointer == NULL)
+ return internalGet ();
+
+ tls_t* tls = (tls_t*)TLSPointer;
+ void *obj = pthread_getspecific(tls->key);
+
+ if (obj)
+ return (::java::lang::Object *)obj;
+
+ ::java::lang::Object *value = internalGet ();
+ pthread_setspecific (tls->key, value);
+
+ return value;
+}
+
+void
+java::lang::ThreadLocal::remove (void)
+{
+ if (TLSPointer != NULL)
+ {
+ tls_t* tls = (tls_t*)TLSPointer;
+ pthread_setspecific (tls->key, NULL);
+ }
+
+ internalRemove ();
+}
+
+void
+java::lang::ThreadLocal::finalize (void)
+{
+ if (TLSPointer != NULL)
+ {
+ tls_t* tls = (tls_t*)TLSPointer;
+ pthread_key_delete (tls->key);
+ _Jv_Free (tls);
+ }
+}
+
+#else
+
+void
+java::lang::ThreadLocal::constructNative (void)
+{
+}
+
+void
+java::lang::ThreadLocal::set (::java::lang::Object *value)
+{
+ internalSet (value);
+}
+
+::java::lang::Object *
+java::lang::ThreadLocal::get (void)
+{
+ return internalGet ();
+}
+
+void
+java::lang::ThreadLocal::remove (void)
+{
+ internalRemove ();
+}
+
+void
+java::lang::ThreadLocal::finalize (void)
+{
+}
+
+#endif
diff --git a/libjava/java/lang/natVMClassLoader.cc b/libjava/java/lang/natVMClassLoader.cc
index 95c1f15934c..2db2429c927 100644
--- a/libjava/java/lang/natVMClassLoader.cc
+++ b/libjava/java/lang/natVMClassLoader.cc
@@ -47,6 +47,9 @@ java::lang::VMClassLoader::defineClass (java::lang::ClassLoader *loader,
jclass klass = VMCompiler::compileClass(loader, name, data,
offset, length, pd);
+ if (klass)
+ _Jv_RegisterInitiatingLoader (klass, klass->loader);
+
#ifdef INTERPRETER
if (klass == NULL)
{
diff --git a/libjava/java/lang/natVMSecurityManager.cc b/libjava/java/lang/natVMSecurityManager.cc
deleted file mode 100644
index 9d52c92c7c5..00000000000
--- a/libjava/java/lang/natVMSecurityManager.cc
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 2002 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
-
-// Written by Tom Tromey <tromey@redhat.com>
-
-#include <config.h>
-
-#include <gcj/cni.h>
-#include <jvm.h>
-#include <java-stack.h>
-
-#include <java/lang/VMSecurityManager.h>
-#include <java/lang/SecurityManager.h>
-#include <java/lang/ClassLoader.h>
-#include <java/lang/Class.h>
-
-JArray<jclass> *
-java::lang::VMSecurityManager::getClassContext (jclass klass)
-{
- JArray<jclass> *result =
- _Jv_StackTrace::GetClassContext (klass);
-
- return result;
-}
diff --git a/libjava/java/lang/natWin32Process.cc b/libjava/java/lang/natWin32Process.cc
index 3c1a4f02c8b..d07f501366b 100644
--- a/libjava/java/lang/natWin32Process.cc
+++ b/libjava/java/lang/natWin32Process.cc
@@ -1,6 +1,6 @@
// natWin32Process.cc - Native side of Win32 process code.
-/* Copyright (C) 2003 Free Software Foundation
+/* Copyright (C) 2003, 2006 Free Software Foundation
This file is part of libgcj.
@@ -14,7 +14,7 @@ details. */
// Conflicts with the definition in "java/lang/reflect/Modifier.h"
#undef STRICT
-#include <java/lang/ConcreteProcess.h>
+#include <java/lang/Win32Process.h>
#include <java/lang/IllegalThreadStateException.h>
#include <java/lang/InterruptedException.h>
#include <java/lang/NullPointerException.h>
@@ -30,7 +30,7 @@ details. */
using gnu::java::nio::channels::FileChannelImpl;
void
-java::lang::ConcreteProcess::cleanup (void)
+java::lang::Win32Process::cleanup (void)
{
// FIXME:
// We used to close the input, output and
@@ -42,7 +42,7 @@ java::lang::ConcreteProcess::cleanup (void)
// to the POSIX approach.
//
// What I wanted to do is have private nested
- // classes in ConcreteProcess which extend FileInputStream
+ // classes in Win32Process which extend FileInputStream
// and FileOutputStream, respectively, but override
// close() to permit multiple calls to close(). This
// led to class header and platform configury issues
@@ -63,7 +63,7 @@ java::lang::ConcreteProcess::cleanup (void)
}
void
-java::lang::ConcreteProcess::destroy (void)
+java::lang::Win32Process::destroy (void)
{
if (! hasExited ())
{
@@ -76,7 +76,7 @@ java::lang::ConcreteProcess::destroy (void)
}
jboolean
-java::lang::ConcreteProcess::hasExited (void)
+java::lang::Win32Process::hasExited (void)
{
DWORD exitStatus;
@@ -100,7 +100,7 @@ java::lang::ConcreteProcess::hasExited (void)
}
jint
-java::lang::ConcreteProcess::waitFor (void)
+java::lang::Win32Process::waitFor (void)
{
if (! hasExited ())
{
@@ -209,7 +209,7 @@ HANDLE ChildProcessPipe::getChildHandle()
}
void
-java::lang::ConcreteProcess::startProcess (jstringArray progarray,
+java::lang::Win32Process::startProcess (jstringArray progarray,
jstringArray envp,
java::io::File *dir)
{
diff --git a/libjava/java/lang/ref/PhantomReference.h b/libjava/java/lang/ref/PhantomReference.h
new file mode 100644
index 00000000000..0c8a823d4f8
--- /dev/null
+++ b/libjava/java/lang/ref/PhantomReference.h
@@ -0,0 +1,20 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ref_PhantomReference__
+#define __java_lang_ref_PhantomReference__
+
+#pragma interface
+
+#include <java/lang/ref/Reference.h>
+
+class java::lang::ref::PhantomReference : public ::java::lang::ref::Reference
+{
+
+public:
+ PhantomReference(::java::lang::Object *, ::java::lang::ref::ReferenceQueue *);
+ virtual ::java::lang::Object * get();
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_ref_PhantomReference__
diff --git a/libjava/java/lang/ref/Reference.h b/libjava/java/lang/ref/Reference.h
new file mode 100644
index 00000000000..3eeaf65c645
--- /dev/null
+++ b/libjava/java/lang/ref/Reference.h
@@ -0,0 +1,45 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ref_Reference__
+#define __java_lang_ref_Reference__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace gnu
+ {
+ namespace gcj
+ {
+ class RawData;
+ }
+ }
+}
+
+class java::lang::ref::Reference : public ::java::lang::Object
+{
+
+public: // actually package-private
+ Reference(::java::lang::Object *);
+ Reference(::java::lang::Object *, ::java::lang::ref::ReferenceQueue *);
+private:
+ void create(::java::lang::Object *);
+public:
+ virtual ::java::lang::Object * get();
+ virtual void clear();
+ virtual jboolean isEnqueued();
+ virtual jboolean enqueue();
+public: // actually package-private
+ ::gnu::gcj::RawData * __attribute__((aligned(__alignof__( ::java::lang::Object)))) referent;
+ ::gnu::gcj::RawData * copy;
+ jboolean cleared;
+ ::java::lang::ref::ReferenceQueue * queue;
+ ::java::lang::ref::Reference * nextOnQueue;
+ static ::java::lang::Object * lock;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_ref_Reference__
diff --git a/libjava/java/lang/ref/Reference.java b/libjava/java/lang/ref/Reference.java
index ab0c55c84ce..a5184cee888 100644
--- a/libjava/java/lang/ref/Reference.java
+++ b/libjava/java/lang/ref/Reference.java
@@ -1,5 +1,5 @@
/* java.lang.ref.Reference
- Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -70,7 +70,7 @@ package java.lang.ref;
* @author Jochen Hoenicke
* @see java.util.WeakHashtable
*/
-public abstract class Reference
+public abstract class Reference<T>
{
/**
* The underlying object. This field is handled in a special way by
@@ -105,7 +105,7 @@ public abstract class Reference
* The queue this reference is registered on. This is null, if this
* wasn't registered to any queue or reference was already enqueued.
*/
- ReferenceQueue queue;
+ ReferenceQueue<? super T> queue;
/**
* Link to the next entry on the queue. If this is null, this
@@ -129,7 +129,7 @@ public abstract class Reference
* class in a different package.
* @param referent the object we refer to.
*/
- Reference(Object ref)
+ Reference(T ref)
{
create (ref);
}
@@ -142,7 +142,7 @@ public abstract class Reference
* @param q the reference queue to register on.
* @exception NullPointerException if q is null.
*/
- Reference(Object ref, ReferenceQueue q)
+ Reference(T ref, ReferenceQueue<? super T> q)
{
if (q == null)
throw new NullPointerException();
@@ -153,20 +153,14 @@ public abstract class Reference
/**
* Notifies the VM that a new Reference has been created.
*/
- private native void create (Object o);
+ private native void create (T o);
/**
* Returns the object, this reference refers to.
* @return the object, this reference refers to, or null if the
* reference was cleared.
*/
- public Object get()
- {
- synchronized (lock)
- {
- return referent;
- }
- }
+ public native T get();
/**
* Clears the reference, so that it doesn't refer to its object
diff --git a/libjava/java/lang/ref/ReferenceQueue.h b/libjava/java/lang/ref/ReferenceQueue.h
new file mode 100644
index 00000000000..bd4a9d8b71d
--- /dev/null
+++ b/libjava/java/lang/ref/ReferenceQueue.h
@@ -0,0 +1,31 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ref_ReferenceQueue__
+#define __java_lang_ref_ReferenceQueue__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::ref::ReferenceQueue : public ::java::lang::Object
+{
+
+public:
+ ReferenceQueue();
+ virtual ::java::lang::ref::Reference * poll();
+public: // actually package-private
+ virtual jboolean enqueue(::java::lang::ref::Reference *);
+private:
+ ::java::lang::ref::Reference * dequeue();
+public:
+ virtual ::java::lang::ref::Reference * remove(jlong);
+ virtual ::java::lang::ref::Reference * remove();
+private:
+ ::java::lang::ref::Reference * __attribute__((aligned(__alignof__( ::java::lang::Object)))) first;
+ ::java::lang::Object * lock;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_ref_ReferenceQueue__
diff --git a/libjava/java/lang/ref/SoftReference.h b/libjava/java/lang/ref/SoftReference.h
new file mode 100644
index 00000000000..faa98e7bd62
--- /dev/null
+++ b/libjava/java/lang/ref/SoftReference.h
@@ -0,0 +1,21 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ref_SoftReference__
+#define __java_lang_ref_SoftReference__
+
+#pragma interface
+
+#include <java/lang/ref/Reference.h>
+
+class java::lang::ref::SoftReference : public ::java::lang::ref::Reference
+{
+
+public:
+ SoftReference(::java::lang::Object *);
+ SoftReference(::java::lang::Object *, ::java::lang::ref::ReferenceQueue *);
+ virtual ::java::lang::Object * get();
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_ref_SoftReference__
diff --git a/libjava/java/lang/ref/WeakReference.h b/libjava/java/lang/ref/WeakReference.h
new file mode 100644
index 00000000000..b540274d3f3
--- /dev/null
+++ b/libjava/java/lang/ref/WeakReference.h
@@ -0,0 +1,20 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_ref_WeakReference__
+#define __java_lang_ref_WeakReference__
+
+#pragma interface
+
+#include <java/lang/ref/Reference.h>
+
+class java::lang::ref::WeakReference : public ::java::lang::ref::Reference
+{
+
+public:
+ WeakReference(::java::lang::Object *);
+ WeakReference(::java::lang::Object *, ::java::lang::ref::ReferenceQueue *);
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_ref_WeakReference__
diff --git a/libjava/java/lang/ref/natReference.cc b/libjava/java/lang/ref/natReference.cc
index 23f435f4def..ac7272cf5c2 100644
--- a/libjava/java/lang/ref/natReference.cc
+++ b/libjava/java/lang/ref/natReference.cc
@@ -1,6 +1,6 @@
// natReference.cc - Native code for References
-/* Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation
+/* Copyright (C) 2001, 2002, 2003, 2005, 2006 Free Software Foundation
This file is part of libgcj.
@@ -368,3 +368,10 @@ void
add_to_hash (this);
}
}
+
+::java::lang::Object *
+::java::lang::ref::Reference::get()
+{
+ JvSynchronize sync (lock);
+ return referent;
+}
diff --git a/libjava/java/lang/reflect/AccessibleObject.h b/libjava/java/lang/reflect/AccessibleObject.h
new file mode 100644
index 00000000000..d140e300c58
--- /dev/null
+++ b/libjava/java/lang/reflect/AccessibleObject.h
@@ -0,0 +1,36 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_AccessibleObject__
+#define __java_lang_reflect_AccessibleObject__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::reflect::AccessibleObject : public ::java::lang::Object
+{
+
+public: // actually protected
+ AccessibleObject();
+public:
+ virtual jboolean isAccessible();
+ static void setAccessible(JArray< ::java::lang::reflect::AccessibleObject * > *, jboolean);
+ virtual void setAccessible(jboolean);
+private:
+ static void checkPermission();
+ void secureSetAccessible(jboolean);
+public:
+ virtual ::java::lang::annotation::Annotation * getAnnotation(::java::lang::Class *);
+ virtual JArray< ::java::lang::annotation::Annotation * > * getAnnotations();
+ virtual JArray< ::java::lang::annotation::Annotation * > * getDeclaredAnnotations();
+ virtual jboolean isAnnotationPresent(::java::lang::Class *);
+public: // actually package-private
+ jboolean __attribute__((aligned(__alignof__( ::java::lang::Object)))) flag;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_reflect_AccessibleObject__
diff --git a/libjava/java/lang/reflect/AnnotatedElement.h b/libjava/java/lang/reflect/AnnotatedElement.h
new file mode 100644
index 00000000000..5792b75e0cc
--- /dev/null
+++ b/libjava/java/lang/reflect/AnnotatedElement.h
@@ -0,0 +1,24 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_AnnotatedElement__
+#define __java_lang_reflect_AnnotatedElement__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::reflect::AnnotatedElement : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::lang::annotation::Annotation * getAnnotation(::java::lang::Class *) = 0;
+ virtual JArray< ::java::lang::annotation::Annotation * > * getAnnotations() = 0;
+ virtual JArray< ::java::lang::annotation::Annotation * > * getDeclaredAnnotations() = 0;
+ virtual jboolean isAnnotationPresent(::java::lang::Class *) = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_reflect_AnnotatedElement__
diff --git a/libjava/java/lang/reflect/Array.h b/libjava/java/lang/reflect/Array.h
new file mode 100644
index 00000000000..48df7d3fa50
--- /dev/null
+++ b/libjava/java/lang/reflect/Array.h
@@ -0,0 +1,46 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_Array__
+#define __java_lang_reflect_Array__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::reflect::Array : public ::java::lang::Object
+{
+
+ Array();
+public:
+ static ::java::lang::Object * newInstance(::java::lang::Class *, jint);
+ static ::java::lang::Object * newInstance(::java::lang::Class *, JArray< jint > *);
+ static jint getLength(::java::lang::Object *);
+ static ::java::lang::Object * get(::java::lang::Object *, jint);
+ static jboolean getBoolean(::java::lang::Object *, jint);
+ static jbyte getByte(::java::lang::Object *, jint);
+ static jchar getChar(::java::lang::Object *, jint);
+ static jshort getShort(::java::lang::Object *, jint);
+ static jint getInt(::java::lang::Object *, jint);
+ static jlong getLong(::java::lang::Object *, jint);
+ static jfloat getFloat(::java::lang::Object *, jint);
+ static jdouble getDouble(::java::lang::Object *, jint);
+private:
+ static ::java::lang::Class * getElementType(::java::lang::Object *, jint);
+ static void set(::java::lang::Object *, jint, ::java::lang::Object *, ::java::lang::Class *);
+public:
+ static void set(::java::lang::Object *, jint, ::java::lang::Object *);
+ static void setBoolean(::java::lang::Object *, jint, jboolean);
+ static void setByte(::java::lang::Object *, jint, jbyte);
+ static void setChar(::java::lang::Object *, jint, jchar);
+ static void setShort(::java::lang::Object *, jint, jshort);
+ static void setInt(::java::lang::Object *, jint, jint);
+ static void setLong(::java::lang::Object *, jint, jlong);
+ static void setFloat(::java::lang::Object *, jint, jfloat);
+ static void setDouble(::java::lang::Object *, jint, jdouble);
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_reflect_Array__
diff --git a/libjava/java/lang/reflect/Constructor.h b/libjava/java/lang/reflect/Constructor.h
new file mode 100644
index 00000000000..5a200bc114d
--- /dev/null
+++ b/libjava/java/lang/reflect/Constructor.h
@@ -0,0 +1,65 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_Constructor__
+#define __java_lang_reflect_Constructor__
+
+#pragma interface
+
+#include <java/lang/reflect/AccessibleObject.h>
+#include <gcj/array.h>
+
+
+jmethodID _Jv_FromReflectedConstructor (java::lang::reflect::Constructor *);
+jobject _Jv_JNI_ToReflectedMethod (_Jv_JNIEnv *, jclass, jmethodID, jboolean);
+
+class java::lang::reflect::Constructor : public ::java::lang::reflect::AccessibleObject
+{
+
+ Constructor();
+public:
+ ::java::lang::Class * getDeclaringClass();
+ ::java::lang::String * getName();
+private:
+ jint getModifiersInternal();
+public:
+ jint getModifiers();
+ jboolean isSynthetic();
+ jboolean isVarArgs();
+ JArray< ::java::lang::Class * > * getParameterTypes();
+ JArray< ::java::lang::Class * > * getExceptionTypes();
+ jboolean equals(::java::lang::Object *);
+ jint hashCode();
+ ::java::lang::String * toString();
+public: // actually package-private
+ static void addTypeParameters(::java::lang::StringBuilder *, JArray< ::java::lang::reflect::TypeVariable * > *);
+public:
+ ::java::lang::String * toGenericString();
+ ::java::lang::Object * newInstance(JArray< ::java::lang::Object * > *);
+ JArray< ::java::lang::reflect::TypeVariable * > * getTypeParameters();
+private:
+ ::java::lang::String * getSignature();
+public:
+ JArray< ::java::lang::reflect::Type * > * getGenericExceptionTypes();
+ JArray< ::java::lang::reflect::Type * > * getGenericParameterTypes();
+ ::java::lang::annotation::Annotation * getAnnotation(::java::lang::Class *);
+ JArray< ::java::lang::annotation::Annotation * > * getDeclaredAnnotations();
+ JArray< JArray< ::java::lang::annotation::Annotation * > * > * getParameterAnnotations();
+private:
+ JArray< ::java::lang::annotation::Annotation * > * getDeclaredAnnotationsInternal();
+ JArray< JArray< ::java::lang::annotation::Annotation * > * > * getParameterAnnotationsInternal();
+ void getType();
+ static const jint CONSTRUCTOR_MODIFIERS = 7;
+ ::java::lang::Class * __attribute__((aligned(__alignof__( ::java::lang::reflect::AccessibleObject)))) declaringClass;
+ JArray< ::java::lang::Class * > * exception_types;
+ JArray< ::java::lang::Class * > * parameter_types;
+ jint offset;
+public:
+ static ::java::lang::Class class$;
+
+ friend jmethodID (::_Jv_FromReflectedConstructor) (java::lang::reflect::Constructor *);
+ friend jobject (::_Jv_JNI_ToReflectedMethod) (_Jv_JNIEnv *, jclass, jmethodID, jboolean);
+ friend class java::lang::Class;
+};
+
+#endif // __java_lang_reflect_Constructor__
diff --git a/libjava/java/lang/reflect/Constructor.java b/libjava/java/lang/reflect/Constructor.java
index 68b2d3985cf..83aae3b48ce 100644
--- a/libjava/java/lang/reflect/Constructor.java
+++ b/libjava/java/lang/reflect/Constructor.java
@@ -40,6 +40,7 @@ exception statement from your version. */
package java.lang.reflect;
import gnu.java.lang.reflect.MethodSignatureParser;
+import java.lang.annotation.Annotation;
/**
* The Constructor class represents a constructor of a class. It also allows
@@ -75,7 +76,7 @@ import gnu.java.lang.reflect.MethodSignatureParser;
* @since 1.1
* @status updated to 1.4
*/
-public final class Constructor extends AccessibleObject
+public final class Constructor<T> extends AccessibleObject
implements Member, GenericDeclaration
{
private static final int CONSTRUCTOR_MODIFIERS
@@ -92,7 +93,7 @@ public final class Constructor extends AccessibleObject
* Gets the class that declared this constructor.
* @return the class that declared this member
*/
- public Class getDeclaringClass()
+ public Class<T> getDeclaringClass ()
{
return declaringClass;
}
@@ -235,8 +236,8 @@ public final class Constructor extends AccessibleObject
return b.toString();
}
- /* FIXME[GENERICS]: Add X extends GenericDeclaration and TypeVariable<X> */
- static void addTypeParameters(StringBuilder sb, TypeVariable[] typeArgs)
+ static <X extends GenericDeclaration>
+ void addTypeParameters(StringBuilder sb, TypeVariable<X>[] typeArgs)
{
if (typeArgs.length == 0)
return;
@@ -320,8 +321,7 @@ public final class Constructor extends AccessibleObject
* specification, version 3.
* @since 1.5
*/
- /* FIXME[GENERICS]: Add <Constructor<T>> */
- public TypeVariable[] getTypeParameters()
+ public TypeVariable<Constructor<T>>[] getTypeParameters()
{
String sig = getSignature();
if (sig == null)
@@ -334,11 +334,7 @@ public final class Constructor extends AccessibleObject
* Return the String in the Signature attribute for this constructor. If there
* is no Signature attribute, return null.
*/
- private String getSignature()
- {
- // FIXME: libgcj doesn't record this information yet.
- return null;
- }
+ private native String getSignature();
/**
* Returns an array of <code>Type</code> objects that represents
@@ -382,11 +378,41 @@ public final class Constructor extends AccessibleObject
return p.getGenericParameterTypes();
}
+ public <T extends Annotation> T getAnnotation(Class<T> annoClass)
+ {
+ Annotation[] annos = getDeclaredAnnotations();
+ for (int i = 0; i < annos.length; ++i)
+ if (annos[i].annotationType() == annoClass)
+ return (T) annos[i];
+ return null;
+ }
+
+ public Annotation[] getDeclaredAnnotations()
+ {
+ Annotation[] result = getDeclaredAnnotationsInternal();
+ if (result == null)
+ result = new Annotation[0];
+ return result;
+ }
+
+ public Annotation[][] getParameterAnnotations()
+ {
+ // FIXME: should check that we have the right number
+ // of parameters ...?
+ Annotation[][] result = getParameterAnnotationsInternal();
+ if (result == null)
+ result = new Annotation[0][0];
+ return result;
+ }
+
+ private native Annotation[] getDeclaredAnnotationsInternal();
+ private native Annotation[][] getParameterAnnotationsInternal();
+
// Update cached values from method descriptor in class.
private native void getType ();
// Declaring class.
- private Class declaringClass;
+ private Class<T> declaringClass;
// Exception types.
private Class[] exception_types;
diff --git a/libjava/java/lang/reflect/Field.h b/libjava/java/lang/reflect/Field.h
new file mode 100644
index 00000000000..3e39fb2bad1
--- /dev/null
+++ b/libjava/java/lang/reflect/Field.h
@@ -0,0 +1,96 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_Field__
+#define __java_lang_reflect_Field__
+
+#pragma interface
+
+#include <java/lang/reflect/AccessibleObject.h>
+#include <gcj/array.h>
+
+
+jfieldID _Jv_FromReflectedField (java::lang::reflect::Field *);
+jobject _Jv_JNI_ToReflectedField (_Jv_JNIEnv*, jclass, jfieldID, jboolean);
+
+class java::lang::reflect::Field : public ::java::lang::reflect::AccessibleObject
+{
+
+public: // actually package-private
+ Field();
+public:
+ ::java::lang::Class * getDeclaringClass();
+ ::java::lang::String * getName();
+private:
+ jint getModifiersInternal();
+public:
+ jint getModifiers();
+ jboolean isSynthetic();
+ jboolean isEnumConstant();
+ ::java::lang::Class * getType();
+ jboolean equals(::java::lang::Object *);
+ jint hashCode();
+ ::java::lang::String * toString();
+ ::java::lang::String * toGenericString();
+ ::java::lang::Object * get(::java::lang::Object *);
+ jboolean getBoolean(::java::lang::Object *);
+ jbyte getByte(::java::lang::Object *);
+ jchar getChar(::java::lang::Object *);
+ jshort getShort(::java::lang::Object *);
+ jint getInt(::java::lang::Object *);
+ jlong getLong(::java::lang::Object *);
+ jfloat getFloat(::java::lang::Object *);
+ jdouble getDouble(::java::lang::Object *);
+private:
+ jboolean getBoolean(::java::lang::Class *, ::java::lang::Object *);
+ jchar getChar(::java::lang::Class *, ::java::lang::Object *);
+ jbyte getByte(::java::lang::Class *, ::java::lang::Object *);
+ jshort getShort(::java::lang::Class *, ::java::lang::Object *);
+ jint getInt(::java::lang::Class *, ::java::lang::Object *);
+ jlong getLong(::java::lang::Class *, ::java::lang::Object *);
+ jfloat getFloat(::java::lang::Class *, ::java::lang::Object *);
+ jdouble getDouble(::java::lang::Class *, ::java::lang::Object *);
+ ::java::lang::Object * get(::java::lang::Class *, ::java::lang::Object *);
+public:
+ void set(::java::lang::Object *, ::java::lang::Object *);
+ void setBoolean(::java::lang::Object *, jboolean);
+ void setByte(::java::lang::Object *, jbyte);
+ void setChar(::java::lang::Object *, jchar);
+ void setShort(::java::lang::Object *, jshort);
+ void setInt(::java::lang::Object *, jint);
+ void setLong(::java::lang::Object *, jlong);
+ void setFloat(::java::lang::Object *, jfloat);
+ void setDouble(::java::lang::Object *, jdouble);
+ ::java::lang::reflect::Type * getGenericType();
+ ::java::lang::annotation::Annotation * getAnnotation(::java::lang::Class *);
+ JArray< ::java::lang::annotation::Annotation * > * getDeclaredAnnotations();
+private:
+ JArray< ::java::lang::annotation::Annotation * > * getDeclaredAnnotationsInternal();
+ ::java::lang::String * getSignature();
+public: // actually package-private
+ void setByte(::java::lang::Class *, ::java::lang::Object *, jbyte, jboolean);
+ void setShort(::java::lang::Class *, ::java::lang::Object *, jshort, jboolean);
+ void setInt(::java::lang::Class *, ::java::lang::Object *, jint, jboolean);
+ void setLong(::java::lang::Class *, ::java::lang::Object *, jlong, jboolean);
+ void setFloat(::java::lang::Class *, ::java::lang::Object *, jfloat, jboolean);
+ void setDouble(::java::lang::Class *, ::java::lang::Object *, jdouble, jboolean);
+ void setChar(::java::lang::Class *, ::java::lang::Object *, jchar, jboolean);
+ void setBoolean(::java::lang::Class *, ::java::lang::Object *, jboolean, jboolean);
+ void set(::java::lang::Class *, ::java::lang::Object *, ::java::lang::Object *, ::java::lang::Class *, jboolean);
+private:
+ void set(::java::lang::Class *, ::java::lang::Object *, ::java::lang::Object *);
+ ::java::lang::Class * __attribute__((aligned(__alignof__( ::java::lang::reflect::AccessibleObject)))) declaringClass;
+ ::java::lang::String * name;
+ jint offset;
+ ::java::lang::Class * type;
+public: // actually package-private
+ static const jint FIELD_MODIFIERS = 223;
+public:
+ static ::java::lang::Class class$;
+
+ friend jfieldID (::_Jv_FromReflectedField) (java::lang::reflect::Field *);
+ friend jobject (::_Jv_JNI_ToReflectedField) (_Jv_JNIEnv*, jclass, jfieldID, jboolean);
+ friend class java::lang::Class;
+};
+
+#endif // __java_lang_reflect_Field__
diff --git a/libjava/java/lang/reflect/Field.java b/libjava/java/lang/reflect/Field.java
index 134ff132ecf..61db14df576 100644
--- a/libjava/java/lang/reflect/Field.java
+++ b/libjava/java/lang/reflect/Field.java
@@ -41,6 +41,7 @@ package java.lang.reflect;
import gnu.java.lang.ClassHelper;
import gnu.java.lang.reflect.FieldSignatureParser;
+import java.lang.annotation.Annotation;
/**
* The Field class represents a member variable of a class. It also allows
@@ -88,7 +89,7 @@ public final class Field
// The Class (or primitive TYPE) of this field.
private Class type;
- private static final int FIELD_MODIFIERS
+ static final int FIELD_MODIFIERS
= Modifier.FINAL | Modifier.PRIVATE | Modifier.PROTECTED
| Modifier.PUBLIC | Modifier.STATIC | Modifier.TRANSIENT
| Modifier.VOLATILE;
@@ -104,7 +105,7 @@ public final class Field
* is a non-inherited member.
* @return the class that declared this member
*/
- public Class getDeclaringClass()
+ public Class<?> getDeclaringClass()
{
return declaringClass;
}
@@ -158,7 +159,7 @@ public final class Field
* Gets the type of this field.
* @return the type of this field
*/
- public native Class getType();
+ public native Class<?> getType();
/**
* Compare two objects to see if they are semantically equivalent.
@@ -733,15 +734,30 @@ public final class Field
return p.getFieldType();
}
+ public <T extends Annotation> T getAnnotation(Class<T> annoClass)
+ {
+ Annotation[] annos = getDeclaredAnnotations();
+ for (int i = 0; i < annos.length; ++i)
+ if (annos[i].annotationType() == annoClass)
+ return (T) annos[i];
+ return null;
+ }
+
+ public Annotation[] getDeclaredAnnotations()
+ {
+ Annotation[] result = getDeclaredAnnotationsInternal();
+ if (result == null)
+ result = new Annotation[0];
+ return result;
+ }
+
+ private native Annotation[] getDeclaredAnnotationsInternal();
+
/**
* Return the String in the Signature attribute for this field. If there
* is no Signature attribute, return null.
*/
- private String getSignature()
- {
- // FIXME: libgcj doesn't record Signature attributes yet.
- return null;
- }
+ private native String getSignature();
native void setByte (Class caller, Object obj, byte b, boolean checkFinal)
throws IllegalArgumentException, IllegalAccessException;
diff --git a/libjava/java/lang/reflect/GenericArrayType.h b/libjava/java/lang/reflect/GenericArrayType.h
new file mode 100644
index 00000000000..cdeb0b2a328
--- /dev/null
+++ b/libjava/java/lang/reflect/GenericArrayType.h
@@ -0,0 +1,19 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_GenericArrayType__
+#define __java_lang_reflect_GenericArrayType__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::reflect::GenericArrayType : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::lang::reflect::Type * getGenericComponentType() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_reflect_GenericArrayType__
diff --git a/libjava/java/lang/reflect/GenericDeclaration.h b/libjava/java/lang/reflect/GenericDeclaration.h
new file mode 100644
index 00000000000..5c484ea96ea
--- /dev/null
+++ b/libjava/java/lang/reflect/GenericDeclaration.h
@@ -0,0 +1,21 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_GenericDeclaration__
+#define __java_lang_reflect_GenericDeclaration__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::reflect::GenericDeclaration : public ::java::lang::Object
+{
+
+public:
+ virtual JArray< ::java::lang::reflect::TypeVariable * > * getTypeParameters() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_reflect_GenericDeclaration__
diff --git a/libjava/java/lang/reflect/GenericSignatureFormatError.h b/libjava/java/lang/reflect/GenericSignatureFormatError.h
new file mode 100644
index 00000000000..c46c9264ad3
--- /dev/null
+++ b/libjava/java/lang/reflect/GenericSignatureFormatError.h
@@ -0,0 +1,22 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_GenericSignatureFormatError__
+#define __java_lang_reflect_GenericSignatureFormatError__
+
+#pragma interface
+
+#include <java/lang/ClassFormatError.h>
+
+class java::lang::reflect::GenericSignatureFormatError : public ::java::lang::ClassFormatError
+{
+
+public:
+ GenericSignatureFormatError();
+private:
+ static const jlong serialVersionUID = 6709919147137911034LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_reflect_GenericSignatureFormatError__
diff --git a/libjava/java/lang/reflect/InvocationHandler.h b/libjava/java/lang/reflect/InvocationHandler.h
new file mode 100644
index 00000000000..7221953217a
--- /dev/null
+++ b/libjava/java/lang/reflect/InvocationHandler.h
@@ -0,0 +1,21 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_InvocationHandler__
+#define __java_lang_reflect_InvocationHandler__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::reflect::InvocationHandler : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::lang::Object * invoke(::java::lang::Object *, ::java::lang::reflect::Method *, JArray< ::java::lang::Object * > *) = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_reflect_InvocationHandler__
diff --git a/libjava/java/lang/reflect/InvocationTargetException.h b/libjava/java/lang/reflect/InvocationTargetException.h
new file mode 100644
index 00000000000..37e229c2957
--- /dev/null
+++ b/libjava/java/lang/reflect/InvocationTargetException.h
@@ -0,0 +1,28 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_InvocationTargetException__
+#define __java_lang_reflect_InvocationTargetException__
+
+#pragma interface
+
+#include <java/lang/Exception.h>
+
+class java::lang::reflect::InvocationTargetException : public ::java::lang::Exception
+{
+
+public: // actually protected
+ InvocationTargetException();
+public:
+ InvocationTargetException(::java::lang::Throwable *);
+ InvocationTargetException(::java::lang::Throwable *, ::java::lang::String *);
+ virtual ::java::lang::Throwable * getTargetException();
+ virtual ::java::lang::Throwable * getCause();
+private:
+ static const jlong serialVersionUID = 4085088731926701167LL;
+ ::java::lang::Throwable * __attribute__((aligned(__alignof__( ::java::lang::Exception)))) target;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_reflect_InvocationTargetException__
diff --git a/libjava/java/lang/reflect/MalformedParameterizedTypeException.h b/libjava/java/lang/reflect/MalformedParameterizedTypeException.h
new file mode 100644
index 00000000000..a48f669c0c1
--- /dev/null
+++ b/libjava/java/lang/reflect/MalformedParameterizedTypeException.h
@@ -0,0 +1,22 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_MalformedParameterizedTypeException__
+#define __java_lang_reflect_MalformedParameterizedTypeException__
+
+#pragma interface
+
+#include <java/lang/RuntimeException.h>
+
+class java::lang::reflect::MalformedParameterizedTypeException : public ::java::lang::RuntimeException
+{
+
+public:
+ MalformedParameterizedTypeException();
+private:
+ static const jlong serialVersionUID = -5696557788586220964LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_reflect_MalformedParameterizedTypeException__
diff --git a/libjava/java/lang/reflect/Member.h b/libjava/java/lang/reflect/Member.h
new file mode 100644
index 00000000000..9e3522be0d6
--- /dev/null
+++ b/libjava/java/lang/reflect/Member.h
@@ -0,0 +1,24 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_Member__
+#define __java_lang_reflect_Member__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::reflect::Member : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::lang::Class * getDeclaringClass() = 0;
+ virtual ::java::lang::String * getName() = 0;
+ virtual jint getModifiers() = 0;
+ virtual jboolean isSynthetic() = 0;
+ static const jint DECLARED = 1;
+ static const jint PUBLIC = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_reflect_Member__
diff --git a/libjava/java/lang/reflect/Method.h b/libjava/java/lang/reflect/Method.h
new file mode 100644
index 00000000000..7d4b46d3e27
--- /dev/null
+++ b/libjava/java/lang/reflect/Method.h
@@ -0,0 +1,76 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_Method__
+#define __java_lang_reflect_Method__
+
+#pragma interface
+
+#include <java/lang/reflect/AccessibleObject.h>
+#include <gcj/array.h>
+
+
+jmethodID _Jv_FromReflectedMethod (java::lang::reflect::Method *);
+jobject _Jv_JNI_ToReflectedMethod (_Jv_JNIEnv *, jclass, jmethodID, jboolean);
+
+class java::lang::reflect::Method : public ::java::lang::reflect::AccessibleObject
+{
+
+ Method();
+public:
+ ::java::lang::Class * getDeclaringClass();
+ ::java::lang::String * getName();
+private:
+ jint getModifiersInternal();
+public:
+ jint getModifiers();
+ jboolean isBridge();
+ jboolean isSynthetic();
+ jboolean isVarArgs();
+ ::java::lang::Class * getReturnType();
+ JArray< ::java::lang::Class * > * getParameterTypes();
+ JArray< ::java::lang::Class * > * getExceptionTypes();
+ jboolean equals(::java::lang::Object *);
+ jint hashCode();
+ ::java::lang::String * toString();
+ ::java::lang::String * toGenericString();
+ ::java::lang::Object * invoke(::java::lang::Object *, JArray< ::java::lang::Object * > *);
+ JArray< ::java::lang::reflect::TypeVariable * > * getTypeParameters();
+private:
+ ::java::lang::String * getSignature();
+public:
+ JArray< ::java::lang::reflect::Type * > * getGenericExceptionTypes();
+ JArray< ::java::lang::reflect::Type * > * getGenericParameterTypes();
+ ::java::lang::reflect::Type * getGenericReturnType();
+ ::java::lang::Object * getDefaultValue();
+ ::java::lang::annotation::Annotation * getAnnotation(::java::lang::Class *);
+ JArray< ::java::lang::annotation::Annotation * > * getDeclaredAnnotations();
+ JArray< JArray< ::java::lang::annotation::Annotation * > * > * getParameterAnnotations();
+private:
+ JArray< ::java::lang::annotation::Annotation * > * getDeclaredAnnotationsInternal();
+ JArray< JArray< ::java::lang::annotation::Annotation * > * > * getParameterAnnotationsInternal();
+ void getType();
+public: // actually package-private
+ static void appendClassName(::java::lang::StringBuffer *, ::java::lang::Class *);
+ static const jint METHOD_MODIFIERS = 3391;
+private:
+ ::java::lang::Class * __attribute__((aligned(__alignof__( ::java::lang::reflect::AccessibleObject)))) declaringClass;
+public: // actually package-private
+ JArray< ::java::lang::Class * > * exception_types;
+private:
+ ::java::lang::String * name;
+public: // actually package-private
+ JArray< ::java::lang::Class * > * parameter_types;
+ ::java::lang::Class * return_type;
+private:
+ jint offset;
+public:
+ static ::java::lang::Class class$;
+
+ friend jmethodID (::_Jv_FromReflectedMethod) (java::lang::reflect::Method *);
+ friend jobject (::_Jv_JNI_ToReflectedMethod) (_Jv_JNIEnv *, jclass, jmethodID, jboolean);
+ friend class java::lang::Class;
+ friend class java::io::ObjectInputStream;
+};
+
+#endif // __java_lang_reflect_Method__
diff --git a/libjava/java/lang/reflect/Method.java b/libjava/java/lang/reflect/Method.java
index 3142d64944f..fc0bf106440 100644
--- a/libjava/java/lang/reflect/Method.java
+++ b/libjava/java/lang/reflect/Method.java
@@ -12,6 +12,7 @@ package java.lang.reflect;
import gnu.gcj.RawData;
import gnu.java.lang.reflect.MethodSignatureParser;
+import java.lang.annotation.Annotation;
/**
* The Method class represents a member method of a class. It also allows
@@ -50,7 +51,7 @@ import gnu.java.lang.reflect.MethodSignatureParser;
public final class Method
extends AccessibleObject implements Member, GenericDeclaration
{
- private static final int METHOD_MODIFIERS
+ static final int METHOD_MODIFIERS
= Modifier.ABSTRACT | Modifier.FINAL | Modifier.NATIVE
| Modifier.PRIVATE | Modifier.PROTECTED | Modifier.PUBLIC
| Modifier.STATIC | Modifier.STRICT | Modifier.SYNCHRONIZED;
@@ -132,7 +133,7 @@ public final class Method
* Gets the return type of this method.
* @return the type of this method
*/
- public Class getReturnType ()
+ public Class<?> getReturnType ()
{
if (return_type == null)
getType();
@@ -145,11 +146,11 @@ public final class Method
*
* @return a list of the types of the method's parameters
*/
- public Class[] getParameterTypes ()
+ public Class<?>[] getParameterTypes ()
{
if (parameter_types == null)
getType();
- return (Class[]) parameter_types.clone();
+ return (Class<?>[]) parameter_types.clone();
}
/**
@@ -159,11 +160,11 @@ public final class Method
*
* @return a list of the types in the method's throws clause
*/
- public Class[] getExceptionTypes ()
+ public Class<?>[] getExceptionTypes ()
{
if (exception_types == null)
getType();
- return (Class[]) exception_types.clone();
+ return (Class<?>[]) exception_types.clone();
}
/**
@@ -309,7 +310,7 @@ public final class Method
* @throws ExceptionInInitializerError if accessing a static method triggered
* class initialization, which then failed
*/
- public native Object invoke (Object obj, Object[] args)
+ public native Object invoke (Object obj, Object... args)
throws IllegalAccessException, IllegalArgumentException,
InvocationTargetException;
@@ -325,8 +326,7 @@ public final class Method
* specification, version 3.
* @since 1.5
*/
- /* FIXME[GENERICS]: Should be TypeVariable<Method>[] */
- public TypeVariable[] getTypeParameters()
+ public TypeVariable<Method>[] getTypeParameters()
{
String sig = getSignature();
if (sig == null)
@@ -339,11 +339,7 @@ public final class Method
* Return the String in the Signature attribute for this method. If there
* is no Signature attribute, return null.
*/
- private String getSignature()
- {
- // FIXME: libgcj doesn't record this information yet.
- return null;
- }
+ private native String getSignature();
/**
* Returns an array of <code>Type</code> objects that represents
@@ -405,6 +401,49 @@ public final class Method
return p.getGenericReturnType();
}
+ /**
+ * If this method is an annotation method, returns the default
+ * value for the method. If there is no default value, or if the
+ * method is not a member of an annotation type, returns null.
+ * Primitive types are wrapped.
+ *
+ * @throws TypeNotPresentException if the method returns a Class,
+ * and the class cannot be found
+ *
+ * @since 1.5
+ */
+ public native Object getDefaultValue();
+
+ public <T extends Annotation> T getAnnotation(Class<T> annoClass)
+ {
+ Annotation[] annos = getDeclaredAnnotations();
+ for (int i = 0; i < annos.length; ++i)
+ if (annos[i].annotationType() == annoClass)
+ return (T) annos[i];
+ return null;
+ }
+
+ public Annotation[] getDeclaredAnnotations()
+ {
+ Annotation[] result = getDeclaredAnnotationsInternal();
+ if (result == null)
+ result = new Annotation[0];
+ return result;
+ }
+
+ public Annotation[][] getParameterAnnotations()
+ {
+ // FIXME: should check that we have the right number
+ // of parameters ...?
+ Annotation[][] result = getParameterAnnotationsInternal();
+ if (result == null)
+ result = new Annotation[0][0];
+ return result;
+ }
+
+ private native Annotation[] getDeclaredAnnotationsInternal();
+ private native Annotation[][] getParameterAnnotationsInternal();
+
private native void getType ();
// Append a class name to a string buffer. We try to print the
@@ -431,13 +470,13 @@ public final class Method
private Class declaringClass;
// Exception types.
- private Class[] exception_types;
+ Class[] exception_types;
// Name cache. (Initially null.)
private String name;
// Parameter types.
- private Class[] parameter_types;
+ Class[] parameter_types;
// Return type.
- private Class return_type;
+ Class return_type;
// Offset in bytes from the start of declaringClass's methods array.
private int offset;
diff --git a/libjava/java/lang/reflect/Modifier.h b/libjava/java/lang/reflect/Modifier.h
new file mode 100644
index 00000000000..4ee474a9500
--- /dev/null
+++ b/libjava/java/lang/reflect/Modifier.h
@@ -0,0 +1,58 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_Modifier__
+#define __java_lang_reflect_Modifier__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::reflect::Modifier : public ::java::lang::Object
+{
+
+public:
+ Modifier();
+ static jboolean isAbstract(jint);
+ static jboolean isFinal(jint);
+ static jboolean isInterface(jint);
+ static jboolean isNative(jint);
+ static jboolean isPrivate(jint);
+ static jboolean isProtected(jint);
+ static jboolean isPublic(jint);
+ static jboolean isStatic(jint);
+ static jboolean isStrict(jint);
+ static jboolean isSynchronized(jint);
+ static jboolean isTransient(jint);
+ static jboolean isVolatile(jint);
+ static ::java::lang::String * toString(jint);
+public: // actually package-private
+ static ::java::lang::StringBuilder * toString(jint, ::java::lang::StringBuilder *);
+ static ::java::lang::StringBuffer * toString(jint, ::java::lang::StringBuffer *);
+public:
+ static const jint PUBLIC = 1;
+ static const jint PRIVATE = 2;
+ static const jint PROTECTED = 4;
+ static const jint STATIC = 8;
+ static const jint FINAL = 16;
+ static const jint SYNCHRONIZED = 32;
+ static const jint VOLATILE = 64;
+ static const jint TRANSIENT = 128;
+ static const jint NATIVE = 256;
+ static const jint INTERFACE = 512;
+ static const jint ABSTRACT = 1024;
+ static const jint STRICT = 2048;
+public: // actually package-private
+ static const jint SUPER = 32;
+ static const jint ALL_FLAGS = 4095;
+ static const jint BRIDGE = 64;
+ static const jint VARARGS = 128;
+ static const jint SYNTHETIC = 4096;
+ static const jint ENUM = 16384;
+ static const jint INVISIBLE = 32768;
+ static const jint INTERPRETED = 4096;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_reflect_Modifier__
diff --git a/libjava/java/lang/reflect/ParameterizedType.h b/libjava/java/lang/reflect/ParameterizedType.h
new file mode 100644
index 00000000000..dab9ad953b6
--- /dev/null
+++ b/libjava/java/lang/reflect/ParameterizedType.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_ParameterizedType__
+#define __java_lang_reflect_ParameterizedType__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::reflect::ParameterizedType : public ::java::lang::Object
+{
+
+public:
+ virtual JArray< ::java::lang::reflect::Type * > * getActualTypeArguments() = 0;
+ virtual ::java::lang::reflect::Type * getOwnerType() = 0;
+ virtual ::java::lang::reflect::Type * getRawType() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_reflect_ParameterizedType__
diff --git a/libjava/java/lang/reflect/Proxy$ClassFactory.h b/libjava/java/lang/reflect/Proxy$ClassFactory.h
new file mode 100644
index 00000000000..c4cfb883d4c
--- /dev/null
+++ b/libjava/java/lang/reflect/Proxy$ClassFactory.h
@@ -0,0 +1,78 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_Proxy$ClassFactory__
+#define __java_lang_reflect_Proxy$ClassFactory__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::reflect::Proxy$ClassFactory : public ::java::lang::Object
+{
+
+public: // actually package-private
+ Proxy$ClassFactory(::java::lang::reflect::Proxy$ProxyData *);
+private:
+ void emitMethod(jint, JArray< ::java::lang::Class * > *);
+public: // actually package-private
+ ::java::lang::Class * generate(::java::lang::ClassLoader *);
+private:
+ void putU1(jint);
+ void putU2(jint);
+ void putU4(jint);
+ void putConst(jint);
+ void putLoad(jint, ::java::lang::Class *);
+ ::java::lang::String * wrapper(::java::lang::Class *);
+ jchar utf8Info(::java::lang::String *);
+ jchar classInfo(::java::lang::String *);
+ jchar classInfo(::java::lang::Class *);
+ jchar refInfo(jbyte, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
+ jchar nameAndTypeInfo(::java::lang::String *, ::java::lang::String *);
+ ::java::lang::String * toUtf8(::java::lang::String *);
+ jchar poolIndex(::java::lang::String *);
+ static const jbyte FIELD = 1;
+ static const jbyte METHOD = 2;
+ static const jbyte INTERFACE = 3;
+ static ::java::lang::String * CTOR_SIG;
+ static ::java::lang::String * INVOKE_SIG;
+ static const jchar ACONST_NULL = 1;
+ static const jchar ICONST_0 = 3;
+ static const jchar BIPUSH = 16;
+ static const jchar SIPUSH = 17;
+ static const jchar ILOAD = 21;
+ static const jchar ILOAD_0 = 26;
+ static const jchar ALOAD_0 = 42;
+ static const jchar ALOAD_1 = 43;
+ static const jchar AALOAD = 50;
+ static const jchar AASTORE = 83;
+ static const jchar DUP = 89;
+ static const jchar DUP_X1 = 90;
+ static const jchar SWAP = 95;
+ static const jchar IRETURN = 172;
+ static const jchar LRETURN = 173;
+ static const jchar FRETURN = 174;
+ static const jchar DRETURN = 175;
+ static const jchar ARETURN = 176;
+ static const jchar RETURN = 177;
+ static const jchar GETSTATIC = 178;
+ static const jchar GETFIELD = 180;
+ static const jchar INVOKEVIRTUAL = 182;
+ static const jchar INVOKESPECIAL = 183;
+ static const jchar INVOKEINTERFACE = 185;
+ static const jchar NEW = 187;
+ static const jchar ANEWARRAY = 189;
+ static const jchar ATHROW = 191;
+ static const jchar CHECKCAST = 192;
+ ::java::lang::StringBuffer * __attribute__((aligned(__alignof__( ::java::lang::Object)))) pool;
+ ::java::lang::StringBuffer * stream;
+ ::java::util::Map * poolEntries;
+ ::java::lang::String * qualName;
+ JArray< ::java::lang::reflect::Method * > * methods;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_reflect_Proxy$ClassFactory__
diff --git a/libjava/java/lang/reflect/Proxy$ProxyData.h b/libjava/java/lang/reflect/Proxy$ProxyData.h
new file mode 100644
index 00000000000..2c0d91e5e5a
--- /dev/null
+++ b/libjava/java/lang/reflect/Proxy$ProxyData.h
@@ -0,0 +1,37 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_Proxy$ProxyData__
+#define __java_lang_reflect_Proxy$ProxyData__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::reflect::Proxy$ProxyData : public ::java::lang::Object
+{
+
+public: // actually package-private
+ Proxy$ProxyData();
+private:
+ static ::java::lang::String * getPackage(::java::lang::Class *);
+public: // actually package-private
+ static ::java::lang::reflect::Proxy$ProxyData * getProxyData(::java::lang::reflect::Proxy$ProxyType *);
+private:
+ static jboolean isCoreObjectMethod(::java::lang::reflect::Method *);
+public: // actually package-private
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) pack;
+ JArray< ::java::lang::Class * > * interfaces;
+ JArray< ::java::lang::reflect::Method * > * methods;
+ JArray< JArray< ::java::lang::Class * > * > * exceptions;
+private:
+ static jint count;
+public: // actually package-private
+ jint id;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_reflect_Proxy$ProxyData__
diff --git a/libjava/java/lang/reflect/Proxy$ProxySignature.h b/libjava/java/lang/reflect/Proxy$ProxySignature.h
new file mode 100644
index 00000000000..ae0f028deb0
--- /dev/null
+++ b/libjava/java/lang/reflect/Proxy$ProxySignature.h
@@ -0,0 +1,28 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_Proxy$ProxySignature__
+#define __java_lang_reflect_Proxy$ProxySignature__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::reflect::Proxy$ProxySignature : public ::java::lang::Object
+{
+
+public: // actually package-private
+ Proxy$ProxySignature(::java::lang::reflect::Method *);
+ void checkCompatibility(::java::lang::reflect::Proxy$ProxySignature *);
+public:
+ jint hashCode();
+ jboolean equals(::java::lang::Object *);
+public: // actually package-private
+ static ::java::util::HashMap * coreMethods;
+ ::java::lang::reflect::Method * __attribute__((aligned(__alignof__( ::java::lang::Object)))) method;
+ ::java::util::Set * exceptions;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_reflect_Proxy$ProxySignature__
diff --git a/libjava/java/lang/reflect/Proxy$ProxyType.h b/libjava/java/lang/reflect/Proxy$ProxyType.h
new file mode 100644
index 00000000000..da7653539f4
--- /dev/null
+++ b/libjava/java/lang/reflect/Proxy$ProxyType.h
@@ -0,0 +1,28 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_Proxy$ProxyType__
+#define __java_lang_reflect_Proxy$ProxyType__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::reflect::Proxy$ProxyType : public ::java::lang::Object
+{
+
+public: // actually package-private
+ Proxy$ProxyType(::java::lang::ClassLoader *, JArray< ::java::lang::Class * > *);
+public:
+ jint hashCode();
+ jboolean equals(::java::lang::Object *);
+public: // actually package-private
+ ::java::lang::ClassLoader * __attribute__((aligned(__alignof__( ::java::lang::Object)))) loader;
+ JArray< ::java::lang::Class * > * interfaces;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_reflect_Proxy$ProxyType__
diff --git a/libjava/java/lang/reflect/Proxy.h b/libjava/java/lang/reflect/Proxy.h
new file mode 100644
index 00000000000..4dad2cffd2d
--- /dev/null
+++ b/libjava/java/lang/reflect/Proxy.h
@@ -0,0 +1,32 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_Proxy__
+#define __java_lang_reflect_Proxy__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::reflect::Proxy : public ::java::lang::Object
+{
+
+public: // actually protected
+ Proxy(::java::lang::reflect::InvocationHandler *);
+public:
+ static ::java::lang::Class * getProxyClass(::java::lang::ClassLoader *, JArray< ::java::lang::Class * > *);
+ static ::java::lang::Object * newProxyInstance(::java::lang::ClassLoader *, JArray< ::java::lang::Class * > *, ::java::lang::reflect::InvocationHandler *);
+ static jboolean isProxyClass(::java::lang::Class *);
+ static ::java::lang::reflect::InvocationHandler * getInvocationHandler(::java::lang::Object *);
+private:
+ static const jlong serialVersionUID = -2222568056686623797LL;
+ static ::java::util::Map * proxyClasses;
+public: // actually protected
+ ::java::lang::reflect::InvocationHandler * __attribute__((aligned(__alignof__( ::java::lang::Object)))) h;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_reflect_Proxy__
diff --git a/libjava/java/lang/reflect/ReflectPermission.h b/libjava/java/lang/reflect/ReflectPermission.h
new file mode 100644
index 00000000000..0e6a7c32e79
--- /dev/null
+++ b/libjava/java/lang/reflect/ReflectPermission.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_ReflectPermission__
+#define __java_lang_reflect_ReflectPermission__
+
+#pragma interface
+
+#include <java/security/BasicPermission.h>
+
+class java::lang::reflect::ReflectPermission : public ::java::security::BasicPermission
+{
+
+public:
+ ReflectPermission(::java::lang::String *);
+ ReflectPermission(::java::lang::String *, ::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 7412737110241507485LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_reflect_ReflectPermission__
diff --git a/libjava/java/lang/reflect/Type.h b/libjava/java/lang/reflect/Type.h
new file mode 100644
index 00000000000..55c317fa425
--- /dev/null
+++ b/libjava/java/lang/reflect/Type.h
@@ -0,0 +1,18 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_Type__
+#define __java_lang_reflect_Type__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::lang::reflect::Type : public ::java::lang::Object
+{
+
+public:
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_reflect_Type__
diff --git a/libjava/java/lang/reflect/TypeVariable.h b/libjava/java/lang/reflect/TypeVariable.h
new file mode 100644
index 00000000000..6029c01903d
--- /dev/null
+++ b/libjava/java/lang/reflect/TypeVariable.h
@@ -0,0 +1,23 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_TypeVariable__
+#define __java_lang_reflect_TypeVariable__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::reflect::TypeVariable : public ::java::lang::Object
+{
+
+public:
+ virtual JArray< ::java::lang::reflect::Type * > * getBounds() = 0;
+ virtual ::java::lang::reflect::GenericDeclaration * getGenericDeclaration() = 0;
+ virtual ::java::lang::String * getName() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_reflect_TypeVariable__
diff --git a/libjava/java/lang/reflect/UndeclaredThrowableException.h b/libjava/java/lang/reflect/UndeclaredThrowableException.h
new file mode 100644
index 00000000000..01b969b0e43
--- /dev/null
+++ b/libjava/java/lang/reflect/UndeclaredThrowableException.h
@@ -0,0 +1,26 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_UndeclaredThrowableException__
+#define __java_lang_reflect_UndeclaredThrowableException__
+
+#pragma interface
+
+#include <java/lang/RuntimeException.h>
+
+class java::lang::reflect::UndeclaredThrowableException : public ::java::lang::RuntimeException
+{
+
+public:
+ UndeclaredThrowableException(::java::lang::Throwable *);
+ UndeclaredThrowableException(::java::lang::Throwable *, ::java::lang::String *);
+ virtual ::java::lang::Throwable * getUndeclaredThrowable();
+ virtual ::java::lang::Throwable * getCause();
+private:
+ static const jlong serialVersionUID = 330127114055056639LL;
+ ::java::lang::Throwable * __attribute__((aligned(__alignof__( ::java::lang::RuntimeException)))) undeclaredThrowable;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_reflect_UndeclaredThrowableException__
diff --git a/libjava/java/lang/reflect/VMProxy.h b/libjava/java/lang/reflect/VMProxy.h
new file mode 100644
index 00000000000..e48e8e4e875
--- /dev/null
+++ b/libjava/java/lang/reflect/VMProxy.h
@@ -0,0 +1,28 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_VMProxy__
+#define __java_lang_reflect_VMProxy__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::reflect::VMProxy : public ::java::lang::Object
+{
+
+public: // actually package-private
+ VMProxy();
+ static ::java::lang::Class * getProxyClass(::java::lang::ClassLoader *, JArray< ::java::lang::Class * > *);
+ static ::java::lang::reflect::Proxy$ProxyData * getProxyData(::java::lang::ClassLoader *, JArray< ::java::lang::Class * > *);
+ static ::java::lang::Class * generateProxyClass(::java::lang::ClassLoader *, ::java::lang::reflect::Proxy$ProxyData *);
+ static jboolean HAVE_NATIVE_GET_PROXY_CLASS;
+ static jboolean HAVE_NATIVE_GET_PROXY_DATA;
+ static jboolean HAVE_NATIVE_GENERATE_PROXY_CLASS;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_lang_reflect_VMProxy__
diff --git a/libjava/java/lang/reflect/VMProxy.java b/libjava/java/lang/reflect/VMProxy.java
index b3641cf17d9..ea1c8850625 100644
--- a/libjava/java/lang/reflect/VMProxy.java
+++ b/libjava/java/lang/reflect/VMProxy.java
@@ -65,7 +65,7 @@ final class VMProxy
* If this is true, HAVE_NATIVE_GET_PROXY_CLASS should be false.
* @see java.lang.reflect.Proxy
*/
- static boolean HAVE_NATIVE_GENERATE_PROXY_CLASS = false;
+ static boolean HAVE_NATIVE_GENERATE_PROXY_CLASS = true;
/**
* Optional native method to replace (and speed up) the pure Java
@@ -136,8 +136,5 @@ final class VMProxy
* @see #getProxyClass(ClassLoader, Class[])
* @see ProxyData#generateProxyClass(ClassLoader)
*/
- static Class generateProxyClass(ClassLoader loader, Proxy.ProxyData data)
- {
- return null;
- }
+ static native Class generateProxyClass(ClassLoader loader, Proxy.ProxyData data);
}
diff --git a/libjava/java/lang/reflect/WildcardType.h b/libjava/java/lang/reflect/WildcardType.h
new file mode 100644
index 00000000000..2c5b93d65e7
--- /dev/null
+++ b/libjava/java/lang/reflect/WildcardType.h
@@ -0,0 +1,22 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_lang_reflect_WildcardType__
+#define __java_lang_reflect_WildcardType__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::lang::reflect::WildcardType : public ::java::lang::Object
+{
+
+public:
+ virtual JArray< ::java::lang::reflect::Type * > * getLowerBounds() = 0;
+ virtual JArray< ::java::lang::reflect::Type * > * getUpperBounds() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_lang_reflect_WildcardType__
diff --git a/libjava/java/lang/reflect/natConstructor.cc b/libjava/java/lang/reflect/natConstructor.cc
index 35cf7f817ef..953d86dd411 100644
--- a/libjava/java/lang/reflect/natConstructor.cc
+++ b/libjava/java/lang/reflect/natConstructor.cc
@@ -23,12 +23,33 @@ details. */
#include <java/lang/InstantiationException.h>
#include <gcj/method.h>
+typedef JArray< ::java::lang::annotation::Annotation * > * anno_a_t;
+typedef JArray< JArray< ::java::lang::annotation::Annotation * > *> * anno_aa_t;
+
jint
java::lang::reflect::Constructor::getModifiersInternal ()
{
return _Jv_FromReflectedConstructor (this)->accflags;
}
+jstring
+java::lang::reflect::Constructor::getSignature()
+{
+ return declaringClass->getReflectionSignature (this);
+}
+
+anno_a_t
+java::lang::reflect::Constructor::getDeclaredAnnotationsInternal()
+{
+ return (anno_a_t) declaringClass->getDeclaredAnnotations(this, false);
+}
+
+anno_aa_t
+java::lang::reflect::Constructor::getParameterAnnotationsInternal()
+{
+ return (anno_aa_t) declaringClass->getDeclaredAnnotations(this, true);
+}
+
void
java::lang::reflect::Constructor::getType ()
{
diff --git a/libjava/java/lang/reflect/natField.cc b/libjava/java/lang/reflect/natField.cc
index 487f62ab0e2..b107ab851b7 100644
--- a/libjava/java/lang/reflect/natField.cc
+++ b/libjava/java/lang/reflect/natField.cc
@@ -29,6 +29,8 @@ details. */
#include <java/lang/Boolean.h>
#include <java/lang/Character.h>
+typedef JArray< ::java::lang::annotation::Annotation * > * anno_a_t;
+
jint
java::lang::reflect::Field::getModifiersInternal ()
{
@@ -36,6 +38,18 @@ java::lang::reflect::Field::getModifiersInternal ()
}
jstring
+java::lang::reflect::Field::getSignature()
+{
+ return declaringClass->getReflectionSignature (this);
+}
+
+anno_a_t
+java::lang::reflect::Field::getDeclaredAnnotationsInternal()
+{
+ return (anno_a_t) declaringClass->getDeclaredAnnotations(this);
+}
+
+jstring
java::lang::reflect::Field::getName ()
{
if (name == NULL)
diff --git a/libjava/java/lang/reflect/natMethod.cc b/libjava/java/lang/reflect/natMethod.cc
index eb7170a02be..6dcd4ec518a 100644
--- a/libjava/java/lang/reflect/natMethod.cc
+++ b/libjava/java/lang/reflect/natMethod.cc
@@ -48,6 +48,11 @@ details. */
#include <java/lang/UnsupportedOperationException.h>
#endif
+typedef JArray< ::java::lang::annotation::Annotation * > * anno_a_t;
+typedef JArray< JArray< ::java::lang::annotation::Annotation * > *> * anno_aa_t;
+
+
+
struct cpair
{
jclass prim;
@@ -189,6 +194,30 @@ java::lang::reflect::Method::getModifiersInternal ()
}
jstring
+java::lang::reflect::Method::getSignature()
+{
+ return declaringClass->getReflectionSignature (this);
+}
+
+jobject
+java::lang::reflect::Method::getDefaultValue()
+{
+ return declaringClass->getMethodDefaultValue(this);
+}
+
+anno_a_t
+java::lang::reflect::Method::getDeclaredAnnotationsInternal()
+{
+ return (anno_a_t) declaringClass->getDeclaredAnnotations(this, false);
+}
+
+anno_aa_t
+java::lang::reflect::Method::getParameterAnnotationsInternal()
+{
+ return (anno_aa_t) declaringClass->getDeclaredAnnotations(this, true);
+}
+
+jstring
java::lang::reflect::Method::getName ()
{
if (name == NULL)
diff --git a/libjava/java/lang/reflect/natVMProxy.cc b/libjava/java/lang/reflect/natVMProxy.cc
new file mode 100644
index 00000000000..8d803a85971
--- /dev/null
+++ b/libjava/java/lang/reflect/natVMProxy.cc
@@ -0,0 +1,394 @@
+// natVMProxy.cc -- Implementation of VMProxy methods.
+
+/* Copyright (C) 2006
+ Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+// The idea of behind this code is to utilize libffi's ability to
+// create closures to provide a fast "cut-through" way to generate
+// proxy classes. Instead of generating bytecode and then
+// interpreting that, we copy the method definitions for each of the
+// methods we're supposed to be prxying and generate a libffi closure
+// for each one.
+
+#include <config.h>
+#include <platform.h>
+#include <sysdep/descriptor.h>
+
+#include <limits.h>
+#include <string.h>
+#include <stddef.h>
+#include <stdio.h>
+
+#include <gcj/cni.h>
+#include <gcj/javaprims.h>
+#include <jvm.h>
+#include <jni.h>
+#include <java-threads.h>
+#include <java-interp.h>
+#include <ffi.h>
+#include <execution.h>
+#include <gcj/method.h>
+
+#include <gnu/gcj/runtime/BootClassLoader.h>
+#include <java/lang/Class.h>
+#include <java/lang/ClassCastException.h>
+#include <java/lang/Error.h>
+#include <java/lang/IllegalArgumentException.h>
+#include <java/lang/Integer.h>
+#include <java/lang/StringBuffer.h>
+#include <java/lang/VMClassLoader.h>
+#include <java/lang/VMCompiler.h>
+#include <java/lang/reflect/InvocationHandler.h>
+#include <java/lang/reflect/Method.h>
+#include <java/lang/reflect/Proxy$ClassFactory.h>
+#include <java/lang/reflect/Proxy$ProxyData.h>
+#include <java/lang/reflect/Proxy.h>
+#include <java/lang/reflect/UndeclaredThrowableException.h>
+#include <java/lang/reflect/VMProxy.h>
+
+#include <java/lang/Byte.h>
+#include <java/lang/Short.h>
+#include <java/lang/Integer.h>
+#include <java/lang/Long.h>
+#include <java/lang/Float.h>
+#include <java/lang/Double.h>
+#include <java/lang/Boolean.h>
+#include <java/lang/Character.h>
+
+
+using namespace java::lang::reflect;
+using namespace java::lang;
+
+typedef void (*closure_fun) (ffi_cif*, void*, void**, void*);
+static void *ncode (_Jv_Method *self, closure_fun fun, Method *meth);
+static void run_proxy (ffi_cif*, void*, void**, void*);
+
+typedef jobject invoke_t (jobject, Proxy *, Method *, JArray< jobject > *);
+
+// True if pc points to a proxy frame.
+
+bool
+_Jv_is_proxy (void *pc)
+{
+ return pc == UNWRAP_FUNCTION_DESCRIPTOR ((void*)&run_proxy);
+}
+
+// Generate a proxy class by using libffi closures for each entry
+// point.
+
+jclass
+java::lang::reflect::VMProxy::generateProxyClass
+ (ClassLoader *loader, Proxy$ProxyData *d)
+{
+ // If we're precompiling, generate bytecode and allow VMCompiler to
+ // precompile it.
+ if (VMCompiler::precompiles ())
+ return (new Proxy$ClassFactory(d))->generate(loader);
+
+ jclass klass = new Class ();
+ klass->superclass = &Proxy::class$;
+ klass->engine = &_Jv_soleIndirectCompiledEngine;
+ klass->size_in_bytes = Proxy::class$.size_in_bytes;
+ klass->vtable_method_count = -1;
+
+ // Synchronize on the class, so that it is not attempted initialized
+ // until we're done.
+ JvSynchronize sync (klass);
+
+ // Record the defining loader. For the bootstrap class loader,
+ // we record NULL.
+ if (loader != VMClassLoader::bootLoader)
+ klass->loader = loader;
+
+ {
+ StringBuffer *sb = new StringBuffer();
+ sb->append(JvNewStringLatin1 ("$Proxy"));
+ sb->append(Integer::toString (d->id));
+ klass->name = _Jv_makeUtf8Const (sb->toString());
+ }
+
+ // Allocate space for the interfaces.
+ klass->interface_count = d->interfaces->length;
+ klass->interfaces = (jclass*) _Jv_AllocRawObj (klass->interface_count
+ *sizeof (jclass));
+ for (int i = 0; i < klass->interface_count; i++)
+ klass->interfaces[i] = elements(d->interfaces)[i];
+
+ size_t count = d->methods->length;
+
+ {
+ size_t total_count = count + Proxy::class$.method_count + 1;
+ if (total_count >= 65536)
+ throw new IllegalArgumentException ();
+ // Allocate space for the methods. This is a worst case
+ // estimate.
+ klass->methods
+ = (_Jv_Method *) _Jv_AllocRawObj (sizeof (_Jv_Method)
+ * total_count);
+ }
+
+ jshort &method_count = klass->method_count;
+
+ // Copy all reachable methods from Proxy.
+ for (int i = 0; i < Proxy::class$.method_count; i++)
+ {
+ if (_Jv_CheckAccess (klass, &Proxy::class$,
+ Proxy::class$.methods[i].accflags))
+ {
+ klass->methods[method_count] = Proxy::class$.methods[i];
+ method_count++;
+ }
+ }
+
+ _Jv_Method *init_method
+ = (_Jv_Linker::search_method_in_class
+ (klass, klass,
+ _Jv_makeUtf8Const ("<init>"),
+ _Jv_makeUtf8Const ("(Ljava.lang.reflect.InvocationHandler;)V"),
+ false));
+ init_method->accflags |= Modifier::PUBLIC;
+
+ // Create the methods for all of the interfaces.
+ for (size_t i = 0; i < count; i++)
+ {
+ _Jv_Method &method = klass->methods[method_count++];
+ const _Jv_Method &imethod = *_Jv_FromReflectedMethod (elements(d->methods)[i]);
+ // We use a shallow copy of IMETHOD rather than a deep copy;
+ // this means that the pointer fields of METHOD point into the
+ // interface. As long as this subclass of Proxy is reachable,
+ // the interfaces of which it is a proxy will also be reachable,
+ // so this is safe.
+ method = imethod;
+ method.ncode = ncode (&method, run_proxy, elements(d->methods)[i]);
+ method.accflags &= ~Modifier::ABSTRACT;
+ }
+
+ _Jv_Linker::layout_vtable_methods (klass);
+ _Jv_RegisterInitiatingLoader (klass, klass->loader);
+
+ return klass;
+}
+
+
+// Box things with primitive types.
+static inline jobject
+box (void *thing, jclass klass, FFI_TYPE type)
+{
+ jobject o;
+
+ switch (type)
+ {
+ case FFI_TYPE_VOID:
+ return NULL;
+
+ case FFI_TYPE_POINTER:
+ o = *(jobject*)thing;
+ return o;
+
+ default:
+ ;
+ }
+
+ if (klass == JvPrimClass (byte))
+ o = new Byte (*(jbyte*)thing);
+ else if (klass == JvPrimClass (short))
+ o = new Short (*(jshort*)thing);
+ else if (klass == JvPrimClass (int))
+ o = new Integer (*(jint*)thing);
+ else if (klass == JvPrimClass (long))
+ o = new Long (*(jlong*)thing);
+ else if (klass == JvPrimClass (float))
+ o = new Float (*(jfloat*)thing);
+ else if (klass == JvPrimClass (double))
+ o = new Double (*(jdouble*)thing);
+ else if (klass == JvPrimClass (boolean))
+ o = new Boolean (*(jboolean*)thing);
+ else if (klass == JvPrimClass (char))
+ o = new Character (*(jchar*)thing);
+ else
+ JvFail ("Bad ffi type in proxy");
+
+ return o;
+}
+
+
+// Unbox things with primitive types.
+static inline void
+unbox (jobject o, jclass klass, void *rvalue, FFI_TYPE type)
+{
+ switch (type)
+ {
+ case FFI_TYPE_VOID:
+ return;
+
+ case FFI_TYPE_POINTER:
+ _Jv_CheckCast (klass, o);
+ *(jobject*)rvalue = o;
+ return;
+
+ default:
+ ;
+ }
+
+ // If the value returned ... is null and the interface method's
+ // return type is primitive, then a NullPointerException will be
+ // thrown ...
+ if (klass == JvPrimClass (byte))
+ {
+ _Jv_CheckCast (&Byte::class$, o);
+ *(jbyte*)rvalue = ((Byte*)o)->byteValue();
+ }
+ else if (klass == JvPrimClass (short))
+ {
+ _Jv_CheckCast (&Short::class$, o);
+ *(jshort*)rvalue = ((Short*)o)->shortValue();
+ }
+ else if (klass == JvPrimClass (int))
+ {
+ _Jv_CheckCast (&Integer::class$, o);
+ *(jint*)rvalue = ((Integer*)o)->intValue();
+ }
+ else if (klass == JvPrimClass (long))
+ {
+ _Jv_CheckCast (&Long::class$, o);
+ *(jlong*)rvalue = ((Long*)o)->longValue();
+ }
+ else if (klass == JvPrimClass (float))
+ {
+ _Jv_CheckCast (&Float::class$, o);
+ *(jfloat*)rvalue = ((Float*)o)->floatValue();
+ }
+ else if (klass == JvPrimClass (double))
+ {
+ _Jv_CheckCast (&Double::class$, o);
+ *(jdouble*)rvalue = ((Double*)o)->doubleValue();
+ }
+ else if (klass == JvPrimClass (boolean))
+ {
+ _Jv_CheckCast (&Boolean::class$, o);
+ *(jboolean*)rvalue = ((Boolean*)o)->booleanValue();
+ }
+ else if (klass == JvPrimClass (char))
+ {
+ _Jv_CheckCast (&Character::class$, o);
+ *(jchar*)rvalue = ((Character*)o)->charValue();
+ }
+ else
+ JvFail ("Bad ffi type in proxy");
+}
+
+
+// run_proxy is the entry point for all proxy methods. It boxes up
+// all the arguments and then invokes the invocation handler's invoke()
+// method. Exceptions are caught and propagated.
+
+typedef struct {
+ ffi_closure closure;
+ ffi_cif cif;
+ Method *meth;
+ _Jv_Method *self;
+ ffi_type *arg_types[0];
+} ncode_closure;
+
+static void
+run_proxy (ffi_cif *cif,
+ void *rvalue,
+ void **args,
+ void*user_data)
+{
+ Proxy *proxy = *(Proxy**)args[0];
+ ncode_closure *self = (ncode_closure *) user_data;
+
+ // FRAME_DESC registers this particular invocation as the top-most
+ // interpreter frame. This lets the stack tracing code (for
+ // Throwable) print information about the Proxy being run rather
+ // than about Proxy.class itself. FRAME_DESC has a destructor so it
+ // cleans up automatically when this proxy invocation returns.
+ Thread *thread = Thread::currentThread();
+ _Jv_InterpFrame frame_desc (self->self, thread, proxy->getClass());
+
+ InvocationHandler *handler = proxy->h;
+ void *poo
+ = _Jv_NewObjectArray (self->meth->parameter_types->length, &Object::class$, NULL);
+ JArray<jobject> *argsArray = (JArray<jobject> *) poo;
+ jobject *jargs = elements(argsArray);
+
+ // FIXME: It must be possible to use fast interface dispatch here,
+ // but I've not quite figured out how to do it.
+ invoke_t *invoke
+ = (invoke_t *)(_Jv_LookupInterfaceMethod
+ (handler->getClass (),
+ _Jv_makeUtf8Const ("invoke"),
+ (_Jv_makeUtf8Const
+ ("(Ljava.lang.Object;Ljava.lang.reflect.Method;[Ljava.lang.Object;)"
+ "Ljava.lang.Object;"))));
+
+ // Copy and box all the args.
+ int index = 1;
+ for (int i = 0; i < self->meth->parameter_types->length; i++, index++)
+ jargs[i] = box (args[index], elements(self->meth->parameter_types)[i],
+ cif->arg_types[index]->type);
+
+ jobject ret;
+ try
+ {
+ ret = invoke (handler, proxy, self->meth, argsArray);
+ }
+ catch (Throwable *t)
+ {
+ if (_Jv_IsInstanceOf (t, &RuntimeException::class$)
+ || _Jv_IsInstanceOf (t, &Error::class$))
+ throw t;
+
+ Class **throwables = elements (self->meth->exception_types);
+ for (int i = 0; i < self->meth->exception_types->length; i++)
+ if (_Jv_IsInstanceOf (t, throwables[i]))
+ throw t;
+
+ throw new UndeclaredThrowableException (t);
+ }
+
+ unbox (ret, self->meth->return_type, rvalue, cif->rtype->type);
+}
+
+
+// Given a method and a closure function, create libffi CIF and return
+// the address of its closure.
+
+static void *
+ncode (_Jv_Method *self, closure_fun fun, Method *meth)
+{
+ using namespace java::lang::reflect;
+
+ jboolean staticp = (self->accflags & Modifier::STATIC) != 0;
+ int arg_count = _Jv_count_arguments (self->signature, staticp);
+
+ ncode_closure *closure =
+ (ncode_closure*)_Jv_AllocBytes (sizeof (ncode_closure)
+ + arg_count * sizeof (ffi_type*));
+
+ _Jv_init_cif (self->signature,
+ arg_count,
+ staticp,
+ &closure->cif,
+ &closure->arg_types[0],
+ NULL);
+ closure->meth = meth;
+ closure->self = self;
+
+ JvAssert ((self->accflags & Modifier::NATIVE) == 0);
+
+ ffi_prep_closure (&closure->closure,
+ &closure->cif,
+ fun,
+ (void*)closure);
+
+ self->ncode = (void*)closure;
+ return self->ncode;
+}
OpenPOWER on IntegriCloud