Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scalafmt-core to 3.8.6 #539

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ aa7db3a42121f78a5b3bed3658786c1cef83efe8

# Enable scalafmt for Scala 3
64df4ae51873593a789af5848bd225c14d0baf8a

# Scala Steward: Reformat with scalafmt 3.8.6
cc9134f21f040edfe3740184cb2a30d855a776d7
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.6.1"
version = "3.8.6"
style = default

maxColumn = 100
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.in(file("core"))
.settings(commonSettings)
.settings(
name := "scala-java-time",
name := "scala-java-time",
libraryDependencies += ("org.portable-scala" %%% "portable-scala-reflect" % "1.1.3")
.cross(CrossVersion.for3Use2_13)
)
Expand Down
4 changes: 2 additions & 2 deletions core/js/src/main/scala/java/util/SimpleTimeZone.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package java.util

class SimpleTimeZone(rawOffset: Int, var ID: String) extends TimeZone {
override def getRawOffset = rawOffset
override def getRawOffset = rawOffset
/* concrete methods */
override def getID: String = ID
override def getID: String = ID
override def setID(id: String): Unit = ID = id

}
6 changes: 3 additions & 3 deletions core/js/src/main/scala/java/util/TimeZone.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ object TimeZone {
new SimpleTimeZone(offsetInMillis, timeZone)
}

def getDefault: TimeZone = default
def getDefault: TimeZone = default
def setDefault(timeZone: TimeZone): Unit = default = timeZone

