From MAILER-DAEMON Tue May 09 04:19:58 2017 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1d80NC-0003mW-CG for mharc-bug-classpath@gnu.org; Tue, 09 May 2017 04:19:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d80N9-0003k2-Jn for bug-classpath@gnu.org; Tue, 09 May 2017 04:19:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d80N4-0005Hc-Qj for bug-classpath@gnu.org; Tue, 09 May 2017 04:19:55 -0400 Received: from server1.sourceware.org ([209.132.180.131]:56662 helo=sourceware.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d80N4-0005HH-Hn for bug-classpath@gnu.org; Tue, 09 May 2017 04:19:50 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=from:to :subject:date:message-id:content-type:content-transfer-encoding :mime-version; q=dns; s=default; b=VIlejoDTlmR45ROmADmClwC6p/9p8 K7WfiJ17Ou0Y0WL9V3StUHKBQT6EpP9N2rgwqUxuNegCvoForhFMgBdRvlt9fwt/ 5Cg7hfwz9/gmD6DzrjLja3R1bzXWehzfDIvLnrI+n55h0H6rk4PMhioARHtGNcSG 9ToxaidUu/ndu8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=from:to :subject:date:message-id:content-type:content-transfer-encoding :mime-version; s=default; bh=Ht+OSRtKaNA81q6LWTp6fDb0D4s=; b=FoM PuVwEJg/C4y7zle/NNG6L2MFR3KCPxYrAEWXKwSf+m7QoeXfbepWk0OknlM/Khid Pbz4kLJzgR984AIs/H3bWjBrLiNun/FJeSOlHUBlnQR57Ca+yRLyj0JG8tXm3V+L dILJO0EiPqjGxEuKSBeZ+LxgaFDEP8h93yPgX2yQ= Received: (qmail 17316 invoked by uid 48); 9 May 2017 08:19:42 -0000 From: "guillerodriguez.dev at gmail dot com" To: bug-classpath@gnu.org Subject: [Bug classpath/80688] New: gnu.java.util.LRUCache is not LRU Date: Tue, 09 May 2017 08:19:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: classpath X-Bugzilla-Component: classpath X-Bugzilla-Version: 0.99 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: guillerodriguez.dev at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.132.180.131 X-BeenThere: bug-classpath@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Classpath project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 May 2017 08:19:56 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D80688 Bug ID: 80688 Summary: gnu.java.util.LRUCache is not LRU Product: classpath Version: 0.99 Status: UNCONFIRMED Severity: normal Priority: P3 Component: classpath Assignee: unassigned at gcc dot gnu.org Reporter: guillerodriguez.dev at gmail dot com Target Milestone: --- According to the documentation, class gnu.java.util.LRUCache is "A least recently used cache, based on LinkedHashMap". However the only constructor of the class calls the no-arg constructor of t= he superclass, LinkedHashMap, which by default creates an insertion-ordered (instead of access-ordered) LinkedHashMap. Thus when the LRUCache is full it will not discard the least recently used items. Instead it will discard the first items that were inserted. In order to behave as a LRU cache, an access-ordered LinkedHashMap must be created: public LRUCache(int cap) { - super(); + super(11, 0.75f, true); capacity =3D cap; }=