diff options
author | Jochen Hoenicke <jochen@gnu.org> | 2001-03-05 10:16:45 +0000 |
---|---|---|
committer | Jochen Hoenicke <jochen@gnu.org> | 2001-03-05 10:16:45 +0000 |
commit | 11aa6a4c5cb8cb25ad3858d47abdf18d87a58453 (patch) | |
tree | 614a212981622c6af8e006864734910104026d3d | |
parent | 034bd9e7702327d1798686520b3644edaf0ae5ce (diff) | |
download | classpath-11aa6a4c5cb8cb25ad3858d47abdf18d87a58453.tar.gz |
* java/util/TreeMap.java (writeObject): Use defaultWriteObject()
instead of the new JDK1.2 API. This is simpler and makes
back-porting the classes to JDK1.1 trivial.
(readObject): likewise.
* lib/mkcollections.pl.in (mymkdir): Give the permission parameter
to mkdir. Simplified the method.
(convert): Removed the hacks to convert the JDK1.2 api to 1.1, as
they are no longer necessary.
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | java/util/TreeMap.java | 7 | ||||
-rwxr-xr-x | lib/mkcollections.pl.in | 60 |
3 files changed, 28 insertions, 50 deletions
@@ -1,3 +1,14 @@ +2001-03-05 Jochen Hoenicke <jochen@gnu.org> + + * java/util/TreeMap.java (writeObject): Use defaultWriteObject() + instead of the new JDK1.2 API. This is simpler and makes + back-porting the classes to JDK1.1 trivial. + (readObject): likewise. + * lib/mkcollections.pl.in (mymkdir): Give the permission parameter + to mkdir. Simplified the method. + (convert): Removed the hacks to convert the JDK1.2 api to 1.1, as + they are no longer necessary. + 2001-02-22 Bryce McKinlay <bryce@albatross.co.nz> Fix for PR java/2040: diff --git a/java/util/TreeMap.java b/java/util/TreeMap.java index c7002e77e..59d6079e3 100644 --- a/java/util/TreeMap.java +++ b/java/util/TreeMap.java @@ -776,9 +776,7 @@ public class TreeMap extends AbstractMap private void writeObject(ObjectOutputStream out) throws IOException { - ObjectOutputStream.PutField fields = out.putFields(); - fields.put("comparator", comparator); - out.writeFields(); + out.defaultWriteObject(); Node node = firstNode(); out.writeInt(size); @@ -794,8 +792,7 @@ public class TreeMap extends AbstractMap private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { - ObjectInputStream.GetField fields = in.readFields(); - comparator = (Comparator) fields.get("comparator", null); + in.defaultReadObject(); int size = in.readInt(); putFromObjStream(in, size, true); } diff --git a/lib/mkcollections.pl.in b/lib/mkcollections.pl.in index 5e0125bb5..ea34a39f2 100755 --- a/lib/mkcollections.pl.in +++ b/lib/mkcollections.pl.in @@ -33,7 +33,6 @@ my @javautilclasses=qw(AbstractCollection ArrayList Arrays BasicMapEntry - Bucket List Collection Collections @@ -63,15 +62,20 @@ my %imports = ( "Collections" => [ "Enumeration" ], "Vector" => [ "Enumeration" ]); -sub mymkdir ($) { +sub mymkdir ($) + { my ($dir) = @_; - $dir =~ /^(.*)\/\w+$/ and - $dir = "$1"; - if (! (-d "$dir")) { - my $ret = mkdir ("$dir"); - if (!($ret)) { mymkdir ("$dir"); mkdir ("$dir"); } - } -} + if ($dir =~ /^(.*)\/\w+$/) + { + $parentdir = "$1"; + if (! (-d $parentdir)) + { + mymkdir ($parentdir); + } + } + print "$dir"; + mkdir ($dir, 0777); + } sub convert($$$) { my ($file, $infile, $outfile) = @_; @@ -81,9 +85,8 @@ sub convert($$$) { my $dir = "$outfile"; $dir =~ /^(.*)\/\S+\.java$/ and $dir = "$1"; - if (! (-d "$dir")) { - my $ret = mkdir("$dir"); - if (!($ret)) { mymkdir ("$dir"); mkdir ("$dir"); } + if (! (-d $dir)) { + mymkdir ($dir); } open (OUTPUT, ">$outfile") || die "Could not open ", $outfile, " for writing\n"; @@ -107,39 +110,6 @@ EOF $_ =~ s/abstract (interface)/$1/g; - if ($file eq "ArrayList") { - # ArrayList makes heavy use of PutField/GetField. - # change it. - $_ =~ s/_iSize/size/g; - $_ =~ s/_arData/data/g; - } - if ($file eq "TreeMap") { - $_ =~ s/_oComparator/comparator/g; - $_ =~ s/(RBNode _oRoot|int _iSize|int _iModCount)/transient $1/; - } - if ($file eq "Vector") { - $_ =~ s/(\s+)return (\w+)\.delete\((.*), x\)\./$1$2.setLength($3);\n${1}return $2./g; - } - - if ($file eq "ArrayList" - || $file eq "TreeMap" - || $file eq "Hashtable") { - if ($_ =~ /serialPersistentFields/) { - $_ = <INPUT> while !($_ =~ /\}/); - next; - } - - $_ =~ /^(\s+)(.*\W)?(\w+).readFields/ and - $_ = "$1$3.defaultReadObject();\n"; - $_ =~ /^(\s+)(.*\W)?(\w+).writeFields/ and - $_ = "$1$3.defaultWriteObject();\n"; - - if ($_ =~ /[io]Fields/) { - $_ = <INPUT> while !($_ =~ /;/); - next; - } - } - print OUTPUT $_; if ($_ =~ /^package $destPkg;$/ && exists $imports{$file}) { |