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 BB7B9200C61 for ; Tue, 11 Apr 2017 06:06:26 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id BA05A160BA5; Tue, 11 Apr 2017 04:06:26 +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 0E415160B99 for ; Tue, 11 Apr 2017 06:06:25 +0200 (CEST) Received: (qmail 33084 invoked by uid 500); 11 Apr 2017 04:06:24 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 33060 invoked by uid 99); 11 Apr 2017 04:06:24 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Apr 2017 04:06:24 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 8903518F4CD for ; Tue, 11 Apr 2017 04:06:23 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.121 X-Spam-Level: X-Spam-Status: No, score=-0.121 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=trypticon.org Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id OWmqa85-10By for ; Tue, 11 Apr 2017 04:06:21 +0000 (UTC) Received: from mail-ua0-f182.google.com (mail-ua0-f182.google.com [209.85.217.182]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id CBAD35FAC9 for ; Tue, 11 Apr 2017 04:06:20 +0000 (UTC) Received: by mail-ua0-f182.google.com with SMTP id u103so51406501uau.1 for ; Mon, 10 Apr 2017 21:06:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trypticon.org; s=google; h=mime-version:from:date:message-id:subject:to; bh=s6pxMKwy4aYWL3V4QP7a9GVbEQ9gy0Wt2b7eejS+/eg=; b=BOs7DjOHvrHlmy8O5rbkfXHc2mVU2/Xg6UOJ6yO/j8/3JsyLqYVRW3ee4JIN7KHd3t 4JUNQLex73cqTQVuCOn2JEhowzym2UHe48TQNHvu0bcpQGRVEtmWdTzNTvtyYXu5xexf pCr9rgqxYb851HYGPf51QAh2KJEPR7Unnlv6iRFWVWMacqPSX2zytY3WzBEd2Ht5/nHU ctdzHj+GWxXsFQ3xbsu0TrIeJkc+k3WkI/IAwwB5kp8/RhAJH8l3sul3r4FMDwebo7Vn JU05lYLsyVucbgI7O/Afz5V+/l+60dgiYjnHM2HOysOtYOEaGyBr9wjdVEVRk5tUPClO 3jpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=s6pxMKwy4aYWL3V4QP7a9GVbEQ9gy0Wt2b7eejS+/eg=; b=tKt3cTZM+XVmcFUQHc+seB/HlOyYyaaVJP2ubQjKMgTdo0rbBypW0aKLEiv/1zM5FW HSoZfLOquTVSeAzGqOD/IHQBHjD3wdzdc2GrYNg9cpIxcmGqHZt0MrcR0ZKe0mk5U45o /rnvsbhM3kFpFVZF8nRTH90wFGpGQzo8tA1wwhStyYfHuFQhUcR4Bucfb6p+5ejHpcZf YtEAzwaYV1LOcdydM5IARpT81zb6U1e0HEy3K3AUOstWiQZB61mUI/QcKRs4vGolCOQH /6O81TQyyeXPYyQO4jeELkDMuSH9GBfJLVpkD73rmnkxgeObhO0dqJlsJTHs7uvcbadQ XkFg== X-Gm-Message-State: AN3rC/4KqFmqZrA7SVrozBagc9iLveHrK6TI1IN1rNNRIGdUck4hZKJ2WMmQz+ODSRMt1Q== X-Received: by 10.176.5.132 with SMTP id e4mr8758080uae.71.1491883579664; Mon, 10 Apr 2017 21:06:19 -0700 (PDT) Received: from mail-ua0-f176.google.com (mail-ua0-f176.google.com. [209.85.217.176]) by smtp.gmail.com with ESMTPSA id v7sm4193354uaa.35.2017.04.10.21.06.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Apr 2017 21:06:19 -0700 (PDT) Received: by mail-ua0-f176.google.com with SMTP id a1so47462674uaf.3 for ; Mon, 10 Apr 2017 21:06:18 -0700 (PDT) X-Received: by 10.159.36.176 with SMTP id 45mr2837951uar.112.1491883578807; Mon, 10 Apr 2017 21:06:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.82.124 with HTTP; Mon, 10 Apr 2017 21:06:18 -0700 (PDT) From: Trejkaz Date: Tue, 11 Apr 2017 14:06:18 +1000 X-Gmail-Original-Message-ID: Message-ID: Subject: Weird cloning in QueryNode implementations To: Lucene Users Mailing List Content-Type: text/plain; charset=UTF-8 archived-at: Tue, 11 Apr 2017 04:06:26 -0000 Hi all. Something queer I found while looking at QueryNode implementations is this sort of thing: @Override public FieldQueryNode cloneTree() throws CloneNotSupportedException { FieldQueryNode fqn = (FieldQueryNode) super.cloneTree(); fqn.begin = this.begin; fqn.end = this.end; fqn.field = this.field; fqn.text = this.text; fqn.positionIncrement = this.positionIncrement; return fqn; } I guess what I don't get is the point of all these field copies, because: * super.cloneTree() seems to call QueryNodeImpl#cloneTree() * QueryNodeImpl#cloneTree seems to call Object#clone() * Object#clone() seems to already copy all primitives and references (a "shallow copy") So to me it looks like the query node classes are doing a lot of pedalling, but that the gears aren't really connected to the wheels, and that classes should only override these if they have a more complex object which isn't already taken care of automatically. Or am I missing something? TX --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org