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

Java9 synch #15

Merged
merged 8 commits into from
May 18, 2024
Merged
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
16 changes: 8 additions & 8 deletions .github/workflows/BuildSnapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'zulu'
cache: maven
- uses: s4u/maven-settings-action@v2.7.0
- uses: s4u/maven-settings-action@v3.0.0
with:
sonatypeSnapshots: true
apacheSnapshots: true
Expand All @@ -45,23 +45,23 @@ jobs:
name: Run Sonar analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '11'
java-version: '17'
distribution: 'zulu'
cache: maven
- name: Cache SonarCloud packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- uses: s4u/maven-settings-action@v2.7.0
- uses: s4u/maven-settings-action@v3.0.0
with:
sonatypeSnapshots: true
apacheSnapshots: true
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'zulu'
cache: maven
gpg-private-key: ${{ secrets.GPG_KEY }}
- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v21
uses: whelk-io/maven-settings-xml-action@v22
with:
repositories: |
[
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/UpdateDependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ jobs:
updateGWT28:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: 'master'
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'zulu'
cache: maven
- uses: s4u/maven-settings-action@v2.7.0
- uses: s4u/maven-settings-action@v3.0.0
with:
sonatypeSnapshots: true
apacheSnapshots: true
Expand All @@ -32,7 +32,7 @@ jobs:
run: mvn -B versions:resolve-ranges versions:update-properties -Dincludes=com.jresearchsoft*:*,org.jresearch*:* -DallowSnapshots --builder singlethreaded
working-directory: pom
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
uses: peter-evans/create-pull-request@v6
with:
branch: gwt28/dep-update
commit-message: Update shapshot dependencies
Expand All @@ -41,16 +41,16 @@ jobs:
updateGWT29:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: 'GWT29'
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'zulu'
cache: maven
- uses: s4u/maven-settings-action@v2.7.0
- uses: s4u/maven-settings-action@v3.0.0
with:
sonatypeSnapshots: true
apacheSnapshots: true
Expand All @@ -64,7 +64,7 @@ jobs:
run: mvn -B versions:resolve-ranges versions:update-properties -Dincludes=com.jresearchsoft*:*,org.jresearch*:* -DallowSnapshots --builder singlethreaded
working-directory: pom
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
uses: peter-evans/create-pull-request@v6
with:
branch: gwt29/dep-update
commit-message: Update shapshot dependencies
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@
**/TempTest.java
/.idea/
/threetenbp.iml
time/gwt-unitCache/*
time/war/*
time/www-test/*
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,9 @@
*/
package org.jresearch.threetenbp.gwt.emu.java.time;

import static org.jresearch.threetenbp.gwt.emu.java.time.LocalTime.NANOS_PER_MINUTE;
import static org.jresearch.threetenbp.gwt.emu.java.time.LocalTime.NANOS_PER_SECOND;
import static org.jresearch.threetenbp.gwt.emu.java.time.LocalTime.*;

import java.io.Serializable;
import org.jresearch.threetenbp.gwt.emu.java.time.Clock;
import org.jresearch.threetenbp.gwt.emu.java.time.DateTimeException;
import org.jresearch.threetenbp.gwt.emu.java.time.Duration;
import org.jresearch.threetenbp.gwt.emu.java.time.Instant;
import org.jresearch.threetenbp.gwt.emu.java.time.ZoneId;
import org.jresearch.threetenbp.gwt.emu.java.time.ZoneOffset;
import java.util.Objects;
import java.util.TimeZone;

Expand Down Expand Up @@ -116,7 +109,7 @@ public abstract class Clock {
* @return a clock that uses the best available system clock in the UTC zone, not null
*/
public static Clock systemUTC() {
return new SystemClock(ZoneOffset.UTC);
return SystemClock.CLOCK_UTC;
}

/**
Expand Down Expand Up @@ -159,9 +152,19 @@ public static Clock systemDefaultZone() {
*/
public static Clock system(ZoneId zone) {
Objects.requireNonNull(zone, "zone");
if (zone == ZoneOffset.UTC) {
return SystemClock.CLOCK_UTC;
}
return new SystemClock(zone);
}

//-------------------------------------------------------------------------
/**
* @since 9
*/
public static Clock tickMillis(ZoneId zone) {
return new TickClock(system(zone), NANOS_PER_MILLI);
}
//-------------------------------------------------------------------------
/**
* Obtains a clock that returns the current instant ticking in whole seconds
Expand Down Expand Up @@ -403,6 +406,7 @@ public int hashCode() {
*/
static final class SystemClock extends Clock implements Serializable {
private static final long serialVersionUID = 6740630888130243051L;
static final SystemClock CLOCK_UTC = new SystemClock(ZoneOffset.UTC);
private final ZoneId zone;

SystemClock(ZoneId zone) {
Expand All @@ -414,8 +418,8 @@ public ZoneId getZone() {
}
@Override
public Clock withZone(ZoneId zone) {
//GWT specific
Objects.requireNonNull(zone);
//GWT specific
Objects.requireNonNull(zone);
if (zone.equals(this.zone)) { // intentional NPE
return this;
}
Expand Down Expand Up @@ -452,7 +456,7 @@ public String toString() {
* This is typically used for testing.
*/
static final class FixedClock extends Clock implements Serializable {
private static final long serialVersionUID = 7430389292664866958L;
private static final long serialVersionUID = 7430389292664866958L;
private final Instant instant;
private final ZoneId zone;

Expand All @@ -466,8 +470,8 @@ public ZoneId getZone() {
}
@Override
public Clock withZone(ZoneId zone) {
//GWT specific
Objects.requireNonNull(zone);
//GWT specific
Objects.requireNonNull(zone);
if (zone.equals(this.zone)) { // intentional NPE
return this;
}
Expand Down Expand Up @@ -504,7 +508,7 @@ public String toString() {
* Implementation of a clock that adds an offset to an underlying clock.
*/
static final class OffsetClock extends Clock implements Serializable {
private static final long serialVersionUID = 2007484719125426256L;
private static final long serialVersionUID = 2007484719125426256L;
private final Clock baseClock;
private final Duration offset;

Expand All @@ -518,8 +522,8 @@ public ZoneId getZone() {
}
@Override
public Clock withZone(ZoneId zone) {
//GWT specific
Objects.requireNonNull(zone);
//GWT specific
Objects.requireNonNull(zone);
if (zone.equals(baseClock.getZone())) { // intentional NPE
return this;
}
Expand Down Expand Up @@ -570,8 +574,8 @@ public ZoneId getZone() {
}
@Override
public Clock withZone(ZoneId zone) {
//GWT specific
Objects.requireNonNull(zone);
//GWT specific
Objects.requireNonNull(zone);
if (zone.equals(baseClock.getZone())) { // intentional NPE
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public boolean isSupported(TemporalField field) {
* <p>
* If the field is {@link ChronoField#DAY_OF_WEEK DAY_OF_WEEK} then the
* range of the day-of-week, from 1 to 7, will be returned.
* All other {@code ChronoField} instances will throw a {@code DateTimeException}.
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
* <p>
* If the field is not a {@code ChronoField}, then the result of this method
* is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)}
Expand All @@ -247,6 +247,7 @@ public boolean isSupported(TemporalField field) {
* @param field the field to query the range for, not null
* @return the range of valid values for the field, not null
* @throws DateTimeException if the range for the field cannot be obtained
* @throws UnsupportedTemporalTypeException if the type of field is not supported (since 9)
*/
@Override
public ValueRange range(TemporalField field) {
Expand All @@ -266,7 +267,7 @@ public ValueRange range(TemporalField field) {
* <p>
* If the field is {@link ChronoField#DAY_OF_WEEK DAY_OF_WEEK} then the
* value of the day-of-week, from 1 to 7, will be returned.
* All other {@code ChronoField} instances will throw a {@code DateTimeException}.
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
* <p>
* If the field is not a {@code ChronoField}, then the result of this method
* is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)}
Expand All @@ -276,8 +277,9 @@ public ValueRange range(TemporalField field) {
* @param field the field to get, not null
* @return the value for the field, within the valid range of values
* @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}
* @throws DateTimeException if the value is outside the range of valid values for the field
* @throws UnsupportedTemporalTypeException if the type of field is not supported or
* the range of values exceeds an {@code int} (since 9)
* @throws ArithmeticException if numeric overflow occurs
*/
@Override
Expand All @@ -297,7 +299,7 @@ public int get(TemporalField field) {
* <p>
* If the field is {@link ChronoField#DAY_OF_WEEK DAY_OF_WEEK} then the
* value of the day-of-week, from 1 to 7, will be returned.
* All other {@code ChronoField} instances will throw a {@code DateTimeException}.
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
* <p>
* If the field is not a {@code ChronoField}, then the result of this method
* is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)}
Expand All @@ -307,6 +309,7 @@ public int get(TemporalField field) {
* @param field the field to get, not null
* @return the value for the field
* @throws DateTimeException if a value for the field cannot be obtained
* @throws UnsupportedTemporalTypeException if the type of field is not supported (since 9)
* @throws ArithmeticException if numeric overflow occurs
*/
@Override
Expand Down
Loading