Path: csiph.com!aioe.org!.POSTED.O5hsyUvK01te0L/SZurVSQ.user.gioia.aioe.org!not-for-mail From: =?UTF-8?Q?Arne_Vajh=c3=b8j?= Newsgroups: comp.lang.java.programmer Subject: Re: How bad i are my coding skills? Date: Mon, 30 Dec 2019 15:11:04 -0500 Organization: Aioe.org NNTP Server Lines: 17 Message-ID: References: <28133f49-0465-447d-9a34-062fb8c82ea1@googlegroups.com> <5d7de6a8-eb4a-462c-989a-1c27a714aa03@googlegroups.com> <10688a10-1ff9-478d-a9f0-0abcf4726077@googlegroups.com> NNTP-Posting-Host: O5hsyUvK01te0L/SZurVSQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: csiph.com comp.lang.java.programmer:39250 On 12/30/2019 8:46 AM, chad altenburg wrote: > And here is the other winner when dealing with memory leaks and off > by one errors. I use the Google Calendar API to check for the current > day. The days representing like Calendar.SUNDAY, Calendar.MONDAY, … > > The problem is that is if Google changes integer value for something > like Calendar.SUNDAY on the next API update, then some of my code > breaks because the value will be off by at least one. Do you have any > ideas how I can prevent something like this from happening? Don't worry about it. Calendar.Xxxday are static final fields. And due to how they are treated in Java, then there is no way Oracle/JCP will ever change the values. Arne