[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes to java.lang.Runtime constructor
From: |
Patrick Doyle |
Subject: |
Changes to java.lang.Runtime constructor |
Date: |
Tue, 3 Jul 2001 23:50:44 -0400 (EDT) |
I have made a change in my working version of java.lang.Runtime's
constructor which makes my life a bit easier for now. If the change is
acceptable, I would appreciate if it could be included in the standard
distribution.
The motivation:
At the current immature stage of my JVM, it is not easy for me to
create a java.lang.String (even an empty one) at arbitrary times. I can
create them in response to a NEW opcode, or from within the constant pool,
but otherwise the facilities don't exist yet.
The change:
The Runtime() constructor will allow getLibraryPath to return null, in
which case it initializes Runtime.libpath to a zero-sized array.
Currently, getLibraryPath must return a non-null string, or else a
NullPointerException will result.
The impact:
This change should have no effect on existing implementations, but
could make it easier for new immature JVMs to get off the ground.
The patch:
I have included a patch below. I didn't indent the code because the
patch was simpler if I didn't. I also didn't put any comments on
getLibraryPath to describe the new semantics.
-------------------------------------------------------------------
*** Runtime-original.java Tue Jul 3 23:33:01 2001
--- Runtime.java Tue Jul 3 23:33:31 2001
***************
*** 43,48 ****
--- 43,51 ----
private Runtime() {
String path = getLibraryPath();
+ if(path == null){
+ libpath = new String[0];
+ }else{
int numColons = 0;
int pathLength = path.length();
for(int i=0;i<pathLength;i++) {
***************
*** 62,67 ****
--- 65,71 ----
libpath[libpathIndex] =
path.substring(current,next);
libpathIndex++;
current = next+1;
+ }
}
}
-------------------------------------------------------------------
Patrick Doyle
address@hidden
- Changes to java.lang.Runtime constructor,
Patrick Doyle <=