groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Northrop <>
Subject Re: Super Confused About Java vs Groovy Date() and deprecation
Date Sun, 10 Jan 2016 08:14:29 GMT
Hi Jerry
never used eclipse myself as i find it tough to figure out if issues are actually code related
or just a flaky IDE.

what happens when you try dates in the groovyConsole or as a script ? i tend to use the groovyConsole
as it (almost) always gives me code i can paste into the final product. 

if i feel really grumpy, this annotation helps:  @SuppressWarnings( "deprecation" )

also i only use ISO  dates and just convert back&forth but rarely use local date approach.
almost worth roll your own Date class for future stuff.

Have a GR8 day !

On Jan 10, 2016, at 5:41 AM, 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. 
> 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 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. 
> 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?
> If this is an eclipse only issue, then I'm sorry. 
> Thanks again!
> Regards,
> Jerry
> Gerald R. Wiltse

View raw message