From commits-return-5613-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Fri Feb 23 11:49:12 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 4C0FE180652 for ; Fri, 23 Feb 2018 11:49:12 +0100 (CET) Received: (qmail 81084 invoked by uid 500); 23 Feb 2018 10:49:11 -0000 Mailing-List: contact commits-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list commits@groovy.apache.org Received: (qmail 81075 invoked by uid 99); 23 Feb 2018 10:49:11 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Feb 2018 10:49:11 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 52451E96C5; Fri, 23 Feb 2018 10:49:11 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: paulk@apache.org To: commits@groovy.apache.org Message-Id: <849b4fe2ebd648a2b78543e109d68f2b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: groovy git commit: Documentation: traits vs default methods: clarify difference (closes #660) Date: Fri, 23 Feb 2018 10:49:11 +0000 (UTC) Repository: groovy Updated Branches: refs/heads/GROOVY_2_5_X 28a9a8053 -> cc9758544 Documentation: traits vs default methods: clarify difference (closes #660) Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/cc975854 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/cc975854 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/cc975854 Branch: refs/heads/GROOVY_2_5_X Commit: cc97585444b71e9eba377d02c26c07c02063c8de Parents: 28a9a80 Author: Martin Gansler Authored: Thu Feb 8 08:27:41 2018 +0100 Committer: paulk Committed: Fri Feb 23 20:48:58 2018 +1000 ---------------------------------------------------------------------- src/spec/doc/core-traits.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/cc975854/src/spec/doc/core-traits.adoc ---------------------------------------------------------------------- diff --git a/src/spec/doc/core-traits.adoc b/src/spec/doc/core-traits.adoc index 5bd17ce..61f66b4 100644 --- a/src/spec/doc/core-traits.adoc +++ b/src/spec/doc/core-traits.adoc @@ -562,7 +562,7 @@ include::{projectdir}/src/spec/test/TraitsSpecificationTest.groovy[tags=sam_trai In Java 8, interfaces can have default implementations of methods. If a class implements an interface and does not provide an implementation for a default method, then the implementation from the interface is chosen. Traits behave the same but with a major difference: the implementation from the trait is *always* used if the class declares the trait in its interface -list *and* that it doesn't provide an implementation. +list *and* that it doesn't provide an implementation *even* if a super class does. This feature can be used to compose behaviors in an very precise way, in case you want to override the behavior of an already implemented method.