def getTimeZone(timeZone: String): TimeZone = getTimeZone(ZoneId.of(timeZone))
def getTimeZone(zoneId: ZoneId): TimeZone = {
def getTimeZone(zoneId: ZoneId): TimeZone = {
val rules = zoneId.getRules
val offsetInMillis = rules.getStandardOffset(Instant.now).getTotalSeconds * 1000
new SimpleTimeZone(offsetInMillis, zoneId.getId)
Expand All @@ -80,7 +80,7 @@ abstract class TimeZone extends Serializable with Cloneable {
// def useDaylightTime: Boolean

/* concrete methods */
def getID: String = ID
def getID: String = ID
def setID(id: String): Unit = ID = id

def getDisplayName(daylight: Boolean, style: Int, locale: Locale): String = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ object HijrahDateConfigurator {
case _: NumberFormatException =>
throw new ParseException(s"Offset is not properly set at line $num.", num)
}
val separatorIndex: Int = deviationElement.indexOf('-')
val separatorIndex: Int = deviationElement.indexOf('-')
if (separatorIndex != -1) {
val startDateStg: String = deviationElement.substring(0, separatorIndex)
val endDateStg: String = deviationElement.substring(separatorIndex + 1, offsetIndex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ final class JapaneseChronology private () extends Chronology with Serializable {
* @throws DateTimeException
* if unable to create the date
* @throws ClassCastException
* if the { @code era} is not a { @code JapaneseEra}
* if the {@code era} is not a {@code JapaneseEra}
*/
override def dateYearDay(era: Era, yearOfEra: Int, dayOfYear: Int): JapaneseDate =
if (!era.isInstanceOf[JapaneseEra]) throw new ClassCastException("Era must be JapaneseEra")
Expand Down Expand Up @@ -283,9 +283,9 @@ final class JapaneseChronology private () extends Chronology with Serializable {
* @param eraValue
* the era value
* @return
* the Japanese { @code Era} for the given numeric era value
* the Japanese {@code Era} for the given numeric era value
* @throws DateTimeException
* if { @code eraValue} is invalid
* if {@code eraValue} is invalid
*/
def eraOf(eraValue: Int): JapaneseEra = JapaneseEra.of(eraValue)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ object JapaneseDate {
* @return
* the date in Japanese calendar system, not null
* @throws DateTimeException
* if unable to convert to a { @code JapaneseDate}
* if unable to convert to a {@code JapaneseDate}
*/
def from(temporal: TemporalAccessor): JapaneseDate = JapaneseChronology.INSTANCE.date(temporal)

Expand Down Expand Up @@ -418,9 +418,9 @@ final class JapaneseDate private[chrono] (
* @param yearOfEra
* the year-of-era to set in the returned date
* @return
* a { @code JapaneseDate} based on this date with the requested year, never null
* a {@code JapaneseDate} based on this date with the requested year, never null
* @throws DateTimeException
* if { @code year} is invalid
* if {@code year} is invalid
*/
private def withYear(era: JapaneseEra, yearOfEra: Int): JapaneseDate = {
val year: Int = JapaneseChronology.INSTANCE.prolepticYear(era, yearOfEra)
Expand All @@ -438,9 +438,9 @@ final class JapaneseDate private[chrono] (
* @param year
* the year to set in the returned date
* @return
* a { @code JapaneseDate} based on this date with the requested year-of-era, never null
* a {@code JapaneseDate} based on this date with the requested year-of-era, never null
* @throws DateTimeException
* if { @code year} is invalid
* if {@code year} is invalid
*/
private def withYear(year: Int): JapaneseDate = withYear(getEra, year)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ object JapaneseEra {
* Obtains an instance of {@code JapaneseEra} from an {@code int} value.
*
* The {@link #SHOWA} era that contains 1970-01-01 (ISO calendar system) has the value 1 Later era
* is numbered 2 ({@link #HEISEI}). Earlier eras are numbered 0 ({@link #TAISHO}),
* -1 ({@link #MEIJI}), only Meiji and later eras are supported.
* is numbered 2 ({@link #HEISEI}). Earlier eras are numbered 0 ({@link #TAISHO}), -1 ({@link
* #MEIJI}), only Meiji and later eras are supported.
*
* @param japaneseEra
* the era to represent
* @return
* the { @code JapaneseEra} singleton, not null
* the {@code JapaneseEra} singleton, not null
* @throws DateTimeException
* if the value is invalid
*/
Expand All @@ -112,7 +112,7 @@ object JapaneseEra {
* @param japaneseEra
* the japaneseEra name; non-null
* @return
* the { @code JapaneseEra} singleton, never null
* the {@code JapaneseEra} singleton, never null
* @throws IllegalArgumentException
* if there is not JapaneseEra with the specified name
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ object TTBPJapaneseEra {
* @param name
* the name
* @return
* the { @code JapaneseEra} singleton, not null
* the {@code JapaneseEra} singleton, not null
* @throws DateTimeException
* if an additional era has already been registered
*/
Expand Down
4 changes: 2 additions & 2 deletions core/native/src/main/scala/java/util/SimpleTimeZone.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package java.util

class SimpleTimeZone(rawOffset: Int, var ID: String) extends TimeZone {
override def getRawOffset = rawOffset
override def getRawOffset = rawOffset
/* concrete methods */
override def getID: String = ID
override def getID: String = ID
override def setID(id: String): Unit = ID = id

}
6 changes: 3 additions & 3 deletions core/native/src/main/scala/java/util/TimeZone.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ object TimeZone {
// TODO: implement this functionality, perhaps using https://github.com/scala-native/scala-native/blob/master/posixlib/src/main/scala/scala/scalanative/posix/time.scala
new SimpleTimeZone(0, "UTC")

def getDefault: TimeZone = default
def getDefault: TimeZone = default
def setDefault(timeZone: TimeZone): Unit = default = timeZone

def getTimeZone(timeZone: String): TimeZone = getTimeZone(ZoneId.of(timeZone))
def getTimeZone(zoneId: ZoneId): TimeZone = {
def getTimeZone(zoneId: ZoneId): TimeZone = {
val rules = zoneId.getRules
val offsetInMillis = rules.getStandardOffset(Instant.now).getTotalSeconds * 1000
new SimpleTimeZone(offsetInMillis, zoneId.getId)
Expand All @@ -42,7 +42,7 @@ abstract class TimeZone extends Serializable with Cloneable {
// def useDaylightTime: Boolean

/* concrete methods */
def getID: String = ID
def getID: String = ID
def setID(id: String): Unit = ID = id

def getDisplayName(daylight: Boolean, style: Int, locale: Locale): String = {
Expand Down
4 changes: 2 additions & 2 deletions core/shared/src/main/scala-2/org/threeten/bp/DayOfWeek.scala
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ object DayOfWeek {
* @return
* the day-of-week, not null
* @throws DateTimeException
* if unable to convert to a { @code DayOfWeek}
* if unable to convert to a {@code DayOfWeek}
*/
def from(temporal: TemporalAccessor): DayOfWeek = {
temporal match {
Expand Down Expand Up @@ -288,7 +288,7 @@ final class DayOfWeek(name: String, ordinal: Int)
* @throws DateTimeException
* if a value for the field cannot be obtained
* @throws DateTimeException
* if the range of valid values for the field exceeds an { @code int}
* if the range of valid values for the field exceeds an {@code int}
* @throws DateTimeException
* if the value is outside the range of valid values for the field
* @throws ArithmeticException
Expand Down
4 changes: 2 additions & 2 deletions core/shared/src/main/scala-2/org/threeten/bp/Month.scala
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ object Month {
* @return
* the month-of-year, not null
* @throws DateTimeException
* if unable to convert to a { @code Month}
* if unable to convert to a {@code Month}
*/
def from(temporal: TemporalAccessor): Month = {
var _temporal = temporal
Expand Down Expand Up @@ -338,7 +338,7 @@ final class Month private (name: String, ordinal: Int)
* @throws DateTimeException
* if a value for the field cannot be obtained
* @throws DateTimeException
* if the range of valid values for the field exceeds an { @code int}
* if the range of valid values for the field exceeds an {@code int}
* @throws DateTimeException
* if the value is outside the range of valid values for the field
* @throws ArithmeticException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ object TTBPDateTimeFormatterBuilder {
* @param signStyle
* the positive/negative sign style, not null
* @param subsequentWidth
* the width of subsequent non-negative numbers, 0 or greater,
* -1 if fixed width due to active adjacent parsing
* the width of subsequent non-negative numbers, 0 or greater, -1 if fixed width due to active
* adjacent parsing
*/
private[format] class NumberPrinterParser private[format] (
private[format] val field: TemporalField,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,13 @@ object IsoFields {
private def QY = "QuarterOfYear"

lazy val QUARTER_OF_YEAR: Field = new Field("QUARTER_OF_YEAR", 1) {
override def toString: String = QY
def getBaseUnit: TemporalUnit = QUARTER_YEARS
def getRangeUnit: TemporalUnit = YEARS
def range: ValueRange = ValueRange.of(1, 4)
def isSupportedBy(temporal: TemporalAccessor): Boolean =
override def toString: String = QY
def getBaseUnit: TemporalUnit = QUARTER_YEARS
def getRangeUnit: TemporalUnit = YEARS
def range: ValueRange = ValueRange.of(1, 4)
def isSupportedBy(temporal: TemporalAccessor): Boolean =
temporal.isSupported(MONTH_OF_YEAR) && isIso(temporal)
def rangeRefinedBy(temporal: TemporalAccessor): ValueRange = range
def rangeRefinedBy(temporal: TemporalAccessor): ValueRange = range
def getFrom(temporal: TemporalAccessor): Long = {
if (!temporal.isSupported(this))
throw unsupportedEx(QY)
Expand Down Expand Up @@ -349,13 +349,13 @@ object IsoFields {
new UnsupportedTemporalTypeException(s"Unsupported field: $f")

lazy val WEEK_BASED_YEAR: Field = new Field("WEEK_BASED_YEAR", 3) {
override def toString: String = WBY
def getBaseUnit: TemporalUnit = WEEK_BASED_YEARS
def getRangeUnit: TemporalUnit = FOREVER
def range: ValueRange = YEAR.range
def isSupportedBy(temporal: TemporalAccessor): Boolean =
override def toString: String = WBY
def getBaseUnit: TemporalUnit = WEEK_BASED_YEARS
def getRangeUnit: TemporalUnit = FOREVER
def range: ValueRange = YEAR.range
def isSupportedBy(temporal: TemporalAccessor): Boolean =
temporal.isSupported(EPOCH_DAY) && isIso(temporal)
def rangeRefinedBy(temporal: TemporalAccessor): ValueRange = YEAR.range
def rangeRefinedBy(temporal: TemporalAccessor): ValueRange = YEAR.range
def getFrom(temporal: TemporalAccessor): Long =
if (!temporal.isSupported(this))
throw unsupportedEx(WBY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import scala.collection.immutable
// TreeMap is not available in Scala.js however it is needed for Time Zone support
// This is a simple implementation of NavigableMap, performance is likely terrible
private[bp] class ZoneMap[K: ClassTag, V] private[bp] (var map: immutable.TreeMap[K, V])(implicit
ordering: Ordering[K]
ordering: Ordering[K]
) extends AbstractMap[K, V]
with java.util.NavigableMap[K, V] {
def this()(implicit ordering: Ordering[K]) =
Expand Down Expand Up @@ -164,6 +164,6 @@ private[bp] class ZoneMap[K: ClassTag, V] private[bp] (var map: immutable.TreeMa
object ZoneMap {

def apply[K: ClassTag, V](map: immutable.TreeMap[K, V])(implicit
ordering: Ordering[K]
ordering: Ordering[K]
): java.util.NavigableMap[K, V] = new ZoneMap[K, V](map)
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ object ZoneOffsetTransitionRule {
* @param dayOfMonthIndicator
* the day of the month-day of the cutover week, positive if the week is that day or later,
* negative if the week is that day or earlier, counting from the last day of the month, from
* -28 to 31 excluding 0
* -28 to 31 excluding 0
* @param dayOfWeek
* the required day-of-week, null if the month-day should not be changed
* @param time
Expand Down
4 changes: 2 additions & 2 deletions core/shared/src/main/scala-3/org/threeten/bp/DayOfWeek.scala
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ object DayOfWeek {
* @return
* the day-of-week, not null
* @throws DateTimeException
* if unable to convert to a { @code DayOfWeek}
* if unable to convert to a {@code DayOfWeek}
*/
def from(temporal: TemporalAccessor): DayOfWeek = {
temporal match {
Expand Down Expand Up @@ -279,7 +279,7 @@ enum DayOfWeek(name: String, ordinal: Int)
* @throws DateTimeException
* if a value for the field cannot be obtained
* @throws DateTimeException
* if the range of valid values for the field exceeds an { @code int}
* if the range of valid values for the field exceeds an {@code int}
* @throws DateTimeException
* if the value is outside the range of valid values for the field
* @throws ArithmeticException
Expand Down
4 changes: 2 additions & 2 deletions core/shared/src/main/scala-3/org/threeten/bp/Month.scala
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ object Month {
* @return
* the month-of-year, not null
* @throws DateTimeException
* if unable to convert to a { @code Month}
* if unable to convert to a {@code Month}
*/
def from(temporal: TemporalAccessor): Month = {
var _temporal = temporal
Expand Down Expand Up @@ -320,7 +320,7 @@ enum Month private (name: String, ordinal: Int)
* @throws DateTimeException
* if a value for the field cannot be obtained
* @throws DateTimeException
* if the range of valid values for the field exceeds an { @code int}
* if the range of valid values for the field exceeds an {@code int}
* @throws DateTimeException
* if the value is outside the range of valid values for the field
* @throws ArithmeticException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ object TTBPDateTimeFormatterBuilder {
* @param signStyle
* the positive/negative sign style, not null
* @param subsequentWidth
* the width of subsequent non-negative numbers, 0 or greater,
* -1 if fixed width due to active adjacent parsing
* the width of subsequent non-negative numbers, 0 or greater, -1 if fixed width due to active
* adjacent parsing
*/
private[format] class NumberPrinterParser private[format] (
private[format] val field: TemporalField,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ object ZoneOffsetTransitionRule {
* @param dayOfMonthIndicator
* the day of the month-day of the cutover week, positive if the week is that day or later,
* negative if the week is that day or earlier, counting from the last day of the month, from
* -28 to 31 excluding 0
* -28 to 31 excluding 0
* @param dayOfWeek
* the required day-of-week, null if the month-day should not be changed
* @param time
Expand Down
4 changes: 3 additions & 1 deletion core/shared/src/main/scala/org/threeten/bp/Clock.scala
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ object Clock {
if (tickDuration.isNegative)
throw new IllegalArgumentException("Tick duration must not be negative")
val tickNanos: Long = tickDuration.toNanos
if (tickNanos % 1000000 == 0) {} else if (1000000000 % tickNanos == 0) {} else
if (tickNanos % 1000000 == 0) {}
else if (1000000000 % tickNanos == 0) {}
else
throw new IllegalArgumentException("Invalid tick duration")
if (tickNanos <= 1)
return baseClock
Expand Down
Loading
Loading