Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 31459 invoked from network); 12 Dec 2007 00:15:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Dec 2007 00:15:41 -0000 Received: (qmail 48808 invoked by uid 500); 12 Dec 2007 00:15:29 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 48779 invoked by uid 500); 12 Dec 2007 00:15:28 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 48770 invoked by uid 99); 12 Dec 2007 00:15:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2007 16:15:28 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of gshimansky@gmail.com designates 64.233.178.242 as permitted sender) Received: from [64.233.178.242] (HELO hs-out-2122.google.com) (64.233.178.242) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Dec 2007 00:15:06 +0000 Received: by hs-out-2122.google.com with SMTP id m63so17152hsc.4 for ; Tue, 11 Dec 2007 16:15:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; bh=2SWAY3fpkKsXoPnDmXr3xfSjppjNcsG0fXRWhZgJXic=; b=t5k37s3aI0K4RLGkqVjuVxefCWHksZs/5eQP1jXsCZlg3vm2h8rSTddt/e69QUjc8QVQOXdJ0CwjdxL9P/aQYbVGKIJfXl+wNI8QM+LxzSqlnd17p4ZLAqAS0etbmkIucnklJfYkUU3VLohb2jKMx76eJv34gEVMWdGdyUCrt9g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=UVeoRUuzoWW1mS9OFAP2p5mZmUyCl+60Vq4z4s5d3twlyFKYO96CIG9cAxUm5/OfvI/tHWSP8WU3OQL1N65IgH2koCDea9EyRswIzuaz3eDT0fPDeNd1nT2q5jc7YSh1h46zXOr+264YR+5Mbmqp/ndhHMUWDOKNCiwnZuKG27w= Received: by 10.70.9.8 with SMTP id 8mr50408wxi.27.1197418507777; Tue, 11 Dec 2007 16:15:07 -0800 (PST) Received: from ?127.0.0.1? ( [140.211.11.9]) by mx.google.com with ESMTPS id h35sm2076453wxd.2007.12.11.16.15.04 (version=SSLv3 cipher=RC4-MD5); Tue, 11 Dec 2007 16:15:06 -0800 (PST) Message-ID: <475F2804.50704@apache.org> Date: Wed, 12 Dec 2007 03:15:00 +0300 From: Gregory Shimansky User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: dev@harmony.apache.org Subject: Re: Eclipse bug was: [classlib][luni] TreeMap woes References: <253b20230712110807h39c89a2awc04b2620289e5d0d@mail.gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: Gregory Shimansky X-Virus-Checked: Checked by ClamAV on apache.org Alexey Petrenko said the following on 11.12.2007 20:47: > Sergey, > > thanks for such detailed investigation. > > It looks like we can keep the patch in M4. > > Objections? This is an impressive evaluation and it is very good that a bug was created in Eclipse bugzilla. If the impact of the new TreeMap is only several failing tests in EUT test suite then I see no reason to revert the patch, failing tests may be just excluded until Eclipse fixes this bug. > SY, Alexey > > 2007/12/11, Sergey Kuksenko : >> Hi All, >> Here is a story why we get EUT failures after new TreeMap. >> >> >> After new TreeMap implementation we got 3 error in EUT: testAddWorkingSet, >> testGetWorkingSet and testRemoveWorkingSet. >> >> The problem here that when this unit tests are running we got incorrect set >> of WorkingSets obtained from WorkingSetManager. >> Another problem - if we run these tests separately all of them are passed. >> >> I did mixed TreeMap implementation: aggregates old and new TreeMaps and >> compare trees after each operation. >> When did it I got error (different trees) in test >> org.eclipse.core.resources.IWorkspace.IWorkingSetManagerTest. >> >> I have to note that there are a lot of other unit tests executed between >> IWorkingSetManagerTest and <>. >> The tree difference error occurs for all test from IWorkingSetManagerTest >> class, because of the error was in "doSetUp()" method. >> Here is a part of code from "doSetUp()": >> >> IWorkingSet[] workingSets = fWorkingSetManager.getWorkingSets(); >> for (int i = 0; i < workingSets.length; i++) { >> fWorkingSetManager.removeWorkingSet(workingSets[i]); >> } >> >> WorkingSetManager store set of WorkingSets in SortedSet (TreeSet). >> >> getWorkingSets() returs some filtered array of WorkingSets. In this unit >> test the first WorkingSet is filtered (as global WS), >> thus after this cycle we should get set of WorkingSets which contains only >> one WS, but it did not occur. >> Otherwords, after this cycle getWorkingSets() should return empty array (all >> non-filtered WS should be removed). >> >> TreeSet contains object with "org.eclipse.ui.internal.WorkingSet" class and >> uses >> "org.eclipse.ui.internal.WorkingSetComparator". >> This classes are part of "org.eclipse.ui.workbench" plugin. >> >> "WorkingSetComparator" compares two "WorkingSet"s using their labels and >> names as strings. Here, before removing, TreeSet contains >> 3 WS objects: >> { "Window Working Set", " ", "ws1" } - this is TreeSet in order which >> elements are stored, I put here labels of WorkingSets, because of it is >> sufficient for understading behavior of comparator. >> >> Here(before removing) we have such ThreeSet for old TreeSet, new TreeSet and >> even on RI! >> >> But! It is already incorrect TreeSet! Because of " " is less then "Window >> Working Set". >> The only difference between old TreeSet/RI and new TreeSet that new TreeSet >> doesn't delete WS with name " " succesfully. >> And as I alredy wrote succesfull removing WS with name " " at this place on >> RI was accidental. >> >> Moreover, I found original source of the problem. >> Class org.eclipse.ui.tests.api.IWorkingSetTest is excecuted before >> IWorkingSetManagerTest. >> IWorkingSetTest contains unit tests "testSetName()" which tests that chaning >> name of WorkingSet works succesfully. >> >> public void testSetName() throws Throwable { >> boolean exceptionThrown = false; >> try { >> fWorkingSet.setName(null); >> } catch (RuntimeException exception) { >> exceptionThrown = true; >> } >> assertTrue(exceptionThrown); >> >> fWorkingSet.setName(WORKING_SET_NAME_2); >> assertEquals(WORKING_SET_NAME_2, fWorkingSet.getName()); >> >> fWorkingSet.setName(""); >> assertEquals("", fWorkingSet.getName()); >> >> fWorkingSet.setName(" "); >> assertEquals(" ", fWorkingSet.getName()); >> } >> >> And after "testSetName()" TreeSet stored in workingSetManager are cleaned in >> order to have empty TreeSet for all subsequent unit tests. >> There are call "workingSetManager.removeWorkingSet(fWorkingSet)" where >> fWorkingSet is WS with name " ". But because >> of originally it was saved in Tree with the inital name ("ws1") then remving >> are not performed even on RI. >> >> So here we meet a bug in Eclipse and sometimes the bug leads to incorrect >> TreeSet on RI and with the bug Eclipse is working on RI. >> So I suppose that here having incorrect TreeSet is not critical for Eclipse >> functionality. >> >> >> Let's add aditional checks into "testSetName()" unit test. >> >> assertTrue(ArrayUtil.equals(new IWorkingSet[] { fWorkingSet }, >> workingSetManager.getWorkingSets())); >> workingSetManager.removeWorkingSet(fWorkingSet); >> assertTrue(ArrayUtil.equals(new IWorkingSet[] {}, >> workingSetManager.getWorkingSets())); >> workingSetManager.addWorkingSet(fWorkingSet); >> >> The first assert here checks that fWorkingSet belongs to the TreeSet from >> setManager, after that we remove the working set, >> the second assert checks that working set was succesfully removed, and the >> latest line restore workingSetManager state. >> >> I've inserted these line at the beginning of "testSetName()" and at the end. >> The first insertion checks that we can succesfully remove WS before >> renaming, and the latest checks that we should be able remove WS after >> remaning. >> >> I've got error on the last assert which proves that after remaning WS can't >> be removed on Sun 1.6u3 and on BEA JRockit1.5 >> >> Bug 212583 was submitted against Eclipse. >> -- Gregory