Skip to content

Commit

Permalink
[misc] pattern matching in instanceof correction for java 8 support
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Oct 18, 2023
1 parent 04f99d5 commit 7b197fe
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/main/java/org/mariadb/jdbc/BasePreparedStatement.java
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,8 @@ private void setInternalObject(
"HY000",
e);
}
} else if (obj instanceof Number bd) {
} else if (obj instanceof Number) {
Number bd = (Number) obj;
switch (targetSqlType) {
case Types.TINYINT:
setByte(parameterIndex, bd.byteValue());
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/mariadb/jdbc/MariaDbPoolConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ public Configuration getConf() {

@Override
public boolean isSameRM(XAResource xaResource) {
if (xaResource instanceof MariaDbXAResource other) {
if (xaResource instanceof MariaDbXAResource) {
MariaDbXAResource other = (MariaDbXAResource) xaResource;
return other.getConf().equals(this.getConf());
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public int hashCode() {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (!(o instanceof Curve c)) return false;
if (!(o instanceof Curve)) return false;
Curve c = (Curve) o;
return f.equals(c.getField()) && d.equals(c.getD()) && I.equals(c.getI());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,8 @@ public int hashCode() {
@Override
public boolean equals(Object obj) {
if (obj == this) return true;
if (!(obj instanceof GroupElement ge)) return false;
if (!(obj instanceof GroupElement)) return false;
GroupElement ge = (GroupElement) obj;
if (!this.repr.equals(ge.repr)) {
try {
ge = ge.toRep(this.repr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,8 @@ public int hashCode() {

@Override
public boolean equals(Object obj) {
if (!(obj instanceof Ed25519FieldElement fe)) return false;
if (!(obj instanceof Ed25519FieldElement)) return false;
Ed25519FieldElement fe = (Ed25519FieldElement) obj;
return 1 == Utils.equal(toByteArray(), fe.toByteArray());
}

Expand Down

0 comments on commit 7b197fe

Please sign in to comment.