Return-Path: X-Original-To: apmail-groovy-users-archive@minotaur.apache.org Delivered-To: apmail-groovy-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2F26818CCA for ; Sun, 10 Jan 2016 15:50:49 +0000 (UTC) Received: (qmail 93747 invoked by uid 500); 10 Jan 2016 15:50:48 -0000 Delivered-To: apmail-groovy-users-archive@groovy.apache.org Received: (qmail 93712 invoked by uid 500); 10 Jan 2016 15:50:48 -0000 Mailing-List: contact users-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@groovy.apache.org Delivered-To: mailing list users@groovy.apache.org Received: (qmail 93702 invoked by uid 99); 10 Jan 2016 15:50:48 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 10 Jan 2016 15:50:48 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 29B46C0CFE for ; Sun, 10 Jan 2016 15:50:48 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.879 X-Spam-Level: X-Spam-Status: No, score=0.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_REPLY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id p11ao_Tb4DgZ for ; Sun, 10 Jan 2016 15:50:47 +0000 (UTC) Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id EF67E43B6F for ; Sun, 10 Jan 2016 15:50:46 +0000 (UTC) Received: by mail-wm0-f52.google.com with SMTP id b14so235113618wmb.1 for ; Sun, 10 Jan 2016 07:50:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=GumOaGl2ZWurdhOjosNjEtiL+aXMK8G2X5eFAgMfLG0=; b=vXvAXJQqgZolV7kY2vyOn/irEfuJQJK/JC3H1RRQcoNVoJZ2qxfZATTxYcmRTBwSjF CCc6A7j76S4TJI0WuQmFDyEIlNj7Kcxz1xetCfIFf5wzS9HN+ul7JoAAyS+4WCXivab4 T4BVEN84GnEkY3lvKdFbRxu05HHO20Fzjn7R8QWgW9zyTRIRgkks2Pu1ToFMxizxywDE QQhOCb4GvgXD/XgG5FRxplVCeWDavZWMMdy83fgu2KHxN7IrY/as6sKZb1QQrRSqQ1iC m3n7M4MG4SFTgMvD9GDkB/kvbl0sicBUwQc67d+MDVvLt9TRfsC+OnhOhTwUABVqo1gU 8brA== X-Received: by 10.194.175.233 with SMTP id cd9mr48125674wjc.115.1452441040216; Sun, 10 Jan 2016 07:50:40 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.178.162 with HTTP; Sun, 10 Jan 2016 07:50:20 -0800 (PST) In-Reply-To: References: From: =?UTF-8?B?RGlua28gU3Jrb8SN?= Date: Sun, 10 Jan 2016 16:50:20 +0100 Message-ID: Subject: Re: Super Confused About Java vs Groovy Date() and deprecation To: users@groovy.apache.org Content-Type: text/plain; charset=UTF-8 On 10 January 2016 at 05:41, Gerald Wiltse wrote: > I'm sure this is old topic, but I can't find clear answer. IT's about > Date(), but i suppose it's true for anything "Java" which Groovy has > decorated. Actually, it's mostly about Java, not much Groovy here. > > Apparently, Java Date() is ancient, disliked, and now a bunch of the > fundamental Java Date() stuff is all "deprecated". Fortunately, Groovys new > Date().parse(string,string) constructor still works for me. But, everything Groovy's `Date.parse` is a static method, so no need to instantiate `Date` to use `parse()` ... This pretty much concludes Groovy's involvement here. ;-) > I try to do with my date object now says deprectated. It gives me all the > good code completion, and shows that it's suggesting Groovy methods, but > when I implement it puts a strikethrough, and says of course... > > setYear > > @Deprecated > public void setYear(int year) > > Deprecated. As of JDK version 1.1, replaced by Calendar.set(Calendar.YEAR, > year + 1900). > > 1. I want to color inside the lines, so should I move toward using all > Calendar objects and methods and completely avoid using Date() on new > projects? It's no problem, I just don't see that clearly stated anywhere in > the Groovy docs. The links that Thibault provided are relevant here. It is not stated in the Groovy docs because those are not Groovy's classes, they're Java's. Groovy does provide some extensions, but that is just to make your life easier if you happen to use that particular API. You should probably use java.time.* if you're on Java 8, otherwise Joda-Time library. Date & Calendar is always here if all else fails. > > 2. OR... are Groovy date methods alive and well and somehow I can tell > eclipse to stop associated with the old Java classes when Groovy ones are > present? Eclipse is right to mark those methods as deprecated because they are. Groovy cannot hide them. > > If this is an eclipse only issue, then I'm sorry. It is not, nothing to be sorry about. :-) Every self-respecting IDE should to the same (and indeed they do). Cheers, Dinko > > Thanks again! > > Regards, > Jerry > > > Gerald R. Wiltse > jerrywiltse@gmail.com >