Commit 93f7aeea by Tom Tromey Committed by Tom Tromey

natString.cc (init): Handle case where DONT_COPY is true and OFFSET!=0.

	* java/lang/natString.cc (init): Handle case where DONT_COPY is
	true and OFFSET!=0.
	* java/lang/String.java (String(char[],int,int,boolean): New
	constructor.
	* java/lang/Long.java: Imported new version from Classpath.
	* java/lang/Number.java: Likewise.
	* java/lang/Integer.java: Likewise.
	* java/lang/Long.java: Likewise.
	* java/lang/Float.java: Likewise.
	* java/lang/Boolean.java: Likewise.
	* java/lang/Double.java: Likewise.
	* java/lang/Void.java: Likewise.

From-SVN: r54595
parent a8fa30f3
2002-06-13 Tom Tromey <tromey@redhat.com>
* java/lang/natString.cc (init): Handle case where DONT_COPY is
true and OFFSET!=0.
* java/lang/String.java (String(char[],int,int,boolean): New
constructor.
* java/lang/Long.java: Imported new version from Classpath.
* java/lang/Number.java: Likewise.
* java/lang/Integer.java: Likewise.
* java/lang/Long.java: Likewise.
* java/lang/Float.java: Likewise.
* java/lang/Boolean.java: Likewise.
* java/lang/Double.java: Likewise.
* java/lang/Void.java: Likewise.
2002-06-12 Tom Tromey <tromey@redhat.com> 2002-06-12 Tom Tromey <tromey@redhat.com>
* java/io/natFilePosix.cc (getCanonicalPath): Treat "" like ".". * java/io/natFilePosix.cc (getCanonicalPath): Treat "" like ".".
......
/* java.lang.Number /* Number.java =- abstract superclass of numeric objects
Copyright (C) 1998, 2001 Free Software Foundation, Inc. Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify ...@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option) the Free Software Foundation; either version 2, or (at your option)
any later version. any later version.
GNU Classpath is distributed in the hope that it will be useful, but GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
...@@ -41,54 +41,91 @@ package java.lang; ...@@ -41,54 +41,91 @@ package java.lang;
import java.io.Serializable; import java.io.Serializable;
/** /**
** Number is a generic superclass of all the numeric classes, namely * Number is a generic superclass of all the numeric classes, including
** <code>Byte</code>, <code>Short</code>, <code>Integer</code>, * the wrapper classes {@link Byte}, {@link Short}, {@link Integer},
** <code>Long</code>, <code>Float</code>, and <code>Double</code>. * {@link Long}, {@link Float}, and {@link Double}. Also worth mentioning
** * are the classes in {@link java.math}.
** It provides ways to convert from any one value to any other. *
** * It provides ways to convert numeric objects to any primitive.
** @author Paul Fisher *
** @author John Keiser * @author Paul Fisher
** @author Warren Levy * @author John Keiser
** @since JDK1.0 * @author Warren Levy
**/ * @author Eric Blake <ebb9@email.byu.edu>
* @since 1.0
* @status updated to 1.4
*/
public abstract class Number implements Serializable public abstract class Number implements Serializable
{ {
/** Return the value of this <code>Number</code> as a <code>byte</code>. /**
** @return the value of this <code>Number</code> as a <code>byte</code>. * Compatible with JDK 1.1+.
**/ */
public byte byteValue() private static final long serialVersionUID = -8742448824652078965L;
{
return (byte) intValue();
}
/** Return the value of this <code>Number</code> as a <code>short</code>. /**
** @return the value of this <code>Number</code> as a <code>short</code>. * Table for calculating digits, used in Character, Long, and Integer.
**/ */
public short shortValue() static final char[] digits = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z'
};
/**
* The basic constructor (often called implicitly).
*/
public Number()
{ {
return (short) intValue();
} }
/** Return the value of this <code>Number</code> as an <code>int</code>. /**
** @return the value of this <code>Number</code> as an <code>int</code>. * Return the value of this <code>Number</code> as an <code>int</code>.
**/ *
* @return the int value
*/
public abstract int intValue(); public abstract int intValue();
/** Return the value of this <code>Number</code> as a <code>long</code>. /**
** @return the value of this <code>Number</code> as a <code>long</code>. * Return the value of this <code>Number</code> as a <code>long</code>.
**/ *
* @return the long value
*/
public abstract long longValue(); public abstract long longValue();
/** Return the value of this <code>Number</code> as a <code>float</code>. /**
** @return the value of this <code>Number</code> as a <code>float</code>. * Return the value of this <code>Number</code> as a <code>float</code>.
**/ *
* @return the float value
*/
public abstract float floatValue(); public abstract float floatValue();
/** Return the value of this <code>Number</code> as a <code>float</code>. /**
** @return the value of this <code>Number</code> as a <code>float</code>. * Return the value of this <code>Number</code> as a <code>float</code>.
**/ *
* @return the double value
*/
public abstract double doubleValue(); public abstract double doubleValue();
private static final long serialVersionUID = -8742448824652078965L; /**
* Return the value of this <code>Number</code> as a <code>byte</code>.
*
* @return the byte value
* @since 1.1
*/
public byte byteValue()
{
return (byte) intValue();
}
/**
* Return the value of this <code>Number</code> as a <code>short</code>.
*
* @return the short value
* @since 1.1
*/
public short shortValue()
{
return (short) intValue();
}
} }
/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation /* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
This file is part of libgcj. This file is part of libgcj.
...@@ -112,6 +112,12 @@ public final class String implements Serializable, Comparable, CharSequence ...@@ -112,6 +112,12 @@ public final class String implements Serializable, Comparable, CharSequence
init(data, offset, count, false); init(data, offset, count, false);
} }
// This is used by Integer.toString(int,int).
String (char[] data, int offset, int count, boolean dont_copy)
{
init(data, offset, count, dont_copy);
}
public String (byte[] byteArray) public String (byte[] byteArray)
{ {
this (byteArray, 0, byteArray.length); this (byteArray, 0, byteArray.length);
......
/* java.lang.Void /* Void.class - defines void.class
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify ...@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option) the Free Software Foundation; either version 2, or (at your option)
any later version. any later version.
GNU Classpath is distributed in the hope that it will be useful, but GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
...@@ -38,30 +38,29 @@ exception statement from your version. */ ...@@ -38,30 +38,29 @@ exception statement from your version. */
package java.lang; package java.lang;
/* Written using "Java Class Libraries", 2nd edition, plus online
* API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Complete.
*/
/** /**
* Void is a placeholder class so that the variable Void.TYPE can be * Void is a placeholder class so that the variable <code>Void.TYPE</code>
* supported for reflection return types. * (also available as <code>void.class</code>) can be supported for
* reflection return types.
*
* <p>This class could be Serializable, but that is up to Sun.
* *
* @author Paul Fisher * @author Paul Fisher
* @author John Keiser * @author John Keiser
* @author Per Bothner <bothner@cygnus.com> * @author Eric Blake <ebb9@email.byu.edu>
* @since JDK1.1 * @since 1.1
* @status updated to 1.4
*/ */
public final class Void public final class Void
{ {
/** /**
* The return type <code>void</code> is represented by this * The return type <code>void</code> is represented by this
* <code>Class</code> object. * <code>Class</code> object.
*/ */
public static final Class TYPE = VMClassLoader.getPrimitiveClass('V'); public static final Class TYPE = VMClassLoader.getPrimitiveClass('V');
/** /**
* Don't allow Void objects to be made. * Void is non-instantiable.
*/ */
private Void() { } private Void() { }
} }
...@@ -456,9 +456,8 @@ java::lang::String::init(jcharArray chars, jint offset, jint count, ...@@ -456,9 +456,8 @@ java::lang::String::init(jcharArray chars, jint offset, jint count,
} }
else else
{ {
JvAssert (offset == 0);
array = chars; array = chars;
pdst = elements (array); pdst = &(elements(array)[offset]);
} }
data = array; data = array;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment