From d4d31af7400b3ef1c77ac70bc0a433aeb8b1f450 Mon Sep 17 00:00:00 2001 From: Timofey Lagutin Date: Sat, 11 Oct 2014 12:05:40 +0400 Subject: [PATCH 01/16] Added missing cp/avian/Math.atan2(double,double) It was implemented as native function, but wasn't added to java.lang.Math. --- classpath/java/lang/Math.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/classpath/java/lang/Math.java b/classpath/java/lang/Math.java index da22694810..f84e789eec 100644 --- a/classpath/java/lang/Math.java +++ b/classpath/java/lang/Math.java @@ -113,6 +113,8 @@ public final class Math { public static native double atan(double v); + public static native double atan2(double y, double x); + public static native double sqrt(double v); public static native double pow(double v, double e); From 2e828b405c5cf417354ba6904a16d29854684b42 Mon Sep 17 00:00:00 2001 From: Joshua Warner Date: Mon, 20 Oct 2014 13:30:07 -0600 Subject: [PATCH 02/16] fix darwin embedding instructions in README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 42b3e99859..58752d4481 100644 --- a/README.md +++ b/README.md @@ -603,8 +603,8 @@ __on Linux:__ __on Mac OS X:__ - $ g++ -I$JAVA_HOME/include -D_JNI_IMPLEMENTATION_ -c embedded-jar-main.cpp \ - -o main.o + $ g++ -I$JAVA_HOME/include -I$JAVA_HOME/include/darwin \ + -D_JNI_IMPLEMENTATION_ -c embedded-jar-main.cpp -o main.o __on Windows:__ From d8f66a84ea94a401f5aaddc8687d27936fb55210 Mon Sep 17 00:00:00 2001 From: Timofey Lagutin Date: Sat, 25 Oct 2014 17:43:46 +0400 Subject: [PATCH 03/16] jnienv.h: deleted redefinition of BOOTCLASSPATH_APPEND_OPTION --- src/avian/jnienv.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/avian/jnienv.h b/src/avian/jnienv.h index 2e9ae3d882..638fc6a864 100644 --- a/src/avian/jnienv.h +++ b/src/avian/jnienv.h @@ -23,7 +23,6 @@ #define BOOTCLASSPATH_PREPEND_OPTION "bootclasspath/p" #define BOOTCLASSPATH_OPTION "bootclasspath" #define BOOTCLASSPATH_APPEND_OPTION "bootclasspath/a" -#define BOOTCLASSPATH_APPEND_OPTION "bootclasspath/a" namespace vm { From 2e5990a6b0c35934b99a0a776762fab8f643599b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xerxes=20R=C3=A5nby?= Date: Sun, 26 Oct 2014 21:46:09 +0100 Subject: [PATCH 04/16] OpenJDK: Implement JVM_FindClassFromCaller 8015256: Better class accessibility Summary: Improve protection domain check in forName() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xerxes RĂ„nby --- openjdk.ld | 1 + src/classpath-openjdk.cpp | 43 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/openjdk.ld b/openjdk.ld index ac767806e5..3c17a160b2 100644 --- a/openjdk.ld +++ b/openjdk.ld @@ -88,6 +88,7 @@ SUNWprivate_1.1 { JVM_EnableCompiler; JVM_Exit; JVM_FillInStackTrace; + JVM_FindClassFromCaller; JVM_FindClassFromClass; JVM_FindClassFromClassLoader; JVM_FindClassFromBootLoader; diff --git a/src/classpath-openjdk.cpp b/src/classpath-openjdk.cpp index 82f24173a1..6247eda6ca 100644 --- a/src/classpath-openjdk.cpp +++ b/src/classpath-openjdk.cpp @@ -4237,6 +4237,49 @@ extern "C" AVIAN_EXPORT void JNICALL run(t, jvmResolveClass, arguments); } +uint64_t jvmFindClassFromCaller(Thread* t, uintptr_t* arguments) +{ + const char* name = reinterpret_cast(arguments[0]); + jboolean init = arguments[1]; + jobject loader = reinterpret_cast(arguments[2]); + // jclass caller = reinterpret_cast(arguments[3]); + + /* XXX The caller's protection domain should be used during + the resolveClass but there is no specification or + unit-test in OpenJDK documenting the desired effect */ + + GcClass* c = resolveClass( + t, + loader ? cast(t, *loader) : roots(t)->bootLoader(), + name, + true, + static_cast(GcClassNotFoundException::Type)); + + if (init) { + PROTECT(t, c); + + initClass(t, c); + } + + return reinterpret_cast(makeLocalReference(t, getJClass(t, c))); +} + +extern "C" AVIAN_EXPORT jclass JNICALL + EXPORT(JVM_FindClassFromCaller)(Thread* t, + const char* name, + jboolean init, + jobject loader, + jclass caller) +{ + uintptr_t arguments[] = {reinterpret_cast(name), + init, + reinterpret_cast(loader), + reinterpret_cast(caller)}; + + return reinterpret_cast( + run(t, jvmFindClassFromCaller, arguments)); +} + uint64_t jvmFindClassFromClassLoader(Thread* t, uintptr_t* arguments) { const char* name = reinterpret_cast(arguments[0]); From 347a56824a7f9f3b860935c8355e3b186fa38575 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Mon, 27 Oct 2014 09:39:53 -0600 Subject: [PATCH 05/16] fix MSYS/MinGW build MinGW defines __STRICT_ANSI__ when -std=c++0x is specified, which we have to override in order to get e.g. strdup. Also, we need to specify -D_WIN32_WINNT=0x0500 to get post-Windows-2000 functions like GetModuleHandleEx. Finally, it seems that GCC 4.8.1 wants us to use %I64d instead of %lld on Windows. --- makefile | 6 +++--- src/avian/common.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/makefile b/makefile index dc2b9dc717..0019262396 100755 --- a/makefile +++ b/makefile @@ -240,7 +240,6 @@ ifneq ($(android),) -g3 \ -Werror \ -Wno-shift-count-overflow - # on Windows (in MinGW-based build) there are neither __BEGIN_DECLS nor __END_DECLS # defines; we don't want to patch every file that uses them, so we stub them in @@ -815,7 +814,7 @@ ifeq ($(platform),windows) rpath = lflags = -L$(lib) $(common-lflags) -lws2_32 -liphlpapi -mconsole - cflags = -I$(inc) $(common-cflags) -DWINVER=0x0500 + cflags = -I$(inc) $(common-cflags) -DWINVER=0x0500 -U__STRICT_ANSI__ ifeq (,$(filter mingw32 cygwin,$(build-platform))) openjdk-extra-cflags += -I$(src)/openjdk/caseSensitive @@ -831,7 +830,8 @@ ifeq ($(platform),windows) build-system = windows static-on-windows = -static common-cflags += "-I$(JAVA_HOME)/include/win32" - build-cflags = $(common-cflags) -I$(src) -I$(inc) -mthreads + build-cflags = $(common-cflags) -I$(src) -I$(inc) -mthreads \ + -D_WIN32_WINNT=0x0500 openjdk-extra-cflags = build-lflags = -L$(lib) $(common-lflags) ifeq ($(build-platform),cygwin) diff --git a/src/avian/common.h b/src/avian/common.h index e1e6a76de3..9310795b49 100644 --- a/src/avian/common.h +++ b/src/avian/common.h @@ -135,7 +135,7 @@ typedef intptr_t __attribute__((__may_alias__)) intptr_alias_t; #if (defined ARCH_x86_32) || (defined ARCH_arm) #define LD "ld" #if (defined _MSC_VER) || ((defined __MINGW32__) && __GNUC__ >= 4) -#if (__GNUC__ == 4 && __GNUC_MINOR__ < 8) +#if (__GNUC__ == 4 && __GNUC_MINOR__ <= 8) #define LLD "I64d" #else #define LLD "lld" From e41133d268cbac4e67e1f30acd5bc36526583baf Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Tue, 28 Oct 2014 14:49:50 -0600 Subject: [PATCH 06/16] fix malformed variable reference in makefile --- makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile b/makefile index 0019262396..39056e5b3e 100755 --- a/makefile +++ b/makefile @@ -67,7 +67,7 @@ ifeq ($(filter x86_64 i386 arm,$(arch)),) endif ifeq ($(platform),darwin) - x := $(error "please use 'platform=macosx' or 'platform=ios' instead of 'platform=$platform'") + x := $(error "please use 'platform=macosx' or 'platform=ios' instead of 'platform=$(platform)'") endif ifneq ($(ios),) From f25d5921a5e0dec4e6e4741a83880861bcb8842d Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Tue, 28 Oct 2014 14:52:02 -0600 Subject: [PATCH 07/16] implement StringWriter.getBuffer This is used by json.org's JSON library. --- classpath/java/io/StringWriter.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/classpath/java/io/StringWriter.java b/classpath/java/io/StringWriter.java index 87c2a1e609..bb71d1209d 100644 --- a/classpath/java/io/StringWriter.java +++ b/classpath/java/io/StringWriter.java @@ -11,7 +11,7 @@ package java.io; public class StringWriter extends Writer { - private final StringBuilder out = new StringBuilder(); + private final StringBuffer out = new StringBuffer(); public void write(char[] b, int offset, int length) throws IOException { out.append(b, offset, length); @@ -24,4 +24,8 @@ public class StringWriter extends Writer { public void flush() throws IOException { } public void close() throws IOException { } + + public StringBuffer getBuffer() { + return out; + } } From 2776e98bf5e8ae93df3336c10b9710bbf6b32a41 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Tue, 28 Oct 2014 14:53:43 -0600 Subject: [PATCH 08/16] use .dylib instead of .jnilib as OS X library suffix This matches the behavior of System.mapLibraryName on JDK 7 and later. --- classpath/java-lang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classpath/java-lang.cpp b/classpath/java-lang.cpp index 00df411811..f5d02d255e 100644 --- a/classpath/java-lang.cpp +++ b/classpath/java-lang.cpp @@ -46,7 +46,7 @@ #define SO_PREFIX "lib" #ifdef __APPLE__ -#define SO_SUFFIX ".jnilib" +#define SO_SUFFIX ".dylib" #include #if !TARGET_IPHONE_SIMULATOR && !TARGET_OS_IPHONE #include From b7abaf7a78571411dea32b8c8d1c2948779c78b8 Mon Sep 17 00:00:00 2001 From: lostdj Date: Fri, 31 Oct 2014 12:22:13 +0300 Subject: [PATCH 09/16] interpret.invokeNative(): call native function with a right signature --- src/avian/machine.h | 1 + src/interpret.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/avian/machine.h b/src/avian/machine.h index d310ac4b88..8caa7ca847 100644 --- a/src/avian/machine.h +++ b/src/avian/machine.h @@ -1441,6 +1441,7 @@ Classpath* makeClasspath(System* system, const char* embedPrefix); typedef uint64_t(JNICALL* FastNativeFunction)(Thread*, GcMethod*, uintptr_t*); +typedef void(JNICALL* FastVoidNativeFunction)(Thread*, GcMethod*, uintptr_t*); inline GcClass* objectClass(Thread*, object o) { diff --git a/src/interpret.cpp b/src/interpret.cpp index 4c908fa09a..41960b602f 100644 --- a/src/interpret.cpp +++ b/src/interpret.cpp @@ -641,8 +641,15 @@ unsigned invokeNative(Thread* t, GcMethod* method) marshalArguments( t, RUNTIME_ARRAY_BODY(args) + argOffset, 0, sp, method, true); - result = reinterpret_cast(native->function())( + if(method->returnCode() != VoidField) { + result = reinterpret_cast(native->function())( t, method, RUNTIME_ARRAY_BODY(args)); + } + else { + result = 0; + reinterpret_cast(native->function())( + t, method, RUNTIME_ARRAY_BODY(args)); + } } pushResult(t, method->returnCode(), result, false); From 8ac58b7d772a92b3d4cbcb06dba64644a3d7cd51 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Wed, 5 Nov 2014 14:27:24 -0700 Subject: [PATCH 10/16] add minimal NavigableMap interface --- classpath/java/util/NavigableMap.java | 6 ++++++ classpath/java/util/TreeMap.java | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 classpath/java/util/NavigableMap.java diff --git a/classpath/java/util/NavigableMap.java b/classpath/java/util/NavigableMap.java new file mode 100644 index 0000000000..05136159c6 --- /dev/null +++ b/classpath/java/util/NavigableMap.java @@ -0,0 +1,6 @@ +package java.util; + +public interface NavigableMap extends SortedMap { + Map.Entry firstEntry(); + Map.Entry lastEntry(); +} diff --git a/classpath/java/util/TreeMap.java b/classpath/java/util/TreeMap.java index e7258255cd..3c4de1b141 100644 --- a/classpath/java/util/TreeMap.java +++ b/classpath/java/util/TreeMap.java @@ -14,7 +14,7 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; -public class TreeMap implements SortedMap { +public class TreeMap implements NavigableMap { private final Comparator comparator; private transient TreeSet> set; @@ -50,6 +50,16 @@ public class TreeMap implements SortedMap { return comparator; } + @Override + public Map.Entry firstEntry() { + return set.first(); + } + + @Override + public Map.Entry lastEntry() { + return set.last(); + } + @Override public K firstKey() { return set.first().key; From fd2cdafed3fe6b211155c621d34b73e282720873 Mon Sep 17 00:00:00 2001 From: Timofey Lagutin Date: Fri, 7 Nov 2014 14:40:31 +0300 Subject: [PATCH 11/16] builtin.cpp: Remove native Class.getDeclaringClass() It's implemented in pure Java and is not used. --- src/builtin.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/builtin.cpp b/src/builtin.cpp index f1b34ba89f..00b2ee744e 100644 --- a/src/builtin.cpp +++ b/src/builtin.cpp @@ -1255,15 +1255,6 @@ extern "C" AVIAN_EXPORT int64_t JNICALL return reinterpret_cast(primitiveClass(t, arguments[0])); } -extern "C" AVIAN_EXPORT int64_t JNICALL - Avian_java_lang_Class_getDeclaringClass(Thread* t, - object, - uintptr_t* arguments) -{ - return reinterpret_cast(getDeclaringClass( - t, cast(t, reinterpret_cast(arguments[0]))->vmClass())); -} - extern "C" AVIAN_EXPORT int64_t JNICALL Avian_java_lang_Class_getEnclosingMethod(Thread* t, object, From 4fd8396ba3eb7c38e8606e4a6e1e0a4a4344ae6d Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Fri, 7 Nov 2014 11:31:19 -0700 Subject: [PATCH 12/16] fix WSA error 10093 when openning a ServerSocketChannel We need to call Socket.init before trying to use the Windows Socket library. We were already doing this in SocketChannel.open, but not in ServerSocketChannel.open. --- classpath/java/nio/channels/ServerSocketChannel.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/classpath/java/nio/channels/ServerSocketChannel.java b/classpath/java/nio/channels/ServerSocketChannel.java index 1bc0891115..6c90af63f6 100644 --- a/classpath/java/nio/channels/ServerSocketChannel.java +++ b/classpath/java/nio/channels/ServerSocketChannel.java @@ -25,6 +25,8 @@ public class ServerSocketChannel extends SelectableChannel { } public static ServerSocketChannel open() throws IOException { + Socket.init(); + return new ServerSocketChannel(); } From 3cff81da8d38df50868e6fb2eeac352a6a82136d Mon Sep 17 00:00:00 2001 From: lostdj Date: Sat, 8 Nov 2014 14:06:11 +0300 Subject: [PATCH 13/16] Fix some native and managed function signatures. --- classpath/java-net.cpp | 32 ++++++++++++++++---------------- classpath/java/io/File.java | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/classpath/java-net.cpp b/classpath/java-net.cpp index 20ba2890e2..aa30c80b01 100644 --- a/classpath/java-net.cpp +++ b/classpath/java-net.cpp @@ -28,44 +28,44 @@ extern "C" JNIEXPORT SOCKET JNICALL extern "C" JNIEXPORT void JNICALL Java_java_net_Socket_connect(JNIEnv* e, jclass, - SOCKET sock, - long addr, - short port) + jlong sock, + jlong addr, + jshort port) { - connect(e, sock, addr, port); + connect(e, static_cast(sock), addr, port); } extern "C" JNIEXPORT void JNICALL Java_java_net_Socket_bind(JNIEnv* e, jclass, - SOCKET sock, - long addr, - short port) + jlong sock, + jlong addr, + jshort port) { - bind(e, sock, addr, port); + bind(e, static_cast(sock), addr, port); } extern "C" JNIEXPORT void JNICALL - Java_java_net_Socket_abort(JNIEnv* e, jclass, SOCKET sock) + Java_java_net_Socket_abort(JNIEnv* e, jclass, jlong sock) { - abort(e, sock); + abort(e, static_cast(sock)); } extern "C" JNIEXPORT void JNICALL - Java_java_net_Socket_close(JNIEnv* e, jclass, SOCKET sock) + Java_java_net_Socket_close(JNIEnv* e, jclass, jlong sock) { - close(e, sock); + close(e, static_cast(sock)); } extern "C" JNIEXPORT void JNICALL - Java_java_net_Socket_closeOutput(JNIEnv* e, jclass, SOCKET sock) + Java_java_net_Socket_closeOutput(JNIEnv* e, jclass, jlong sock) { - close_output(e, sock); + close_output(e, static_cast(sock)); } extern "C" JNIEXPORT void JNICALL - Java_java_net_Socket_closeInput(JNIEnv* e, jclass, SOCKET sock) + Java_java_net_Socket_closeInput(JNIEnv* e, jclass, jlong sock) { - close_input(e, sock); + close_input(e, static_cast(sock)); } extern "C" JNIEXPORT void JNICALL diff --git a/classpath/java/io/File.java b/classpath/java/io/File.java index 38aab82840..7ff2375fef 100644 --- a/classpath/java/io/File.java +++ b/classpath/java/io/File.java @@ -307,7 +307,7 @@ public class File implements Serializable { private static native String readDir(long handle); - private static native long closeDir(long handle); + private static native void closeDir(long handle); From 1b19dc2c4f46e3be3863676c4b4530078fe79fd1 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Tue, 11 Nov 2014 14:13:26 -0700 Subject: [PATCH 14/16] use inttypes.h macros to determine printf format symbols if possible This addresses a recent regression where different versions of MinGW(-w64) had different opinions about whether to use e.g. %I64d or %lld to print 64-bit integers on 32-bit platforms. --- src/avian/common.h | 30 +++++++++++++++++++++--------- src/interpret.cpp | 4 ++-- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/avian/common.h b/src/avian/common.h index 9310795b49..ac05cef999 100644 --- a/src/avian/common.h +++ b/src/avian/common.h @@ -15,15 +15,20 @@ #define __STDC_CONSTANT_MACROS #endif +#ifndef __STDC_FORMAT_MACROS +#define __STDC_FORMAT_MACROS +#endif + #include -#include "stdlib.h" -#include "stdarg.h" -#include "stddef.h" -#include "string.h" -#include "stdio.h" +#include +#include +#include +#include +#include +#include #include "avian/types.h" -#include "math.h" +#include #ifdef UNUSED #undef UNUSED @@ -31,7 +36,7 @@ #ifdef _MSC_VER -#include "float.h" +#include #include #ifdef linux @@ -132,6 +137,12 @@ typedef intptr_t __attribute__((__may_alias__)) intptr_alias_t; #define PATH_SEPARATOR ':' #endif // not PLATFORM_WINDOWS +#ifdef PRId64 +#define LLD PRId64 +#define ULD PRIu64 +#define LD PRIdPTR +#define LX PRIxPTR +#else #if (defined ARCH_x86_32) || (defined ARCH_arm) #define LD "ld" #if (defined _MSC_VER) || ((defined __MINGW32__) && __GNUC__ >= 4) @@ -154,7 +165,7 @@ typedef intptr_t __attribute__((__may_alias__)) intptr_alias_t; #define LD "ld" #define LX "lx" #if (defined _MSC_VER) || (defined __MINGW32__) -#if (__GNUC__ == 4 && __GNUC_MINOR__ < 8) +#if (__GNUC__ == 4 && __GNUC_MINOR__ <= 8) #define LLD "I64d" #define ULD "I64x" #else @@ -172,7 +183,8 @@ typedef intptr_t __attribute__((__may_alias__)) intptr_alias_t; #else #error "Unsupported architecture" #endif - +#endif + #ifdef PLATFORM_WINDOWS #define SO_PREFIX "" #else diff --git a/src/interpret.cpp b/src/interpret.cpp index 41960b602f..2283cf58c8 100644 --- a/src/interpret.cpp +++ b/src/interpret.cpp @@ -114,7 +114,7 @@ inline uint32_t popInt(Thread* t) { if (DebugStack) { fprintf(stderr, - "pop int %" ULD " at %d\n", + "pop int %" LD " at %d\n", t->stack[((t->sp - 1) * 2) + 1], t->sp - 1); } @@ -167,7 +167,7 @@ inline uint32_t peekInt(Thread* t, unsigned index) { if (DebugStack) { fprintf( - stderr, "peek int %" ULD " at %d\n", t->stack[(index * 2) + 1], index); + stderr, "peek int %" LD " at %d\n", t->stack[(index * 2) + 1], index); } assertT(t, index < stackSizeInWords(t) / 2); From e65786365671acee7d9744588fcbf6e37ebed68c Mon Sep 17 00:00:00 2001 From: Timofey Lagutin Date: Wed, 19 Nov 2014 14:06:31 +0300 Subject: [PATCH 15/16] String.equalsIgnoreCase(): fix nullptrex. It's logical and conforms OpenJDK.. --- classpath/java/lang/String.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classpath/java/lang/String.java b/classpath/java/lang/String.java index e3f301b4ca..b186bced4f 100644 --- a/classpath/java/lang/String.java +++ b/classpath/java/lang/String.java @@ -186,7 +186,7 @@ public final class String if (this == s) { return true; } else { - return s.length == length && compareToIgnoreCase(s) == 0; + return s != null && s.length == length && compareToIgnoreCase(s) == 0; } } From 0ec230497b1b1bb1c45558cc5af33f89462fc12a Mon Sep 17 00:00:00 2001 From: lostdj Date: Wed, 19 Nov 2014 14:27:11 +0300 Subject: [PATCH 16/16] Added missing MIX/MAX_VALUE for basic types. --- classpath/java/lang/Byte.java | 3 +++ classpath/java/lang/Double.java | 3 +++ classpath/java/lang/Float.java | 5 ++++- classpath/java/lang/Short.java | 2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/classpath/java/lang/Byte.java b/classpath/java/lang/Byte.java index 13a8b1dbef..cda92676b1 100644 --- a/classpath/java/lang/Byte.java +++ b/classpath/java/lang/Byte.java @@ -13,6 +13,9 @@ package java.lang; public final class Byte extends Number implements Comparable { public static final Class TYPE = avian.Classes.forCanonicalName("B"); + public static final byte MIN_VALUE = -128; + public static final byte MAX_VALUE = 127; + private final byte value; public Byte(byte value) { diff --git a/classpath/java/lang/Double.java b/classpath/java/lang/Double.java index 2e6fedd3a3..e1875355cc 100644 --- a/classpath/java/lang/Double.java +++ b/classpath/java/lang/Double.java @@ -17,6 +17,9 @@ public final class Double extends Number { public static final double POSITIVE_INFINITY = 1.0 / 0.0; public static final double NaN = 0.0 / 0.0; + public static final double MIN_VALUE = 2.22507385850720138309e-308; + public static final double MAX_VALUE = 1.79769313486231570815e+308; + private final double value; public Double(String value) { diff --git a/classpath/java/lang/Float.java b/classpath/java/lang/Float.java index 17795fdcc3..e8a41b07d7 100644 --- a/classpath/java/lang/Float.java +++ b/classpath/java/lang/Float.java @@ -18,7 +18,10 @@ public final class Float extends Number { public static final float NEGATIVE_INFINITY = -1.0f / 0.0f; public static final float POSITIVE_INFINITY = 1.0f / 0.0f; public static final float NaN = 0.0f / 0.0f; - + + public static final float MIN_VALUE = 1.17549435082228750797e-38f; + public static final float MAX_VALUE = 3.40282346638528859812e+38f; + private final float value; public Float(String value) { diff --git a/classpath/java/lang/Short.java b/classpath/java/lang/Short.java index c9d7abc324..fb56c74621 100644 --- a/classpath/java/lang/Short.java +++ b/classpath/java/lang/Short.java @@ -12,6 +12,8 @@ package java.lang; public final class Short extends Number implements Comparable { public static final Class TYPE = avian.Classes.forCanonicalName("S"); + + public static final short MIN_VALUE = -32768; public static final short MAX_VALUE = 32767; private final short value;