Skip to content

Commit

Permalink
backport -api and -bouncy modules to JDK 17
Browse files Browse the repository at this point in the history
  • Loading branch information
msgilligan committed Mar 8, 2024
1 parent cc5159c commit 6d4ad77
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion secp256k1-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

tasks.withType(JavaCompile).configureEach {
options.release = 21
options.release = 17
}

ext.moduleName = 'org.bitcoinj.secp256k1.api'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ static <T> Result<T> checked(int error_code, T result) {
default T unwrap() {
return unwrap("Error");
}
default T unwrap(String message) {
return switch(this) {
case Ok<T> ok -> ok.result();
case Err<T> err -> throw new IllegalStateException(message + ": " + err.code());
};
}
default T unwrap(String message) {
if (this instanceof Ok<T> ok) {
return ok.result();
} else if (this instanceof Err<T> err) {
throw new IllegalStateException(message + ": " + err.code());
} else {
throw new IllegalStateException("Can't get here");
}
}
}
2 changes: 1 addition & 1 deletion secp256k1-bouncy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

tasks.withType(JavaCompile).configureEach {
options.release = 21
options.release = 17
}

ext.moduleName = 'org.bitcoinj.secp256k1.bouncy'
Expand Down

0 comments on commit 6d4ad77

Please sign in to comment.