changeset 21:9b96950f2c3c

the 'java' tree compiles on both D1-Tango and D2-Phobos
author Frank Benoit <benoit@tionex.de>
date Thu, 19 Mar 2009 20:38:55 +0100
parents dccb717aa902
children 4642ab680468
files java/src/java/beans/PropertyChangeEvent.d java/src/java/beans/PropertyChangeSupport.d java/src/java/io/BufferedInputStream.d java/src/java/io/ByteArrayOutputStream.d java/src/java/io/File.d java/src/java/io/FileInputStream.d java/src/java/io/FileOutputStream.d java/src/java/lang/Boolean.d java/src/java/lang/Byte.d java/src/java/lang/Character.d java/src/java/lang/Float.d java/src/java/lang/Integer.d java/src/java/lang/Math.d java/src/java/lang/Runnable.d java/src/java/lang/StringBuffer.d java/src/java/lang/System.d java/src/java/lang/Thread.d java/src/java/lang/all.d java/src/java/lang/exceptions.d java/src/java/lang/util.d java/src/java/mangoicu/ICU.d java/src/java/mangoicu/UBreakIterator.d java/src/java/mangoicu/UCalendar.d java/src/java/mangoicu/UChar.d java/src/java/mangoicu/UDateFormat.d java/src/java/mangoicu/ULocale.d java/src/java/mangoicu/UMessageFormat.d java/src/java/mangoicu/URegex.d java/src/java/mangoicu/UString.d java/src/java/mangoicu/UText.d java/src/java/mangoicu/UTimeZone.d java/src/java/nonstandard/WeakRef.d java/src/java/nonstandard/XmlTranscode.d java/src/java/text/MessageFormat.d java/src/java/util/AbstractCollection.d java/src/java/util/AbstractList.d java/src/java/util/AbstractMap.d java/src/java/util/AbstractSet.d java/src/java/util/ArrayList.d java/src/java/util/Arrays.d java/src/java/util/Collections.d java/src/java/util/HashMap.d java/src/java/util/HashSet.d java/src/java/util/Hashtable.d java/src/java/util/IdentityHashMap.d java/src/java/util/LinkedList.d java/src/java/util/Map.d java/src/java/util/Random.d java/src/java/util/ResourceBundle.d java/src/java/util/Stack.d java/src/java/util/Timer.d java/src/java/util/TimerTask.d java/src/java/util/TreeMap.d java/src/java/util/TreeSet.d java/src/java/util/Vector.d java/src/java/util/WeakHashMap.d java/src/java/util/zip/InflaterInputStream.d org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/Compatibility.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/LEDataInputStream.d org.eclipse.text/src/org/eclipse/jface/text/TreeLineTracker.d rakefile
diffstat 62 files changed, 2055 insertions(+), 1671 deletions(-) [+]
line wrap: on
line diff
--- a/java/src/java/beans/PropertyChangeEvent.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/beans/PropertyChangeEvent.d	Thu Mar 19 20:38:55 2009 +0100
@@ -2,7 +2,6 @@
 
 import java.lang.all;
 import java.util.EventObject;
