Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E7F8C200AC0 for ; Tue, 24 May 2016 10:40:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E6B6C160A2D; Tue, 24 May 2016 08:40:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3C2AF160A11 for ; Tue, 24 May 2016 10:40:14 +0200 (CEST) Received: (qmail 38801 invoked by uid 500); 24 May 2016 08:40:13 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 38780 invoked by uid 99); 24 May 2016 08:40:13 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 May 2016 08:40:13 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id EF8822C1F60 for ; Tue, 24 May 2016 08:40:12 +0000 (UTC) Date: Tue, 24 May 2016 08:40:12 +0000 (UTC) From: "Dawid Weiss (JIRA)" To: dev@lucene.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (LUCENE-7277) Make Query.hashCode and Query.equals abstract MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 24 May 2016 08:40:15 -0000 [ https://issues.apache.org/jira/browse/LUCENE-7277?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Dawid Weiss resolved LUCENE-7277. --------------------------------- Resolution: Fixed Fix Version/s: 6.x Pushed to master and branch_6x. Thanks for helping out, Paul! > Make Query.hashCode and Query.equals abstract > --------------------------------------------- > > Key: LUCENE-7277 > URL: https://issues.apache.org/jira/browse/LUCENE-7277 > Project: Lucene - Core > Issue Type: Improvement > Reporter: Dawid Weiss > Assignee: Dawid Weiss > Priority: Trivial > Fix For: 6.x, master (7.0) > > Attachments: LUCENE-7277-20160518.patch, LUCENE-7277.patch, LUCENE-7277.patch > > > Custom subclasses of the Query class have the default implementation of hashCode/equals that make all instances of the subclass equal. If somebody doesn't know this it can be pretty tricky to debug with IndexSearcher's query cache on. > Is there any rationale for declaring it this way instead of making those methods abstract (and enforcing their proper implementation in a subclass)? > {code} > public int hashCode() { > return getClass().hashCode(); > } > public boolean equals(Object obj) { > if (obj == null) > return false; > return getClass() == obj.getClass(); > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org