This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Date getstartDate() | |
{ | |
return startDate; | |
} | |
public void setstartDate(Date startDate) | |
{ | |
this.startDate = startDate; | |
} |
But SonarLint is complaining about it, so I refactored it into this:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Date getstartDate() | |
{ | |
return startDate == null ? null : new Date(startDate.getTime()); | |
} | |
public void setstartDate(Date startDate) | |
{ | |
if (startDate != null) { | |
this.startDate = new Date(startDate.getTime()); | |
} else | |
{ | |
this.startDate = null; | |
} | |
} | |
It's high time this old codebase gets converted to LocalDates.
References
- SonarSource - RSPEC-2384
- https://rules.sonarsource.com/java/RSPEC-2384
No comments:
Post a Comment