-static import tango.core.Array;
 
 class PropertyChangeEvent : EventObject {
     private String propertyName;
--- a/java/src/java/beans/PropertyChangeSupport.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/beans/PropertyChangeSupport.d	Thu Mar 19 20:38:55 2009 +0100
@@ -4,6 +4,11 @@
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeEvent;
 
+version(Tango){
+    static import tango.core.Array;
+} else { // Phobos
+
+}
 class PropertyChangeSupport {
     PropertyChangeListener[][ String ] listeners;
     Object obj;
@@ -44,7 +49,11 @@
     }
     void removePropertyChangeListener(String propertyName, PropertyChangeListener listener){
         if( auto list = propertyName in listeners ){
-            list.length = tango.core.Array.remove( *list, listener );
+            version(Tango){
+                list.length = tango.core.Array.remove( *list, listener );
+            } else {
+                implMissing( __FILE__, __LINE__ );
+            }
             if( list.length > 0 ){
                 listeners[ propertyName.dup ] = *list;
             }
--- a/java/src/java/io/BufferedInputStream.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/io/BufferedInputStream.d	Thu Mar 19 20:38:55 2009 +0100
@@ -6,8 +6,6 @@
 import java.io.InputStream;
 import java.lang.all;
 
-import tango.core.Exception;
-
 public class BufferedInputStream : java.io.InputStream.InputStream {
 
     alias java.io.InputStream.InputStream.read read;
--- a/java/src/java/io/ByteArrayOutputStream.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/io/ByteArrayOutputStream.d	Thu Mar 19 20:38:55 2009 +0100
@@ -5,32 +5,59 @@
 
 public import java.io.OutputStream;
 import java.lang.all;
-import tango.io.device.Array;
+
+version(Tango){
+    import tango.io.device.Array;
+} else { // Phobos
+}
 
 public class ByteArrayOutputStream : java.io.OutputStream.OutputStream {
 
-    protected Array buffer;
+    version(Tango){
+        protected Array buffer;
+    } else { // Phobos
+    }
 
     public this (){
-        buffer = new Array();
+        version(Tango){
+            buffer = new Array();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
 
     public this ( int par_size ){
-        buffer = new Array(par_size);
+        version(Tango){
+            buffer = new Array(par_size);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
 
     public synchronized override void write( int b ){
-        byte[1] a;
-        a[0] = b & 0xFF;
-        buffer.append(a);
+        version(Tango){
+            byte[1] a;
+            a[0] = b & 0xFF;
+            buffer.append(a);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
 
     public synchronized override void write( byte[] b, int off, int len ){
-        buffer.append( b[ off .. off + len ]);
+        version(Tango){
+            buffer.append( b[ off .. off + len ]);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
 
     public synchronized override void write( byte[] b ){
-        buffer.append( b );
+        version(Tango){
+            buffer.append( b );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
 
     public synchronized void writeTo( java.io.OutputStream.OutputStream out_KEYWORDESCAPE ){
@@ -42,7 +69,12 @@
     }
 
     public synchronized byte[] toByteArray(){
-        return cast(byte[])buffer.slice();
+        version(Tango){
+            return cast(byte[])buffer.slice();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
+        }
     }
 
     public int size(){
--- a/java/src/java/io/File.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/io/File.d	Thu Mar 19 20:38:55 2009 +0100
@@ -5,10 +5,15 @@
 
 import java.lang.all;
 
-static import tango.io.model.IFile;
-static import tango.io.FilePath;
-static import tango.io.Path;
-static import tango.io.FileSystem;
+version(Tango){
+    static import tango.io.model.IFile;
+    static import tango.io.FilePath;
+    static import tango.io.Path;
+    static import tango.io.FileSystem;
+} else { // Phobos
+    static import std.file;
+    static import std.path;
+}
 
 public class File {
 
@@ -17,25 +22,55 @@
     public static char pathSeparatorChar;
     public static String pathSeparator;
 
-    private tango.io.FilePath.FilePath mFilePath;
+    private String mFilePath;
 
     static this(){
-        separator = tango.io.model.IFile.FileConst.PathSeparatorString;
-        separatorChar = tango.io.model.IFile.FileConst.PathSeparatorChar;
-        pathSeparator = tango.io.model.IFile.FileConst.SystemPathString;
-        pathSeparatorChar = tango.io.model.IFile.FileConst.SystemPathChar;
+        version(Tango){
+            separator = tango.io.model.IFile.FileConst.PathSeparatorString;
+            separatorChar = tango.io.model.IFile.FileConst.PathSeparatorChar;
+            pathSeparator = tango.io.model.IFile.FileConst.SystemPathString;
+            pathSeparatorChar = tango.io.model.IFile.FileConst.SystemPathChar;
+        } else { // Phobos
+            version(Windows){
+                separator = "\\";
+                separatorChar = '\\';
+                pathSeparator = ";";
+                pathSeparatorChar = ';';
+            }
+            else{
+                separator = "/";
+                separatorChar = '/';
+                pathSeparator = ":";
+                pathSeparatorChar = ':';
+            }
+        }
+    }
+
+    private static String toStd( String path ){
+        version(Tango){
+            return tango.io.Path.standard( path );
+        } else { // Phobos
+            return path;
+        }
+    }
+    private static String join( String path, String file ){
+        version(Tango){
+            return tango.io.Path.join( path, file );
+        } else { // Phobos
+            return std.path.join( path, file );
+        }
     }
 
     public this ( String pathname ){
-        mFilePath = new tango.io.FilePath.FilePath( tango.io.Path.standard( pathname ));
+        mFilePath = toStd( pathname );
     }
 
     public this ( String parent, String child ){
-        mFilePath = new tango.io.FilePath.FilePath( tango.io.FilePath.FilePath.join( parent, child ) );
+        mFilePath = join( toStd(parent), toStd(child) );
     }
 
     public this ( java.io.File.File parent, String child ){
-        mFilePath = new tango.io.FilePath.FilePath( tango.io.FilePath.FilePath.join( parent.mFilePath.toString, child ) );
+        mFilePath = join( parent.mFilePath, toStd(child) );
     }
 
     public int getPrefixLength(){
@@ -69,11 +104,21 @@
     }
 
     public String getAbsolutePath(){
-        return tango.io.FileSystem.FileSystem.toAbsolute( mFilePath ).toString;
+        version(Tango){
+            return tango.io.FileSystem.FileSystem.toAbsolute( mFilePath );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return "";
+        }
     }
 
     public java.io.File.File getAbsoluteFile(){
-        return new File( getAbsolutePath() );
+        version(Tango){
+            return new File( getAbsolutePath() );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
+        }
     }
 
     public String getCanonicalPath(){
@@ -92,15 +137,30 @@
     }
 
     public bool canWrite(){
-        return mFilePath.isWritable;
+        version(Tango){
+            return tango.io.Path.isWritable(mFilePath);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
 
     public bool exists(){
-        return mFilePath.exists;
+        version(Tango){
+            return tango.io.Path.exists(mFilePath);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
 
     public bool isDirectory(){
-        return mFilePath.isFolder;
+        version(Tango){
+            return tango.io.Path.isFolder(mFilePath);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
 
     public bool isFile(){
--- a/java/src/java/io/FileInputStream.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/io/FileInputStream.d	Thu Mar 19 20:38:55 2009 +0100
@@ -7,15 +7,19 @@
 import java.io.File;
 import java.io.InputStream;
 
-import TangoFile = tango.io.device.File;
-import tango.core.Exception;
-import tango.text.convert.Format;
+version(Tango){
+    import TangoFile = tango.io.device.File;
+} else { // Phobos
+}
 
 public class FileInputStream : java.io.InputStream.InputStream {
 
     alias java.io.InputStream.InputStream.read read;
 
-    private TangoFile.File conduit;
+    version(Tango){
+        private TangoFile.File conduit;
+    } else { // Phobos
+    }
     private ubyte[] buffer;
     private int buf_pos;
     private int buf_size;
@@ -23,38 +27,51 @@
     private bool eof;
 
     public this ( String name ){
-        conduit = new TangoFile.File( name );
+        version(Tango){
+            conduit = new TangoFile.File( name );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
         buffer = new ubyte[]( BUFFER_SIZE );
     }
 
     public this ( java.io.File.File file ){
         implMissing( __FILE__, __LINE__ );
-        conduit = new TangoFile.File( file.getAbsolutePath(), TangoFile.File.ReadExisting );
+        version(Tango){
+            conduit = new TangoFile.File( file.getAbsolutePath(), TangoFile.File.ReadExisting );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
         buffer = new ubyte[]( BUFFER_SIZE );
     }
 
     public override int read(){
-        if( eof ){
-            return -1;
-        }
-        try{
-            if( buf_pos == buf_size ){
-                buf_pos = 0;
-                buf_size = conduit.input.read( buffer );
+        version(Tango){
+            if( eof ){
+                return -1;
             }
-            if( buf_size <= 0 ){
+            try{
+                if( buf_pos == buf_size ){
+                    buf_pos = 0;
+                    buf_size = conduit.input.read( buffer );
+                }
+                if( buf_size <= 0 ){
+                    eof = true;
+                    return -1;
+                }
+                assert( buf_pos < BUFFER_SIZE, Format( "{0} {1}", buf_pos, buf_size ) );
+                assert( buf_size <= BUFFER_SIZE );
+                int res = cast(int) buffer[ buf_pos ];
+                buf_pos++;
+                return res;
+            }
+            catch( IOException e ){
                 eof = true;
                 return -1;
             }
-            assert( buf_pos < BUFFER_SIZE, Format( "{0} {1}", buf_pos, buf_size ) );
-            assert( buf_size <= BUFFER_SIZE );
-            int res = cast(int) buffer[ buf_pos ];
-            buf_pos++;
-            return res;
-        }
-        catch( IOException e ){
-            eof = true;
-            return -1;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return 0;
         }
     }
 
@@ -69,7 +86,11 @@
     }
 
     public override void close(){
-        conduit.close();
+        version(Tango){
+            conduit.close();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
 }
 
--- a/java/src/java/io/FileOutputStream.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/io/FileOutputStream.d	Thu Mar 19 20:38:55 2009 +0100
@@ -8,20 +8,36 @@
 
 import java.lang.all;
 
-import TangoFile = tango.io.device.File;
+version(Tango){
+    import TangoFile = tango.io.device.File;
+} else { // Phobos
+    static import std.file;
+    static import std.path;
+}
 
 public class FileOutputStream : java.io.OutputStream.OutputStream {
 
     alias java.io.OutputStream.OutputStream.write write;
     alias java.io.OutputStream.OutputStream.close close;
-    TangoFile.File fc;
-    
+    version(Tango){
+        TangoFile.File fc;
+    } else { // Phobos
+    }
+
     public this ( String name ){
-        fc = new TangoFile.File( name, TangoFile.File.WriteCreate );
+        version(Tango){
+            fc = new TangoFile.File( name, TangoFile.File.WriteCreate );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
 
     public this ( String name, bool append ){
-        fc = new TangoFile.File( name, append ? TangoFile.File.WriteAppending : TangoFile.File.WriteCreate );
+        version(Tango){
+            fc = new TangoFile.File( name, append ? TangoFile.File.WriteAppending : TangoFile.File.WriteCreate );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
 
     public this ( java.io.File.File file ){
@@ -35,11 +51,19 @@
     public override void write( int b ){
         ubyte[1] a;
         a[0] = b & 0xFF;
-        fc.write(a);
+        version(Tango){
+            fc.write(a);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
 
     public override void close(){
-        fc.close();
+        version(Tango){
+            fc.close();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
 
     public void finalize(){
--- a/java/src/java/lang/Boolean.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/lang/Boolean.d	Thu Mar 19 20:38:55 2009 +0100
@@ -3,6 +3,11 @@
 import java.lang.util;
 import java.lang.System;
 
+version(Tango){
+    static import tango.text.Ascii;
+} else { // Phobos
+    static import std.string;
+}
 class Boolean : ValueWrapperT!(bool) {
     public static Boolean TRUE;
     public static Boolean FALSE;
@@ -16,10 +21,10 @@
     }
 
     alias ValueWrapperT!(bool).opEquals opEquals;
-    public int opEquals( int other ){
+    public equals_t opEquals( int other ){
         return value == ( other !is 0 );
     }
-    public int opEquals( Object other ){
+    public equals_t opEquals( Object other ){
         if( auto o = cast(Boolean)other ){
             return value == o.value;
         }
@@ -38,7 +43,11 @@
         return b ? TRUE : FALSE;
     }
     public static bool getBoolean(String name){
-        return tango.text.Ascii.icompare(System.getProperty(name, "false"), "true" ) is 0;
+        version(Tango){
+            return tango.text.Ascii.icompare(System.getProperty(name, "false"), "true" ) is 0;
+        } else { // Phobos
+            return std.string.icmp(System.getProperty(name, "false"), "true" ) is 0;
+        }
     }
 }
 
--- a/java/src/java/lang/Byte.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/lang/Byte.d	Thu Mar 19 20:38:55 2009 +0100
@@ -3,17 +3,26 @@
 import java.lang.util;
 import java.lang.exceptions;
 
+version(Tango){
+    static import tango.text.convert.Integer;
+} else { // Phobos
+}
 class Byte : ValueWrapperT!(byte) {
     public static byte parseByte( String s ){
-        try{
-            int res = tango.text.convert.Integer.parse( s );
-            if( res < byte.min || res > byte.max ){
-                throw new NumberFormatException( "out of range" );
+        version(Tango){
+            try{
+                int res = tango.text.convert.Integer.parse( s );
+                if( res < byte.min || res > byte.max ){
+                    throw new NumberFormatException( "out of range" );
+                }
+                return res;
             }
-            return res;
-        }
-        catch( IllegalArgumentException e ){
-            throw new NumberFormatException( e );
+            catch( IllegalArgumentException e ){
+                throw new NumberFormatException( e );
+            }
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__);
+            return 0;
         }
     }
     this( byte value ){
@@ -21,7 +30,7 @@
     }
 
     public static String toString( byte i ){
-        return tango.text.convert.Integer.toString(i);
+        return String_valueOf(i);
     }
 
 }
--- a/java/src/java/lang/Character.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/lang/Character.d	Thu Mar 19 20:38:55 2009 +0100
@@ -2,7 +2,15 @@
 
 import java.lang.exceptions;
 import java.lang.util;
-import tango.text.Unicode;
+
+version(Tango){
+    static import tango.text.Unicode;
+} else { // Phobos
+    static import std.utf;
+    static import std.uni;
+    static import std.ctype;
+    static import std.string;
+}
 
 class Character {
     public static bool isUpperCase( dchar c ){
@@ -10,45 +18,87 @@
         return false;
     }
     public static dchar toUpperCase( wchar c ){
-        wchar[1] src;
-        src[0] = c;
-        dchar[1] buf;
-        uint ate;
-        dchar[] res = tango.text.convert.Utf.toString32( src, buf, &ate );
-        dchar[] r = tango.text.Unicode.toUpper( res );
-        return r[0];
+        version(Tango){
+            wchar[1] src;
+            src[0] = c;
+            dchar[1] buf;
+            uint ate;
+            dchar[] darr = tango.text.convert.Utf.toString32( src, buf, &ate );
+        } else { // Phobos
+            wchar[1] src;
+            src[0] = c;
+            auto darr = std.utf.toUTF32(src);
+        }
+        return toUpperCase( darr[0] );
     }
     public static dchar toUpperCase( dchar c ){
-        dchar[] r = tango.text.Unicode.toUpper( [c] );
-        return r[0];
+        version(Tango){
+            dchar[1] src;
+            src[0] = c;
+            dchar[] r = tango.text.Unicode.toUpper( src );
+            return r[0];
+        } else { // Phobos
+            return std.uni.toUniUpper( c );
+        }
     }
     public static dchar toLowerCase( wchar c ){
-        wchar[1] src;
-        src[0] = c;
-        dchar[1] buf;
-        uint ate;
-        dchar[] res = tango.text.convert.Utf.toString32( src, buf, &ate );
-        dchar[] r = tango.text.Unicode.toLower( res );
-        return r[0];
+        version(Tango){
+            wchar[1] src;
+            src[0] = c;
+            dchar[1] buf;
+            uint ate;
+            dchar[] darr = tango.text.convert.Utf.toString32( src, buf, &ate );
+        } else { // Phobos
+            wchar[1] src;
+            src[0] = c;
+            auto darr = std.utf.toUTF32(src);
+        }
+        return toLowerCase( darr[0] );
     }
     public static dchar toLowerCase( dchar c ){
-        dchar[] r = tango.text.Unicode.toLower( [c] );
-        return r[0];
+        version(Tango){
+            dchar[1] src;
+            src[0] = c;
+            dchar[] r = tango.text.Unicode.toLower( src );
+            return r[0];
+        } else { // Phobos
+            return std.uni.toUniLower( c );
+        }
     }
     public static bool isWhitespace( dchar c ){
-        return tango.text.Unicode.isWhitespace( c );
+        version(Tango){
+            return tango.text.Unicode.isWhitespace( c );
+        } else { // Phobos
+            return std.string.iswhite(c);
+        }
     }
     public static bool isDigit( dchar c ){
-        return tango.text.Unicode.isDigit( c );
+        version(Tango){
+            return tango.text.Unicode.isDigit( c );
+        } else { // Phobos
+            return cast(bool)std.ctype.isdigit(c);
+        }
     }
     public static bool isLetter( dchar c ){
-        return tango.text.Unicode.isLetter(c);
+        version(Tango){
+            return tango.text.Unicode.isLetter(c);
+        } else { // Phobos
+            return cast(bool)std.ctype.isalpha(c);
+        }
     }
     public static bool isSpace( dchar c ){
-        return tango.text.Unicode.isSpace(c);
+        version(Tango){
+            return tango.text.Unicode.isSpace(c);
+        } else { // Phobos
+            return cast(bool)std.ctype.isspace(c);
+        }
     }
     public static bool isWhiteSpace( dchar c ){
-        return tango.text.Unicode.isWhitespace(c);
+        version(Tango){
+            return tango.text.Unicode.isWhitespace(c);
+        } else { // Phobos
+            return std.string.iswhite(c);
+        }
     }
     public static bool isLetterOrDigit( dchar c ){
         return isDigit(c) || isLetter(c);
@@ -75,3 +125,73 @@
         implMissing( __FILE__, __LINE__);
     }
 }
+
+bool CharacterIsDefined( dchar ch ){
+    version(Tango){
+        return (ch in tango.text.UnicodeData.unicodeData) !is null;
+    } else { // Phobos
+        implMissing( __FILE__, __LINE__);
+        return false;
+    }
+}
+
+dchar CharacterFirstToLower( String str ){
+    int consumed;
+    return CharacterFirstToLower( str, consumed );
+}
+
+dchar CharacterFirstToLower( String str, out int consumed ){
+    version(Tango){
+        dchar[1] buf;
+        buf[0] = firstCodePoint( str, consumed );
+        dchar[] r = tango.text.Unicode.toLower( buf );
+        return r[0];
+    } else { // Phobos
+        implMissing( __FILE__, __LINE__);
+        return 0;
+    }
+}
+
+dchar CharacterToLower( dchar c ){
+    version(Tango){
+        dchar[] r = tango.text.Unicode.toLower( [c] );
+        return r[0];
+    } else { // Phobos
+        implMissing( __FILE__, __LINE__);
+        return 0;
+    }
+}
+dchar CharacterToUpper( dchar c ){
+    version(Tango){
+        dchar[] r = tango.text.Unicode.toUpper( [c] );
+        return r[0];
+    } else { // Phobos
+        implMissing( __FILE__, __LINE__);
+        return 0;
+    }
+}
+bool CharacterIsWhitespace( dchar c ){
+    version(Tango){
+        return tango.text.Unicode.isWhitespace( c );
+    } else { // Phobos
+        implMissing( __FILE__, __LINE__);
+        return false;
+    }
+}
+bool CharacterIsDigit( dchar c ){
+    version(Tango){
+        return tango.text.Unicode.isDigit( c );
+    } else { // Phobos
+        implMissing( __FILE__, __LINE__);
+        return false;
+    }
+}
+bool CharacterIsLetter( dchar c ){
+    version(Tango){
+        return tango.text.Unicode.isLetter( c );
+    } else { // Phobos
+        implMissing( __FILE__, __LINE__);
+        return false;
+    }
+}
+
--- a/java/src/java/lang/Float.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/lang/Float.d	Thu Mar 19 20:38:55 2009 +0100
@@ -27,11 +27,16 @@
         return null;
     }
     public static float parseFloat( String s ){
-        try{
-            return tango.text.convert.Float.toFloat( s );
-        }
-        catch( IllegalArgumentException e ){
-            throw new NumberFormatException( e );
+        version(Tango){
+            try{
+                return tango.text.convert.Float.toFloat( s );
+            }
+            catch( IllegalArgumentException e ){
+                throw new NumberFormatException( e );
+            }
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return 0.0f;
         }
     }
 
--- a/java/src/java/lang/Integer.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/lang/Integer.d	Thu Mar 19 20:38:55 2009 +0100
@@ -3,6 +3,15 @@
 import java.lang.util;
 import java.lang.exceptions;
 
+version(Tango){
+} else { // Phobos
+}
+
+version(Tango){
+} else { // Phobos
+}
+
+
 class Integer : ValueWrapperT!(int) {
 
     public static const int MIN_VALUE = 0x80000000;
@@ -19,57 +28,72 @@
 
     public static String toString( int i, int radix ){
         switch( radix ){
-        case 2:
-            return toBinaryString(i);
-        case 8:
-            return toOctalString(i);
-        case 10:
-            return toString(i);
-        case 16:
-            return toHexString(i);
-        default:
-            implMissing( __FILE__, __LINE__ );
-            return null;
+            case 2:
+                return toBinaryString(i);
+            case 8:
+                return toOctalString(i);
+            case 10:
+                return toString(i);
+            case 16:
+                return toHexString(i);
+            default:
+                implMissing( __FILE__, __LINE__ );
+                return null;
         }
     }
 
     public static String toHexString( int i ){
-        return tango.text.convert.Integer.toString(i, "x" );
+        version(Tango){
+            return tango.text.convert.Integer.toString(i, "x" );
+        } else { // Phobos
+            return std.string.toString( cast(long)i, 16u );
+        }
     }
 
     public static String toOctalString( int i ){
-        return tango.text.convert.Integer.toString(i, "o" );
+        version(Tango){
+            return tango.text.convert.Integer.toString(i, "o" );
+        } else { // Phobos
+            return std.string.toString( cast(long)i, 8u );
+        }
     }
 
     public static String toBinaryString( int i ){
-        return tango.text.convert.Integer.toString(i, "b" );
+        version(Tango){
+            return tango.text.convert.Integer.toString(i, "b" );
+        } else { // Phobos
+            return std.string.toString( cast(long)i, 2u );
+        }
     }
 
     public static String toString( int i ){
-        return tango.text.convert.Integer.toString(i);
+        version(Tango){
+            return tango.text.convert.Integer.toString(i);
+        } else { // Phobos
+            return std.string.toString( i );
+        }
     }
 
     public static int parseInt( String s, int radix ){
-        try{
-            return tango.text.convert.Integer.toLong( s, radix );
-        }
-        catch( IllegalArgumentException e ){
-            throw new NumberFormatException( e );
+        version(Tango){
+            try{
+                return tango.text.convert.Integer.toLong( s, radix );
+            }
+            catch( IllegalArgumentException e ){
+                throw new NumberFormatException( e );
+            }
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return 0;
         }
     }
 
     public static int parseInt( String s ){
-        try{
-            return tango.text.convert.Integer.toLong( s );
-        }
-        catch( IllegalArgumentException e ){
-            throw new NumberFormatException( e );
-        }
+        return parseInt( s, 10 );
     }
 
     public static Integer valueOf( String s, int radix ){
-        implMissing( __FILE__, __LINE__ );
-        return null;
+        return new Integer( parseInt( s, radix ));
     }
 
     public static Integer valueOf( String s ){
@@ -109,7 +133,11 @@
     }
 
     public override String toString(){
-        return tango.text.convert.Integer.toString( value );
+        version(Tango){
+            return tango.text.convert.Integer.toString( value );
+        } else { // Phobos
+            return std.string.toString(value);
+        }
     }
 }
 alias Integer ValueWrapperInt;
--- a/java/src/java/lang/Math.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/lang/Math.d	Thu Mar 19 20:38:55 2009 +0100
@@ -1,10 +1,16 @@
 module java.lang.Math;
 
-static import tango.math.Math;
+version(Tango){
+    static import tango.math.Math;
+    alias tango.math.Math MathLib;
+} else {
+    static import std.math;
+    alias std.math MathLib;
+}
 
 class Math {
 
-    public const double PI = tango.math.Math.PI;
+    public const double PI = MathLib.PI;
 
     static double abs(double a){ return a > 0 ? a : -a; }
     static float  abs(float  a){ return a > 0 ? a : -a; }
@@ -38,18 +44,21 @@
     static long   max(long   a, int    b){ return a > b ? a : b; }
 
 
-    static double sin(double a)  { return tango.math.Math.sin(a); }
-    static double cos(double a)  { return tango.math.Math.cos(a); }
+    static double sin(double a)  { return MathLib.sin(a); }
+    static double cos(double a)  { return MathLib.cos(a); }
 
-    static long   round(double a) { return cast(long)tango.math.Math.round(a); }
-    static int    round(float a)  { return cast(int)tango.math.Math.round(a); }
+    static long   round(double a) { return cast(long)MathLib.round(a); }
+    static int    round(float a)  { return cast(int)MathLib.round(a); }
     static int    round(int a)  { return a; }
-    static double rint(double a) { return tango.math.Math.rndint(a); }
-    static double ceil(double a) { return tango.math.Math.ceil(a); }
-    static double floor(double a) { return tango.math.Math.floor(a); }
-    static double sqrt(double a) { return tango.math.Math.sqrt(a); }
-    static double atan2(double a, double b) { return tango.math.Math.atan2(a,b); }
-    static double pow(double a, double b) { return tango.math.Math.pow(a, b); }
+    static double rint(double a) {
+        version(Tango) return MathLib.rndint(a);
+        else           return MathLib.rint(a);
+    }
+    static double ceil(double a) { return MathLib.ceil(a); }
+    static double floor(double a) { return MathLib.floor(a); }
+    static double sqrt(double a) { return MathLib.sqrt(a); }
+    static double atan2(double a, double b) { return MathLib.atan2(a,b); }
+    static double pow(double a, double b) { return MathLib.pow(a, b); }
 }
 
 
--- a/java/src/java/lang/Runnable.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/lang/Runnable.d	Thu Mar 19 20:38:55 2009 +0100
@@ -3,9 +3,13 @@
  */
 module java.lang.Runnable;
 
-
-import tango.core.Tuple;
-import tango.core.Traits;
+version(Tango){
+    import tango.core.Tuple;
+    import tango.core.Traits;
+} else { // Phobos
+    static import std.traits;
+    static import std.typetuple;
+}
 
 public interface Runnable  {
 
@@ -15,9 +19,15 @@
 
 class _DgRunnableT(Dg,T...) : Runnable {
 
-    alias ParameterTupleOf!(Dg) DgArgs;
-    static assert( is(DgArgs == Tuple!(T)),
+    version(Tango){
+        alias ParameterTupleOf!(Dg) DgArgs;
+        static assert( is(DgArgs == Tuple!(T)),
                 "Delegate args not correct: "~DgArgs.stringof~" vs "~T.stringof );
+    } else { // Phobos
+        alias std.traits.ParameterTypeTuple!(Dg) DgArgs;
+        static assert( is(DgArgs == std.typetuple.TypeTuple!(T)),
+                "Delegate args not correct: "~DgArgs.stringof~" vs "~T.stringof );
+    }
 
     Dg dg;
     T t;
--- a/java/src/java/lang/StringBuffer.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/lang/StringBuffer.d	Thu Mar 19 20:38:55 2009 +0100
@@ -2,131 +2,228 @@
 
 import java.lang.util;
 
-static import tango.text.Text;
-static import tango.text.convert.Utf;
+version(Tango){
+    static import tango.text.Text;
+    static import tango.text.convert.Utf;
+} else { // Phobos
+    static import std.uni;
+    static import std.utf;
+}
 
 class StringBuffer : CharSequence {
-    alias tango.text.Text.Text!(char) TBuf;
-    TBuf buf;
+    version(Tango){
+        alias tango.text.Text.Text!(char) TBuf;
+        TBuf buf;
+    } else { // Phobos
+        const int STDINCR = 128;
+        char[] buf;
+        int used;
+    }
 
     public this(){
-        buf = new TBuf();
+        version(Tango){
+            buf = new TBuf();
+        } else { // Phobos
+        }
     }
 
     public this( int cap ){
-        buf = new TBuf( cap );
+        version(Tango){
+            buf = new TBuf(cap);
+        } else { // Phobos
+            buf.length = cap;
+        }
     }
 
     public this( String content ){
-        buf = new TBuf( content );
+        version(Tango){
+            buf = new TBuf( content );
+        } else { // Phobos
+            buf.length = content.length + STDINCR;
+            buf[ 0 .. content.length ] = content;
+            used = content.length;
+        }
     }
 
     char charAt(int index){
-        return buf.slice()[ index ];
+        version(Tango){
+            return buf.slice()[ index ];
+        } else { // Phobos
+            return buf[ index ];
+        }
     }
 
     int length(){
-        return buf.length();
+        version(Tango){
+            return buf.length();
+        } else { // Phobos
+            return used;
+        }
     }
 
     CharSequence subSequence(int start, int end){
-        return new StringBuffer( buf.slice()[ start .. end ] );
+        version(Tango){
+            return new StringBuffer( buf.slice()[ start .. end ] );
+        } else { // Phobos
+            return new StringBuffer( cast(String)buf[ start .. end ] );
+        }
     }
 
     String toString(){
-        return buf.slice();
+        version(Tango){
+            return buf.slice();
+        } else { // Phobos
+            return cast(String)buf[ 0 .. used ];
+        }
     }
 
     StringBuffer append( String s ){
-        buf.append( s );
+        version(Tango){
+            buf.append( s );
+        } else { // Phobos
+            if( buf.length < used + s.length ){
+                buf.length = used + s.length + STDINCR;
+            }
+            buf[ used .. used + s.length ] = s;
+            used += s.length;
+        }
         return this;
     }
 
     StringBuffer append( String s, int offset, int len ){
-        buf.append( s[ offset .. offset+len ] );
-        return this;
+        return append( s[ offset .. offset+len ] );
     }
 
     StringBuffer append( StringBuffer other ){
-        buf.append( other.slice() );
-        return this;
+        return append( other.slice() );
     }
 
     StringBuffer append( Object obj ){
-        buf.append( obj.toString() );
-        return this;
+        return append( obj.toString() );
     }
 
     StringBuffer append( char c ){
-        buf.append( c );
-        return this;
+        char[1] src;
+        src[0] = c;
+        return append( cast(String)src );
     }
 
     StringBuffer append( wchar c ){
         wchar[1] src;
         src[0] = c;
-        char[2] trg;
-        auto s = tango.text.convert.Utf.toString( src, trg );
-        buf.append( s );
-        return this;
+        version(Tango){
+            char[2] trg;
+            auto arr = tango.text.convert.Utf.toString( src, trg );
+        } else { // Phobos
+            auto arr = std.utf.toUTF8( src );
+        }
+        return append( arr );
     }
 
     StringBuffer append( int i ){
-        buf.append( String_valueOf(i) );
-        return this;
+        return append( String_valueOf(i) );
     }
 
     StringBuffer append( long i ){
-        buf.append( String_valueOf(i) );
-        return this;
+        return append( String_valueOf(i) );
     }
 
     StringBuffer append( dchar c ){
         dchar[1] src;
         src[0] = c;
-        char[4] trg;
-        auto s = tango.text.convert.Utf.toString( src, trg );
-        buf.append( s );
-        return this;
+        version(Tango){
+            char[4] trg;
+            auto arr = tango.text.convert.Utf.toString( src, trg );
+        } else { // Phobos
+            auto arr = std.utf.toUTF8( src );
+        }
+        return append( arr );
     }
 
 
     StringBuffer insert(int offset, String str){
-        buf.select(offset, 0);
-        buf.replace(str);
-        buf.select();
-        return this;
+        return replace( offset, offset, str );
     }
 
     StringBuffer insert(int offset, StringBuffer other){
-        insert( offset, other.slice());
-        return this;
+        return insert( offset, other.slice());
     }
 
     StringBuffer replace(int start, int end, String str) {
-        buf.select(start, end-start);
-        buf.replace(str);
-        buf.select();
+        version(Tango){
+            buf.select(start, end-start);
+            buf.replace(str);
+            buf.select();
+        } else { // Phobos
+            int incr = end - start - str.length;
+            if( incr > 0 ){
+                if( buf.length < used + incr ){
+                    char[] newbuf = new char[ 2*(used + incr) + STDINCR ];
+                    newbuf[ 0 .. start ] = buf[ 0 .. start ];
+                    newbuf[ start .. start + str.length ] = str;
+                    newbuf[ start + str.length .. used + str.length ] = buf[ end .. used ];
+                    buf = newbuf;
+                }
+                else{
+                    char* s = buf.ptr + start;
+                    char* t = buf.ptr + start + str.length;
+                    char* e = buf.ptr + start + str.length;
+                    while( s !is e ){
+                        *t = *s;
+                        s++; t++;
+                    }
+                    buf[ start .. start + str.length ] = str;
+                }
+            }
+            else if( incr == 0 ){
+                buf[ start .. end ] = str;
+            }
+            else{
+                buf[ start .. end ] = str;
+                char* s = buf.ptr + end;
+                char* t = buf.ptr + start + str.length;
+                char* e = buf.ptr + start + str.length;
+                while( s !is e ){
+                    *t = *s;
+                    s--; t--;
+                }
+            }
+            used += incr;
+        }
         return this;
     }
 
     void setLength( int newLength ){
-        buf.truncate( newLength );
+        version(Tango){
+            buf.truncate( newLength );
+        } else { // Phobos
+            if( buf.length < newLength ){
+                buf.length = 2*newLength + STDINCR;
+            }
+            used = newLength;
+        }
     }
 
     String substring( int start, int end ){
-        return buf.slice()[ start .. end ].dup;
+        version(Tango){
+            return buf.slice()[ start .. end ].dup;
+        } else { // Phobos
+            return buf[ start .. end ].idup;
+        }
     }
 
     void delete_( int start, int end ){
-        buf.select( start, end - start );
-        buf.remove();
+        replace( start, end, "" );
     }
     String slice(){
-        return buf.slice();
+        version(Tango){
+            return buf.slice();
+        } else { // Phobos
+            return cast(String)buf[ 0 .. used ];
+        }
     }
     void truncate( int start ){
-        buf.truncate( start );
+        setLength( start );
     }
 }
 
--- a/java/src/java/lang/System.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/lang/System.d	Thu Mar 19 20:38:55 2009 +0100
@@ -4,12 +4,19 @@
 module java.lang.System;
 
 import java.lang.util;
+import java.lang.exceptions;
 
-import tango.sys.Environment;
-import tango.core.Exception;
-import tango.io.model.IFile : FileConst;
-import tango.time.Clock;
-import tango.stdc.stdlib : exit;
+version(Tango){
+    static import tango.sys.Environment;
+    static import tango.core.Exception;
+    static import tango.io.model.IFile;
+    static import tango.time.Clock;
+    static import tango.stdc.stdlib;
+} else { // Phobos
+    static import std.c.stdlib;
+    static import std.date;
+    static import std.path;
+}
 
 template SimpleType(T) {
     debug{
@@ -26,7 +33,7 @@
             return;
 
         if(index < 0 || index >= items.length){
-            throw new ArrayBoundsException(__FILE__, __LINE__);
+            throw new ArrayIndexOutOfBoundsException(__FILE__, __LINE__);
         }
 
         T element = items[index];
@@ -50,7 +57,7 @@
             index = items.length;
 
         if(index < 0 || index > items.length ){
-            throw new ArrayBoundsException(__FILE__, __LINE__);
+            throw new ArrayIndexOutOfBoundsException(__FILE__, __LINE__);
         }
 
         if(index == items.length){
@@ -133,11 +140,13 @@
     alias SimpleType!(void*[]).arraycopy arraycopy;
 
     static long currentTimeMillis(){
-        return Clock.now().ticks() / 10000;
+        version(Tango) return tango.time.Clock.Clock.now().ticks() / 10000;
+        else           return std.date.getUTCtime() / (std.date.TicksPerSecond/1000);
     }
 
     static void exit( int code ){
-        .exit(code);
+        version(Tango) tango.stdc.stdlib.exit(code);
+        else           std.c.stdlib.exit(code);
     }
     public static int identityHashCode(Object x){
         if( x is null ){
@@ -165,7 +174,9 @@
                 case "user.name": return "";
                 case "user.home": return "";
                 case "user.dir" : return "";
-                case "file.separator" : return FileConst.PathSeparatorString ;
+                case "file.separator" : 
+                    version(Tango) return tango.io.model.IFile.FileConst.PathSeparatorString ;
+                    else           return std.path.sep;
                 default: return null;
             }
         }
--- a/java/src/java/lang/Thread.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/lang/Thread.d	Thu Mar 19 20:38:55 2009 +0100
@@ -1,51 +1,66 @@
 module java.lang.Thread;
 
-static import tango.core.Thread;
+version(Tango){
+    static import tango.core.Thread;
+} else { // Phobos
+    static import core.thread;
+}
 import java.lang.util;
 import java.lang.Runnable;
 
 class Thread {
 
-    private tango.core.Thread.Thread thread;
+    version(Tango){
+        alias tango.core.Thread.Thread TThread;
+    } else { // Phobos
+        alias core.thread.Thread TThread;
+    }
+    private TThread thread;
     private Runnable runnable;
 
-    private alias tango.core.Thread.ThreadLocal!(Thread) TTLS;
-    private static TTLS tls;
+    version(Tango){
+        private alias tango.core.Thread.ThreadLocal!(Thread) TTLS;
+        private static TTLS tls;
+    } else { // Phobos
+        mixin( "static __thread Thread tls;" );
+    }
 
     public static const int MAX_PRIORITY  = 10;
     public static const int MIN_PRIORITY  =  1;
     public static const int NORM_PRIORITY =  5;
 
-    private static TTLS getTls(){
-        if( tls is null ){
-            synchronized( Thread.classinfo ){
-                if( tls is null ){
-                    tls = new TTLS();
+    version(Tango){
+        private static TTLS getTls(){
+            if( tls is null ){
+                synchronized( Thread.classinfo ){
+                    if( tls is null ){
+                        tls = new TTLS();
+                    }
                 }
             }
+            return tls;
         }
-        return tls;
     }
 
     public this(){
-        thread = new tango.core.Thread.Thread(&internalRun);
+        thread = new TThread(&internalRun);
     }
     public this( void delegate() dg ){
-        thread = new tango.core.Thread.Thread(&internalRun);
+        thread = new TThread(&internalRun);
         runnable = dgRunnable( dg );
     }
     public this(Runnable runnable){
-        thread = new tango.core.Thread.Thread(&internalRun);
+        thread = new TThread(&internalRun);
         this.runnable = runnable;
     }
     public this(Runnable runnable, String name){
-        thread = new tango.core.Thread.Thread(&internalRun);
+        thread = new TThread(&internalRun);
         this.runnable = runnable;
-        thread.name = name;
+        thread.name = cast(char[])name;
     }
     public this(String name){
-        thread = new tango.core.Thread.Thread(&internalRun);
-        thread.name = name;
+        thread = new TThread(&internalRun);
+        thread.name = cast(char[])name;
     }
 
     public void start(){
@@ -53,29 +68,46 @@
     }
 
     public static Thread currentThread(){
-        auto res = getTls().val();
-        if( res is null ){
-            // no synchronized needed
-            res = new Thread();
-            res.thread = tango.core.Thread.Thread.getThis();
-            getTls().val( res );
+        version(Tango){
+            auto res = getTls().val();
+            if( res is null ){
+                // no synchronized needed
+                res = new Thread();
+                res.thread = tango.core.Thread.Thread.getThis();
+                getTls().val( res );
+            }
+            assert( res );
+            return res;
+        } else { // Phobos
+            auto res = tls;
+            if( res is null ){
+                // no synchronized needed
+                res = new Thread();
+                res.thread = TThread.getThis();
+                tls = res;
+            }
+            assert( res );
+            return res;
         }
-        assert( res );
-        return res;
     }
     public int getPriority() {
-        return (thread.priority-tango.core.Thread.Thread.PRIORITY_MIN) * (MAX_PRIORITY-MIN_PRIORITY) / (tango.core.Thread.Thread.PRIORITY_MAX-tango.core.Thread.Thread.PRIORITY_MIN) + MIN_PRIORITY;
+        return (thread.priority-TThread.PRIORITY_MIN) * (MAX_PRIORITY-MIN_PRIORITY) / (TThread.PRIORITY_MAX-TThread.PRIORITY_MIN) + MIN_PRIORITY;
     }
     public void setPriority( int newPriority ) {
 //         assert( MIN_PRIORITY < MAX_PRIORITY );
 //         assert( tango.core.Thread.Thread.PRIORITY_MIN < tango.core.Thread.Thread.PRIORITY_MAX );
-        auto scaledPrio = (newPriority-MIN_PRIORITY) * (tango.core.Thread.Thread.PRIORITY_MAX-tango.core.Thread.Thread.PRIORITY_MIN) / (MAX_PRIORITY-MIN_PRIORITY) +tango.core.Thread.Thread.PRIORITY_MIN;
-        getDwtLogger().trace( __FILE__, __LINE__, "Thread.setPriority: scale ({} {} {}) -> ({} {} {})", MIN_PRIORITY, newPriority, MAX_PRIORITY, tango.core.Thread.Thread.PRIORITY_MIN, scaledPrio, tango.core.Thread.Thread.PRIORITY_MAX);
+        auto scaledPrio = (newPriority-MIN_PRIORITY) * (TThread.PRIORITY_MAX-TThread.PRIORITY_MIN) / (MAX_PRIORITY-MIN_PRIORITY) +TThread.PRIORITY_MIN;
+        getDwtLogger().trace( __FILE__, __LINE__, "Thread.setPriority: scale ({} {} {}) -> ({} {} {})", MIN_PRIORITY, newPriority, MAX_PRIORITY, TThread.PRIORITY_MIN, scaledPrio, TThread.PRIORITY_MAX);
 //         thread.priority( scaledPrio );
     }
 
     private void internalRun(){
-        getTls().val( this );
+        version(Tango){
+            // Store this thread object ref to the TLS
+            getTls().val( this );
+        } else { // Phobos
+            tls = this;
+        }
         if( runnable !is null ){
             runnable.run();
         }
@@ -101,10 +133,10 @@
     }
 
     public void setName(String name){
-        thread.name = name;
+        thread.name = cast(char[])name;
     }
     public String getName(){
-        return thread.name;
+        return cast(String)thread.name;
     }
 
     void interrupt() {
@@ -120,17 +152,21 @@
         // default impl, do nothing
     }
     public static void sleep( int time ){
-        tango.core.Thread.Thread.sleep(time/1000.0);
+        version(Tango){
+            TThread.sleep(time/1000.0);
+        } else { // Phobos
+            TThread.sleep(time*10_000);
+        }
     }
-    public tango.core.Thread.Thread nativeThread(){
+    public TThread nativeThread(){
         assert(thread);
         return thread;
     }
-    public override char[] toString(){
-        return "Thread "~thread.name;
+    public override String toString(){
+        return cast(String) "Thread "~cast(String)thread.name;
     }
     public static void yield(){
-        tango.core.Thread.Thread.yield();
+        TThread.yield();
     }
 }
 
--- a/java/src/java/lang/all.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/lang/all.d	Thu Mar 19 20:38:55 2009 +0100
@@ -10,11 +10,14 @@
 public import java.lang.Long;
 public import java.lang.Math;
 public import java.lang.Runnable;
+public import java.lang.String;
 public import java.lang.StringBuffer;
 public import java.lang.System;
 
 public import java.lang.util;
 public import java.lang.exceptions;
+public import java.lang.interfaces;
+public import java.lang.wrappers;
 
 
 
--- a/java/src/java/lang/exceptions.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/lang/exceptions.d	Thu Mar 19 20:38:55 2009 +0100
@@ -1,9 +1,53 @@
 module java.lang.exceptions;
 
 import java.lang.util;
+import java.lang.String;
 
-static import tango.core.Exception;
-public alias tango.core.Exception.IOException IOException;
+version(Tango){
+    static import tango.core.Exception;
+    public alias tango.core.Exception.IllegalArgumentException IllegalArgumentException;
+    public alias tango.core.Exception.IOException IOException;
+    public alias tango.core.Exception.PlatformException PlatformException;
+    public alias tango.core.Exception.ArrayBoundsException ArrayIndexOutOfBoundsException;
+    public alias tango.core.Exception.NoSuchElementException NoSuchElementException;
+    public alias tango.core.Exception.UnicodeException UnicodeException;
+    alias Exception Throwable;
+} else { // Phobos
+
+    static import core.exception;
+    public alias core.exception.RangeError ArrayIndexOutOfBoundsException;
+
+    class IllegalArgumentException : Exception {
+        this( String e = null ){
+            super(e);
+        }
+    }
+
+    class IOException : Exception {
+        this( String e = null ){
+            super(e);
+        }
+    }
+
+    class NoSuchElementException : Exception {
+        this( String e = null ){
+            super(e);
+        }
+    }
+
+    class UnicodeException : Exception {
+        this( String msg, int idx){
+            super( "" );
+        }
+    }
+
+}
+
+class InternalError : Exception {
+    this( String file, long line, String e = null ){
+        super(e);
+    }
+}
 
 class ClassCastException : Exception {
     this( String e = null ){
@@ -54,7 +98,7 @@
 }
 
 class RuntimeException : Exception {
-    this( char[] file, long line, char[] msg = null){
+    this( String file, long line, String msg = null){
         super( msg, file, line );
     }
     this( String e = null){
@@ -64,8 +108,8 @@
         super(e.toString);
         next = e;
     }
-    public Exception getCause() {
-        return next;
+    public Throwable getCause() {
+        return next; // D2 has next of type Throwable
     }
 }
 
@@ -78,3 +122,38 @@
     }
 }
 
+/// Extension to the D Exception
+String ExceptionGetLocalizedMessage( Exception e ){
+    return e.msg;
+}
+
+/// Extension to the D Exception
+void ExceptionPrintStackTrace( Exception e ){
+    ExceptionPrintStackTrace( e, & getDwtLogger().error );
+}
+
+/// Extension to the D Exception
+void ExceptionPrintStackTrace( Throwable e, void delegate ( String file, ulong line, String fmt, ... ) dg ){
+    Throwable exception = e;
+    while( exception !is null ){
+        dg( exception.file, exception.line, "Exception in {}({}): {}", exception.file, exception.line, exception.msg );
+        if( exception.info !is null ){
+            foreach( msg; exception.info ){
+                dg( exception.file, exception.line, "trc {}", msg );
+            }
+        }
+        exception = exception.next;
+    }
+}
+
+void PrintStackTrace( int deepth = 100, String prefix = "trc" ){
+    auto e = new Exception( null );
+    int idx = 0;
+    const start = 3;
+    foreach( msg; e.info ){
+        if( idx >= start && idx < start+deepth ) {
+            getDwtLogger().trace( __FILE__, __LINE__, "{}: {}", prefix, msg );
+        }
+        idx++;
+    }
+}
--- a/java/src/java/lang/util.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/lang/util.d	Thu Mar 19 20:38:55 2009 +0100
@@ -1,30 +1,31 @@
 module java.lang.util;
 
-void implMissing( String file, uint line ){
-    Stderr.formatln( "implementation missing in file {} line {}", file, line );
-    Stderr.formatln( "exiting ..." );
-    exit(1);
+public import java.lang.wrappers;
+public import java.lang.String;
+public import java.lang.interfaces;
+
+version(Tango){
+    static import tango.text.convert.Format;
+    static import tango.core.Exception;
+    static import tango.util.log.Log;
+    static import tango.stdc.stdlib;
+
+    alias tango.stdc.stdlib.exit exit;
+} else { // Phobos
+    static import core.exception;
+    static import std.c.stdlib;
+    alias std.c.stdlib.exit exit;
 }
 
-alias char[] String;
-
-public import tango.core.Exception : IllegalArgumentException, IOException;
-
-import tango.io.Stdout;
-import tango.io.stream.Format;
-static import tango.text.convert.Format;
-static import tango.stdc.stringz;
-static import tango.text.Util;
-static import tango.text.Text;
-static import tango.text.Ascii;
-import tango.text.Unicode;
-import tango.text.convert.Utf;
-import tango.core.Exception;
-import tango.stdc.stdlib : exit;
-
-import tango.util.log.Trace;
-import tango.util.log.Log;
-import tango.text.UnicodeData;
+version(Tango){
+} else { // Phobos
+}
+version(Tango){
+} else { // Phobos
+}
+version(Tango){
+} else { // Phobos
+}
 
 interface IDwtLogger {
     void trace( String file, ulong line, String fmt, ... );
@@ -34,39 +35,56 @@
     void fatal( String file, ulong line, String fmt, ... );
 }
 
-class DwtLogger : IDwtLogger {
-    Logger logger;
-    private this( char[] name ){
-        logger = Log.lookup( name );
-    }
-    private char[] format( String file, ulong line, String fmt, TypeInfo[] types, void* argptr ){
-        auto msg = Format.convert( types, argptr, fmt );
-        auto text = Format( "{} {}: {}", file, line, msg );
-        return text;
-    }
-    void trace( String file, ulong line, String fmt, ... ){
-        if( logger.trace ){
-            logger.trace( format( file, line, fmt, _arguments, _argptr ));
+version(Tango){
+    class DwtLogger : IDwtLogger {
+        tango.util.log.Log.Logger logger;
+        private this( char[] name ){
+            logger = tango.util.log.Log.Log.lookup( name );
+        }
+        private char[] format( String file, ulong line, String fmt, TypeInfo[] types, void* argptr ){
+            auto msg = Format.convert( types, argptr, fmt );
+            auto text = Format( "{} {}: {}", file, line, msg );
+            return text;
+        }
+        void trace( String file, ulong line, String fmt, ... ){
+            if( logger.trace ){
+                logger.trace( format( file, line, fmt, _arguments, _argptr ));
+            }
+        }
+        void info( String file, ulong line, String fmt, ... ){
+            if( logger.info ){
+                logger.info( format( file, line, fmt, _arguments, _argptr ));
+            }
+        }
+        void warn( String file, ulong line, String fmt, ... ){
+            if( logger.warn ){
+                logger.warn( format( file, line, fmt, _arguments, _argptr ));
+            }
+        }
+        void error( String file, ulong line, String fmt, ... ){
+            if( logger.error ){
+                logger.error( format( file, line, fmt, _arguments, _argptr ));
+            }
+        }
+        void fatal( String file, ulong line, String fmt, ... ){
+            if( logger.fatal ){
+                logger.fatal( format( file, line, fmt, _arguments, _argptr ));
+            }
         }
     }
-    void info( String file, ulong line, String fmt, ... ){
-        if( logger.info ){
-            logger.info( format( file, line, fmt, _arguments, _argptr ));
+} else { // Phobos
+    class DwtLogger : IDwtLogger {
+        private this( String name ){
         }
-    }
-    void warn( String file, ulong line, String fmt, ... ){
-        if( logger.warn ){
-            logger.warn( format( file, line, fmt, _arguments, _argptr ));
+        void trace( String file, ulong line, String fmt, ... ){
         }
-    }
-    void error( String file, ulong line, String fmt, ... ){
-        if( logger.error ){
-            logger.error( format( file, line, fmt, _arguments, _argptr ));
+        void info( String file, ulong line, String fmt, ... ){
+        }
+        void warn( String file, ulong line, String fmt, ... ){
         }
-    }
-    void fatal( String file, ulong line, String fmt, ... ){
-        if( logger.fatal ){
-            logger.fatal( format( file, line, fmt, _arguments, _argptr ));
+        void error( String file, ulong line, String fmt, ... ){
+        }
+        void fatal( String file, ulong line, String fmt, ... ){
         }
     }
 }
@@ -84,687 +102,24 @@
     return dwtLoggerInstance;
 }
 
-public alias tango.text.convert.Format.Format Format;
-alias ArrayBoundsException ArrayIndexOutOfBoundsException;
-
-abstract class ArrayWrapper{
-}
-abstract class ValueWrapper{
+void implMissing( String file, uint line ){
+    getDwtLogger().fatal( file, line, "implementation missing in file {} line {}", file, line );
+    getDwtLogger().fatal( file, line, "Please create a bug report at http://www.dsource.org/projects/dwt" );
+    getDwtLogger().fatal( file, line, "exiting ..." );
+    exit(1);
 }
 
-class ArrayWrapperT(T) : ArrayWrapper {
-    public T[] array;
-    public this( T[] data ){
-        array = data;
-    }
-    public override int opEquals( Object o ){
-        if( auto other = cast(ArrayWrapperT!(T))o){
-            return array == other.array;
-        }
-        return false;
-    }
-    public override hash_t toHash(){
-        return (typeid(T[])).getHash(&array);
-    }
-    static if( is( T == char )){
-        public override char[] toString(){
-            return array;
+version(Tango){
+    public alias tango.text.convert.Format.Format Format;
+} else { // Phobos
+    class Format{
+        static String opCall( String fmt, ... ){
+            implMissing(__FILE__,__LINE__);
+            return null;
         }
     }
 }
 
-class ValueWrapperT(T) : ValueWrapper {
-    public T value;
-    public this( T data ){
-        value = data;
-    }
-    static if( is(T==class) || is(T==interface)){
-        public int opEquals( Object other ){
-            if( auto o = cast(ValueWrapperT!(T))other ){
-                return value == o.value;
-            }
-            if( auto o = cast(T)other ){
-                if( value is o ){
-                    return true;
-                }
-                if( value is null || o is null ){
-                    return false;
-                }
-                return value == o;
-            }
-            return false;
-        }
-    }
-    else{
-        public int opEquals( Object other ){
-            if( auto o = cast(ValueWrapperT!(T))other ){
-                return value == o.value;
-            }
-            return false;
-        }
-        public int opEquals( T other ){
-            return value == other;
-        }
-    }
-    public override hash_t toHash(){
-        return (typeid(T)).getHash(&value);
-    }
-}
-
-alias ArrayWrapperT!(byte)    ArrayWrapperByte;
-alias ArrayWrapperT!(int)     ArrayWrapperInt;
-alias ArrayWrapperT!(Object)  ArrayWrapperObject;
-alias ArrayWrapperT!(char)    ArrayWrapperString;
-alias ArrayWrapperT!(String)  ArrayWrapperString2;
-
-Object[] StringArrayToObjectArray( String[] strs ){
-    Object[] res = new Object[strs.length];
-    foreach( idx, str; strs ){
-        res[idx] = new ArrayWrapperString(str);
-    }
-    return res;
-}
-int codepointIndexToIndex( String str, int cpIndex ){
-    int cps = cpIndex;
-    int res = 0;
-    while( cps > 0 ){
-        cps--;
-        if( str[res] < 0x80 ){
-            res+=1;
-        }
-        else if( str[res] < 0xE0 ){
-            res+=2;
-        }
-        else if( str[res] & 0xF0 ){
-            res+=3;
-        }
-        else{
-            res+=4;
-        }
-    }
-    return res;
-}
-
-/++
- +
- +/
-int indexToCodepointIndex( String str, int index ){
-    if( index < 0 ) return index;
-    int i = 0;
-    int res = 0;
-    while( i < index ){
-        if( i >= str.length ){
-            break;
-        }
-        if( str[i] < 0x80 ){
-            i+=1;
-        }
-        else if( str[i] < 0xE0 ){
-            i+=2;
-        }
-        else if( str[i] & 0xF0 ){
-            i+=3;
-        }
-        else{
-            i+=4;
-        }
-        res++;
-    }
-    return res;
-}
-
-/++
- + Get that String, that contains the next codepoint of a String.
- +/
-String firstCodePointStr( String str, out int consumed ){
-    dchar[1] buf;
-    uint ate;
-    dchar[] res = str.toString32( buf, &ate );
-    consumed = ate;
-    return str[ 0 .. ate ];
-}
-
-/++
- + Get first codepoint of a String. If an offset is needed, simply use a slice:
- + ---
- + dchar res = str[ offset .. $ ].firstCodePoint();
- + ---
- +/
-dchar firstCodePoint( String str ){
-    int dummy;
-    return firstCodePoint( str, dummy );
-}
-dchar firstCodePoint( String str, out int consumed ){
-    dchar[1] buf;
-    uint ate;
-    dchar[] res = str.toString32( buf, &ate );
-    consumed = ate;
-    if( ate is 0 || res.length is 0 ){
-        Trace.formatln( "dwthelper.utils {}: str.length={} str={:X2}", __LINE__, str.length, cast(ubyte[])str );
-    }
-    assert( ate > 0 );
-    assert( res.length is 1 );
-    return res[0];
-}
-dchar firstCodePoint( wchar[] str, out int consumed ){
-    dchar[1] buf;
-    uint ate;
-    dchar[] res = str.toString32( buf, &ate );
-    consumed = ate;
-    if( ate is 0 || res.length is 0 ){
-        Trace.formatln( "dwthelper.utils {}: str.length={} str={:X2}", __LINE__, str.length, cast(ubyte[])str );
-    }
-    assert( ate > 0 );
-    assert( res.length is 1 );
-    return res[0];
-}
-
-String dcharToString( dchar key ){
-    dchar[1] buf;
-    buf[0] = key;
-    return tango.text.convert.Utf.toString( buf );
-}
-
-int codepointCount( String str ){
-    scope dchar[] buf = new dchar[]( str.length );
-    uint ate;
-    dchar[] res = tango.text.convert.Utf.toString32( str, buf, &ate );
-    assert( ate is str.length );
-    return res.length;
-}
-
-//alias tango.text.convert.Utf.toString16 toString16;
-//alias tango.text.convert.Utf.toString toString;
-
-int toAbsoluteCodePointStartOffset( String str, int index ){
-    //Trace.formatln( "str={}, str.length={}, index={}", str, str.length, index );
-    //Trace.memory( str );
-    if( str.length is index ){
-        return index;
-    }
-    if( ( str[index] & 0x80 ) is 0x00 ) {
-        return index;
-    }
-    else{
-        int steps = 0;
-        while(( str[index] & 0xC0 ) is 0x80 ){
-            index--;
-            steps++;
-            if( steps > 3 || index < 0 ){
-                break;
-            }
-        }
-        if((( str[index] & 0xE0 ) is 0xC0) && ( steps <= 1 )){
-            // ok
-        }
-        else if((( str[index] & 0xF0 ) is 0xE0) && ( steps <= 2 )){
-            // ok
-        }
-        else if((( str[index] & 0xF8 ) is 0xF0) && ( steps <= 3 )){
-            // ok
-        }
-        else{
-            tango.text.convert.Utf.onUnicodeError( "invalid utf8 input to toAbsoluteCodePointStartOffset" );
-        }
-        return index;
-    }
-}
-int getRelativeCodePointOffset( String str, int startIndex, int searchRelCp ){
-    return getAbsoluteCodePointOffset( str, startIndex, searchRelCp ) - startIndex;
-}
-int getAbsoluteCodePointOffset( String str, int startIndex, int searchRelCp ){
-
-    //Trace.formatln( "str={}, str.length={}, startIndex={}, searchRelCp={}", str, str.length, startIndex, searchRelCp );
-    //Trace.memory( str );
-
-    int ignore;
-    int i = startIndex;
-    if( searchRelCp > 0 ){
-        while( searchRelCp !is 0 ){
-
-            if( ( i < str.length )
-            && (( str[i] & 0x80 ) is 0x00 ))
-            {
-                i+=1;
-            }
-            else if( ( i+1 < str.length )
-                && (( str[i+1] & 0xC0 ) is 0x80 )
-                && (( str[i  ] & 0xE0 ) is 0xC0 ))
-            {
-                i+=2;
-            }
-            else if( ( i+2 < str.length )
-                && (( str[i+2] & 0xC0 ) is 0x80 )
-                && (( str[i+1] & 0xC0 ) is 0x80 )
-                && (( str[i  ] & 0xF0 ) is 0xE0 ))
-            {
-                i+=3;
-            }
-            else if(( i+3 < str.length )
-                && (( str[i+3] & 0xC0 ) is 0x80 )
-                && (( str[i+2] & 0xC0 ) is 0x80 )
-                && (( str[i+1] & 0xC0 ) is 0x80 )
-                && (( str[i  ] & 0xF8 ) is 0xF0 ))
-            {
-                i+=4;
-            }
-            else{
-                Trace.formatln( "getAbsoluteCodePointOffset invalid utf8 characters:  {:X2}", cast(ubyte[]) str );
-                tango.text.convert.Utf.onUnicodeError( "invalid utf8 input", i );
-            }
-            searchRelCp--;
-        }
-    }
-    else if( searchRelCp < 0 ){
-        while( searchRelCp !is 0 ){
-            do{
-                i--;
-                if( i < 0 ){
-                    return startIndex-1;
-                }
-            } while(( str[i] & 0xC0 ) is 0x80 );
-            searchRelCp++;
-        }
-    }
-    return i;
-}
-int getAbsoluteCodePointOffset( wchar[] str, int startIndex, int searchRelCp ){
-    int ignore;
-    int i = startIndex;
-    if( searchRelCp > 0 ){
-        while( searchRelCp !is 0 ){
-
-            if( ( i < str.length )
-                && ( str[i] & 0xD800 ) !is 0xD800 )
-            {
-                i+=1;
-            }
-            else if( ( i+1 < str.length )
-                && (( str[i+1] & 0xDC00 ) is 0xDC00 )
-                && (( str[i  ] & 0xDC00 ) is 0xD800 ))
-            {
-                i+=2;
-            }
-            else{
-                Trace.formatln( "invalid utf16 characters:  {:X2}", cast(ubyte[]) str );
-                tango.text.convert.Utf.onUnicodeError( "invalid utf16 input", i );
-            }
-            searchRelCp--;
-        }
-    }
-    else if( searchRelCp < 0 ){
-        while( searchRelCp !is 0 ){
-            do{
-                i--;
-                if( i < 0 ){
-                    return startIndex-1;
-                    //Trace.formatln( "dwthelper.utils getRelativeCodePointOffset {}: str={}, startIndex={}, searchRelCp={}", __LINE__, str, startIndex, searchRelCp );
-                    //tango.text.convert.Utf.onUnicodeError( "invalid utf16 input", i );
-                }
-            } while(( str[i] & 0xDC00 ) is 0xDC00 );
-            searchRelCp++;
-        }
-    }
-    return i;
-}
-dchar getRelativeCodePoint( String str, int startIndex, int searchRelCp ){
-    int dummy;
-    return getRelativeCodePoint( str, startIndex, dummy );
-}
-dchar getRelativeCodePoint( String str, int startIndex, int searchRelCp, out int relIndex ){
-    relIndex = getRelativeCodePointOffset( str, startIndex, searchRelCp );
-    int ignore;
-    return firstCodePoint( str[ startIndex+relIndex .. $ ], ignore );
-}
-
-int utf8AdjustOffset( String str, int offset ){
-    if( str.length <= offset || offset <= 0 ){
-        return offset;
-    }
-    while(( str[offset] & 0xC0 ) is 0x80 ){
-        offset--;
-    }
-    return offset;
-}
-int utf8OffsetIncr( String str, int offset ){
-    int res = offset +1;
-    if( str.length <= res || res <= 0 ){
-        return res;
-    }
-    int tries = 4;
-    while(( str[res] & 0xC0 ) is 0x80 ){
-        res++;
-        assert( tries-- > 0 );
-    }
-    return res;
-}
-int utf8OffsetDecr( String str, int offset ){
-    int res = offset-1;
-    if( str.length <= res || res <= 0 ){
-        return res;
-    }
-    int tries = 4;
-    while(( str[res] & 0xC0 ) is 0x80 ){
-        res--;
-        assert( tries-- > 0 );
-    }
-    Trace.formatln( "utf8OffsetDecr {}->{}", offset, res );
-    Trace.memory( str );
-    return res;
-}
-
-String new_String( String cont, int offset, int len ){
-    return cont[ offset .. offset+len ].dup;
-}
-
-String new_String( String cont ){
-    return cont.dup;
-}
-
-String String_valueOf( bool v ){
-    return v ? "true" : "false";
-}
-
-String String_valueOf( byte v ){
-    return tango.text.convert.Integer.toString(v);
-}
-
-String String_valueOf( ubyte v ){
-    return tango.text.convert.Integer.toString(v);
-}
-
-String String_valueOf( short v ){
-    return tango.text.convert.Integer.toString(v);
-}
-
-String String_valueOf( int v ){
-    return tango.text.convert.Integer.toString(v);
-}
-
-String String_valueOf( uint v ){
-    return tango.text.convert.Integer.toString(v);
-}
-
-String String_valueOf( long v ){
-    return tango.text.convert.Integer.toString(v);
-}
-
-String String_valueOf( float v ){
-    return tango.text.convert.Float.toString(v);
-}
-
-String String_valueOf( double v ){
-    return tango.text.convert.Float.toString(v);
-}
-
-String String_valueOf( dchar v ){
-    return dcharToString(v);
-}
-
-String String_valueOf( char[] v ){
-    return v.dup;
-}
-
-String String_valueOf( char[] v, int offset, int len ){
-    return v[ offset .. offset+len ].dup;
-}
-
-String String_valueOf( Object v ){
-    return v is null ? "null" : v.toString();
-}
-
-String String_valueOf( wchar[] wstr ){
-    return .toString(wstr);
-}
-
-bool CharacterIsDefined( dchar ch ){
-    return (ch in tango.text.UnicodeData.unicodeData) !is null;
-}
-
-dchar CharacterFirstToLower( String str ){
-    int consumed;
-    return CharacterFirstToLower( str, consumed );
-}
-
-dchar CharacterFirstToLower( String str, out int consumed ){
-    dchar[1] buf;
-    buf[0] = firstCodePoint( str, consumed );
-    dchar[] r = tango.text.Unicode.toLower( buf );
-    return r[0];
-}
-
-int length( String str ){
-    return str.length;
-}
-
-dchar CharacterToLower( dchar c ){
-    dchar[] r = tango.text.Unicode.toLower( [c] );
-    return r[0];
-}
-dchar CharacterToUpper( dchar c ){
-    dchar[] r = tango.text.Unicode.toUpper( [c] );
-    return r[0];
-}
-bool CharacterIsWhitespace( dchar c ){
-    return tango.text.Unicode.isWhitespace( c );
-}
-bool CharacterIsDigit( dchar c ){
-    return tango.text.Unicode.isDigit( c );
-}
-bool CharacterIsLetter( dchar c ){
-    return tango.text.Unicode.isLetter( c );
-}
-
-/// Extension to String
-public String toUpperCase( String str ){
-    return tango.text.Unicode.toUpper( str );
-}
-
-/// Extension to String
-public String replaceFirst( String str, String regex, String replacement ){
-    implMissing(__FILE__,__LINE__);
-    return str;
-}
-
-/// Extension to String
-public int indexOf( String str, char searched ){
-    int res = tango.text.Util.locate( str, searched );
-    if( res is str.length ) res = -1;
-    return res;
-}
-
-/// Extension to String
-public int indexOf( String str, char searched, int startpos ){
-    int res = tango.text.Util.locate( str, searched, startpos );
-    if( res is str.length ) res = -1;
-    return res;
-}
-
-/// Extension to String
-public int indexOf(String str, String ch){
-    return indexOf( str, ch, 0 );
-}
-
-/// Extension to String
-public int indexOf(String str, String ch, int start){
-    int res = tango.text.Util.locatePattern( str, ch, start );
-    if( res is str.length ) res = -1;
-    return res;
-}
-
-/// Extension to String
-public int lastIndexOf(String str, char ch){
-    return lastIndexOf( str, ch, str.length );
-}
-
-/// Extension to String
-public int lastIndexOf(String str, char ch, int formIndex){
-    int res = tango.text.Util.locatePrior( str, ch, formIndex );
-    if( res is str.length ) res = -1;
-    return res;
-}
-
-/// Extension to String
-public int lastIndexOf(String str, String ch ){
-    return lastIndexOf( str, ch, str.length );
-}
-
-/// Extension to String
-public int lastIndexOf(String str, String ch, int start ){
-    int res = tango.text.Util.locatePatternPrior( str, ch, start );
-    if( res is str.length ) res = -1;
-    return res;
-}
-
-/// Extension to String
-public String replaceAll( String str, String regex, String replacement ){
-    implMissing(__FILE__,__LINE__);
-    return null;
-}
-
-/// Extension to String
-public String replace( String str, char from, char to ){
-    return tango.text.Util.replace( str.dup, from, to );
-}
-
-/// Extension to String
-public String substring( String str, int start ){
-    return str[ start .. $ ].dup;
-}
-
-/// Extension to String
-public String substring( String str, int start, int end ){
-    return str[ start .. end ].dup;
-}
-
-/// Extension to String
-public wchar[] substring( wchar[] str, int start ){
-    return str[ start .. $ ].dup;
-}
-
-/// Extension to String
-public wchar[] substring( wchar[] str, int start, int end ){
-    return str[ start .. end ].dup;
-}
-
-/// Extension to String
-public char charAt( String str, int pos ){
-    return str[ pos ];
-}
-
-/// Extension to String
-public dchar dcharAt( String str, int pos ){
-    return str[ pos .. $ ].firstCodePoint();
-}
-
-/// Extension to String
-public void getChars( String src, int srcBegin, int srcEnd, String dst, int dstBegin){
-    dst[ dstBegin .. dstBegin + srcEnd - srcBegin ] = src[ srcBegin .. srcEnd ];
-}
-
-/// Extension to String
-public wchar[] toWCharArray( String str ){
-    return toString16(str);
-}
-
-/// Extension to String
-public char[] toCharArray( String str ){
-    return str;
-}
-
-/// Extension to String
-public bool endsWith( String src, String pattern ){
-    if( src.length < pattern.length ){
-        return false;
-    }
-    return src[ $-pattern.length .. $ ] == pattern;
-}
-
-/// Extension to String
-public bool equals( String src, String other ){
-    return src == other;
-}
-
-/// Extension to String
-public bool equalsIgnoreCase( String src, String other ){
-    return tango.text.Unicode.toFold(src) == tango.text.Unicode.toFold(other);
-}
-
-/// Extension to String
-public int compareToIgnoreCase( String src, String other ){
-    return compareTo( tango.text.Unicode.toFold(src), tango.text.Unicode.toFold(other));
-}
-
-/// Extension to String
-public int compareTo( String src, String other ){
-    return typeid(String).compare( cast(void*)&src, cast(void*)&other );
-}
-
-/// Extension to String
-public bool startsWith( String src, String pattern ){
-    if( src.length < pattern.length ){
-        return false;
-    }
-    return src[ 0 .. pattern.length ] == pattern;
-}
-
-/// Extension to String
-public String toLowerCase( String src ){
-    return tango.text.Unicode.toLower( src );
-}
-
-/// Extension to String
-public hash_t toHash( String src ){
-    return typeid(String).getHash(&src);
-}
-
-/// Extension to String
-public String trim( String str ){
-    return tango.text.Util.trim( str ).dup;
-}
-
-/// Extension to String
-public String intern( String str ){
-    return str;
-}
-
-/++
- + This is like tango.stdc.stringz.toStringz, but in case of an empty input string,
- + this function returns a pointer to a null value instead of a null ptr.
- +/
-public char* toStringzValidPtr( String src ){
-    if( src ){
-        return src.toStringz();
-    }
-    else{
-        static const String nullPtr = "\0";
-        return nullPtr.ptr;
-    }
-}
-
-public alias tango.stdc.stringz.toStringz toStringz;
-public alias tango.stdc.stringz.toString16z toString16z;
-public alias tango.stdc.stringz.fromStringz fromStringz;
-public alias tango.stdc.stringz.fromString16z fromString16z;
-
-static String toHex(uint value, bool prefix = true, int radix = 8){
-    return tango.text.convert.Integer.toString(
-            value,
-            radix is 10 ? "d" :
-            radix is  8 ? "o" :
-            radix is 16 ? "x" :
-                          "d" );
-}
-
-interface Cloneable{
-}
-
-interface Comparable {
-    int compareTo(Object o);
-}
-interface Comparator {
-    int compare(Object o1, Object o2);
-}
 
 private struct GCStats {
     size_t poolsize;        // total size of pool
@@ -780,30 +135,6 @@
     return s.poolsize;
 }
 
-/// Extension to the D Exception
-String ExceptionGetLocalizedMessage( Exception e ){
-    return e.msg;
-}
-
-/// Extension to the D Exception
-void ExceptionPrintStackTrace( Exception e ){
-    ExceptionPrintStackTrace( e, & getDwtLogger().error );
-}
-
-/// Extension to the D Exception
-void ExceptionPrintStackTrace( Exception e, void delegate ( String file, ulong line, String fmt, ... ) dg ){
-    Exception exception = e;
-    while( exception !is null ){
-        dg( exception.file, exception.line, "Exception in {}({}): {}", exception.file, exception.line, exception.msg );
-        if( exception.info !is null ){
-            foreach( msg; exception.info ){
-                dg( exception.file, exception.line, "trc {}", msg );
-            }
-        }
-        exception = exception.next;
-    }
-}
-
 
 template arraycast(T) {
     T[] arraycast(U) (U[] u) {
@@ -824,59 +155,6 @@
     }
 }
 
-String stringcast( Object o ){
-    if( auto str = cast(ArrayWrapperString) o ){
-        return str.array;
-    }
-    return null;
-}
-String[] stringcast( Object[] objs ){
-    String[] res = new String[](objs.length);
-    foreach( idx, obj; objs ){
-        res[idx] = stringcast(obj);
-    }
-    return res;
-}
-ArrayWrapperString stringcast( String str ){
-    return new ArrayWrapperString( str );
-}
-ArrayWrapperString[] stringcast( String[] strs ){
-    ArrayWrapperString[] res = new ArrayWrapperString[ strs.length ];
-    foreach( idx, str; strs ){
-        res[idx] = stringcast(str);
-    }
-    return res;
-}
-
-String[] stringArrayFromObject( Object obj ){
-    if( auto wrapper = cast(ArrayWrapperString2)obj ){
-        return wrapper.array;
-    }
-    if( auto wrapper = cast(ArrayWrapperObject)obj ){
-        String[] res = new String[ wrapper.array.length ];
-        foreach( idx, o; wrapper.array ){
-            if( auto swrapper = cast(ArrayWrapperString) o ){
-                res[idx] = swrapper.array;
-            }
-        }
-        return res;
-    }
-    assert( obj is null ); // if not null, it was the wrong type
-    return null;
-}
-
-T[] arrayFromObject(T)( Object obj ){
-    if( auto wrapper = cast(ArrayWrapperObject)obj ){
-        T[] res = new T[ wrapper.array.length ];
-        foreach( idx, o; wrapper.array ){
-            res[idx] = cast(T)o;
-        }
-        return res;
-    }
-    assert( obj is null ); // if not null, it was the wrong type
-    return null;
-}
-
 
 bool ArrayEquals(T)( T[] a, T[] b ){
     if( a.length !is b.length ){
@@ -904,17 +182,6 @@
     return true;
 }
 
-/+int SeqIndexOf(T)( tango.util.collection.model.Seq.Seq!(T) s, T src ){
-    int idx;
-    foreach( e; s ){
-        if( e == src ){
-            return idx;
-        }
-        idx++;
-    }
-    return -1;
-}+/
-
 int arrayIndexOf(T)( T[] arr, T v ){
     int res = -1;
     int idx = 0;
@@ -928,30 +195,6 @@
     return res;
 }
 
-// int seqIndexOf( tango.util.collection.model.Seq.Seq!(Object) seq, Object v ){
-//     int res = -1;
-//     int idx = 0;
-//     foreach( p; seq ){
-//         if( p == v){
-//             res = idx;
-//             break;
-//         }
-//         idx++;
-//     }
-//     return res;
-// }
-
-void PrintStackTrace( int deepth = 100, String prefix = "trc" ){
-    auto e = new Exception( null );
-    int idx = 0;
-    const start = 3;
-    foreach( msg; e.info ){
-        if( idx >= start && idx < start+deepth ) {
-            Trace.formatln( "{}: {}", prefix, msg );
-        }
-        idx++;
-    }
-}
 
 struct ImportData{
     void[] data;
@@ -969,34 +212,4 @@
     const ImportData getImportData = ImportData( import(name), name );
 }
 
-interface CharSequence {
-    char         charAt(int index);
-    int          length();
-    CharSequence subSequence(int start, int end);
-    String       toString();
-}
 
-/++
- + String in java is implementing the interface CharSequence
- +/
-class StringCharSequence : CharSequence {
-    private String str;
-    this( String str ){
-        this.str = str;
-    }
-    char           charAt(int index){
-        return str[index];
-    }
-    int             length(){
-        return str.length;
-    }
-    CharSequence    subSequence(int start, int end){
-        return new StringCharSequence( str[ start .. end ]);
-    }
-    String          toString(){
-        return str;
-    }
-}
-
-
-
--- a/java/src/java/mangoicu/ICU.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/mangoicu/ICU.d	Thu Mar 19 20:38:55 2009 +0100
@@ -42,6 +42,7 @@
 
 module java.mangoicu.ICU;
 
+import java.lang.util;
 /*******************************************************************************
 
         Library version identifiers
@@ -50,28 +51,28 @@
 
 version (ICU30)
         {
-        private static const final char[] ICULib = "30";
-        private static const final char[] ICUSig = "_3_0\0";
+        private static const char[] ICULib = "30";
+        private static const char[] ICUSig = "_3_0\0";
         }
 version (ICU32)
         {
-        private static const final char[] ICULib = "32";
-        private static const final char[] ICUSig = "_3_2\0";
+        private static const char[] ICULib = "32";
+        private static const char[] ICUSig = "_3_2\0";
         }
 version (ICU34)
         {
-        private static const final char[] ICULib = "34";
-        private static const final char[] ICUSig = "_3_4\0";
+        private static const char[] ICULib = "34";
+        private static const char[] ICUSig = "_3_4\0";
         }
 version (ICU36)
         {
-        private static const final char[] ICULib = "36";
-        private static const final char[] ICUSig = "_3_6\0";
+        private static const char[] ICULib = "36";
+        private static const char[] ICUSig = "_3_6\0";
         }
 else
         {
-        private static const final char[] ICULib = "38";
-        private static const final char[] ICUSig = "_3_8\0";
+        private static const char[] ICULib = "38";
+        private static const char[] ICUSig = "_3_8\0";
         }
 
 /*******************************************************************************
@@ -177,16 +178,16 @@
 
         ***********************************************************************/
 
-        package static final void exception (char[] msg)
+        package static final void exception (CString msg)
         {
-                throw new ICUException (msg);
+                throw new ICUException ( cast(String)msg);
         }
 
         /***********************************************************************
 
         ***********************************************************************/
 
-        package static final void testError (UErrorCode e, char[] msg)
+        package static final void testError (UErrorCode e, CString msg)
         {
                 if (e > 0)
                     exception (msg);
@@ -196,9 +197,9 @@
 
         ***********************************************************************/
 
-        protected static final char* toString (char[] string)
+        package static final char* toString (CString string)
         {
-                static char[] empty = "";
+                static char[] empty;
 
                 if (! string.length)
                       return (string.ptr) ? empty.ptr : null;
@@ -211,16 +212,16 @@
                    copy [string.length] = 0;
                    string = copy;
                    }
-                return string.ptr;
+                return cast(char*)string.ptr;
         }
 
         /***********************************************************************
 
         ***********************************************************************/
 
-        protected static final wchar* toString (wchar[] string)
+        package static final wchar* toString (CString16 string)
         {
-                static wchar[] empty = "";
+                static wchar[] empty;
 
                 if (! string.length)
                       return (string.ptr) ? empty.ptr : null;
@@ -233,7 +234,7 @@
                    copy [string.length] = 0;
                    string = copy;
                    }
-                return string.ptr;
+                return cast(wchar*)string.ptr;
         }
 
         /***********************************************************************
@@ -290,7 +291,7 @@
 
         ***********************************************************************/
 
-        this (char[] msg)
+        this (String msg)
         {
                 super (msg);
         }
@@ -329,7 +330,7 @@
                 protected struct Bind
                 {
                         void**  fnc;
-                        char[]  name;
+                        CString  name;
                 }
 
                 /***************************************************************
@@ -342,12 +343,12 @@
 
                         foreach (Bind b; targets)
                                 {
-                                char[] name = b.name ~ ICUSig;
-                                *b.fnc = GetProcAddress (lib, name.ptr);
+                                auto name = b.name ~ ICUSig;
+                                *b.fnc = GetProcAddress (lib, cast(char*)name.ptr);
                                 if (*b.fnc)
                                    {}// printf ("bound '%.*s'\n", name);
                                 else
-                                   throw new Exception ("required " ~ name ~ " in library " ~ library);
+                                   throw new Exception ( cast(String)("required " ~ name ~ " in library " ~ library));
                                 }
                         return lib;
                 }
@@ -400,7 +401,7 @@
                 protected struct Bind
                 {
                         void**  fnc;
-                        char[]  name;
+                        CString  name;
                 }
 
                 /***************************************************************
@@ -559,7 +560,7 @@
                 protected struct Bind
                 {
                         void**  fnc;
-                        char[]  name;
+                        CString  name;
                 }
 
                 /***************************************************************
--- a/java/src/java/mangoicu/UBreakIterator.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/mangoicu/UBreakIterator.d	Thu Mar 19 20:38:55 2009 +0100
@@ -370,7 +370,7 @@
         static UBreakIterator openWordIterator( ULocale locale, char[] str = null ){
             UBreakIterator res;
             auto e = ICU.UErrorCode.OK;
-            res.handle = ubrk_open( Type.Word, locale.name.ptr, null, 0, e);
+            res.handle = ubrk_open( Type.Word, cast(char*)locale.name.ptr, null, 0, e);
             ICU.testError (e, "failed to open word iterator");
             if( str ) {
                 res.ut.openUTF8(str);
@@ -383,7 +383,7 @@
         static UBreakIterator openLineIterator( ULocale locale, char[] str = null ){
             UBreakIterator res;
             auto e = ICU.UErrorCode.OK;
-            res.handle = ubrk_open( Type.Line, locale.name.ptr, null, 0, e);
+            res.handle = ubrk_open( Type.Line, cast(char*)locale.name.ptr, null, 0, e);
             ICU.testError (e, "failed to open line iterator");
             if( str ) {
                 res.ut.openUTF8(str);
--- a/java/src/java/mangoicu/UCalendar.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/mangoicu/UCalendar.d	Thu Mar 19 20:38:55 2009 +0100
@@ -246,7 +246,7 @@
         {
                 UErrorCode e;
 
-                handle = ucal_open (zone.name.ptr, zone.name.length, toString(locale.name), type, e);
+                handle = ucal_open (cast(wchar*)zone.name.ptr, zone.name.length, ICU.toString(locale.name), type, e);
                 testError (e, "failed to open calendar");
         }
 
@@ -282,7 +282,7 @@
         {
                 UErrorCode e;
 
-                ucal_setTimeZone (handle, zone.name.ptr, zone.name.length, e);
+                ucal_setTimeZone (handle, cast(wchar*)zone.name.ptr, zone.name.length, e);
                 testError (e, "failed to set calendar time zone");
         }
 
--- a/java/src/java/mangoicu/UChar.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/mangoicu/UChar.d	Thu Mar 19 20:38:55 2009 +0100
@@ -765,7 +765,7 @@
 
         ***********************************************************************/
 
-        final static extern (C) 
+        static extern (C) 
         {
                 /***************************************************************
 
--- a/java/src/java/mangoicu/UDateFormat.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/mangoicu/UDateFormat.d	Thu Mar 19 20:38:55 2009 +0100
@@ -186,7 +186,7 @@
 
                 if (pattern)
                     p = pattern.get.ptr, c = pattern.length;
-                handle = udat_open (time, date, toString(locale.name), tz.name.ptr, tz.name.length, p, c, e);
+                handle = udat_open (time, date, ICU.toString(locale.name), cast(wchar*)tz.name.ptr, tz.name.length, p, c, e);
                 testError (e, "failed to create DateFormat");
         }
 
--- a/java/src/java/mangoicu/ULocale.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/mangoicu/ULocale.d	Thu Mar 19 20:38:55 2009 +0100
@@ -85,6 +85,7 @@
 module java.mangoicu.ULocale;
 
 private import java.mangoicu.ICU;
+private import java.lang.util;
 
 /*******************************************************************************
 
@@ -96,7 +97,7 @@
 
 struct ULocale 
 {
-        public char[] name;
+        public CString name;
 
         /***********************************************************************
         
--- a/java/src/java/mangoicu/UMessageFormat.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/mangoicu/UMessageFormat.d	Thu Mar 19 20:38:55 2009 +0100
@@ -256,12 +256,13 @@
                 ***************************************************************/
 
                 version( D_Version2 ){
+                    mixin( "invariant() { invariant_(); }");
                 }
                 else{
-                mixin( "invariant 
-                {
-                       assert (index < args.length);
-                }");
+                    mixin( "invariant { invariant_(); }");
+                }
+                private void invariant_(){
+                   assert (index < args.length);
                 }
 
                 /***************************************************************
@@ -271,7 +272,11 @@
                 Args* reset ()
                 {
                         index = 0;
-                        return this;
+                        version(D_Version2){
+                            return &this;
+                        } else {
+                            return this;
+                        }
                 }
 
                 /***************************************************************
@@ -282,7 +287,11 @@
                 {
                         args[index] = cast(uint) cast(wchar*) x.get();
                         ++index;
-                        return this;
+                        version(D_Version2){
+                            return &this;
+                        } else {
+                            return this;
+                        }
                 }
 
                 /***************************************************************
@@ -293,7 +302,11 @@
                 {
                         args[index] = cast(uint) cast(wchar*) x;
                         ++index;
-                        return this;
+                        version(D_Version2){
+                            return &this;
+                        } else {
+                            return this;
+                        }
                 }
 
                 /***************************************************************
@@ -304,7 +317,11 @@
                 {
                         args[index] = x;
                         ++index;
-                        return this;
+                        version(D_Version2){
+                            return &this;
+                        } else {
+                            return this;
+                        }
                 }
 
                 /***************************************************************
@@ -315,7 +332,11 @@
                 {
                         *(cast(double*) &args[index]) = x;
                         index += 2;
-                        return this;
+                        version(D_Version2){
+                            return &this;
+                        } else {
+                            return this;
+                        }
                 }
         }
 
@@ -383,16 +404,16 @@
 
         ***********************************************************************/
 
-        static void test()
-        {
-                UString output = new UString(100);
-                wchar[] format = "{0} {1, number, currency} {2, number, integer}";
+        //static void test()
+        //{
+        //        UString output = new UString(100);
+        //        wchar[] format = "{0} {1, number, currency} {2, number, integer}";
 
-                UMessageFormat msg = new UMessageFormat (format);
+        //        UMessageFormat msg = new UMessageFormat (format);
 
-                msg.Args args;
-                msg.format (output, args.add("abc").add(152.0).add(456));
-        }
+        //        msg.Args args;
+        //        msg.format (output, args.add("abc").add(152.0).add(456));
+        //}
 }
 
 
--- a/java/src/java/mangoicu/URegex.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/mangoicu/URegex.d	Thu Mar 19 20:38:55 2009 +0100
@@ -172,7 +172,7 @@
 
                 handle = uregex_open (pattern.ptr, pattern.length, flags, pe, e);
                 testError (e, "failed to open regex");
-                uregex_setText (handle, "", 0, e);
+                uregex_setText (handle, null, 0, e);
         }
 
         /***********************************************************************
@@ -200,7 +200,7 @@
                 UErrorCode e;
 
                 this.handle = handle;
-                uregex_setText (handle, "", 0, e);
+                uregex_setText (handle, null, 0, e);
         }
 
         /***********************************************************************
--- a/java/src/java/mangoicu/UString.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/mangoicu/UString.d	Thu Mar 19 20:38:55 2009 +0100
@@ -87,7 +87,7 @@
 private import  java.mangoicu.ICU,
                 java.mangoicu.UChar,
                 java.mangoicu.ULocale;
-
+import java.lang.util;
 /*******************************************************************************
 
 *******************************************************************************/
@@ -181,7 +181,7 @@
 
         ***********************************************************************/
 
-        this (wchar[] content, bool mutable = true)
+        this (CString16 content, bool mutable = true)
         {
                 setTo (content, mutable);
         }
@@ -439,13 +439,13 @@
 
         ***********************************************************************/
 
-        UString setTo (wchar[] chars, bool mutable = true)
+        UString setTo (CString16 chars, bool mutable = true)
         {
                 len = chars.length;
                 if ((this.mutable = mutable) == true)
                      content = chars.dup;
                 else
-                   content = chars;
+                   content = cast(wchar[])chars;
                 return this;
         }
 
@@ -623,7 +623,7 @@
 
         typedef uint delegate (wchar* dst, uint len, inout UErrorCode e) Formatter;
 
-        package final UString format (Formatter format, char[] msg)
+        package final UString format (Formatter format, CString msg)
         {
                 UErrorCode   e;
                 uint    length;
@@ -730,7 +730,7 @@
 
         ***********************************************************************/
 
-        final override int opEquals (Object o)
+        final override equals_t opEquals (Object o)
         {
                 UStringView other = cast(UStringView) o;
 
@@ -1493,16 +1493,16 @@
 
         ***********************************************************************/
 
-        private static void test()
-        {
-                UString s = new UString (r"aaaqw \uabcd eaaa");
-                char[] x = "dssfsdff";
-                s ~ x ~ x;
-                wchar c = s[3];
-                s[3] = 'Q';
-                int y = s.indexOf ("qwe");
-                s.unEscape ();
-                s.toUpper (new UString);
-                s.padLeading(2).padTrailing(2).trim();
-        }
+        //private static void test()
+        //{
+        //        UString s = new UString (r"aaaqw \uabcd eaaa");
+        //        CString16 x = "dssfsdff";
+        //        s ~ x ~ x;
+        //        wchar c = s[3];
+        //        s[3] = 'Q';
+        //        int y = s.indexOf ("qwe");
+        //        s.unEscape ();
+        //        s.toUpper (new UString);
+        //        s.padLeading(2).padTrailing(2).trim();
+        //}
 }
--- a/java/src/java/mangoicu/UText.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/mangoicu/UText.d	Thu Mar 19 20:38:55 2009 +0100
@@ -119,7 +119,11 @@
         UTEXT_MAGIC = 0x345ad82c
     }
     void close(){
-        utext_close(this);
+        version(D_Version2){
+            utext_close(&this);
+        } else {
+            utext_close(this);
+        }
     }
     private void ensureStatusOk( ICU.UErrorCode status ){
         if( status !is ICU.UErrorCode.OK ){
@@ -128,7 +132,11 @@
     }
     void openUTF8( char[] str ){
         auto status = ICU.UErrorCode.OK;
-        utext_openUTF8(this, str.ptr, str.length, status );
+        version(D_Version2){
+            utext_openUTF8(&this, str.ptr, str.length, status );
+        } else {
+            utext_openUTF8(this, str.ptr, str.length, status );
+        }
         ensureStatusOk( status );
     }
 
--- a/java/src/java/mangoicu/UTimeZone.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/mangoicu/UTimeZone.d	Thu Mar 19 20:38:55 2009 +0100
@@ -87,6 +87,7 @@
 private import  java.mangoicu.ICU,
                 java.mangoicu.UString,
                 java.mangoicu.UEnumeration;
+private import java.lang.util;
 
 /*******************************************************************************
 
@@ -98,7 +99,7 @@
 
 struct UTimeZone 
 {
-        public wchar[]  name;
+        public CString16  name;
 
         public static UTimeZone Default =       {null};
         public static UTimeZone Gmt =           {"Etc/GMT"};
--- a/java/src/java/nonstandard/WeakRef.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/nonstandard/WeakRef.d	Thu Mar 19 20:38:55 2009 +0100
@@ -76,7 +76,7 @@
     WeakRef dup() {
         return new WeakRef(ptr());
     }
-    int opEquals( Object o ){
+    equals_t opEquals( Object o ){
         if( auto other = cast( WeakRef!(T) )o ){
             return other.cast_ptr_ is cast_ptr_;
         }
--- a/java/src/java/nonstandard/XmlTranscode.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/nonstandard/XmlTranscode.d	Thu Mar 19 20:38:55 2009 +0100
@@ -1,8 +1,8 @@
 module java.nonstandard.XmlTranscode;
 
 import java.lang.util;
+import java.lang.exceptions;
 import java.lang.Math;
-import tango.core.Exception;
 
 /++
  + Decode XML entities into UTF8 string.
@@ -13,7 +13,7 @@
 String xmlUnescape( String str ){
 
     void error(){
-        throw new TextException( "xmlUnescape" );
+        throw new RuntimeException( "xmlUnescape" );
     }
     // &lt; ...
     // &#1234;
@@ -22,7 +22,7 @@
     String trg = str;
     while( src.length ){
         if( src[0] !is '&' ){
-            trg[0] = src[0];
+            //trg[0] = src[0];
             trg = trg[1..$];
             src = src[1..$];
         }
@@ -32,8 +32,8 @@
 
             // search semi
             int len = Math.min( cast(int)src.length, 10 ); // limit semi search to possible longest entityname
-            int semi = tango.text.Util.locate( src[0 .. len ], ';' );
-            if( semi is len ) error(); // no semi found
+            int semi = java.lang.util.indexOf( src[0 .. len ], ';' );
+            if( semi is -1 ) error(); // no semi found
 
             String entityName = src[ 0 .. semi ]; // name without semi
             dchar entityValue = 0;
@@ -77,10 +77,7 @@
                         }
                     }
             }
-            dchar[1] arr;
-            arr[0] = entityValue;
-            uint ate = 0;
-            String res = tango.text.convert.Utf.toString( arr, trg, &ate );
+            String res = String_valueOf( entityValue );
             trg = trg[ res.length .. $ ];
             src = src[ semi +1 .. $ ]; // go past semi
         }
@@ -122,7 +119,7 @@
 Lprocess:
 
     // yes, do a new string, start with +20 chars
-    String res = new char[ xml.length + 20 ];
+    char[] res = new char[ xml.length + 20 ];
     res.length = 0;
 
     foreach( dchar c; xml ){
--- a/java/src/java/text/MessageFormat.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/text/MessageFormat.d	Thu Mar 19 20:38:55 2009 +0100
@@ -1,7 +1,6 @@
 module java.text.MessageFormat;
 
 import java.lang.all;
-import tango.text.convert.Format;
 
 class MessageFormat {
     public static String format( String frmt, Object[] args... ){
--- a/java/src/java/util/AbstractCollection.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/AbstractCollection.d	Thu Mar 19 20:38:55 2009 +0100
@@ -29,7 +29,7 @@
         }
         return true;
     }
-    override int opEquals(Object o){
+    override equals_t opEquals(Object o){
         implMissing( __FILE__, __LINE__ );
         return false;
     }
--- a/java/src/java/util/AbstractList.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/AbstractList.d	Thu Mar 19 20:38:55 2009 +0100
@@ -21,7 +21,7 @@
         return contains(stringcast(str));
     }
     public abstract bool     containsAll(Collection c);
-    public abstract int  opEquals(Object o);
+    public abstract equals_t  opEquals(Object o);
     public abstract  Object        get(int index);
 
     public hash_t  toHash(){
--- a/java/src/java/util/AbstractMap.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/AbstractMap.d	Thu Mar 19 20:38:55 2009 +0100
@@ -26,9 +26,9 @@
     }
     abstract  Set   entrySet();
 
-    public override int       opEquals(Object o){
+    public override equals_t       opEquals(Object o){
         if( Map other = cast(Map)o){
-            return entrySet().opEquals( cast(Object) other.entrySet() );
+            return cast(equals_t)entrySet().opEquals( cast(Object) other.entrySet() );
         }
         return false;
     }
--- a/java/src/java/util/AbstractSet.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/AbstractSet.d	Thu Mar 19 20:38:55 2009 +0100
@@ -9,7 +9,7 @@
 abstract class AbstractSet : AbstractCollection, Set {
     this(){
     }
-    int         opEquals(Object o){
+    equals_t         opEquals(Object o){
         implMissing( __FILE__, __LINE__ );
         return 0;
     }
--- a/java/src/java/util/ArrayList.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/ArrayList.d	Thu Mar 19 20:38:55 2009 +0100
@@ -7,8 +7,6 @@
 import java.util.Collection;
 import java.util.Iterator;
 
-static import tango.core.Array;
-
 class ArrayList : AbstractList, List {
     private Object[] data;
 
@@ -75,7 +73,7 @@
         implMissing( __FILE__, __LINE__ );
         return false;
     }
-    int opEquals(Object o){
+    equals_t opEquals(Object o){
         if( auto other = cast(ArrayList)o ){
             if( data.length !is other.data.length ){
                 return false;
@@ -211,7 +209,21 @@
         return res;
     }
     bool    remove(Object o){
-        return tango.core.Array.remove(data, o) !is 0;
+        int idx = -1;
+        for( int i = 0; i < data.length; i++ ){
+            if( data[i] is null ? o is null : data[i] == o ){
+                idx = i;
+                break;
+            }
+        }
+        if( idx is -1 ){
+            return false;
+        }
+        for( int i = idx + 1; i < data.length; i++ ){
+            data[i-1] = data[i];
+        }
+        data.length = data.length - 1;
+        return true;
     }
     public bool remove(String key){
         return remove(stringcast(key));
--- a/java/src/java/util/Arrays.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/Arrays.d	Thu Mar 19 20:38:55 2009 +0100
@@ -58,7 +58,7 @@
         }
         return res;
     }
-    public static void fill( String str, char c ){
+    public static void fill( char[] str, char c ){
         str[] = c;
     }
 }
--- a/java/src/java/util/Collections.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/Collections.d	Thu Mar 19 20:38:55 2009 +0100
@@ -139,8 +139,8 @@
         public bool     containsAll(Collection c){
             return list.containsAll(c);
         }
-        public int      opEquals(Object o){
-            return list.opEquals(o);
+        public equals_t      opEquals(Object o){
+            return cast(equals_t)list.opEquals(o);
         }
         public Object   get(int index){
             return list.get(index);
@@ -261,7 +261,7 @@
         public bool     contains(Object o){ synchronized(this){ return this.list.contains(o); } }
         public bool     contains(String o){ synchronized(this){ return this.list.contains(o); } }
         public bool     containsAll(Collection c){ synchronized(this){ return this.list.containsAll(c); } }
-        public int      opEquals(Object o){ synchronized(this){ return this.list.opEquals(o); } }
+        public equals_t      opEquals(Object o){ synchronized(this){ return cast(equals_t)this.list.opEquals(o); } }
         public Object   get(int index){ synchronized(this){ return this.list.get(index); } }
         public hash_t   toHash(){ synchronized(this){ return this.list.toHash(); } }
         public int      indexOf(Object o){ synchronized(this){ return this.list.indexOf(o); } }
@@ -302,7 +302,7 @@
         public bool containsKey(String key){ synchronized(this){ return this.map.containsKey(key); } }
         public bool containsValue(Object value){ synchronized(this){ return this.map.containsValue(value); } }
         public Set  entrySet(){ synchronized(this){ return this.map.entrySet(); } }
-        public int opEquals(Object o){ synchronized(this){ return this.map.opEquals(o); } }
+        public equals_t opEquals(Object o){ synchronized(this){ return this.map.opEquals(o); } }
         public Object get(Object key){ synchronized(this){ return this.map.get(key); } }
         public Object get(String key){ synchronized(this){ return this.map.get(key); } }
         public hash_t toHash(){ synchronized(this){ return this.map.toHash(); } }
--- a/java/src/java/util/HashMap.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/HashMap.d	Thu Mar 19 20:38:55 2009 +0100
@@ -7,7 +7,10 @@
 import java.util.HashSet;
 import java.util.ArrayList;
 
-static import tango.util.container.HashMap;
+version(Tango){
+    static import tango.util.container.HashMap;
+} else { // Phobos
+}
 
 private struct ObjRef {
     Object obj;
@@ -19,75 +22,115 @@
     public hash_t toHash(){
         return obj is null ? 0 : obj.toHash();
     }
-    public int opEquals( ObjRef other ){
+    public equals_t opEquals( ObjRef other ){
         return obj is null ? other.obj is null : obj.opEquals( other.obj );
     }
-    public int opEquals( Object other ){
+    public equals_t opEquals( Object other ){
         return obj is null ? other is null : obj.opEquals( other );
     }
 }
 
 class HashMap : Map {
     // The HashMap  class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls.
-    alias tango.util.container.HashMap.HashMap!(ObjRef,ObjRef) MapType;
-    private MapType map;
+    version(Tango){
+        alias tango.util.container.HashMap.HashMap!(ObjRef,ObjRef) MapType;
+        private MapType map;
+    } else { // Phobos
+    }
 
     public this(){
-        map = new MapType();
+        version(Tango){
+            map = new MapType();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
     public this(int initialCapacity){
         this();
     }
     public this(int initialCapacity, float loadFactor){
-        map = new MapType(loadFactor);
+        version(Tango){
+            map = new MapType(loadFactor);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
     public this(Map m){
         this();
         putAll(m);
     }
     public void clear(){
-        map.clear();
+        version(Tango){
+            map.clear();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
     public bool containsKey(Object key){
-        ObjRef v;
-        ObjRef keyr = ObjRef(key);
-        return map.get(keyr, v );
+        version(Tango){
+            ObjRef v;
+            ObjRef keyr = ObjRef(key);
+            return map.get(keyr, v );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public bool containsKey(String key){
         return containsKey(stringcast(key));
     }
     public bool containsValue(Object value){
-        ObjRef valuer = ObjRef(value);
-        return map.contains(valuer);
+        version(Tango){
+            ObjRef valuer = ObjRef(value);
+            return map.contains(valuer);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public Set  entrySet(){
-        HashSet res = new HashSet();
-        foreach( k, v; map ){
-            res.add( new MapEntry(this,k.obj));
+        version(Tango){
+            HashSet res = new HashSet();
+            foreach( k, v; map ){
+                res.add( new MapEntry(this,k.obj));
+            }
+            return res;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        return res;
     }
-    public override int opEquals(Object o){
-        if( auto other = cast(HashMap) o ){
-            if( other.size() !is size() ){
-                return false;
-            }
-            foreach( k, v; map ){
-                auto vo = other.get(k.obj);
-                if( v != vo ){
+    public override equals_t opEquals(Object o){
+        version(Tango){
+            if( auto other = cast(HashMap) o ){
+                if( other.size() !is size() ){
                     return false;
                 }
+                foreach( k, v; map ){
+                    auto vo = other.get(k.obj);
+                    if( v != vo ){
+                        return false;
+                    }
+                }
+                return true;
             }
-            return true;
+            return false;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
         }
-        return false;
     }
     public Object get(Object key){
-        ObjRef keyr = ObjRef(key);
-        if( auto v = keyr in map ){
-            return (*v).obj;
+        version(Tango){
+            ObjRef keyr = ObjRef(key);
+            if( auto v = keyr in map ){
+                return (*v).obj;
+            }
+            return null;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        return null;
     }
     public Object get(String key){
         return get(stringcast(key));
@@ -96,24 +139,39 @@
         return super.toHash();
     }
     public bool isEmpty(){
-        return map.isEmpty();
+        version(Tango){
+            return map.isEmpty();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public Set    keySet(){
-        HashSet res = new HashSet();
-        foreach( k, v; map ){
-            res.add(k.obj);
+        version(Tango){
+            HashSet res = new HashSet();
+            foreach( k, v; map ){
+                res.add(k.obj);
+            }
+            return res;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        return res;
     }
     public Object put(Object key, Object value){
-        ObjRef valuer = ObjRef(value);
-        ObjRef keyr = ObjRef(key);
-        Object res = null;
-        if( auto vold = keyr in map ){
-            res = (*vold).obj;
+        version(Tango){
+            ObjRef valuer = ObjRef(value);
+            ObjRef keyr = ObjRef(key);
+            Object res = null;
+            if( auto vold = keyr in map ){
+                res = (*vold).obj;
+            }
+            map[ keyr ] = valuer;
+            return res;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        map[ keyr ] = valuer;
-        return res;
     }
     public Object put(String key, Object value){
         return put( stringcast(key), value );
@@ -125,45 +183,74 @@
         return put( stringcast(key), stringcast(value) );
     }
     public void   putAll(Map t){
-        foreach( k, v; t ){
-            map[ObjRef(k)] = ObjRef(v);
+        version(Tango){
+            foreach( k, v; t ){
+                map[ObjRef(k)] = ObjRef(v);
+            }
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
         }
     }
     public Object remove(Object key){
-        ObjRef keyr = ObjRef(key);
-        if( auto v = keyr in map ){
-            Object res = (*v).obj;
+        version(Tango){
+            ObjRef keyr = ObjRef(key);
+            if( auto v = keyr in map ){
+                Object res = (*v).obj;
+                map.remove(keyr);
+                return res;
+            }
             map.remove(keyr);
-            return res;
+            return null;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        map.remove(keyr);
-        return null;
     }
     public Object remove(String key){
         return remove(stringcast(key));
     }
     public int    size(){
-        return map.size();
+        version(Tango){
+            return map.size();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return 0;
+        }
     }
     public Collection values(){
-        ArrayList res = new ArrayList( size() );
-        foreach( k, v; map ){
-            res.add( v.obj );
+        version(Tango){
+            ArrayList res = new ArrayList( size() );
+            foreach( k, v; map ){
+                res.add( v.obj );
+            }
+            return res;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        return res;
     }
 
     public int opApply (int delegate(ref Object value) dg){
-        int ldg( ref ObjRef or ){
-            return dg( or.obj );
+        version(Tango){
+            int ldg( ref ObjRef or ){
+                return dg( or.obj );
+            }
+            return map.opApply( &ldg );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return 0;
         }
-        return map.opApply( &ldg );
     }
     public int opApply (int delegate(ref Object key, ref Object value) dg){
-        int ldg( ref ObjRef key, ref ObjRef value ){
-            return dg( key.obj, value.obj );
+        version(Tango){
+            int ldg( ref ObjRef key, ref ObjRef value ){
+                return dg( key.obj, value.obj );
+            }
+            return map.opApply( &ldg );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return 0;
         }
-        return map.opApply( &ldg );
     }
 
 }
--- a/java/src/java/util/HashSet.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/HashSet.d	Thu Mar 19 20:38:55 2009 +0100
@@ -5,14 +5,24 @@
 import java.util.Collection;
 import java.util.Iterator;
 
-static import tango.util.container.HashSet;
+version(Tango){
+    static import tango.util.container.HashSet;
+} else { // Phobos
+}
 
 class HashSet : Set {
-    alias tango.util.container.HashSet.HashSet!(Object) SetType;
-    private SetType set;
+    version(Tango){
+        alias tango.util.container.HashSet.HashSet!(Object) SetType;
+        private SetType set;
+    } else { // Phobos
+    }
 
     public this(){
-        set = new SetType();
+        version(Tango){
+            set = new SetType();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
     public this(Collection c){
         implMissing( __FILE__, __LINE__ );
@@ -24,7 +34,12 @@
         implMissing( __FILE__, __LINE__ );
     }
     public bool    add(Object o){
-        return set.add(o);
+        version(Tango){
+            return set.add(o);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public bool    add(String o){
         return add(stringcast(o));
@@ -34,10 +49,19 @@
         return false;
     }
     public void   clear(){
-        set.clear();
+        version(Tango){
+            set.clear();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
     public bool    contains(Object o){
-        return set.contains(o);
+        version(Tango){
+            return set.contains(o);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public bool     contains(String o){
         return contains(stringcast(o));
@@ -46,7 +70,7 @@
         implMissing( __FILE__, __LINE__ );
         return false;
     }
-    public override int    opEquals(Object o){
+    public override equals_t    opEquals(Object o){
         implMissing( __FILE__, __LINE__ );
         return 0;
     }
@@ -55,29 +79,47 @@
         return 0;
     }
     public bool    isEmpty(){
-        return set.isEmpty();
-    }
-    class LocalIterator : Iterator {
-        SetType.Iterator iter;
-        Object nextElem;
-        this( SetType.Iterator iter){
-            this.iter = iter;
-        }
-        public bool hasNext(){
-            return iter.next(nextElem);
-        }
-        public Object next(){
-            return nextElem;
-        }
-        public void  remove(){
-            iter.remove();
+        version(Tango){
+            return set.isEmpty();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
         }
     }
+    version(Tango){
+        class LocalIterator : Iterator {
+            SetType.Iterator iter;
+            Object nextElem;
+            this( SetType.Iterator iter){
+                this.iter = iter;
+            }
+            public bool hasNext(){
+                return iter.next(nextElem);
+            }
+            public Object next(){
+                return nextElem;
+            }
+            public void  remove(){
+                iter.remove();
+            }
+        }
+    } else { // Phobos
+    }
     public Iterator   iterator(){
-        return new LocalIterator(set.iterator());
+        version(Tango){
+            return new LocalIterator(set.iterator());
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
+        }
     }
     public bool    remove(Object o){
-        return set.remove(o);
+        version(Tango){
+            return set.remove(o);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public bool remove(String key){
         return remove(stringcast(key));
@@ -91,17 +133,27 @@
         return false;
     }
     public int    size(){
-        return set.size();
+        version(Tango){
+            return set.size();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return 0;
+        }
     }
     public Object[]   toArray(){
-        Object[] res;
-        res.length = size();
-        int idx = 0;
-        foreach( o; set ){
-            res[idx] = o;
-            idx++;
+        version(Tango){
+            Object[] res;
+            res.length = size();
+            int idx = 0;
+            foreach( o; set ){
+                res[idx] = o;
+                idx++;
+            }
+            return res;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        return res;
     }
     public Object[]   toArray(Object[] a){
         implMissing( __FILE__, __LINE__ );
@@ -114,7 +166,12 @@
 
     // only for D
     public int opApply (int delegate(ref Object value) dg){
-        return set.opApply(dg);
+        version(Tango){
+            return set.opApply(dg);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return 0;
+        }
     }
 
 }
--- a/java/src/java/util/Hashtable.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/Hashtable.d	Thu Mar 19 20:38:55 2009 +0100
@@ -88,7 +88,7 @@
         implMissing( __FILE__, __LINE__ );
         return null;
     }
-    public int opEquals(Object o){
+    public equals_t opEquals(Object o){
         implMissing( __FILE__, __LINE__ );
         return 0;
     }
--- a/java/src/java/util/IdentityHashMap.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/IdentityHashMap.d	Thu Mar 19 20:38:55 2009 +0100
@@ -8,13 +8,25 @@
 import java.util.Collection;
 import java.util.Set;
 
+version(Tango){
+    static import tango.util.container.HashMap;
+} else { // Phobos
+}
+
 class IdentityHashMap : Map {
-    alias tango.util.container.HashMap.HashMap!(Object,Object) MapType;
-    private MapType map;
+    version(Tango){
+        alias tango.util.container.HashMap.HashMap!(Object,Object) MapType;
+        private MapType map;
+    } else { // Phobos
+    }
 
     public this(){
         implMissing(__FILE__, __LINE__ );
-        map = new MapType();
+        version(Tango){
+            map = new MapType();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
     public this(int initialCapacity){
         implMissing(__FILE__, __LINE__ );
@@ -22,7 +34,11 @@
     }
     public this(int initialCapacity, float loadFactor){
         implMissing(__FILE__, __LINE__ );
-        map = new MapType(loadFactor);
+        version(Tango){
+            map = new MapType(loadFactor);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
     public this(Map m){
         implMissing(__FILE__, __LINE__ );
@@ -30,45 +46,74 @@
         putAll(m);
     }
     public void clear(){
-        map.clear();
+        version(Tango){
+            map.clear();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
     public bool containsKey(Object key){
-        Object v;
-        return map.get(key, v );
+        version(Tango){
+            Object v;
+            return map.get(key, v );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public bool containsKey(String key){
         return containsKey(stringcast(key));
     }
     public bool containsValue(Object value){
-        return map.contains(value);
+        version(Tango){
+            return map.contains(value);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public Set  entrySet(){
-        HashSet res = new HashSet();
-        foreach( k, v; map ){
-            res.add( new MapEntry(this,k));
+        version(Tango){
+            HashSet res = new HashSet();
+            foreach( k, v; map ){
+                res.add( new MapEntry(this,k));
+            }
+            return res;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        return res;
     }
-    public override int opEquals(Object o){
-        if( auto other = cast(HashMap) o ){
-            if( other.size() !is size() ){
-                return false;
-            }
-            foreach( k, v; map ){
-                Object vo = other.get(k);
-                if( v != vo ){
+    public override equals_t opEquals(Object o){
+        version(Tango){
+            if( auto other = cast(HashMap) o ){
+                if( other.size() !is size() ){
                     return false;
                 }
+                foreach( k, v; map ){
+                    Object vo = other.get(k);
+                    if( v != vo ){
+                        return false;
+                    }
+                }
+                return true;
             }
-            return true;
+            return false;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
         }
-        return false;
     }
     public Object get(Object key){
-        if( auto v = key in map ){
-            return *v;
+        version(Tango){
+            if( auto v = key in map ){
+                return *v;
+            }
+            return null;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        return null;
     }
     public Object get(String key){
         return get(stringcast(key));
@@ -77,22 +122,37 @@
         return super.toHash();
     }
     public bool isEmpty(){
-        return map.isEmpty();
+        version(Tango){
+            return map.isEmpty();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public Set    keySet(){
-        HashSet res = new HashSet();
-        foreach( k, v; map ){
-            res.add(k);
+        version(Tango){
+            HashSet res = new HashSet();
+            foreach( k, v; map ){
+                res.add(k);
+            }
+            return res;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        return res;
     }
     public Object put(Object key, Object value){
-        Object res = null;
-        if( auto vold = key in map ){
-            res = *vold;
+        version(Tango){
+            Object res = null;
+            if( auto vold = key in map ){
+                res = *vold;
+            }
+            map[ key ] = value;
+            return res;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        map[ key ] = value;
-        return res;
     }
     public Object put(String key, Object value){
         return put( stringcast(key), value );
@@ -104,38 +164,67 @@
         return put( stringcast(key), stringcast(value) );
     }
     public void   putAll(Map t){
-        foreach( k, v; t ){
-            map[k] = v;
+        version(Tango){
+            foreach( k, v; t ){
+                map[k] = v;
+            }
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
         }
     }
     public Object remove(Object key){
-        if( auto v = key in map ){
-            Object res = *v;
+        version(Tango){
+            if( auto v = key in map ){
+                Object res = *v;
+                map.remove(key);
+                return res;
+            }
             map.remove(key);
-            return res;
+            return null;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        map.remove(key);
-        return null;
     }
     public Object remove(String key){
         return remove(stringcast(key));
     }
     public int    size(){
-        return map.size();
+        version(Tango){
+            return map.size();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return 0;
+        }
     }
     public Collection values(){
-        ArrayList res = new ArrayList( size() );
-        foreach( k, v; map ){
-            res.add( v );
+        version(Tango){
+            ArrayList res = new ArrayList( size() );
+            foreach( k, v; map ){
+                res.add( v );
+            }
+            return res;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        return res;
     }
 
     public int opApply (int delegate(ref Object value) dg){
-        return map.opApply( dg );
+        version(Tango){
+            return map.opApply( dg );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return 0;
+        }
     }
     public int opApply (int delegate(ref Object key, ref Object value) dg){
-        return map.opApply( dg );
+        version(Tango){
+            return map.opApply( dg );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return 0;
+        }
     }
 }
 
--- a/java/src/java/util/LinkedList.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/LinkedList.d	Thu Mar 19 20:38:55 2009 +0100
@@ -6,26 +6,45 @@
 import java.util.ListIterator;
 import java.util.Collection;
 
-static import tango.util.container.CircularList;
+version(Tango){
+    static import tango.util.container.CircularList;
+} else { // Phobos
+}
 
 class LinkedList : List {
-    alias tango.util.container.CircularList.CircularList!(Object) ListType;
-    private ListType list;
+    version(Tango){
+        alias tango.util.container.CircularList.CircularList!(Object) ListType;
+        private ListType list;
+    } else { // Phobos
+    }
 
     this(){
-        list = new ListType();
+        version(Tango){
+            list = new ListType();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
     this( Collection c ){
         this();
         addAll(c);
     }
     void   add(int index, Object element){
-        list.addAt(index,element);
-        return true;
+        version(Tango){
+            list.addAt(index,element);
+            return true;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
     bool    add(Object o){
-        list.add(o);
-        return true;
+        version(Tango){
+            list.add(o);
+            return true;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public bool    add(String o){
         return add(stringcast(o));
@@ -43,51 +62,79 @@
         return false;
     }
     void   addFirst(Object o){
-        list.prepend( o );
+        version(Tango){
+            list.prepend( o );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
     void   addLast(Object o){
-        list.append( o );
+        version(Tango){
+            list.append( o );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
-//     void   addElement(Object obj){
-//         implMissing( __FILE__, __LINE__ );
-//     }
+    //     void   addElement(Object obj){
+    //         implMissing( __FILE__, __LINE__ );
+    //     }
     int    capacity(){
         implMissing( __FILE__, __LINE__ );
         return 0;
     }
     void   clear(){
-        list.clear();
+        version(Tango){
+            list.clear();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     Object     clone(){
         implMissing( __FILE__, __LINE__ );
         return null;
     }
     bool    contains(Object elem){
-        return list.contains(elem);
+        version(Tango){
+            return list.contains(elem);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     bool    contains(String elem){
         return contains(stringcast(elem));
     }
     bool    containsAll(Collection c){
-        foreach(o; c){
-            if( !list.contains(o)) return false;
+        version(Tango){
+            foreach(o; c){
+                if( !list.contains(o)) return false;
+            }
+            return true;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
         }
-        return true;
     }
     void   copyInto(Object[] anArray){
         implMissing( __FILE__, __LINE__ );
     }
     Object     elementAt(int index){
-        return list.get(index);
+        version(Tango){
+            return list.get(index);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
+        }
     }
-//     Enumeration    elements(){
-//         implMissing( __FILE__, __LINE__ );
-//         return null;
-//     }
+    //     Enumeration    elements(){
+    //         implMissing( __FILE__, __LINE__ );
+    //         return null;
+    //     }
     void   ensureCapacity(int minCapacity){
         implMissing( __FILE__, __LINE__ );
     }
-    int opEquals(Object o){
+    equals_t opEquals(Object o){
         implMissing( __FILE__, __LINE__ );
         return false;
     }
@@ -96,13 +143,28 @@
         return null;
     }
     Object     get(int index){
-        return list.get(index);
+        version(Tango){
+            return list.get(index);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
+        }
     }
     Object     getFirst(){
-        return list.get(0);
+        version(Tango){
+            return list.get(0);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
+        }
     }
     Object     getLast(){
-        return list.get(list.size()-1);
+        version(Tango){
+            return list.get(list.size()-1);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
+        }
     }
     hash_t    toHash(){
         implMissing( __FILE__, __LINE__ );
@@ -120,7 +182,12 @@
         implMissing( __FILE__, __LINE__ );
     }
     bool    isEmpty(){
-        return list.isEmpty();
+        version(Tango){
+            return list.isEmpty();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     Iterator   iterator(){
         implMissing( __FILE__, __LINE__ );
@@ -151,17 +218,27 @@
         return null;
     }
     bool    remove(Object o){
-        return list.remove(o,false) !is 0;
+        version(Tango){
+            return list.remove(o,false) !is 0;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public bool remove(String key){
         return remove(stringcast(key));
     }
     bool    removeAll(Collection c){
-        bool res = false;
-        foreach( o; c){
-            res |= list.remove(o,false) !is 0;
+        version(Tango){
+            bool res = false;
+            foreach( o; c){
+                res |= list.remove(o,false) !is 0;
+            }
+            return res;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
         }
-        return res;
     }
     void   removeAllElements(){
         implMissing( __FILE__, __LINE__ );
@@ -199,19 +276,34 @@
         implMissing( __FILE__, __LINE__ );
     }
     int    size(){
-        return list.size();
+        version(Tango){
+            return list.size();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return 0;
+        }
     }
     List   subList(int fromIndex, int toIndex){
         implMissing( __FILE__, __LINE__ );
         return null;
     }
     Object[]   toArray(){
-        if( list.size() is 0 ) return null; // workaround tango ticket 1237
-        return list.toArray();
+        version(Tango){
+            if( list.size() is 0 ) return null; // workaround tango ticket 1237
+            return list.toArray();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
+        }
     }
     Object[]   toArray(Object[] a){
-        if( list.size() is 0 ) return a[0 .. 0]; // workaround tango ticket 1237
-        return list.toArray( a );
+        version(Tango){
+            if( list.size() is 0 ) return a[0 .. 0]; // workaround tango ticket 1237
+            return list.toArray( a );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
+        }
     }
     String     toString(){
         implMissing( __FILE__, __LINE__ );
--- a/java/src/java/util/Map.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/Map.d	Thu Mar 19 20:38:55 2009 +0100
@@ -17,7 +17,7 @@
     public bool containsKey(String key);
     public bool containsValue(Object value);
     public Set  entrySet();
-    public int opEquals(Object o);
+    public equals_t opEquals(Object o);
     public Object get(Object key);
     public Object get(String key);
     public hash_t toHash();
@@ -44,7 +44,7 @@
         this.map = map;
         this.key = key;
     }
-    public override int opEquals(Object o){
+    public override equals_t opEquals(Object o){
         if( auto other = cast(MapEntry)o){
 
             if(( getKey() is null ? other.getKey() is null : getKey() == other.getKey() )  &&
--- a/java/src/java/util/Random.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/Random.d	Thu Mar 19 20:38:55 2009 +0100
@@ -1,16 +1,32 @@
 module java.util.Random;
 
 import java.lang.all;
-static import tango.math.random.Kiss;
+version(Tango){
+    static import tango.math.random.Kiss;
+} else { // Phobos
+    static import std.random;
+}
 
 class Random {
-    tango.math.random.Kiss.Kiss kiss;
+    version(Tango){
+        tango.math.random.Kiss.Kiss kiss;
+    } else { // Phobos
+        std.random.MinstdRand gen;
+    }
 
     public this(int seed ){
-        kiss.seed(seed);
+        version(Tango){
+            kiss.seed(seed);
+        } else { // Phobos
+            gen.seed( seed );
+        }
     }
     public bool  nextBoolean(){
-        return kiss.toInt(2) is 0;
+        version(Tango){
+            return kiss.toInt(2) is 0;
+        } else { // Phobos
+            return (gen.next() & 1 ) is 0;
+        }
     }
 }
 
--- a/java/src/java/util/ResourceBundle.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/ResourceBundle.d	Thu Mar 19 20:38:55 2009 +0100
@@ -3,14 +3,17 @@
  */
 module java.util.ResourceBundle;
 
-import tango.text.Util;
-
 import java.lang.util;
 import java.lang.Integer;
 import java.lang.exceptions;
 import java.util.MissingResourceException;
-import tango.io.device.File;
-import tango.text.locale.Core;
+version(Tango){
+    //import tango.text.Util;
+    import tango.io.device.File;
+    import tango.text.locale.Core;
+} else { // Phobos
+}
+
 
 class ResourceBundle {
 
@@ -20,10 +23,20 @@
      + First entry is the default entry if no maching locale is found
      +/
     public this( ImportData[] data ){
-        char[] name = Culture.current().name.dup;
-        if( name.length is 5 && name[2] is '-' ){
-            name[2] = '_';
-            char[] end = "_" ~ name ~ ".properties";
+        version(Tango){
+            char[] name = Culture.current().name.dup;
+            if( name.length is 5 && name[2] is '-' ){
+                name[2] = '_';
+                char[] end = "_" ~ name ~ ".properties";
+                foreach( entry; data ){
+                    if( entry.name.length > end.length && entry.name[ $-end.length .. $ ] == end ){
+                        //Trace.formatln( "ResourceBundle {}", entry.name );
+                        initialize( cast(char[])entry.data );
+                        return;
+                    }
+                }
+            }
+            char[] end = "_" ~ name[0..2] ~ ".properties";
             foreach( entry; data ){
                 if( entry.name.length > end.length && entry.name[ $-end.length .. $ ] == end ){
                     //Trace.formatln( "ResourceBundle {}", entry.name );
@@ -31,20 +44,14 @@
                     return;
                 }
             }
+            //Trace.formatln( "ResourceBundle default" );
+            initialize( cast(char[])data[0].data );
+        } else { // Phobos
+            implMissing(__FILE__,__LINE__);
         }
-        char[] end = "_" ~ name[0..2] ~ ".properties";
-        foreach( entry; data ){
-            if( entry.name.length > end.length && entry.name[ $-end.length .. $ ] == end ){
-                //Trace.formatln( "ResourceBundle {}", entry.name );
-                initialize( cast(char[])entry.data );
-                return;
-            }
-        }
-        //Trace.formatln( "ResourceBundle default" );
-        initialize( cast(char[])data[0].data );
     }
     public this( ImportData data ){
-        initialize( cast(char[])data.data );
+        initialize( cast(String)data.data );
     }
     public this( String data ){
         initialize( data );
@@ -87,24 +94,23 @@
                 linecontinue = false;
             }
             while( pos < line.length ){
-                char[] c = line[pos .. pos +1];
+                dchar c = line[pos];
                 if( esc ){
                     esc = false;
-                    switch( c[0] ){
-                    case 't' : c[0] = '\t'; break;
-                    case 'n' : c[0] = '\n'; break;
-                    case '\\': c[0] = '\\'; break;
-                    case '\"': c[0] = '\"'; break;
-                    case 'u' :
-                        dchar d = Integer.parseInt( line[ pos+1 .. pos+5 ], 16 );
-                        c = dcharToString(d);
-                        pos += 4;
-                       break;
-                    default: break;
+                    switch( c ){
+                        case 't' : c = '\t'; break;
+                        case 'n' : c = '\n'; break;
+                        case '\\': c = '\\'; break;
+                        case '\"': c = '\"'; break;
+                        case 'u' :
+                               dchar d = Integer.parseInt( line[ pos+1 .. pos+5 ], 16 );
+                               pos += 4;
+                               break;
+                        default: break;
                     }
                 }
                 else{
-                    if( c == "\\" ){
+                    if( c == '\\' ){
                         if( pos == line.length -1 ){
                             linecontinue = true;
                             goto nextline;
@@ -113,7 +119,7 @@
                         pos++;
                         continue;
                     }
-                    else if( iskeypart && c == "=" ){
+                    else if( iskeypart && c == '=' ){
                         pos++;
                         iskeypart = false;
                         continue;
@@ -121,10 +127,10 @@
                 }
                 pos++;
                 if( iskeypart ){
-                    key ~= c;
+                    key ~= dcharToString(c);
                 }
                 else{
-                    value ~= c;
+                    value ~= dcharToString(c);
                 }
             }
             if( iskeypart ){
@@ -133,7 +139,11 @@
             key = java.lang.util.trim(key);
             value = java.lang.util.trim(value);
 
-            map[ key.dup ] = value.dup;
+            version(D_Version2){
+                map[ key.idup ] = value.idup;
+            } else {
+                map[ key.dup ] = value.dup;
+            }
         }
     }
 
@@ -143,7 +153,11 @@
 
     public String getString( String key ){
         if( auto v = key in map ){
-            return (*v).dup;
+            version(D_Version2){
+                return (*v).idup;
+            } else {
+                return (*v).dup;
+            }
         }
         throw new MissingResourceException( "key not found", this.classinfo.name, key );
     }
@@ -160,7 +174,11 @@
     }
     public static ResourceBundle getBundle( String name ){
         try{
-            return new ResourceBundle( cast(String) File.get(name) );
+            version(Tango){
+                return new ResourceBundle( cast(String) File.get(name) );
+            } else { // Phobos
+                implMissing(__FILE__,__LINE__);
+            }
         }
         catch( IOException e){
             e.msg ~= " file:" ~ name;
--- a/java/src/java/util/Stack.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/Stack.d	Thu Mar 19 20:38:55 2009 +0100
@@ -65,7 +65,7 @@
     void   ensureCapacity(int minCapacity){
         implMissing( __FILE__, __LINE__ );
     }
-    int opEquals(Object o){
+    equals_t opEquals(Object o){
         implMissing( __FILE__, __LINE__ );
         return false;
     }
--- a/java/src/java/util/Timer.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/Timer.d	Thu Mar 19 20:38:55 2009 +0100
@@ -1,19 +1,24 @@
 module java.util.Timer;
 
+import java.lang.all;
 import java.util.TimerTask;
-// import tango.util.container.CircularList;
 import java.lang.Thread;
-import tango.core.sync.Mutex;
-import tango.core.sync.Condition;
-// import tango.time.Time;
-// import tango.time.Clock;
-import tango.text.convert.Format;
-import java.lang.all;
+
+version(Tango){
+    import tango.core.sync.Mutex;
+    import tango.core.sync.Condition;
+    import tango.text.convert.Format;
+} else { // Phobos
+}
+
 
 class Timer {
     private static final class TaskQueue {
-        private Mutex mutex;
-        private Condition cond;
+        version(Tango){
+            private Mutex mutex;
+            private Condition cond;
+        } else { // Phobos
+        }
 
 
         private static const int DEFAULT_SIZE = 32;
@@ -21,11 +26,15 @@
         private TimerTask heap[];
         private int elements;
         public this() {
-            mutex = new Mutex();
-            cond = new Condition( mutex );
-            heap = new TimerTask[DEFAULT_SIZE];
-            elements = 0;
-            nullOnEmpty = false;
+            version(Tango){
+                mutex = new Mutex();
+                cond = new Condition( mutex );
+                heap = new TimerTask[DEFAULT_SIZE];
+                elements = 0;
+                nullOnEmpty = false;
+            } else { // Phobos
+                implMissing(__FILE__,__LINE__);
+            }
         }
 
         private void add(TimerTask task) {
@@ -50,23 +59,27 @@
         }
 
         public void enqueue(TimerTask task) {
-            synchronized( mutex ){
-                if (heap is null) {
-                    throw new IllegalStateException("cannot enqueue when stop() has been called on queue");
-                }
+            version(Tango){
+                synchronized( mutex ){
+                    if (heap is null) {
+                        throw new IllegalStateException("cannot enqueue when stop() has been called on queue");
+                    }
 
-                heap[0] = task;
-                add(task);
-                int child = elements;
-                int parent = child / 2;
-                while (heap[parent].scheduled > task.scheduled) {
-                    heap[child] = heap[parent];
-                    child = parent;
-                    parent = child / 2;
+                    heap[0] = task;
+                    add(task);
+                    int child = elements;
+                    int parent = child / 2;
+                    while (heap[parent].scheduled > task.scheduled) {
+                        heap[child] = heap[parent];
+                        child = parent;
+                        parent = child / 2;
+                    }
+                    heap[child] = task;
+                    heap[0] = null;
+                    cond.notify();
                 }
-                heap[child] = task;
-                heap[0] = null;
-                cond.notify();
+            } else { // Phobos
+                implMissing(__FILE__,__LINE__);
             }
         }
 
@@ -80,79 +93,92 @@
         }
 
         public TimerTask serve() {
-            synchronized( mutex ){
-                TimerTask task = null;
-                while (task is null) {
-                    task = top();
+            version(Tango){
+                synchronized( mutex ){
+                    TimerTask task = null;
+                    while (task is null) {
+                        task = top();
 
-                    if ((heap is null) || (task is null && nullOnEmpty)) {
-                        return null;
-                    }
+                        if ((heap is null) || (task is null && nullOnEmpty)) {
+                            return null;
+                        }
 
-                    if (task !is null) {
-                        // The time to wait until the task should be served
-                        long time = task.scheduled - System.currentTimeMillis();
-                        if (time > 0) {
-                            // This task should not yet be served
-                            // So wait until this task is ready
+                        if (task !is null) {
+                            // The time to wait until the task should be served
+                            long time = task.scheduled - System.currentTimeMillis();
+                            if (time > 0) {
+                                // This task should not yet be served
+                                // So wait until this task is ready
+                                // or something else happens to the queue
+                                task = null;  // set to null to make sure we call top()
+                                try {
+                                    cond.wait(time);
+                                }
+                                catch (InterruptedException _) {
+                                }
+                            }
+                        }
+                        else {
+                            // wait until a task is added
                             // or something else happens to the queue
-                            task = null;  // set to null to make sure we call top()
                             try {
-                                cond.wait(time);
+                                cond.wait();
                             }
                             catch (InterruptedException _) {
                             }
                         }
                     }
-                    else {
-                        // wait until a task is added
-                        // or something else happens to the queue
-                        try {
-                            cond.wait();
-                        }
-                        catch (InterruptedException _) {
-                        }
-                    }
-                }
+
+                    TimerTask lastTask = heap[elements];
+                    remove();
 
-                TimerTask lastTask = heap[elements];
-                remove();
+                    int parent = 1;
+                    int child = 2;
+                    heap[1] = lastTask;
+                    while (child <= elements) {
+                        if (child < elements) {
+                            if (heap[child].scheduled > heap[child + 1].scheduled) {
+                                child++;
+                            }
+                        }
 
-                int parent = 1;
-                int child = 2;
-                heap[1] = lastTask;
-                while (child <= elements) {
-                    if (child < elements) {
-                        if (heap[child].scheduled > heap[child + 1].scheduled) {
-                            child++;
-                        }
+                        if (lastTask.scheduled <= heap[child].scheduled)
+                            break;
+
+                        heap[parent] = heap[child];
+                        parent = child;
+                        child = parent * 2;
                     }
 
-                    if (lastTask.scheduled <= heap[child].scheduled)
-                        break;
-
-                    heap[parent] = heap[child];
-                    parent = child;
-                    child = parent * 2;
+                    heap[parent] = lastTask;
+                    return task;
                 }
-
-                heap[parent] = lastTask;
-                return task;
+            } else { // Phobos
+                implMissing(__FILE__,__LINE__);
+                return null;
             }
         }
 
         public void setNullOnEmpty(bool nullOnEmpty) {
-            synchronized( mutex ){
-                this.nullOnEmpty = nullOnEmpty;
-                cond.notify();
+            version(Tango){
+                synchronized( mutex ){
+                    this.nullOnEmpty = nullOnEmpty;
+                    cond.notify();
+                }
+            } else { // Phobos
+                implMissing(__FILE__,__LINE__);
             }
         }
 
         public void stop() {
-            synchronized( mutex ){
-                this.heap = null;
-                this.elements = 0;
-                cond.notify();
+            version(Tango){
+                synchronized( mutex ){
+                    this.heap = null;
+                    this.elements = 0;
+                    cond.notify();
+                }
+            } else { // Phobos
+                implMissing(__FILE__,__LINE__);
             }
         }
 
@@ -176,11 +202,11 @@
                     try {
                         task.run();
                     }
-//                     catch (ThreadDeath death) {
-//                         // If an exception escapes, the Timer becomes invalid.
-//                         queue.stop();
-//                         throw death;
-//                     }
+                    //                     catch (ThreadDeath death) {
+                    //                         // If an exception escapes, the Timer becomes invalid.
+                    //                         queue.stop();
+                    //                         throw death;
+                    //                     }
                     catch (Exception t) {
                         queue.stop();
                     }
@@ -270,16 +296,16 @@
         }
     }
 
-//     public void schedule(TimerTask task, Date date) {
-//         long time = date.getTime();
-//         schedule(task, time, -1, false);
-//     }
+    //     public void schedule(TimerTask task, Date date) {
+    //         long time = date.getTime();
+    //         schedule(task, time, -1, false);
+    //     }
 
-//     public void schedule(TimerTask task, Date date, long period) {
-//         positivePeriod(period);
-//         long time = date.getTime();
-//         schedule(task, time, period, false);
-//     }
+    //     public void schedule(TimerTask task, Date date, long period) {
+    //         positivePeriod(period);
+    //         long time = date.getTime();
+    //         schedule(task, time, period, false);
+    //     }
 
     public void schedule(TimerTask task, long delay) {
         positiveDelay(delay);
@@ -294,11 +320,11 @@
         schedule(task, time, period, false);
     }
 
-//     public void scheduleAtFixedRate(TimerTask task, Date date, long period)  {
-//         positivePeriod(period);
-//         long time = date.getTime();
-//         schedule(task, time, period, true);
-//     }
+    //     public void scheduleAtFixedRate(TimerTask task, Date date, long period)  {
+    //         positivePeriod(period);
+    //         long time = date.getTime();
+    //         schedule(task, time, period, true);
+    //     }
 
     public void scheduleAtFixedRate(TimerTask task, long delay, long period)  {
         positiveDelay(delay);
--- a/java/src/java/util/TimerTask.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/TimerTask.d	Thu Mar 19 20:38:55 2009 +0100
@@ -1,6 +1,5 @@
 module java.util.TimerTask;
 
-import tango.time.Time;
 import java.lang.all;
 import java.util.Timer;
 
--- a/java/src/java/util/TreeMap.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/TreeMap.d	Thu Mar 19 20:38:55 2009 +0100
@@ -8,14 +8,26 @@
 import java.util.TreeSet;
 import java.util.ArrayList;
 
-static import tango.util.container.SortedMap;
+version(Tango){
+    static import tango.util.container.SortedMap;
+} else { // Phobos
+}
+
 
 class TreeMap : Map, SortedMap {
-    alias tango.util.container.SortedMap.SortedMap!(Object,Object) MapType;
-    private MapType map;
+    version(Tango){
+        alias tango.util.container.SortedMap.SortedMap!(Object,Object) MapType;
+        private MapType map;
+    } else { // Phobos
+    }
+
 
     public this(){
-        map = new MapType();
+        version(Tango){
+            map = new MapType();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
     public this(Comparator c){
         implMissing( __FILE__, __LINE__ );
@@ -27,49 +39,78 @@
         implMissing( __FILE__, __LINE__ );
     }
     public void clear(){
-        map.clear();
+        version(Tango){
+            map.clear();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
     Comparator     comparator(){
         implMissing( __FILE__, __LINE__ );
         return null;
     }
     public bool containsKey(Object key){
-        Object v;
-        return map.get(key, v );
+        version(Tango){
+            Object v;
+            return map.get(key, v );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public bool containsKey(String key){
         return containsKey(stringcast(key));
     }
     public bool containsValue(Object value){
-        return map.contains(value);
+        version(Tango){
+            return map.contains(value);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public Set  entrySet(){
-        TreeSet res = new TreeSet();
-        foreach( k, v; map ){
-            res.add( new MapEntry(this,k) );
+        version(Tango){
+            TreeSet res = new TreeSet();
+            foreach( k, v; map ){
+                res.add( new MapEntry(this,k) );
+            }
+            return res;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        return res;
     }
-    public override int opEquals(Object o){
-        if( auto other = cast(TreeMap) o ){
-            if( other.size() !is size() ){
-                return false;
-            }
-            foreach( k, v; map ){
-                Object vo = other.get(k);
-                if( v != vo ){
+    public override equals_t opEquals(Object o){
+        version(Tango){
+            if( auto other = cast(TreeMap) o ){
+                if( other.size() !is size() ){
                     return false;
                 }
+                foreach( k, v; map ){
+                    Object vo = other.get(k);
+                    if( v != vo ){
+                        return false;
+                    }
+                }
+                return true;
             }
-            return true;
+            return false;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
         }
-        return false;
     }
     Object         firstKey(){
-        foreach( k; map ){
-            return k;
+        version(Tango){
+            foreach( k; map ){
+                return k;
+            }
+            throw new tango.core.Exception.NoSuchElementException( "TreeMap.firstKey" );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        throw new tango.core.Exception.NoSuchElementException( "TreeMap.firstKey" );
     }
     public Object get(Object key){
         implMissing( __FILE__, __LINE__ );
@@ -91,31 +132,51 @@
         return null;
     }
     public bool isEmpty(){
-        return map.isEmpty();
+        version(Tango){
+            return map.isEmpty();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public Set keySet(){
-        TreeSet res = new TreeSet();
-        foreach( k; map ){
-            res.add( k );
+        version(Tango){
+            TreeSet res = new TreeSet();
+            foreach( k; map ){
+                res.add( k );
+            }
+            return res;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        return res;
     }
     Object lastKey(){
-        Object res;
-        foreach( k; map ){
-            res = k;
+        version(Tango){
+            Object res;
+            foreach( k; map ){
+                res = k;
+            }
+            if( map.size() ) return res;
+            throw new tango.core.Exception.NoSuchElementException( "TreeMap.lastKey" );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        if( map.size() ) return res;
-        throw new tango.core.Exception.NoSuchElementException( "TreeMap.lastKey" );
     }
     public Object put(Object key, Object value){
-        if( map.contains(key) ){ // TODO if tango has opIn_r, then use the "in" operator
-            Object res = map[key];
+        version(Tango){
+            if( map.contains(key) ){ // TODO if tango has opIn_r, then use the "in" operator
+                Object res = map[key];
+                map[key] = value;
+                return res;
+            }
             map[key] = value;
-            return res;
+            return null;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        map[key] = value;
-        return null;
     }
     public Object put(String key, Object value){
         return put(stringcast(key), value);
@@ -132,15 +193,25 @@
         }
     }
     public Object remove(Object key){
-        Object res;
-        map.take(key,res);
-        return res;
+        version(Tango){
+            Object res;
+            map.take(key,res);
+            return res;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
+        }
     }
     public Object remove(String key){
         return remove(stringcast(key));
     }
     public int    size(){
-        return map.size();
+        version(Tango){
+            return map.size();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return 0;
+        }
     }
     SortedMap      subMap(Object fromKey, Object toKey){
         implMissing( __FILE__, __LINE__ );
@@ -151,18 +222,33 @@
         return null;
     }
     public Collection values(){
-        ArrayList res = new ArrayList( size() );
-        foreach( k, v; map ){
-            res.add( v );
+        version(Tango){
+            ArrayList res = new ArrayList( size() );
+            foreach( k, v; map ){
+                res.add( v );
+            }
+            return res;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return null;
         }
-        return res;
     }
 
     public int opApply (int delegate(ref Object value) dg){
-        return map.opApply( dg );
+        version(Tango){
+            return map.opApply( dg );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return 0;
+        }
     }
     public int opApply (int delegate(ref Object key, ref Object value) dg){
-        return map.opApply( dg );
+        version(Tango){
+            return map.opApply( dg );
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return 0;
+        }
     }
 }
 
--- a/java/src/java/util/TreeSet.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/TreeSet.d	Thu Mar 19 20:38:55 2009 +0100
@@ -6,15 +6,25 @@
 import java.util.Collection;
 import java.util.Iterator;
 
-static import tango.util.container.SortedMap;
+version(Tango){
+    static import tango.util.container.SortedMap;
+} else { // Phobos
+}
 
 class TreeSet : AbstractSet, SortedSet {
 
-    alias tango.util.container.SortedMap.SortedMap!(Object,int) SetType;
-    private SetType set;
+    version(Tango){
+        alias tango.util.container.SortedMap.SortedMap!(Object,int) SetType;
+        private SetType set;
+    } else { // Phobos
+    }
 
     public this(){
-        set = new SetType();
+        version(Tango){
+            set = new SetType();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
     public this(Collection c){
         implMissing( __FILE__, __LINE__ );
@@ -27,39 +37,73 @@
     }
 
     public bool    add(Object o){
-        return set.add(o, 0);
+        version(Tango){
+            return set.add(o, 0);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public bool    add(String o){
-        return add(stringcast(o));
+        version(Tango){
+            return add(stringcast(o));
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public bool    addAll(Collection c){
-        foreach( o; c ){
-            add(o);
+        version(Tango){
+            foreach( o; c ){
+                add(o);
+            }
+            return true;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
         }
-        return true;
     }
     public void   clear(){
-        set.clear();
+        version(Tango){
+            set.clear();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
     public bool    contains(Object o){
-        return set.containsKey(o);
+        version(Tango){
+            return set.containsKey(o);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public bool     contains(String o){
-        return contains(stringcast(o));
+        version(Tango){
+            return contains(stringcast(o));
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public bool    containsAll(Collection c){
-        foreach( o; c ){
-            if( !contains(o) ){
-                return false;
+        version(Tango){
+            foreach( o; c ){
+                if( !contains(o) ){
+                    return false;
+                }
             }
+            return true;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
         }
-        return true;
     }
     public Comparator     comparator(){
         implMissing( __FILE__, __LINE__ );
         return null;
     }
-    public override int    opEquals(Object o){
+    public override equals_t    opEquals(Object o){
         implMissing( __FILE__, __LINE__ );
         return 0;
     }
@@ -76,7 +120,12 @@
         return null;
     }
     public bool    isEmpty(){
-        return set.isEmpty();
+        version(Tango){
+            return set.isEmpty();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public Iterator   iterator(){
         implMissing( __FILE__, __LINE__ );
@@ -87,10 +136,16 @@
         return null;
     }
     public bool    remove(Object o){
+        implMissing( __FILE__, __LINE__ );
         return false;
     }
     public bool remove(String key){
-        return remove(stringcast(key));
+        version(Tango){
+            return remove(stringcast(key));
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return false;
+        }
     }
     public bool    removeAll(Collection c){
         implMissing( __FILE__, __LINE__ );
@@ -101,7 +156,12 @@
         return false;
     }
     public int    size(){
-        return set.size();
+        version(Tango){
+            return set.size();
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return 0;
+        }
     }
     public SortedSet      subSet(Object fromElement, Object toElement){
         implMissing( __FILE__, __LINE__ );
@@ -127,10 +187,15 @@
 
     // only for D
     public int opApply (int delegate(ref Object value) dg){
-        int localDg( ref Object key, ref int value ){
-            return dg( key );
+        version(Tango){
+            int localDg( ref Object key, ref int value ){
+                return dg( key );
+            }
+            return set.opApply(&localDg);
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return 0;
         }
-        return set.opApply(&localDg);
     }
 }
 
--- a/java/src/java/util/Vector.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/Vector.d	Thu Mar 19 20:38:55 2009 +0100
@@ -82,7 +82,7 @@
    public  void   ensureCapacity(int minCapacity){
         implMissing( __FILE__, __LINE__ );
     }
-    public int opEquals(Object o){
+    public equals_t opEquals(Object o){
         implMissing( __FILE__, __LINE__ );
         return false;
     }
@@ -92,7 +92,7 @@
     }
     public Object     get(int index){
         if( index >= used || index < 0 ){
-            throw new tango.core.Exception.ArrayBoundsException( __FILE__, __LINE__ );
+            throw new ArrayIndexOutOfBoundsException( __FILE__, __LINE__ );
         }
         return vect[index];
     }
--- a/java/src/java/util/WeakHashMap.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/WeakHashMap.d	Thu Mar 19 20:38:55 2009 +0100
@@ -21,7 +21,7 @@
         override hash_t toHash(){
             return cast(hash_t)ptr;
         }
-        override int opEquals( Object o ){
+        override equals_t opEquals( Object o ){
             if( auto other = cast(Ref)o ){
                 return ptr is other.ptr;
             }
--- a/java/src/java/util/zip/InflaterInputStream.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/util/zip/InflaterInputStream.d	Thu Mar 19 20:38:55 2009 +0100
@@ -3,56 +3,63 @@
  */
 module java.util.zip.InflaterInputStream;
 
-public import java.io.InputStream;
 import java.lang.all;
-import tango.io.compress.ZlibStream;
-version(Windows){
-    version(build){
-        pragma(link,"zlib");
+import java.io.InputStream;
+version(Tango){
+    import tango.io.compress.ZlibStream;
+    import tango.io.device.Conduit;
+    version(Windows){
+        version(build){
+            pragma(link,"zlib");
+        }
     }
+} else { // Phobos
+    import std.zlib;
 }
 
-import tango.io.device.Conduit;
-
-class InputStreamWrapper : tango.io.model.IConduit.InputStream {
+version(Tango){
+    class InputStreamWrapper : tango.io.model.IConduit.InputStream {
 
-    java.io.InputStream.InputStream istr;
+        java.io.InputStream.InputStream istr;
 
-    this( java.io.InputStream.InputStream istr ){
-        this.istr = istr;
-    }
+        this( java.io.InputStream.InputStream istr ){
+            this.istr = istr;
+        }
 
-    uint read (void[] dst){
-        int res = istr.read( cast(byte[])dst );
-        return res;
-    }
+        uint read (void[] dst){
+            int res = istr.read( cast(byte[])dst );
+            return res;
+        }
 
-    tango.io.model.IConduit.IConduit conduit (){
-        implMissing(__FILE__,__LINE__);
-        return null;
-    }
+        tango.io.model.IConduit.IConduit conduit (){
+            implMissing(__FILE__,__LINE__);
+            return null;
+        }
 
-    void close (){
-        istr.close();
-    }
-    tango.io.model.IConduit.InputStream input (){
-        implMissing(__FILE__,__LINE__);
-        return null;
+        void close (){
+            istr.close();
+        }
+        tango.io.model.IConduit.InputStream input (){
+            implMissing(__FILE__,__LINE__);
+            return null;
+        }
+        long seek (long offset, Anchor anchor = Anchor.Begin){
+            implMissing(__FILE__,__LINE__);
+            return 0;
+        }
+        void[] load (size_t max = -1){
+            implMissing(__FILE__,__LINE__);
+            return null;
+        }
+        IOStream flush (){
+            implMissing(__FILE__,__LINE__);
+            return null;
+        }
     }
-    long seek (long offset, Anchor anchor = Anchor.Begin){
-        implMissing(__FILE__,__LINE__);
-        return 0;
-    }
-    void[] load (size_t max = -1){
-        implMissing(__FILE__,__LINE__);
-        return null;
-    }
-    IOStream flush (){
-        implMissing(__FILE__,__LINE__);
-        return null;
-    }
+} else { // Phobos
 }
 
+
 public class InflaterInputStream : java.io.InputStream.InputStream {
 
     alias java.io.InputStream.InputStream.read read;
@@ -67,19 +74,31 @@
     protected int len;
     package bool usesDefaultInflater = false;
 
-    ZlibInput tangoIstr;
+    version(Tango){
+        ZlibInput tangoIstr;
+    } else { // Phobos
+    }
 
     public this ( java.io.InputStream.InputStream istr ){
-        tangoIstr = new ZlibInput( new InputStreamWrapper(istr ));
+        version(Tango){
+            tangoIstr = new ZlibInput( new InputStreamWrapper(istr ));
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+        }
     }
 
     public int read(){
-        ubyte[1] data;
-        uint res = tangoIstr.read( data );
-        if( res !is 1 ){
-            return data[0] & 0xFF;
+        version(Tango){
+            ubyte[1] data;
+            uint res = tangoIstr.read( data );
+            if( res !is 1 ){
+                return data[0] & 0xFF;
+            }
+            return -1;
+        } else { // Phobos
+            implMissing( __FILE__, __LINE__ );
+            return -1;
         }
-        return -1;
     }
 
     public int read( byte[] b, int off, int len ){
--- a/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.d	Thu Mar 19 20:38:55 2009 +0100
@@ -18,6 +18,7 @@
 static import tango.text.xml.Document;
 static import tango.text.xml.SaxParser;
 static import tango.text.xml.PullParser;
+import tango.core.Exception;
 
 import java.lang.all;
 import java.util.Enumeration;
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/Compatibility.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/Compatibility.d	Thu Mar 19 20:38:55 2009 +0100
@@ -23,6 +23,7 @@
 import org.eclipse.swt.SWT;
 public import java.io.FileInputStream;
 public import java.io.FileOutputStream;
+import java.io.InputStream;
 
 import Unicode = tango.text.Unicode;
 import tango.sys.Process;
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/LEDataInputStream.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/LEDataInputStream.d	Thu Mar 19 20:38:55 2009 +0100
@@ -123,7 +123,7 @@
         if (buf is null) throw new IOException("buf is null");
         if (offset < 0 || offset > buffer.length ||
             len < 0 || (len > buffer.length - offset)) {
-            throw new ArrayBoundsException(__FILE__,__LINE__);
+            throw new ArrayIndexOutOfBoundsException(__FILE__,__LINE__);
             }
 
         int cacheCopied = 0;
--- a/org.eclipse.text/src/org/eclipse/jface/text/TreeLineTracker.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/org.eclipse.text/src/org/eclipse/jface/text/TreeLineTracker.d	Thu Mar 19 20:38:55 2009 +0100
@@ -1310,7 +1310,7 @@
         try {
             replace(0, 0, text);
         } catch (BadLocationException x) {
-            throw new AssertException(__FILE__,__LINE__);
+            throw new InternalError(__FILE__,__LINE__);
         }
     }
 
@@ -1392,7 +1392,7 @@
         try {
             checkTreeOffsets(nodeByOffset(0), [0, 0], null);
         } catch (BadLocationException x) {
-            throw new AssertException(__FILE__,__LINE__);
+            throw new InternalError(__FILE__,__LINE__);
         }
     }
 
--- a/rakefile	Wed Mar 18 12:10:17 2009 +0100
+++ b/rakefile	Thu Mar 19 20:38:55 2009 +0100
@@ -12,7 +12,13 @@
 OBJDIR="obj"
 DIMPDIR="imp"
 RSPNAME="rsp"
-ALL_RESDIRS= [ "java/res", "org.eclipse.swt.win32.win32.x86/res", "res" ]
+ALL_RESDIRS= [ "java/res", "res" ]
+
+if Rake::Win32.windows?
+    ALL_RESDIRS << "org.eclipse.swt.win32.win32.x86/res"
+else
+    ALL_RESDIRS << "org.eclipse.swt.gtk.linux.x86/res"
+end
 
 class String
     def to_path
@@ -100,7 +106,11 @@
 
 desc "Build SWT"
 task :swt do
-    buildTree( "org.eclipse.swt.win32.win32.x86", "src", "res" )
+    if Rake::Win32.windows?
+        buildTree( "org.eclipse.swt.win32.win32.x86", "src", "res" )
+    else
+        buildTree( "org.eclipse.swt.gtk.linux.x86", "src", "res" )
+    end
 end
 
 desc "Build Equinox"
@@ -120,6 +130,10 @@
 desc "Build JFace"
 task :jface do
     buildTree( "org.eclipse.jface", "src", "res" )
+end
+
+desc "Build JFace.Text"
+task :jfacetext do
     buildTree( "org.eclipse.text", "src", "res" )
     buildTree( "org.eclipse.jface.text", "projection", "res", "-Isrc" )
     buildTree( "org.eclipse.jface.text", "src", "res" )
@@ -136,8 +150,10 @@
 end
 
 desc "Build ALL"
-task :all => [ :java, :swt, :equinox, :core, :jface, :uiforms, :draw2d ]
+task :all => [ :java, :swt, :equinox, :core, :jface, :jfacetext, :uiforms,
+    :draw2d ]
 
+desc "Clean, then build ALL"
 task :default => [ :clean, :all ]