You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because of the setters on private Calendar startDate, endDate; the SunPhase class is not thread safe. And since com.florianmski.suncalc.SunCalc which calls the setters is in a different package from com.florianmski.suncalc.models.SunPhase, the setter can't even be made package private for better encapsulation.
Perhaps we SunPhase should only house the the existing constructor's final variables:
private final Name name;
private final double startAngle, endAngle;
private final boolean startRise, endRise;
and then, once the date is known, we construct and return a new SunPhaseDay class once the date is specified in SunCalc#getPhases that includes:
private final Name name;
private final double startAngle, endAngle;
private final boolean startRise, endRise;
private final Calendar startDate, endDate;
The text was updated successfully, but these errors were encountered:
Because of the setters on
private Calendar startDate, endDate;
theSunPhase
class is not thread safe. And sincecom.florianmski.suncalc.SunCalc
which calls the setters is in a different package fromcom.florianmski.suncalc.models.SunPhase
, the setter can't even be made package private for better encapsulation.Perhaps we
SunPhase
should only house the the existing constructor's final variables:and then, once the date is known, we construct and return a new
SunPhaseDay
class once the date is specified inSunCalc#getPhases
that includes:The text was updated successfully, but these errors were encountered: