Re: Java tools

2001-07-09 Thread Stuart Ballard

Nic Ferrier wrote:
 
 I have proposed to Julian that a new GNU project be setup called:
 java-tools. We can put things like javadoc and jar-tool
 implementations under that project.
 
 Does anyone have any objections to that?

Sun might - they don't like people using the name Java for things.
(Just ask the guy who wrote Java invaders, and also the
java.apache.org people).

I have no idea to what extent they have a legitimate claim here (they
certainly do own the trademark, but then they use the same trademark all
throughout their public APIs, which IANAL so I don't know what to make
of. I remember that Classpath even had to change it's subtitle to
Essential libraries for the java platform instead of Essential
libraries for Java in line with Sun's stated policy.

I like the idea, but I think a different name for it might be in
order... how about gtj in line with gcj?

Stuart.

___
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath



Re: Java tools

2001-07-09 Thread Nic Ferrier

 Stuart Ballard [EMAIL PROTECTED] 09-Jul-01 4:00:18 PM 

   Sun might - they don't like people using the name 
   Java for things.

The FSF doesn't use the word either. It was a mistake for me to call
the project that.

The project wouyld actually be called something like class-tools
but we can come up with a name later.

I'm more interested in knowing if there are any objections to the
idea of a seperate project for tools.


   I like the idea, but I think a different name for it 
   might be in order... how about gtj in line with gcj?

Could be a good one... I don't think it matters what the name is. The
FSF leadership are quite good at suggesting names for projects.


Nic

___
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath



File compile fix

2001-07-09 Thread Mark Wielaard

Hi,

I comitted the following to get java/io/File.java to compile again.
The single String constructor will throw the NullPointerException
when needed.

2001-07-10  Mark Wielaard [EMAIL PROTECTED]
* java/io/File.java (String,String constructor): compile fix

Cheers,
Mark
-- 
Stuff to read:
http://www.toad.com/gnu/whatswrong.html
  What's Wrong with Copy Protection, by John Gilmore


Index: java/io/File.java
===
RCS file: /cvs/classpath/java/io/File.java,v
retrieving revision 1.9
diff -u -u -r1.9 File.java
--- java/io/File.java   2001/07/06 12:27:51 1.9
+++ java/io/File.java   2001/07/09 22:36:36
@@ -295,16 +295,7 @@
 public
 File(String dirname, String name)
 {
-  if (name == null)
-throw new NullPointerException (File name is null);
-
-  if (dirname == null)
-return new File (name);
-
-  StringBuffer buf = new StringBuffer(dirname);
-  buf.append(separator);
-  buf.append(name);
-  return new File (buf.toString());
+  this((name == null || dirname ==null) ? null : dirname + separator + name);
 }
 
 /*/



Re: Java tools

2001-07-09 Thread Brian Jones

Nic Ferrier [EMAIL PROTECTED] writes:

  Stuart Ballard [EMAIL PROTECTED] 09-Jul-01 4:00:18 PM 
 
Sun might - they don't like people using the name 
Java for things.
 
 The FSF doesn't use the word either. It was a mistake for me to call
 the project that.
 
 The project wouyld actually be called something like class-tools
 but we can come up with a name later.
 
 I'm more interested in knowing if there are any objections to the
 idea of a seperate project for tools.
 
 
I like the idea, but I think a different name for it 
might be in order... how about gtj in line with gcj?
 
 Could be a good one... I don't think it matters what the name is. The
 FSF leadership are quite good at suggesting names for projects.

The idea sounds fine to me, and you may even want to take the com.sun
interface stuff with you.

Brian
-- 
Brian Jones [EMAIL PROTECTED]

___
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath



Primitive types 1.4 updates

2001-07-09 Thread Mark Wielaard

Hi,

The following patch adds new 1.4 functionality to the Boolean, Double
and Float classes. It also makes Boolean a little bit more efficient
by always returning the predefined TRUE or FALSE instances when
possible.

2001-07-10  Mark Wielaard [EMAIL PROTECTED]
* java/lang/Boolean.java (valueOf boolean): new 1.4 method
(toString boolean): idem
(valueOf String): return one of the predefined Boolean instances
* java/lang/Double.java (compare double double): new 1.4 method
(compareTo Double): call new method
* java/lang/Float.java (compare float float): new 1.4 method
(compareTo Float): call new method

Is there any reason the primitive classes have not been merged with
libgcj? Some of those classes, like Boolean, are pure java. The only
difference seems to be the way they define the TYPE instance variable.
We use VMClassLoader.getPrimitiveClass(boolean) and libgcj seems to
use some compiler magic to set this field. Maybe we could just add a
VMClassLoader class to libgcj that does the magic?

Cheers,

Mark
-- 
Stuff to read:
http://www.toad.com/gnu/whatswrong.html
  What's Wrong with Copy Protection, by John Gilmore


Index: java/lang/Boolean.java
===
RCS file: /cvs/classpath/java/lang/Boolean.java,v
retrieving revision 1.14
diff -u -u -r1.14 Boolean.java
--- java/lang/Boolean.java  2000/03/16 23:31:19 1.14
+++ java/lang/Boolean.java  2001/07/09 23:07:36
@@ -1,5 +1,5 @@
 /* Boolean.java -- object wrapper for boolean
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -42,13 +42,17 @@
 
 /**
  * This field is a codeBoolean/code object representing the
- * primitive value codetrue/code.
+ * primitive value codetrue/code. This instance is returned
+ * by the static codevalueOf()/code methods if they return
+ * a codeBoolean/code representing codetrue/code.
  */
 public static final Boolean TRUE  = new Boolean(true);
 
 /**
  * This field is a codeBoolean/code object representing the 
- * primitive value codefalse/code.
+ * primitive value codefalse/code. This instance is returned
+ * by the static codevalueOf()/code methods if they return
+ * a codeBoolean/code representing codefalse/code.
  */
  public static final Boolean FALSE = new Boolean(false);
 
@@ -62,7 +66,9 @@
 
 /**
  * Create a codeBoolean/code object representing the value of the 
- * argument codevalue/code
+ * argument codevalue/code. In general the use of the static
+ * method codevalueof(boolean)/code is more efficient since it will
+ * not create a new object.
  *
  * @param value the primitive value of this codeBoolean/code
  */
@@ -74,7 +80,9 @@
  * Creates a codeBoolean/code object representing the primitive 
  * codetrue/code if and only if codes/code matches 
  * the string true ignoring case, otherwise the object will represent 
- * the primitive codefalse/code.
+ * the primitive codefalse/code. In general the use of the static
+ * method codevalueof(String)/code is more efficient since it will
+ * not create a new object.
  *
  * @param s the codeString/code representation of codetrue/code
  *   or false
@@ -92,11 +100,23 @@
 }
 
 /**
- * Calls codeBoolean(String)/code to create the new object.
- * @see #Boolean(java.lang.String)
+ * Returns the Boolean codeTRUE/code if the given boolean is
+ * codetrue/code, otherwise it will return the Boolean
+ * codeFALSE/code.
+ *
+ * @since 1.4
+ */
+public static Boolean valueOf(boolean b) {
+   return b ? TRUE : FALSE;
+}
+
+/**
+ * Returns the Boolean codeTRUE/code if and only if the given
+ * String is equal, ignoring case, to the the String true, otherwise
+ * it will return the Boolean codeFALSE/code.
  */
 public static Boolean valueOf(String s) {
-   return new Boolean(s);
+   return true.equalsIgnoreCase(s) ? TRUE : FALSE;
 }
 
 /**
@@ -132,6 +152,17 @@
return (val != null  val.equalsIgnoreCase(true));
 }
 
+/**
+ * Returns true if the value of the give boolean is codetrue/code and
+ * returns false if the value of the given boolean is codefalse/code.
+ *
+ * @since 1.4
+ */
+public static String toString(boolean b)
+{
+   return b ? true : false;
+}
+
 /**
  * Returns true if the value of this object is codetrue/code and
  * returns false if the value of this object is codefalse/code.
Index: java/lang/Double.java
===
RCS file: /cvs/classpath/java/lang/Double.java,v
retrieving revision 1.16
diff -u -u -r1.16 Double.java
--- java/lang/Double.java   2001/06/25 04:43:56 1.16
+++ 

Re: Primitive types 1.4 updates

2001-07-09 Thread Brian Jones

Mark Wielaard [EMAIL PROTECTED] writes:

 Hi,
 
 The following patch adds new 1.4 functionality to the Boolean, Double
 and Float classes. It also makes Boolean a little bit more efficient
 by always returning the predefined TRUE or FALSE instances when
 possible.
 
 2001-07-10  Mark Wielaard [EMAIL PROTECTED]
 * java/lang/Boolean.java (valueOf boolean): new 1.4 method
 (toString boolean): idem
 (valueOf String): return one of the predefined Boolean instances
 * java/lang/Double.java (compare double double): new 1.4 method
 (compareTo Double): call new method
 * java/lang/Float.java (compare float float): new 1.4 method
 (compareTo Float): call new method
 
 Is there any reason the primitive classes have not been merged with
 libgcj? Some of those classes, like Boolean, are pure java. The only
 difference seems to be the way they define the TYPE instance variable.
 We use VMClassLoader.getPrimitiveClass(boolean) and libgcj seems to
 use some compiler magic to set this field. Maybe we could just add a
 VMClassLoader class to libgcj that does the magic?

Is it possible to move the VMClassLoader call to inside of the
static{} block so we can place it inside the if
(Configuration.INIT_LOAD_LIBRARY clause?).  I have started merging
java/lang/Double and java/lang/Float.  I still need to test what I've
done and maybe move the common .c libs to a new directory outside of
both the cni directory and the jni directory so that both
implementations can use it from one place.  I checked in my changes to
both classes a few weeks ago.

Brian
-- 
Brian Jones [EMAIL PROTECTED]

___
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath



Re: CharSequence support

2001-07-09 Thread Nic Ferrier

 Mark Wielaard [EMAIL PROTECTED] 10-Jul-01 1:00:59 AM 

   I did not add the new 1.4 split() methods to String.
   They need java/util/regexp support. Maybe we can 
   ask Wes Biggs if we may import part of gnu.regexp to 
   implement it. It is licensed under the LGPL, but since it 
   seems to be a GNU package we might get it relicensed 
   under GPL+exception for Classpath/libgcj.

I've been thinking about this too.

I looked at Wes' regexp implementation some time ago and it was
pretty good.

IMHO the best thing to do would be to get Wes to join Classpath to
make the regexp package part of the overall project. Having a seperate
regexp package when it's also supplied by the core platform doesn't
make any sense. Java programmers won't expect that.


BTW I've been doing some socket code updates for GCJ (adding timeout
support). The problems in GCJ are now fixed (well, there's a patch).
I'm starting to think about the nio stuff now because it follows
similar lines to the stuff I've been doing.


I understand that the GCJ code and the Classpath code will need to
merge at some point. I'd like to help with that by doing a single 1.4
implementation of .net and the .net parts of .nio.

Hacking CNI is pretty easy compared to JNI, are there any guidelines
about how to make things portable between GCJ and Classpath?

Do the GCJ people keep their CNI interfaces and link with abstracted
C modules which are also linked by Classpath's JNI?

Or do you guys just not bother merging the native code?


Nic

___
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath



Chained Exceptions and StackTraceElement support

2001-07-09 Thread Mark Wielaard

Hi,

The 1.4 spec finally defines a generic Exception chaining mechanism
so you don't have to implement this in an ad hoc way for every project.
It also defines a general StackTraceElement that can be used to inspect
the call stack of an exception. I have seen people do this by parsing the
output of printStackTrace which is clever, but not really portable or
reliably.

The attached patch implements the Java side of this. I am not going to
check this in because I have not yet looked at the serialization issues.
It is attached so that people know what I am working on.

I was hoping that we could use the java version of printStackTrace and
let the VM only handle the fillInStackTrace() - StackTraceElement side
of things. This might be doable for japhar as far as I can understand the
code. But for libgcj this might be a bit more difficuly since it seems
to use external programs (addr2line and c++filt) through pipes to get
and print this information.

Cheers,

Mark
-- 
Stuff to read:
http://www.toad.com/gnu/whatswrong.html
  What's Wrong with Copy Protection, by John Gilmore


Index: java/lang/ClassNotFoundException.java
===
RCS file: /cvs/classpath/java/lang/ClassNotFoundException.java,v
retrieving revision 1.5
diff -u -u -r1.5 ClassNotFoundException.java
--- java/lang/ClassNotFoundException.java   2000/03/16 23:31:21 1.5
+++ java/lang/ClassNotFoundException.java   2001/07/10 00:45:59
@@ -31,10 +31,11 @@
 import java.io.ObjectOutputStream;
 import java.io.ObjectInputStream;
 import java.io.IOException;
-import java.io.PrintStream;
-import java.io.PrintWriter;
 
 /**
+ * Thrown when a class represented by a String could not be found by either
+ * codeClass.forName()/code, codeClassLoader.findSystemClass()/code
+ * or codeClassLoader.loadClass()/code.
  * Exceptions may be thrown by one part of a Java program and caught
  * by another in order to deal with exceptional conditions.  This 
  * exception can by thrown by specific methods of codeClassLoader/code
@@ -93,50 +94,16 @@
 }
 
   /**
-   * Print a stack trace of the exception that occurred.
-   */
-  public void printStackTrace()
-{
-  if (ex == null)
-{
-  super.printStackTrace();
-}
-  else
-{
-  ex.printStackTrace();
-}
-}
-
-  /**
-   * Print a stack trace of the exception that occurred to 
-   * the specified codePrintStream/code.
-   */
-  public void printStackTrace(PrintStream ps)
-{
-  if (ex == null)
-{
-  super.printStackTrace(ps);
-}
-  else
-{
-  ex.printStackTrace(ps);
-}
-}
-
-  /**
-   * Print a stack trace of the exception that occurred to 
-   * the specified codePrintWriter/code.
+   * Returns the exception which occurred while loading the class, 
+   * otherwise returns null.
+   * Returns the same as codegetException()/code to support the general
+   * exception chaining mechanism of 1.4.
+   * 
+   * @since JDK 1.4
*/
-  public void printStackTrace(PrintWriter pw)
+  public Throwable getCause()
 {
-  if (ex == null)
-{
-  super.printStackTrace(pw);
-}
-  else
-{
-  ex.printStackTrace(pw);
-}
+  return ex;
 }
 
   /**
Index: java/lang/Error.java
===
RCS file: /cvs/classpath/java/lang/Error.java,v
retrieving revision 1.4
diff -u -u -r1.4 Error.java
--- java/lang/Error.java2001/03/11 15:52:38 1.4
+++ java/lang/Error.java2001/07/10 00:45:59
@@ -55,6 +55,8 @@
 
   /**
* Create an error without a message.
+   * The cause will not be initialized which means it can be set later by
+   * calling codeinitCause()/code.
*/
   public Error()
 {
@@ -63,9 +65,34 @@
 
   /**
* Create an error with a message.
+   * The cause will not be initialized which means it can be set later by
+   * calling codeinitCause()/code.
*/
   public Error(String s)
 {
   super(s);
+}
+
+  /**
+   * Create an error with a cause.
+   * If the cause is not null the message will be set to the result of calling
+   * codetoString()/code on the cause otherwise the message will be null.
+   *
+   * @since 1.4
+   */
+  public Error(Throwable c)
+{
+  super(c);
+}
+
+  /**
+   * Create an error with a cause and a message.
+   * Both parameters may be null.
+   *
+   * @since 1.4
+   */
+  public Error(String s, Throwable c)
+{
+  super(s, c);
 }
 }
Index: java/lang/Exception.java
===
RCS file: /cvs/classpath/java/lang/Exception.java,v
retrieving revision 1.6
diff -u -u -r1.6 Exception.java
--- java/lang/Exception.java2001/03/11 15:52:38 1.6
+++ java/lang/Exception.java2001/07/10 00:45:59
@@ -51,6 +51,8 @@
 
   /**
* Create an exception without a message.
+   * The cause will not be