The spec on the method Temporal plus(long amountToAdd, TemporalUnit unit) says:
http://download.java.net/jdk9/docs/api/java/time/temporal/Temporal.html#plus-long-java.time.temporal.TemporalUnit-
that UnsupportedTemporalTypeException is expected in the case if the unit is not supported
The following test shows that exception can be thrown not only in the case mentioned above:
public class Test {
public static void main(String[] args) {
Temporal temporal = JapaneseDate.now();
if (IsoFields.WEEK_BASED_YEARS.isSupportedBy(temporal)) {
try {
temporal.minus(1, IsoFields.WEEK_BASED_YEARS);
} catch (UnsupportedTemporalTypeException ute) {
System.out.println("We don't expect UnsupportedTemporalTypeException since the temporal unit is supported by the temporal");
} catch (Exception ex) {
// other exceptions is OK
}
}
}
}
Tests belonging to the JCK9 suite (not yet integrated) will fail due to this issue:
- api/java_time/temporal/TemporalUnit/index.html#IsSupported
http://download.java.net/jdk9/docs/api/java/time/temporal/Temporal.html#plus-long-java.time.temporal.TemporalUnit-
that UnsupportedTemporalTypeException is expected in the case if the unit is not supported
The following test shows that exception can be thrown not only in the case mentioned above:
public class Test {
public static void main(String[] args) {
Temporal temporal = JapaneseDate.now();
if (IsoFields.WEEK_BASED_YEARS.isSupportedBy(temporal)) {
try {
temporal.minus(1, IsoFields.WEEK_BASED_YEARS);
} catch (UnsupportedTemporalTypeException ute) {
System.out.println("We don't expect UnsupportedTemporalTypeException since the temporal unit is supported by the temporal");
} catch (Exception ex) {
// other exceptions is OK
}
}
}
}
Tests belonging to the JCK9 suite (not yet integrated) will fail due to this issue:
- api/java_time/temporal/TemporalUnit/index.html#IsSupported
- duplicates
-
JDK-8223875 Typo in Java API doc for IsoFields
-
- Closed
-
- relates to
-
JDK-8062804 IsoFields WEEK_BASED_YEAR and QUARTER_OF_YEAR too lenient
-
- Resolved
-