Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 30911 invoked from network); 16 Jun 2006 04:36:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 16 Jun 2006 04:36:29 -0000 Received: (qmail 30143 invoked by uid 500); 16 Jun 2006 04:36:28 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 29710 invoked by uid 500); 16 Jun 2006 04:36:27 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 29677 invoked by uid 99); 16 Jun 2006 04:36:26 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Jun 2006 21:36:26 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of mloenko@gmail.com designates 66.249.82.193 as permitted sender) Received: from [66.249.82.193] (HELO wx-out-0102.google.com) (66.249.82.193) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Jun 2006 21:36:25 -0700 Received: by wx-out-0102.google.com with SMTP id s6so425809wxc for ; Thu, 15 Jun 2006 21:36:04 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=X3az2gDuk8UUe3goRjGaSeYorIM4M3Hr2lhsXqb05FlRCkLiQejI3gpKTmelFkGnmb6N0yclXSVQOGTqBYk0YR74+vW9vbeKlXp9zcJglldrHnVXWVkgeS8/mrieybzo45M7JCpgdpvNUJrRiMNaWsQoaGrkQ058BB7Rt5ELyWo= Received: by 10.70.11.8 with SMTP id 8mr3382988wxk; Thu, 15 Jun 2006 21:36:04 -0700 (PDT) Received: by 10.70.28.12 with HTTP; Thu, 15 Jun 2006 21:36:04 -0700 (PDT) Message-ID: <906dd82e0606152136o6ba62938gec7b9493244e0e36@mail.gmail.com> Date: Fri, 16 Jun 2006 11:36:04 +0700 From: "Mikhail Loenko" To: harmony-dev@incubator.apache.org Subject: Re: [classlib][util] HARMONY-574: Java 5 Enhancement:new class java.util.PriorityQueue In-Reply-To: <906dd82e0606152114s52cdd3eeuf3eca970e1e136bc@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <906dd82e0606152114s52cdd3eeuf3eca970e1e136bc@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N One more wtih the tests: /** * @tests serialization/deserialization compatibility with RI. */ public void test_SerializationCompatibility() throws Exception { Integer[] array = { 2, 45, 7, -12, 9, 23, 17, 1118, 10, 16, 39 }; List list = Arrays.asList(array); PriorityQueue srcIntegerQueue = new PriorityQueue( list); PriorityQueue destStringQueue = (PriorityQueue) SerializationTester .readObject(srcIntegerQueue, SERIALIZATION_FILE_NAME); } /** * @tests serialization/deserialization compatibility with RI. */ public void test_SerializationCompatibility_cast() throws Exception { Integer[] array = { 2, 45, 7, -12, 9, 23, 17, 1118, 10, 16, 39 }; List list = Arrays.asList(array); PriorityQueue srcIntegerQueue = new PriorityQueue( list); PriorityQueue destStringQueue = (PriorityQueue) SerializationTester .readObject(srcIntegerQueue, SERIALIZATION_FILE_NAME); // will not incur class cast exception. Object o = destStringQueue.peek(); Arrays.sort(array); Integer I = (Integer) o; assertEquals(array[0], I); } the first test differs from the beginning of the second one in the following lines: --- first test PriorityQueue destStringQueue = (PriorityQueue) SerializationTester .readObject(srcIntegerQueue, SERIALIZATION_FILE_NAME); --- second test PriorityQueue destStringQueue = (PriorityQueue) SerializationTester .readObject(srcIntegerQueue, SERIALIZATION_FILE_NAME); But these line in both cases compile into the following: 160: invokestatic #88; //Method tests/util/SerializationTester.readObject:(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; 163: checkcast #2; //class PriorityQueue 166: astore 4 So the first test is a subset of the second one and thus I'll remove it. Thanks, Mikhail 2006/6/16, Mikhail Loenko : > Hi Paulex! > > fyi the following method: > > public int compare(Object object1, Object object2) { > // test cast > E e1 = (E) object1; > E e2 = (E) object2; > return 0; > } > > compiles to the following bytecode: > > 0: aload_1 > 1: astore_3 > 2: aload_2 > 3: astore 4 > 5: iconst_0 > 6: ireturn > > So, it does not have any cast testing. > > I'll slightly update the test if you don't mind > > Thanks, > Mikhail > --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org For additional commands, e-mail: harmony-dev-help@incubator.apache.org