diff options
author | Antonio Cunei <antonio.cunei@epfl.ch> | 2009-11-24 17:30:44 +0000 |
---|---|---|
committer | Antonio Cunei <antonio.cunei@epfl.ch> | 2009-11-24 17:30:44 +0000 |
commit | 839d0ee5ec9c27e2e5da6bab6f03c8a95e90a109 (patch) | |
tree | 613ed692570fb5891f57e76854d9ff4af8ed13d1 /test/files/jvm | |
parent | 5f71b9208404015f425f30a0b4b3f4b3df4ec83f (diff) | |
download | scala-839d0ee5ec9c27e2e5da6bab6f03c8a95e90a109.tar.gz scala-839d0ee5ec9c27e2e5da6bab6f03c8a95e90a109.tar.bz2 scala-839d0ee5ec9c27e2e5da6bab6f03c8a95e90a109.zip |
Merged revisions 19624,19629-19630,19645,19651,...
Merged revisions
19624,19629-19630,19645,19651,19655-19660,19666-19668,19670,19673-19679,
19683-19685,19688,19692,19695-19700,19706-19707,19717-19719,19723-19724,
19726,19730,19735-19740,19742-19744,19746-19759,19762-19764,19767-19769,
19773,19776,19781,19787,19789,19792-19793,19798-19800,19803-19804,19806-
19808,19813-19815,19818-19820,19824 via svnmerge from
https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk
........
r19624 | moors | 2009-11-13 13:17:50 +0100 (Fri, 13 Nov 2009) | 2 lines
fixed #1236
another Symbol::tpe bites the dust (should'be been tpeHK)
........
r19629 | rytz | 2009-11-13 16:53:11 +0100 (Fri, 13 Nov 2009) | 1 line
review board scipt
........
r19630 | rytz | 2009-11-13 17:10:35 +0100 (Fri, 13 Nov 2009) | 1 line
updates to review script
........
r19645 | odersky | 2009-11-13 18:31:12 +0100 (Fri, 13 Nov 2009) | 1 line
Fixes #1477 by requiring that abstract types with non-volatile upper
bounds cannot be overridden by volatile types. ........ r19651 |
extempore | 2009-11-14 19:02:10 +0100 (Sat, 14 Nov 2009) | 5 lines
Fixes and test cases for #2087 and #2400. This required fixing a
long-standing bug in fjbg and recompiling fjbg.jar, which had the side
effect of revealing that the current fjbg jar had never been recompiled
with target 1.5, so now it's smaller and (I imagine) faster. ........
r19655 | odersky | 2009-11-15 12:14:57 +0100 (Sun, 15 Nov 2009) | 2
lines
Fixed #2848 and #2630; Improvements in equality speed ........ r19656
| odersky | 2009-11-15 14:56:21 +0100 (Sun, 15 Nov 2009) | 2 lines
Fixed #1459
........
r19657 | odersky | 2009-11-15 15:17:48 +0100 (Sun, 15 Nov 2009) | 2 lines
Added benchmarks with results for equality.
........
r19658 | milessabin | 2009-11-15 16:46:52 +0100 (Sun, 15 Nov 2009) | 1 line
Fixed #2627. Also ensure that a non-empty dependencies file is created
on the first build. ........ r19659 | extempore | 2009-11-15 19:08:45
+0100 (Sun, 15 Nov 2009) | 3 lines
Tweaked a test which has been regularly failing due to heap
exhaustion, although what it's supposed to be testing is stack
utilization. ........ r19660 | milessabin | 2009-11-15 21:57:46 +0100
(Sun, 15 Nov 2009) | 1 line
Corrected help syntax for -Ybuilder-debug.
........
r19666 | milessabin | 2009-11-16 11:17:01 +0100 (Mon, 16 Nov 2009) | 1 line
Fixed #2627.
........
r19667 | rytz | 2009-11-16 11:45:54 +0100 (Mon, 16 Nov 2009) | 1 line
review requests can now be created outside a checkout ........ r19668
| rytz | 2009-11-16 11:55:59 +0100 (Mon, 16 Nov 2009) | 1 line
another minor change to teh review script
........
r19670 | odersky | 2009-11-16 13:31:40 +0100 (Mon, 16 Nov 2009) | 2 lines
Fixed #2323; made Pickler do the right thing.
........
r19673 | moors | 2009-11-16 18:44:25 +0100 (Mon, 16 Nov 2009) | 1 line
test cases in pending
........
r19674 | dragos | 2009-11-16 19:24:40 +0100 (Mon, 16 Nov 2009) | 2 lines
Faster optimizer by caching successors/predecessors in basic blocks,
and better lub for icode ........ r19675 | extempore | 2009-11-16
22:30:22 +0100 (Mon, 16 Nov 2009) | 1 line
Minor pickler organization stemming from optimizer appeasement.
........ r19676 | extempore | 2009-11-16 22:30:36 +0100 (Mon, 16 Nov
2009) | 2 lines
Some organization & duplication removal in GenICode stemming from
optimizer appeasement. ........ r19677 | extempore | 2009-11-16 22:30:54
+0100 (Mon, 16 Nov 2009) | 2 lines
A lot of minor code adjustments to ease the burden on the optimizer,
and various cleanups encountered along the way. ........ r19678 |
extempore | 2009-11-16 22:31:07 +0100 (Mon, 16 Nov 2009) | 2 lines
Some organization & duplication removal in RefChecks stemming from
optimizer appeasement. ........ r19679 | extempore | 2009-11-16 22:56:00
+0100 (Mon, 16 Nov 2009) | 1 line
Fix for #2647.
........
r19683 | extempore | 2009-11-17 05:51:43 +0100 (Tue, 17 Nov 2009) | 1 line
Fix and test case for #2636.
........
r19684 | extempore | 2009-11-17 06:25:48 +0100 (Tue, 17 Nov 2009) | 2 lines
Contents of scala.Math moved into scala.math package object, and
scala.Math deprecated. Also a couple janitorial cleanups. ........
r19685 | milessabin | 2009-11-17 10:04:00 +0100 (Tue, 17 Nov 2009) | 1
line
More String.isEmpty breakage.
........
r19688 | odersky | 2009-11-17 14:12:31 +0100 (Tue, 17 Nov 2009) | 1 line
Allow implicit modifier on single-parameter function literals. Fixes
and closes #1492. ........ r19692 | extempore | 2009-11-17 21:51:23
+0100 (Tue, 17 Nov 2009) | 1 line
Partial fix for #2625.
........
r19695 | extempore | 2009-11-18 01:18:58 +0100 (Wed, 18 Nov 2009) | 11 lines
Removing bits from the library which shouldn't make the 2.8 cut.
Removed outright:
util.Hashable: unused and I have a better plan for this net.Utility:
class created to accomodate expansion which never materialized
reflect.Invocation: doesn't go far enough, needs love it won't find
right now reflect.RichClass: same as Invocation
Moved into compiler:
util.ScalaClassLoader: too useful to lose, not done enough to ship
........ r19696 | extempore | 2009-11-18 01:36:26 +0100 (Wed, 18 Nov
2009) | 1 line
More minor removals and some cleanups of !!!s and XXXs. ........
r19697 | dcaoyuan | 2009-11-18 05:35:07 +0100 (Wed, 18 Nov 2009) | 1
line
Fixed #2631
........
r19698 | dcaoyuan | 2009-11-18 05:36:59 +0100 (Wed, 18 Nov 2009) | 1 line
to fix varies conditions of removed source/class files that were
previously recorded in .scala_dependencies. ........ r19699 | extempore
| 2009-11-18 06:41:16 +0100 (Wed, 18 Nov 2009) | 3 lines
More deprecation work. Removes most elements which have been
deprecated since 2.7.2 (still except for lower case primitive type
aliases) and removes every deprecated method which has never shipped in
a release. ........ r19700 | rytz | 2009-11-18 11:19:30 +0100 (Wed, 18
Nov 2009) | 1 line
recompiled msil.jar, it refered to scala.Math$
........
r19706 | extempore | 2009-11-18 15:45:11 +0100 (Wed, 18 Nov 2009) | 3 lines
Fixed a bug in Range which was causing take and drop to overflow and
return empty if the argument was larger than the actual length
of the Range and arg * step > MaxInt.
........
r19707 | dcaoyuan | 2009-11-18 15:46:01 +0100 (Wed, 18 Nov 2009) | 1 line
Fixed #2645
........
r19717 | extempore | 2009-11-18 23:06:03 +0100 (Wed, 18 Nov 2009) | 3 lines
Finally completed the incredibly tedious task of removing the lower
case primitive aliases from Predef. Had to rebuild msil.jar along the
way. ........ r19718 | extempore | 2009-11-18 23:43:54 +0100 (Wed, 18
Nov 2009) | 2 lines
New starr based on r19717 since I'm finding the current starr doesn't
have TupleN.zipped fully working. ........ r19719 | extempore |
2009-11-19 00:24:23 +0100 (Thu, 19 Nov 2009) | 2 lines
More deprecation soothing. Soon we'll be down to a double-digit
warning count. ........ r19723 | extempore | 2009-11-19 05:59:46 +0100
(Thu, 19 Nov 2009) | 2 lines
Restoring an embarassingly large quantity of deprecated methods whose
time had not yet come. ........ r19724 | dcaoyuan | 2009-11-19 09:24:37
+0100 (Thu, 19 Nov 2009) | 1 line
Path.parent now returns Path instead of Option[Path], and it prefers
relative path. ........ r19726 | rytz | 2009-11-19 14:44:15 +0100 (Thu,
19 Nov 2009) | 1 line
closes #2670. the target-annotations can now be placed on annotation
classes as well ........ r19730 | extempore | 2009-11-19 21:31:46 +0100
(Thu, 19 Nov 2009) | 2 lines
Deprecation patrol exercises the new capabilities in Tuple2.zipped
among other exciting no-ops. ........ r19735 | extempore | 2009-11-20
01:49:58 +0100 (Fri, 20 Nov 2009) | 1 line
Fix for infinite loop in StringBuilder pointed out by dpp. ........
r19736 | extempore | 2009-11-20 04:50:12 +0100 (Fri, 20 Nov 2009) | 1
line
Slightly more fixy fix than the previous fix.
........
r19737 | plocinic | 2009-11-20 10:04:04 +0100 (Fri, 20 Nov 2009) | 1 line
closes #1422
........
r19738 | odersky | 2009-11-20 14:57:22 +0100 (Fri, 20 Nov 2009) | 1 line
Simplifiations in collections libraries, enabled by introduction of
Self type in TraversableLike. ........ r19739 | odersky | 2009-11-20
14:58:36 +0100 (Fri, 20 Nov 2009) | 1 line
new test
........
r19740 | extempore | 2009-11-20 16:16:45 +0100 (Fri, 20 Nov 2009) | 4 lines
More world-shaking deprecation work. Using the scala.math package
object, updating some @deprecated messages to give realistic
alternatives, properly resolving the semantic mismatch between List.--
and diff, its once-recommended but inequivalent alternative. ........
r19742 | prokopec | 2009-11-20 17:11:19 +0100 (Fri, 20 Nov 2009) | 1
line
PriorityQueue fixed, should work ok now.
........
r19743 | prokopec | 2009-11-20 17:11:53 +0100 (Fri, 20 Nov 2009) | 1 line
Priority queue test.
........
r19744 | prokopec | 2009-11-20 17:12:48 +0100 (Fri, 20 Nov 2009) | 1 line
Priority queue test, updated.
........
r19746 | prokopec | 2009-11-20 18:25:08 +0100 (Fri, 20 Nov 2009) | 1 line
Changes made in the clean up phase - now the symbols get interned during classload for each symbol literal - references to them reside in static fields. These static fields get initialized in static constructors - the java backend will now identify ctors with static flags and generate a static initializer containing the necessary code.
........
r19747 | prokopec | 2009-11-20 18:29:39 +0100 (Fri, 20 Nov 2009) | 1 line
Removed a couple of unneeded comments.
........
r19748 | extempore | 2009-11-20 18:39:49 +0100 (Fri, 20 Nov 2009) | 3 lines
Deprecated the Tuple(...) methods in Predef, but at the same time
extended the overload out to 22 and moved them into the scala package
object. ........ r19749 | odersky | 2009-11-20 19:02:42 +0100 (Fri, 20
Nov 2009) | 1 line
Closed #2641
........
r19750 | prokopec | 2009-11-20 19:06:41 +0100 (Fri, 20 Nov 2009) | 1 line
Commented out anonymous function invocation for which Hudson was
complaining it couldn't find the classdef. ........ r19751 | extempore |
2009-11-20 19:08:57 +0100 (Fri, 20 Nov 2009) | 2 lines
Subtly altered implementation of iterator which does not go into an
infinite loop when deprecated "append" is replaced with ++. ........
r19752 | extempore | 2009-11-20 19:09:08 +0100 (Fri, 20 Nov 2009) | 2
lines
Tweak to Iterator.++ to keep it from going into an infinite loop on x
++ x. ........ r19753 | prokopec | 2009-11-20 19:17:13 +0100 (Fri, 20
Nov 2009) | 1 line
Trying to get the test to pass on the server.
........
r19754 | extempore | 2009-11-20 19:35:52 +0100 (Fri, 20 Nov 2009) | 1 line
Eliminated warning about Tuple2 and Tuple3 importing Traversable.
........ r19755 | extempore | 2009-11-20 19:59:30 +0100 (Fri, 20 Nov
2009) | 1 line
More deprecation avoidance and some minor smoothings. ........ r19756
| moors | 2009-11-20 20:25:32 +0100 (Fri, 20 Nov 2009) | 3 lines
closes #2585: generate more precise Java generic signatures for
classes nested in parametric outer classes fix based on review by Martin
baseType is your friend ........ r19757 | michelou | 2009-11-20 21:19:41
+0100 (Fri, 20 Nov 2009) | 2 lines
updated/extended serialization tests
........
r19758 | extempore | 2009-11-20 21:37:12 +0100 (Fri, 20 Nov 2009) | 1 line
Expanding the warning cleansing into -unchecked territory. ........
r19759 | odersky | 2009-11-20 22:02:23 +0100 (Fri, 20 Nov 2009) | 2
lines
Closed #2642
........
r19762 | extempore | 2009-11-21 18:24:29 +0100 (Sat, 21 Nov 2009) | 1 line
Applied performance patch and test case from ijuma; closes #2526.
........ r19763 | extempore | 2009-11-21 20:58:05 +0100 (Sat, 21 Nov
2009) | 2 lines
Partially addresses #2626 - pattern matcher no longer depends
on drop(n) behavior if n < 0.
........
r19764 | extempore | 2009-11-22 00:55:06 +0100 (Sun, 22 Nov 2009) | 2 lines
Cleanup of Cleanup. Finally straightening out a bunch of duplicated
boxing code in the right location. ........ r19767 | extempore |
2009-11-22 02:26:04 +0100 (Sun, 22 Nov 2009) | 2 lines
Fix (I think) for recently introduced MSIL breakage stemming from
eliminating deprecation warnings. ........ r19768 | odersky | 2009-11-22
12:32:26 +0100 (Sun, 22 Nov 2009) | 2 lines
Made implicit resolution compatible with numeric conformance. ........
r19769 | odersky | 2009-11-22 13:28:57 +0100 (Sun, 22 Nov 2009) | 2
lines
Closed #2635
........
r19773 | extempore | 2009-11-22 17:07:46 +0100 (Sun, 22 Nov 2009) | 1 line
Removed all traces of Boxed*Array. New starr.
........
r19776 | odersky | 2009-11-22 19:13:34 +0100 (Sun, 22 Nov 2009) | 2 lines
Moved failing test due to fix of #2635 to pending. ........ r19781 |
prokopec | 2009-11-22 23:47:08 +0100 (Sun, 22 Nov 2009) | 2 lines
Priority queue reverse is undefined - overriden to throw an exception.
Reverse iterator seems to have sense - it is overriden and is defined, and some methods in SeqLike are implemented in terms of it.
........
r19787 | extempore | 2009-11-23 13:51:56 +0100 (Mon, 23 Nov 2009) | 1 line
A couple more warning fixes I meant to check in with r19758. ........
r19789 | dragos | 2009-11-23 14:58:56 +0100 (Mon, 23 Nov 2009) | 2 lines
== for specialized types will not cause boxing anymore ........ r19792
| odersky | 2009-11-23 15:45:44 +0100 (Mon, 23 Nov 2009) | 1 line
Closed #1226. Added new test cases.
........
r19793 | malayeri | 2009-11-23 16:16:25 +0100 (Mon, 23 Nov 2009) | 1 line
Closed #2552. Changed Iterator.takeWhile and Iterator.filter to avoid
recomputing predicate in next and hasNext methods. ........ r19798 |
odersky | 2009-11-23 18:50:54 +0100 (Mon, 23 Nov 2009) | 1 line
Partial fix for #2683
........
r19799 | odersky | 2009-11-23 19:12:34 +0100 (Mon, 23 Nov 2009) | 1 line
Closed #1545
........
r19800 | extempore | 2009-11-23 22:03:51 +0100 (Mon, 23 Nov 2009) | 4 lines
Partitioned scala.Math and scala.math a little bit. ALL_CAP aliases
are deprecated and only in Math. Formerly unavailable members of
java.lang.Math which were added in 1.5 are now available in scala.math.
........ r19803 | extempore | 2009-11-24 01:08:32 +0100 (Tue, 24 Nov
2009) | 2 lines
Some more XML cleanups. I'm seeing if I can break the compiler
dependency on scala.util.automata. ........ r19804 | milessabin |
2009-11-24 02:13:01 +0100 (Tue, 24 Nov 2009) | 1 line
Improved completion for locals and import.
........
r19806 | moors | 2009-11-24 10:09:49 +0100 (Tue, 24 Nov 2009) | 5 lines
close #2665 and close #2667: use weak conformance in polymorphic case
of isApplicable reviewed by: odersky
exprTypeArgs now takes a comparison function: isWeaklyCompatible is
passed in isApplicable's typesCompatible (to mimic what happens in the
monomorphic case) Martin: please review as this is different from my
original proposal (that one broke type inference, this one passes all
tests and does not slow down quick.comp) ........ r19807 | moors |
2009-11-24 11:15:58 +0100 (Tue, 24 Nov 2009) | 1 line
pending test: see #2660, #2691
........
r19808 | moors | 2009-11-24 11:19:08 +0100 (Tue, 24 Nov 2009) | 1 line
close #2626 as specified by Martin
........
r19813 | odersky | 2009-11-24 15:40:04 +0100 (Tue, 24 Nov 2009) | 1 line
relaxed rule requiring `override` modifiers so that it's OK if self
type contains overridden symbol. ........ r19814 | odersky | 2009-11-24
16:50:06 +0100 (Tue, 24 Nov 2009) | 1 line
Closed #2629 #2639 #2669
........
r19815 | odersky | 2009-11-24 16:57:17 +0100 (Tue, 24 Nov 2009) | 1 line
Closed #2696
........
r19818 | odersky | 2009-11-24 17:07:49 +0100 (Tue, 24 Nov 2009) | 1 line
Closed #2698
........
r19819 | odersky | 2009-11-24 17:12:18 +0100 (Tue, 24 Nov 2009) | 1 line
Closed #2664
........
r19820 | prokopec | 2009-11-24 17:35:09 +0100 (Tue, 24 Nov 2009) | 1 line
Added reverse capabilities to PriorityQueue. Seems to work well - tests pass.
........
r19824 | phaller | 2009-11-24 18:11:45 +0100 (Tue, 24 Nov 2009) | 1 line
Made mutable.OpenHashMap a MapLike. Closes #2681. ........
Diffstat (limited to 'test/files/jvm')
-rw-r--r-- | test/files/jvm/serialization.check | 229 | ||||
-rw-r--r-- | test/files/jvm/serialization.scala | 552 | ||||
-rw-r--r-- | test/files/jvm/stringbuilder.scala | 4 | ||||
-rw-r--r-- | test/files/jvm/t2585.check | 0 | ||||
-rw-r--r-- | test/files/jvm/t2585/Test.java | 16 | ||||
-rw-r--r-- | test/files/jvm/t2585/genericouter.scala | 25 |
6 files changed, 549 insertions, 277 deletions
diff --git a/test/files/jvm/serialization.check b/test/files/jvm/serialization.check index da11d7c7f0..f1b5b10ec6 100644 --- a/test/files/jvm/serialization.check +++ b/test/files/jvm/serialization.check @@ -1,126 +1,209 @@ -x0 = List(1, 2, 3) -y0 = List(1, 2, 3) -x0 eq y0: false - y0 eq x0: false -x0 equals y0: true - y0 equals x0: true +a1 = Array[1,2,3] +_a1 = Array[1,2,3] +arrayEquals(a1, _a1): true -x1 = List() -y1 = List() -x1 eq y1: true - y1 eq x1: true +c1 = Cell(a) +_c1 = Cell(a) +c1 eq _c1: false, _c1 eq c1: false +c1 equals _c1: true, _c1 equals c1: true -x2 = None -y2 = None -x2 eq y2: true - y2 eq x2: true - -x3 = Array[1,2,3] -y3 = Array[1,2,3] -arrayEquals(x3, y3): true - -x4 = <na> -y4 = <na> -x4(2): 4 - y4(2): 4 - -x5 = 'hello -y5 = 'hello -x5 eq y5: true - y5 eq x5: true -x5 equals y5: true - y5 equals x5: true - -x6 = (BannerLimit,12345) -y6 = (BannerLimit,12345) -x6 eq y6: false - y6 eq x6: false -x6 equals y6: true - y6 equals x6: true +e1 = Left(1) +_e1 = Left(1) +e1 eq _e1: false, _e1 eq e1: false +e1 equals _e1: true, _e1 equals e1: true x7 = RoundingMode y7 = RoundingMode -x7 eq y7: true - y7 eq x7: true -x7 equals y7: true - y7 equals x7: true +x7 eq y7: true, y7 eq x7: true +x7 equals y7: true, y7 equals x7: true x8 = WeekDay y8 = WeekDay -x8 eq y8: true - y8 eq x8: true -x8 equals y8: true - y8 equals x8: true +x8 eq y8: true, y8 eq x8: true +x8 equals y8: true, y8 equals x8: true x9 = UP y9 = UP -x9 eq y9: true - y9 eq x9: true -x9 equals y9: true - y9 equals x9: true +x9 eq y9: true, y9 eq x9: true +x9 equals y9: true, y9 equals x9: true x10 = Monday y10 = Monday -x10 eq y10: true - y10 eq x10: true -x10 equals y10: true - y10 equals x10: true +x10 eq y10: true, y10 eq x10: true +x10 equals y10: true, y10 equals x10: true + +x9 eq x10: false, x10 eq x9: false +x9 equals x10: true, x10 equals x9: true +x9 eq y10: false, y10 eq x9: false +x9 equals y10: true, y10 equals x9: true + +f1 = <na> +_f1 = <na> +f1(2): 4, _f1(2): 4 + +xs0 = List(1, 2, 3) +_xs0 = List(1, 2, 3) +xs0 eq _xs0: false, _xs0 eq xs0: false +xs0 equals _xs0: true, _xs0 equals xs0: true + +xs1 = List() +_xs1 = List() +xs1 eq _xs1: true, _xs1 eq xs1: true + +o1 = None +_o1 = None +o1 eq _o1: true, _o1 eq o1: true + +o2 = Some(1) +_o2 = Some(1) +o2 eq _o2: false, _o2 eq o2: false +o2 equals _o2: true, _o2 equals o2: true + +s1 = 'hello +_s1 = 'hello +s1 eq _s1: true, _s1 eq s1: true +s1 equals _s1: true, _s1 equals s1: true + +t1 = (BannerLimit,12345) +_t1 = (BannerLimit,12345) +t1 eq _t1: false, _t1 eq t1: false +t1 equals _t1: true, _t1 equals t1: true + +x = BitSet(1, 2) +y = BitSet(1, 2) +x equals y: true, y equals x: true + +x = BitSet(2, 3) +y = BitSet(2, 3) +x equals y: true, y equals x: true + +x = Map(2 -> B, 1 -> A, 3 -> C) +y = Map(2 -> B, 1 -> A, 3 -> C) +x equals y: true, y equals x: true -x9 eq x10: false - x10 eq x9: false -x9 equals x10: true - x10 equals x9: true -x9 eq y10: false - y10 eq x9: false -x9 equals y10: true - y10 equals x9: true +x = Set(1, 2) +y = Set(1, 2) +x equals y: true, y equals x: true x = List((buffers,20), (layers,2), (title,3)) y = List((buffers,20), (layers,2), (title,3)) -x equals y: true - y equals x: true +x equals y: true, y equals x: true x = Map(buffers -> 20, layers -> 2, title -> 3) y = Map(buffers -> 20, layers -> 2, title -> 3) -x equals y: true - y equals x: true - -x = BitSet(2, 3) -y = BitSet(2, 3) -x equals y: true - y equals x: true +x equals y: true, y equals x: true x = Set(5, 3) y = Set(5, 3) -x equals y: true - y equals x: true +x equals y: true, y equals x: true x = Queue(a, b, c) y = Queue(a, b, c) -x equals y: true - y equals x: true +x equals y: true, y equals x: true + +x = Range(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) +y = Range(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) +x equals y: true, y equals x: true + +x = NumericRange(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) +y = NumericRange(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) +x equals y: true, y equals x: true + +x = Map(1 -> A, 2 -> B, 3 -> C) +y = Map(1 -> A, 2 -> B, 3 -> C) +x equals y: true, y equals x: true + +x = TreeSet(1, 2, 3) +y = TreeSet(1, 2, 3) +x equals y: true, y equals x: true x = Stack(c, b, a) y = Stack(c, b, a) -x equals y: true - y equals x: true +x equals y: true, y equals x: true + +x = Stream(0, ?) +y = Stream(0, ?) +x equals y: true, y equals x: true x = Map(42 -> FortyTwo) y = Map(42 -> FortyTwo) -x equals y: true - y equals x: true +x equals y: true, y equals x: true x = TreeSet(0, 2) y = TreeSet(0, 2) -x equals y: true - y equals x: true +x equals y: true, y equals x: true + +x = Vector('a, 'b, 'c) +y = Vector('a, 'b, 'c) +x equals y: true, y equals x: true x = ArrayBuffer(one, two) y = ArrayBuffer(one, two) -x equals y: true - y equals x: true +x equals y: true, y equals x: true + +x = ArrayBuilder.ofLong +y = ArrayBuilder.ofLong +x equals y: true, y equals x: true + +x = ArrayBuilder.ofFloat +y = ArrayBuilder.ofFloat +x equals y: true, y equals x: true -x = Map(title -> 3, buffers -> 20, layers -> 2) -y = Map(title -> 3, buffers -> 20, layers -> 2) -x equals y: true - y equals x: true +x = ArrayStack(3, 2, 20) +y = ArrayStack(3, 2, 20) +x equals y: true, y equals x: true x = BitSet(0, 8, 9) y = BitSet(0, 8, 9) -x equals y: true - y equals x: true +x equals y: true, y equals x: true + +x = Map(A -> 1, C -> 3, B -> 2) +y = Map(A -> 1, C -> 3, B -> 2) +x equals y: true, y equals x: true x = Set(layers, buffers, title) y = Set(layers, buffers, title) -x equals y: true - y equals x: true +x equals y: true, y equals x: true + +x = History() +y = History() +x equals y: true, y equals x: true + +x = ListBuffer(white, black) +y = ListBuffer(white, black) +x equals y: true, y equals x: true x = Queue(20, 2, 3) y = Queue(20, 2, 3) -x equals y: true - y equals x: true +x equals y: true, y equals x: true x = Stack(3, 2, 20) y = Stack(3, 2, 20) -x equals y: true - y equals x: true +x equals y: true, y equals x: true -x = ListBuffer(white, black) -y = ListBuffer(white, black) -x equals y: true - y equals x: true +x = abc +y = abc +x equals y: true, y equals x: true + +x = WrappedArray(1, 2, 3) +y = WrappedArray(1, 2, 3) +x equals y: true, y equals x: true + +x = xml:src="hello" +y = xml:src="hello" +x equals y: true, y equals x: true + +x = <title></title> +y = <title></title> +x equals y: true, y equals x: true x = <html><title>title</title><body></body></html> y = <html><title>title</title><body></body></html> -x equals y: true - y equals x: true +x equals y: true, y equals x: true x = <html> <body> - <table cellpadding="2" cellspacing="0"> + <table cellpadding="2" cellspacing="0"> <tr> <th>Last Name</th> <th>First Name</th> @@ -137,10 +220,10 @@ x = <html> </tr> </table> </body> - </html> + </html> y = <html> <body> - <table cellpadding="2" cellspacing="0"> + <table cellpadding="2" cellspacing="0"> <tr> <th>Last Name</th> <th>First Name</th> @@ -157,26 +240,26 @@ y = <html> </tr> </table> </body> - </html> -x equals y: true - y equals x: true + </html> +x equals y: true, y equals x: true x = Tim y = Tim -x equals y: true - y equals x: true +x equals y: true, y equals x: true x = Bob y = Bob -x equals y: true - y equals x: true +x equals y: true, y equals x: true x = John y = John -x equals y: true - y equals x: true +x equals y: true, y equals x: true x = Bill y = Bill -x equals y: true - y equals x: true +x equals y: true, y equals x: true x = Paul y = Paul -x equals y: true - y equals x: true +x equals y: true, y equals x: true diff --git a/test/files/jvm/serialization.scala b/test/files/jvm/serialization.scala index 81d21e6dc5..06086f4038 100644 --- a/test/files/jvm/serialization.scala +++ b/test/files/jvm/serialization.scala @@ -2,17 +2,6 @@ // Serialization //############################################################################ -import java.lang.System - -object EqualityTest { - def check[A, B](x: A, y: B) { - println("x = " + x) - println("y = " + y) - println("x equals y: " + (x equals y) + " - y equals x: " + (y equals x)) - println() - } -} - object Serialize { @throws(classOf[java.io.IOException]) def write[A](o: A): Array[Byte] = { @@ -29,7 +18,14 @@ object Serialize { new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(buffer)) in.readObject().asInstanceOf[A] } + def check[A, B](x: A, y: B) { + println("x = " + x) + println("y = " + y) + println("x equals y: " + (x equals y) + ", y equals x: " + (y equals x)) + println() + } } +import Serialize._ //############################################################################ // Test classes in package "scala" @@ -50,92 +46,140 @@ object Test1_scala { } import WeekDay._, BigDecimal._, RoundingMode._ - val x0 = List(1, 2, 3) - val x1 = Nil - val x2 = None - val x3 = Array(1, 2, 3) - val x4 = { x: Int => 2 * x } - val x5 = 'hello - val x6 = ("BannerLimit", 12345) - val x7 = BigDecimal.RoundingMode - val x8 = WeekDay - val x9 = UP - val x10 = Monday - + // in alphabetic order try { - val y0: List[Int] = Serialize.read(Serialize.write(x0)) - val y1: List[Nothing] = Serialize.read(Serialize.write(x1)) - val y2: Option[Nothing] = Serialize.read(Serialize.write(x2)) - val y3: Array[Int] = Serialize.read(Serialize.write(x3)) - val y4: Function[Int, Int] = Serialize.read(Serialize.write(x4)) - val y5: Symbol = Serialize.read(Serialize.write(x5)) - val y6: (String, Int) = Serialize.read(Serialize.write(x6)) - val y7: RoundingMode.type = Serialize.read(Serialize.write(x7)) - val y8: WeekDay.type = Serialize.read(Serialize.write(x8)) - val y9: RoundingMode = Serialize.read(Serialize.write(x9)) - val y10: WeekDay = Serialize.read(Serialize.write(x10)) - - println("x0 = " + x0) - println("y0 = " + y0) - println("x0 eq y0: " + (x0 eq y0) + " - y0 eq x0: " + (y0 eq x0)) - println("x0 equals y0: " + (x0 equals y0) + " - y0 equals x0: " + (y0 equals x0)) - println() - println("x1 = " + x1) - println("y1 = " + y1) - println("x1 eq y1: " + (x1 eq y1) + " - y1 eq x1: " + (y1 eq x1)) - println() - println("x2 = " + x2) - println("y2 = " + y2) - println("x2 eq y2: " + (x2 eq y2) + " - y2 eq x2: " + (y2 eq x2)) - println() - println("x3 = " + arrayToString(x3)) - println("y3 = " + arrayToString(y3)) - println("arrayEquals(x3, y3): " + arrayEquals(x3, y3)) + // Array + val a1 = Array(1, 2, 3) + val _a1: Array[Int] = read(write(a1)) + println("a1 = " + arrayToString(a1)) + println("_a1 = " + arrayToString(_a1)) + println("arrayEquals(a1, _a1): " + arrayEquals(a1, _a1)) println() - println("x4 = <na>") - println("y4 = <na>") - println("x4(2): " + x4(2) + " - y4(2): " + y4(2)) - println() - println("x5 = " + x5) - println("y5 = " + y5) - println("x5 eq y5: " + (x5 eq y5) + " - y5 eq x5: " + (y5 eq x5)) - println("x5 equals y5: " + (x5 equals y5) + " - y5 equals x5: " + (y5 equals x5)) + + // Cell + val c1 = new Cell('a') + val _c1: Cell[Char] = read(write(c1)) + println("c1 = " + c1) + println("_c1 = " + _c1) + println("c1 eq _c1: " + (c1 eq _c1) + ", _c1 eq c1: " + (_c1 eq c1)) + println("c1 equals _c1: " + (c1 equals _c1) + ", _c1 equals c1: " + (_c1 equals c1)) println() - println("x6 = " + x6) - println("y6 = " + y6) - println("x6 eq y6: " + (x6 eq y6) + " - y6 eq x6: " + (y6 eq x6)) - println("x6 equals y6: " + (x6 equals y6) + " - y6 equals x6: " + (y6 equals x6)) + + // Either + val e1 = Left(1) + val _e1: Either[Int, String] = read(write(e1)) + println("e1 = " + e1) + println("_e1 = " + _e1) + println("e1 eq _e1: " + (e1 eq _e1) + ", _e1 eq e1: " + (_e1 eq e1)) + println("e1 equals _e1: " + (e1 equals _e1) + ", _e1 equals e1: " + (_e1 equals e1)) println() + + // Enumeration + val x7 = BigDecimal.RoundingMode + val y7: RoundingMode.type = read(write(x7)) println("x7 = " + x7) println("y7 = " + y7) - println("x7 eq y7: " + (x7 eq y7) + " - y7 eq x7: " + (y7 eq x7)) - println("x7 equals y7: " + (x7 equals y7) + " - y7 equals x7: " + (y7 equals x7)) + println("x7 eq y7: " + (x7 eq y7) + ", y7 eq x7: " + (y7 eq x7)) + println("x7 equals y7: " + (x7 equals y7) + ", y7 equals x7: " + (y7 equals x7)) println() + + val x8 = WeekDay + val y8: WeekDay.type = read(write(x8)) println("x8 = " + x8) println("y8 = " + y8) - println("x8 eq y8: " + (x8 eq y8) + " - y8 eq x8: " + (y8 eq x8)) - println("x8 equals y8: " + (x8 equals y8) + " - y8 equals x8: " + (y8 equals x8)) + println("x8 eq y8: " + (x8 eq y8) + ", y8 eq x8: " + (y8 eq x8)) + println("x8 equals y8: " + (x8 equals y8) + ", y8 equals x8: " + (y8 equals x8)) println() + + val x9 = UP + val y9: RoundingMode = read(write(x9)) println("x9 = " + x9) println("y9 = " + y9) - println("x9 eq y9: " + (x9 eq y9) + " - y9 eq x9: " + (y9 eq x9)) - println("x9 equals y9: " + (x9 equals y9) + " - y9 equals x9: " + (y9 equals x9)) + println("x9 eq y9: " + (x9 eq y9) + ", y9 eq x9: " + (y9 eq x9)) + println("x9 equals y9: " + (x9 equals y9) + ", y9 equals x9: " + (y9 equals x9)) println() + + val x10 = Monday + val y10: WeekDay = read(write(x10)) println("x10 = " + x10) println("y10 = " + y10) - println("x10 eq y10: " + (x10 eq y10) + " - y10 eq x10: " + (y10 eq x10)) - println("x10 equals y10: " + (x10 equals y10) + " - y10 equals x10: " + (y10 equals x10)) + println("x10 eq y10: " + (x10 eq y10) + ", y10 eq x10: " + (y10 eq x10)) + println("x10 equals y10: " + (x10 equals y10) + ", y10 equals x10: " + (y10 equals x10)) println() - println("x9 eq x10: " + (x9 eq x10) + " - x10 eq x9: " + (x10 eq x9)) - println("x9 equals x10: " + (x9 equals x10) + " - x10 equals x9: " + (x10 equals x9)) - println("x9 eq y10: " + (x9 eq y10) + " - y10 eq x9: " + (y10 eq x9)) - println("x9 equals y10: " + (x9 equals y10) + " - y10 equals x9: " + (y10 equals x9)) + + println("x9 eq x10: " + (x9 eq x10) + ", x10 eq x9: " + (x10 eq x9)) + println("x9 equals x10: " + (x9 equals x10) + ", x10 equals x9: " + (x10 equals x9)) + println("x9 eq y10: " + (x9 eq y10) + ", y10 eq x9: " + (y10 eq x9)) + println("x9 equals y10: " + (x9 equals y10) + ", y10 equals x9: " + (y10 equals x9)) + println() + + // Function + val f1 = { x: Int => 2 * x } + val _f1: Function[Int, Int] = read(write(f1)) + println("f1 = <na>") + println("_f1 = <na>") + println("f1(2): " + f1(2) + ", _f1(2): " + _f1(2)) + println() + + // List + val xs0 = List(1, 2, 3) + val _xs0: List[Int] = read(write(xs0)) + println("xs0 = " + xs0) + println("_xs0 = " + _xs0) + println("xs0 eq _xs0: " + (xs0 eq _xs0) + ", _xs0 eq xs0: " + (_xs0 eq xs0)) + println("xs0 equals _xs0: " + (xs0 equals _xs0) + ", _xs0 equals xs0: " + (_xs0 equals xs0)) + println() + + val xs1 = Nil + val _xs1: List[Nothing] = read(write(xs1)) + println("xs1 = " + xs1) + println("_xs1 = " + _xs1) + println("xs1 eq _xs1: " + (xs1 eq _xs1) + ", _xs1 eq xs1: " + (_xs1 eq xs1)) + println() + + // Option + val o1 = None + val _o1: Option[Nothing] = read(write(o1)) + println("o1 = " + o1) + println("_o1 = " + _o1) + println("o1 eq _o1: " + (o1 eq _o1) + ", _o1 eq o1: " + (_o1 eq o1)) + println() + + val o2 = Some(1) + val _o2: Option[Int] = read(write(o2)) + println("o2 = " + o2) + println("_o2 = " + _o2) + println("o2 eq _o2: " + (o2 eq _o2) + ", _o2 eq o2: " + (_o2 eq o2)) + println("o2 equals _o2: " + (o2 equals _o2) + ", _o2 equals o2: " + (_o2 equals o2)) + println() +/* + // Responder + val r1 = Responder.constant("xyz") + val _r1: Responder[String] = read(write(r1)) + check(r1, _r1) +*/ + // Symbol + val s1 = 'hello + val _s1: Symbol = read(write(s1)) + println("s1 = " + s1) + println("_s1 = " + _s1) + println("s1 eq _s1: " + (s1 eq _s1) + ", _s1 eq s1: " + (_s1 eq s1)) + println("s1 equals _s1: " + (s1 equals _s1) + ", _s1 equals s1: " + (_s1 equals s1)) + println() + + // Tuple + val t1 = ("BannerLimit", 12345) + val _t1: (String, Int) = read(write(t1)) + println("t1 = " + t1) + println("_t1 = " + _t1) + println("t1 eq _t1: " + (t1 eq _t1) + ", _t1 eq t1: " + (_t1 eq t1)) + println("t1 equals _t1: " + (t1 equals _t1) + ", _t1 equals t1: " + (_t1 equals t1)) println() } catch { case e: Exception => - e.printStackTrace() println("Error in Test1_scala: " + e) + throw e } } @@ -145,50 +189,97 @@ object Test1_scala { @serializable object Test2_immutable { import scala.collection.immutable.{ - BitSet, ListMap, ListSet, Queue, Stack, TreeSet, TreeMap} - - val x1 = List( - Pair("buffers", 20), - Pair("layers", 2), - Pair("title", 3) - ) - - val x2 = new ListMap[String, Int] + ("buffers" -> 20, "layers" -> 2, "title" -> 3) - - val x3 = { - val bs = new collection.mutable.BitSet() - bs += 2; bs += 3 - bs.toImmutable - } - - val x4 = new ListSet[Int]() + 3 + 5 - - val x5 = Queue("a", "b", "c") - - val x6 = new Stack().push("a", "b", "c") - - val x7 = new TreeMap[Int, String] + (42 -> "FortyTwo") - - val x8 = new TreeSet[Int]() + 2 + 0 + BitSet, HashMap, HashSet, ListMap, ListSet, Queue, Range, SortedMap, + SortedSet, Stack, Stream, TreeMap, TreeSet, Vector} + // in alphabetic order try { - val y1: List[Pair[String, Int]] = Serialize.read(Serialize.write(x1)) - val y2: ListMap[String, Int] = Serialize.read(Serialize.write(x2)) - val y3: BitSet = Serialize.read(Serialize.write(x3)) - val y4: ListSet[Int] = Serialize.read(Serialize.write(x4)) - val y5: Queue[String] = Serialize.read(Serialize.write(x5)) - val y6: Stack[String] = Serialize.read(Serialize.write(x6)) - val y7: TreeMap[Int, String] = Serialize.read(Serialize.write(x7)) - val y8: TreeSet[Int] = Serialize.read(Serialize.write(x8)) - - EqualityTest.check(x1, y1) - EqualityTest.check(x2, y2) - EqualityTest.check(x3, y3) - EqualityTest.check(x4, y4) - EqualityTest.check(x5, y5) - EqualityTest.check(x6, y6) - EqualityTest.check(x7, y7) - EqualityTest.check(x8, y8) + // BitSet + val bs1 = BitSet.empty + 1 + 2 + val _bs1: BitSet = read(write(bs1)) + check(bs1, _bs1) + + val bs2 = { + val bs = new collection.mutable.BitSet() + bs += 2; bs += 3 + bs.toImmutable + } + val _bs2: BitSet = read(write(bs2)) + check(bs2, _bs2) + + // HashMap + val hm1 = new HashMap[Int, String] + (1 -> "A", 2 -> "B", 3 -> "C") + val _hm1: HashMap[Int, String] = read(write(hm1)) + check(hm1, _hm1) + + // HashSet + val hs1 = new HashSet[Int] + 1 + 2 + val _hs1: HashSet[Int] = read(write(hs1)) + check(hs1, _hs1) + + // List + val xs1 = List(("buffers", 20), ("layers", 2), ("title", 3)) + val _xs1: List[(String, Int)] = read(write(xs1)) + check(xs1, _xs1) + + // ListMap + val lm1 = new ListMap[String, Int] + ("buffers" -> 20, "layers" -> 2, "title" -> 3) + val _lm1: ListMap[String, Int] = read(write(lm1)) + check(lm1, _lm1) + + // ListSet + val ls1 = new ListSet[Int] + 3 + 5 + val _ls1: ListSet[Int] = read(write(ls1)) + check(ls1, _ls1) + + // Queue + val q1 = Queue("a", "b", "c") + val _q1: Queue[String] = read(write(q1)) + check(q1, _q1) + + // Range + val r1 = 0 until 10 + val _r1: Range = read(write(r1)) + check(r1, _r1) + + val r2 = Range.Long(0L, 10L, 1) + val _r2: r2.type = read(write(r2)) + check(r2, _r2) + + // SortedMap + val sm1 = SortedMap.empty[Int, String] + (2 -> "B", 3 -> "C", 1 -> "A") + val _sm1: SortedMap[Int, String] = read(write(sm1)) + check(sm1, _sm1) + + // SortedSet + val ss1 = SortedSet.empty[Int] + 2 + 3 + 1 + val _ss1: SortedSet[Int] = read(write(ss1)) + check(ss1, _ss1) + + // Stack + val s1 = new Stack().push("a", "b", "c") + val _s1: Stack[String] = read(write(s1)) + check(s1, _s1) + + // Stream + val st1 = Stream.range(0, 10) + val _st1: Stream[Int] = read(write(st1)) + check(st1, _st1) + + // TreeMap + val tm1 = new TreeMap[Int, String] + (42 -> "FortyTwo") + val _tm1: TreeMap[Int, String] = read(write(tm1)) + check(tm1, _tm1) + + // TreeSet + val ts1 = new TreeSet[Int]() + 2 + 0 + val _ts1: TreeSet[Int] = read(write(ts1)) + check(ts1, _ts1) + + // Vector + val v1 = Vector('a, 'b, 'c) + val _v1: Vector[Symbol] = read(write(v1)) + check(v1, _v1) } catch { case e: Exception => @@ -201,65 +292,110 @@ object Test2_immutable { // Test classes in package "scala.collection.mutable" object Test3_mutable { + import scala.reflect.ClassManifest import scala.collection.mutable.{ - ArrayBuffer, BitSet, HashMap, HashSet, History, LinkedList, ListBuffer, - Publisher, Queue, Stack} - - val x0 = new ArrayBuffer[String] - x0 ++= List("one", "two") - - val x2 = new BitSet() - x2 += 0 - x2 += 8 - x2 += 9 - - val x1 = new HashMap[String, Int] - x1 ++= Test2_immutable.x1 - - val x3 = new HashSet[String] - x3 ++= Test2_immutable.x1.map(p => p._1) - - @serializable - class Feed extends Publisher[String, Feed] - - val x8 = new History[String, Feed] - - val x4 = new LinkedList[Int](2, null) - x4.append(new LinkedList(3, null)) - - val x7 = new ListBuffer[String] - x7 ++= List("white", "black") - - val x5 = new Queue[Int] - x5 ++= Test2_immutable.x1.map(p => p._2) - - val x6 = new Stack[Int] - x6 ++= x5 + ArrayBuffer, ArrayBuilder, ArrayStack, BitSet, DoubleLinkedList, + HashMap, HashSet, History, LinkedList, ListBuffer, Publisher, Queue, + Stack, StringBuilder, WrappedArray} + // in alphabetic order try { - val y0: ArrayBuffer[String] = Serialize.read(Serialize.write(x0)) - val y1: HashMap[String, Int] = Serialize.read(Serialize.write(x1)) - val y2: BitSet = Serialize.read(Serialize.write(x2)) - val y3: HashSet[String] = Serialize.read(Serialize.write(x3)) -// val y4: LinkedList[Int] = Serialize.read(Serialize.write(x4)) - val y5: Queue[Int] = Serialize.read(Serialize.write(x5)) - val y6: Stack[Int] = Serialize.read(Serialize.write(x6)) - val y7: ListBuffer[String] = Serialize.read(Serialize.write(x7)) - val y8: History[String, Feed] = Serialize.read(Serialize.write(x8)) - - EqualityTest.check(x0, y0) - EqualityTest.check(x1, y1) - EqualityTest.check(x2, y2) - EqualityTest.check(x3, y3) - //EqualityTest.check(x4, y4) //todo - EqualityTest.check(x5, y5) - EqualityTest.check(x6, y6) - EqualityTest.check(x7, y7) - //EqualityTest.check(x8, y8) //todo + // ArrayBuffer + val ab1 = new ArrayBuffer[String] + ab1 ++= List("one", "two") + val _ab1: ArrayBuffer[String] = read(write(ab1)) + check(ab1, _ab1) + + // ArrayBuilder + val abu1 = ArrayBuilder.make[Long] + val _abu1: ArrayBuilder[ClassManifest[Long]] = read(write(abu1)) + check(abu1, _abu1) + + val abu2 = ArrayBuilder.make[Float] + val _abu2: ArrayBuilder[ClassManifest[Float]] = read(write(abu2)) + check(abu2, _abu2) + + // ArrayStack + val as1 = new ArrayStack[Int] + as1 ++= List(20, 2, 3).iterator + val _as1: ArrayStack[Int] = read(write(as1)) + check(as1, _as1) + + // BitSet + val bs1 = new BitSet() + bs1 += 0 + bs1 += 8 + bs1 += 9 + val _bs1: BitSet = read(write(bs1)) + check(bs1, _bs1) +/* + // DoubleLinkedList + val dl1 = new DoubleLinkedList[Int](2, null) + dl1.append(new DoubleLinkedList(3, null)) + val _dl1: DoubleLinkedList[Int] = read(write(dl1)) + check(dl1, _dl1) +*/ + // HashMap + val hm1 = new HashMap[String, Int] + hm1 ++= List(("A", 1), ("B", 2), ("C", 3)).iterator + val _hm1: HashMap[String, Int] = read(write(hm1)) + check(hm1, _hm1) + + // HashSet + val hs1 = new HashSet[String] + hs1 ++= List("layers", "buffers", "title").iterator + val _hs1: HashSet[String] = read(write(hs1)) + check(hs1, _hs1) + + // History + @serializable + class Feed extends Publisher[String] + + val h1 = new History[String, Int] + val _h1: History[String, Int] = read(write(h1)) + check(h1, _h1) +/* + // LinkedList + val ll1 = new LinkedList[Int](2, null) + ll1.append(new LinkedList(3, null)) + val _ll1: LinkedList[Int] = read(write(ll1)) + check(ll1, _ll1) +*/ + // ListBuffer + val lb1 = new ListBuffer[String] + lb1 ++= List("white", "black") + val _lb1: ListBuffer[String] = read(write(lb1)) + check(lb1, _lb1) + + // Publisher + + // Queue + val q1 = new Queue[Int] + q1 ++= List(20, 2, 3).iterator + val _q1: Queue[Int] = read(write(q1)) + check(q1, _q1) + + // Stack + val s1 = new Stack[Int] + s1 pushAll q1 + val _s1: Stack[Int] = read(write(s1)) + check(s1, _s1) + + // StringBuilder + val sb1 = new StringBuilder + sb1 append "abc" + val _sb1: StringBuilder = read(write(sb1)) + check(sb1, _sb1) + + // WrappedArray + val wa1 = WrappedArray.make(Array(1, 2, 3)) + val _wa1: WrappedArray[Int] = read(write(wa1)) + check(wa1, _wa1) } catch { case e: Exception => println("Error in Test3_mutable: " + e) + throw e } } @@ -267,15 +403,31 @@ object Test3_mutable { // Test classes in package "scala.xml" object Test4_xml { - import scala.xml.Elem - - val x1 = <html><title>title</title><body></body></html>; + import scala.xml.{Attribute, Document, Elem, Null, PrefixedAttribute, Text} case class Person(name: String, age: Int) - class AddressBook(a: Person*) { - private val people: List[Person] = a.toList - def toXHTML = + try { + // Attribute + val a1 = new PrefixedAttribute("xml", "src", Text("hello"), Null) + val _a1: Attribute = read(write(a1)) + check(a1, _a1) + + // Document + val d1 = new Document + d1.docElem = <title></title> + d1.encoding = Some("UTF-8") + val _d1: Document = read(write(d1)) + check(d1, _d1) + + // Elem + val e1 = <html><title>title</title><body></body></html>; + val _e1: Elem = read(write(e1)) + check(e1, _e1) + + class AddressBook(a: Person*) { + private val people: List[Person] = a.toList + def toXHTML = <table cellpadding="2" cellspacing="0"> <tr> <th>Last Name</th> @@ -287,30 +439,26 @@ object Test4_xml { <td> { p.age.toString() } </td> </tr> } </table>; - } + } - val people = new AddressBook( - Person("Tom", 20), - Person("Bob", 22), - Person("James", 19)) + val people = new AddressBook( + Person("Tom", 20), + Person("Bob", 22), + Person("James", 19)) - val x2 = - <html> + val e2 = + <html> <body> - { people.toXHTML } + { people.toXHTML } </body> - </html>; - - try { - val y1: scala.xml.Elem = Serialize.read(Serialize.write(x1)) - val y2: scala.xml.Elem = Serialize.read(Serialize.write(x2)) - - EqualityTest.check(x1, y1) - EqualityTest.check(x2, y2) + </html>; + val _e2: Elem = read(write(e2)) + check(e2, _e2) } catch { case e: Exception => println("Error in Test4_xml: " + e) + throw e } } @@ -339,11 +487,11 @@ object Test5 { val x2 = bob try { - val y1: Person = Serialize.read(Serialize.write(x1)) - val y2: Employee = Serialize.read(Serialize.write(x2)) + val y1: Person = read(write(x1)) + val y2: Employee = read(write(x2)) - EqualityTest.check(x1, y1) - EqualityTest.check(x2, y2) + check(x1, y1) + check(x2, y2) } catch { case e: Exception => @@ -369,13 +517,13 @@ object Test6 { val x3 = paul try { - val y1: Person = Serialize.read(Serialize.write(x1)) - val y2: Employee = Serialize.read(Serialize.write(x2)) - val y3: Person = Serialize.read(Serialize.write(x3)) + val y1: Person = read(write(x1)) + val y2: Employee = read(write(x2)) + val y3: Person = read(write(x3)) - EqualityTest.check(x1, y1) - EqualityTest.check(x2, y2) - EqualityTest.check(x3, y3) + check(x1, y1) + check(x2, y2) + check(x3, y3) } catch { case e: Exception => diff --git a/test/files/jvm/stringbuilder.scala b/test/files/jvm/stringbuilder.scala index bacd13c715..c86a8a7713 100644 --- a/test/files/jvm/stringbuilder.scala +++ b/test/files/jvm/stringbuilder.scala @@ -53,7 +53,7 @@ object Test2 extends TestCase("append") with Assert { val j1 = new java.lang.StringBuilder // Java 1.5+ val s1 = new StringBuilder j1 append "###" append Array('0', '1', '2') append "xyz".subSequence(0, 3) - s1 append "###" append Array('0', '1', '2') append List('x', 'y', 'z') + s1 append "###" appendAll Array('0', '1', '2') appendAll List('x', 'y', 'z') assertEquals("s1.toString equals j1.toString", true, s1.toString equals j1.toString) } } @@ -72,7 +72,7 @@ object Test3 extends TestCase("insert") with Assert { val j1 = new java.lang.StringBuilder // Java 1.5+ val s1 = new StringBuilder j1 insert (0, "###") insert (0, Array('0', '1', '2')) insert (0, "xyz".subSequence(0, 3)) - s1 insert (0, "###") insert (0, Array('0', '1', '2')) insert (0, List('x', 'y', 'z')) + s1 insert (0, "###") insertAll (0, Array('0', '1', '2')) insertAll (0, List('x', 'y', 'z')) //println("j1="+j1+", s1="+s1)//debug assertEquals("s1.toString equals j1.toString", true, s1.toString equals j1.toString) diff --git a/test/files/jvm/t2585.check b/test/files/jvm/t2585.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/jvm/t2585.check diff --git a/test/files/jvm/t2585/Test.java b/test/files/jvm/t2585/Test.java new file mode 100644 index 0000000000..51fe20d81e --- /dev/null +++ b/test/files/jvm/t2585/Test.java @@ -0,0 +1,16 @@ +class J { S s ; } + +public class Test { + public static void main(String[] args) { + final X x = new X(); + final OuterImpl o = new OuterImpl(x); + + final OuterImpl.Inner i1 = o.newInner(); + i1.getT().getI().getT().getI(); // <--- Error: "The method getI() is undefined for the type Object" + + final Outer<X>.Inner i2 = o.newInner(); + i2.getT().getI().getT().getI(); // <--- Error: "The method getI() is undefined for the type Object" + + HashMap<String, String> map = new HashMap<String, String>(); + } +}
\ No newline at end of file diff --git a/test/files/jvm/t2585/genericouter.scala b/test/files/jvm/t2585/genericouter.scala new file mode 100644 index 0000000000..e06aa8101e --- /dev/null +++ b/test/files/jvm/t2585/genericouter.scala @@ -0,0 +1,25 @@ +case class S(n:Int) + +trait TraversableLike[+A, +Repr] { + class WithFilter(p: A => Boolean) + def withFilter(p: A => Boolean): WithFilter = new WithFilter(p) +} + +class HashMap[K, +V] extends TraversableLike[(K, V), HashMap[K, V]] + +class Outer[T](val t: T) { + class Inner { + def getT : T = t + } +} + +class OuterImpl(x: X) extends Outer[X](x) { + def newInner = new Inner +} + +class X { + def getI : Outer[X]#Inner = { + val oImpl = new OuterImpl(this) + new oImpl.Inner + } +}
\ No newline at end of file |