Skip to content

Commit

Permalink
Regenerate XDR (remove the dependency on Guava) (#525)
Browse files Browse the repository at this point in the history
  • Loading branch information
overcat authored Sep 12, 2023
1 parent 00da8ab commit e6ccc9e
Show file tree
Hide file tree
Showing 358 changed files with 2,641 additions and 3,490 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ xdr/Stellar-contract.x \
xdr/Stellar-internal.x \
xdr/Stellar-contract-config-setting.x

XDRGEN_COMMIT=472eac8c5609d310d48bd8eed68aa24d2626df53
XDRGEN_COMMIT=f0c41458ca0b66b4649b18deddc9f7a11199f1f9
XDRNEXT_COMMIT=e372df9f677961aac04c5a4cc80a3667f310b29f

.PHONY: xdr xdr-clean xdr-update
Expand Down
40 changes: 18 additions & 22 deletions src/main/java/org/stellar/sdk/xdr/AccountEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

import static org.stellar.sdk.xdr.Constants.*;

import com.google.common.base.Objects;
import com.google.common.io.BaseEncoding;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Base64;
import java.util.Objects;

// === xdr source ============================================================

Expand Down Expand Up @@ -198,7 +198,7 @@ public static AccountEntry decode(XdrDataInputStream stream) throws IOException

@Override
public int hashCode() {
return Objects.hashCode(
return Objects.hash(
this.accountID,
this.balance,
this.seqNum,
Expand All @@ -218,22 +218,21 @@ public boolean equals(Object object) {
}

AccountEntry other = (AccountEntry) object;
return Objects.equal(this.accountID, other.accountID)
&& Objects.equal(this.balance, other.balance)
&& Objects.equal(this.seqNum, other.seqNum)
&& Objects.equal(this.numSubEntries, other.numSubEntries)
&& Objects.equal(this.inflationDest, other.inflationDest)
&& Objects.equal(this.flags, other.flags)
&& Objects.equal(this.homeDomain, other.homeDomain)
&& Objects.equal(this.thresholds, other.thresholds)
return Objects.equals(this.accountID, other.accountID)
&& Objects.equals(this.balance, other.balance)
&& Objects.equals(this.seqNum, other.seqNum)
&& Objects.equals(this.numSubEntries, other.numSubEntries)
&& Objects.equals(this.inflationDest, other.inflationDest)
&& Objects.equals(this.flags, other.flags)
&& Objects.equals(this.homeDomain, other.homeDomain)
&& Objects.equals(this.thresholds, other.thresholds)
&& Arrays.equals(this.signers, other.signers)
&& Objects.equal(this.ext, other.ext);
&& Objects.equals(this.ext, other.ext);
}

@Override
public String toXdrBase64() throws IOException {
BaseEncoding base64Encoding = BaseEncoding.base64();
return base64Encoding.encode(toXdrByteArray());
return Base64.getEncoder().encodeToString(toXdrByteArray());
}

@Override
Expand All @@ -245,8 +244,7 @@ public byte[] toXdrByteArray() throws IOException {
}

public static AccountEntry fromXdrBase64(String xdr) throws IOException {
BaseEncoding base64Encoding = BaseEncoding.base64();
byte[] bytes = base64Encoding.decode(xdr);
byte[] bytes = Base64.getDecoder().decode(xdr);
return fromXdrByteArray(bytes);
}

Expand Down Expand Up @@ -413,7 +411,7 @@ public static AccountEntryExt decode(XdrDataInputStream stream) throws IOExcepti

@Override
public int hashCode() {
return Objects.hashCode(this.v1, this.v);
return Objects.hash(this.v1, this.v);
}

@Override
Expand All @@ -423,13 +421,12 @@ public boolean equals(Object object) {
}

AccountEntryExt other = (AccountEntryExt) object;
return Objects.equal(this.v1, other.v1) && Objects.equal(this.v, other.v);
return Objects.equals(this.v1, other.v1) && Objects.equals(this.v, other.v);
}

@Override
public String toXdrBase64() throws IOException {
BaseEncoding base64Encoding = BaseEncoding.base64();
return base64Encoding.encode(toXdrByteArray());
return Base64.getEncoder().encodeToString(toXdrByteArray());
}

@Override
Expand All @@ -441,8 +438,7 @@ public byte[] toXdrByteArray() throws IOException {
}

public static AccountEntryExt fromXdrBase64(String xdr) throws IOException {
BaseEncoding base64Encoding = BaseEncoding.base64();
byte[] bytes = base64Encoding.decode(xdr);
byte[] bytes = Base64.getDecoder().decode(xdr);
return fromXdrByteArray(bytes);
}

Expand Down
25 changes: 11 additions & 14 deletions src/main/java/org/stellar/sdk/xdr/AccountEntryExtensionV1.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

import static org.stellar.sdk.xdr.Constants.*;

import com.google.common.base.Objects;
import com.google.common.io.BaseEncoding;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Base64;
import java.util.Objects;

// === xdr source ============================================================

Expand Down Expand Up @@ -71,7 +71,7 @@ public static AccountEntryExtensionV1 decode(XdrDataInputStream stream) throws I

@Override
public int hashCode() {
return Objects.hashCode(this.liabilities, this.ext);
return Objects.hash(this.liabilities, this.ext);
}

@Override
Expand All @@ -81,13 +81,13 @@ public boolean equals(Object object) {
}

AccountEntryExtensionV1 other = (AccountEntryExtensionV1) object;
return Objects.equal(this.liabilities, other.liabilities) && Objects.equal(this.ext, other.ext);
return Objects.equals(this.liabilities, other.liabilities)
&& Objects.equals(this.ext, other.ext);
}

@Override
public String toXdrBase64() throws IOException {
BaseEncoding base64Encoding = BaseEncoding.base64();
return base64Encoding.encode(toXdrByteArray());
return Base64.getEncoder().encodeToString(toXdrByteArray());
}

@Override
Expand All @@ -99,8 +99,7 @@ public byte[] toXdrByteArray() throws IOException {
}

public static AccountEntryExtensionV1 fromXdrBase64(String xdr) throws IOException {
BaseEncoding base64Encoding = BaseEncoding.base64();
byte[] bytes = base64Encoding.decode(xdr);
byte[] bytes = Base64.getDecoder().decode(xdr);
return fromXdrByteArray(bytes);
}

Expand Down Expand Up @@ -213,7 +212,7 @@ public static AccountEntryExtensionV1Ext decode(XdrDataInputStream stream) throw

@Override
public int hashCode() {
return Objects.hashCode(this.v2, this.v);
return Objects.hash(this.v2, this.v);
}

@Override
Expand All @@ -223,13 +222,12 @@ public boolean equals(Object object) {
}

AccountEntryExtensionV1Ext other = (AccountEntryExtensionV1Ext) object;
return Objects.equal(this.v2, other.v2) && Objects.equal(this.v, other.v);
return Objects.equals(this.v2, other.v2) && Objects.equals(this.v, other.v);
}

@Override
public String toXdrBase64() throws IOException {
BaseEncoding base64Encoding = BaseEncoding.base64();
return base64Encoding.encode(toXdrByteArray());
return Base64.getEncoder().encodeToString(toXdrByteArray());
}

@Override
Expand All @@ -241,8 +239,7 @@ public byte[] toXdrByteArray() throws IOException {
}

public static AccountEntryExtensionV1Ext fromXdrBase64(String xdr) throws IOException {
BaseEncoding base64Encoding = BaseEncoding.base64();
byte[] bytes = base64Encoding.decode(xdr);
byte[] bytes = Base64.getDecoder().decode(xdr);
return fromXdrByteArray(bytes);
}

Expand Down
28 changes: 12 additions & 16 deletions src/main/java/org/stellar/sdk/xdr/AccountEntryExtensionV2.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

import static org.stellar.sdk.xdr.Constants.*;

import com.google.common.base.Objects;
import com.google.common.io.BaseEncoding;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Base64;
import java.util.Objects;

// === xdr source ============================================================

Expand Down Expand Up @@ -107,7 +107,7 @@ public static AccountEntryExtensionV2 decode(XdrDataInputStream stream) throws I

@Override
public int hashCode() {
return Objects.hashCode(
return Objects.hash(
this.numSponsored, this.numSponsoring, Arrays.hashCode(this.signerSponsoringIDs), this.ext);
}

Expand All @@ -118,16 +118,15 @@ public boolean equals(Object object) {
}

AccountEntryExtensionV2 other = (AccountEntryExtensionV2) object;
return Objects.equal(this.numSponsored, other.numSponsored)
&& Objects.equal(this.numSponsoring, other.numSponsoring)
return Objects.equals(this.numSponsored, other.numSponsored)
&& Objects.equals(this.numSponsoring, other.numSponsoring)
&& Arrays.equals(this.signerSponsoringIDs, other.signerSponsoringIDs)
&& Objects.equal(this.ext, other.ext);
&& Objects.equals(this.ext, other.ext);
}

@Override
public String toXdrBase64() throws IOException {
BaseEncoding base64Encoding = BaseEncoding.base64();
return base64Encoding.encode(toXdrByteArray());
return Base64.getEncoder().encodeToString(toXdrByteArray());
}

@Override
Expand All @@ -139,8 +138,7 @@ public byte[] toXdrByteArray() throws IOException {
}

public static AccountEntryExtensionV2 fromXdrBase64(String xdr) throws IOException {
BaseEncoding base64Encoding = BaseEncoding.base64();
byte[] bytes = base64Encoding.decode(xdr);
byte[] bytes = Base64.getDecoder().decode(xdr);
return fromXdrByteArray(bytes);
}

Expand Down Expand Up @@ -267,7 +265,7 @@ public static AccountEntryExtensionV2Ext decode(XdrDataInputStream stream) throw

@Override
public int hashCode() {
return Objects.hashCode(this.v3, this.v);
return Objects.hash(this.v3, this.v);
}

@Override
Expand All @@ -277,13 +275,12 @@ public boolean equals(Object object) {
}

AccountEntryExtensionV2Ext other = (AccountEntryExtensionV2Ext) object;
return Objects.equal(this.v3, other.v3) && Objects.equal(this.v, other.v);
return Objects.equals(this.v3, other.v3) && Objects.equals(this.v, other.v);
}

@Override
public String toXdrBase64() throws IOException {
BaseEncoding base64Encoding = BaseEncoding.base64();
return base64Encoding.encode(toXdrByteArray());
return Base64.getEncoder().encodeToString(toXdrByteArray());
}

@Override
Expand All @@ -295,8 +292,7 @@ public byte[] toXdrByteArray() throws IOException {
}

public static AccountEntryExtensionV2Ext fromXdrBase64(String xdr) throws IOException {
BaseEncoding base64Encoding = BaseEncoding.base64();
byte[] bytes = base64Encoding.decode(xdr);
byte[] bytes = Base64.getDecoder().decode(xdr);
return fromXdrByteArray(bytes);
}

Expand Down
18 changes: 8 additions & 10 deletions src/main/java/org/stellar/sdk/xdr/AccountEntryExtensionV3.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

import static org.stellar.sdk.xdr.Constants.*;

import com.google.common.base.Objects;
import com.google.common.io.BaseEncoding;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Base64;
import java.util.Objects;

// === xdr source ============================================================

Expand Down Expand Up @@ -82,7 +82,7 @@ public static AccountEntryExtensionV3 decode(XdrDataInputStream stream) throws I

@Override
public int hashCode() {
return Objects.hashCode(this.ext, this.seqLedger, this.seqTime);
return Objects.hash(this.ext, this.seqLedger, this.seqTime);
}

@Override
Expand All @@ -92,15 +92,14 @@ public boolean equals(Object object) {
}

AccountEntryExtensionV3 other = (AccountEntryExtensionV3) object;
return Objects.equal(this.ext, other.ext)
&& Objects.equal(this.seqLedger, other.seqLedger)
&& Objects.equal(this.seqTime, other.seqTime);
return Objects.equals(this.ext, other.ext)
&& Objects.equals(this.seqLedger, other.seqLedger)
&& Objects.equals(this.seqTime, other.seqTime);
}

@Override
public String toXdrBase64() throws IOException {
BaseEncoding base64Encoding = BaseEncoding.base64();
return base64Encoding.encode(toXdrByteArray());
return Base64.getEncoder().encodeToString(toXdrByteArray());
}

@Override
Expand All @@ -112,8 +111,7 @@ public byte[] toXdrByteArray() throws IOException {
}

public static AccountEntryExtensionV3 fromXdrBase64(String xdr) throws IOException {
BaseEncoding base64Encoding = BaseEncoding.base64();
byte[] bytes = base64Encoding.decode(xdr);
byte[] bytes = Base64.getDecoder().decode(xdr);
return fromXdrByteArray(bytes);
}

Expand Down
8 changes: 3 additions & 5 deletions src/main/java/org/stellar/sdk/xdr/AccountFlags.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

import static org.stellar.sdk.xdr.Constants.*;

import com.google.common.io.BaseEncoding;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Base64;

// === xdr source ============================================================

Expand Down Expand Up @@ -73,8 +73,7 @@ public void encode(XdrDataOutputStream stream) throws IOException {

@Override
public String toXdrBase64() throws IOException {
BaseEncoding base64Encoding = BaseEncoding.base64();
return base64Encoding.encode(toXdrByteArray());
return Base64.getEncoder().encodeToString(toXdrByteArray());
}

@Override
Expand All @@ -86,8 +85,7 @@ public byte[] toXdrByteArray() throws IOException {
}

public static AccountFlags fromXdrBase64(String xdr) throws IOException {
BaseEncoding base64Encoding = BaseEncoding.base64();
byte[] bytes = base64Encoding.decode(xdr);
byte[] bytes = Base64.getDecoder().decode(xdr);
return fromXdrByteArray(bytes);
}

Expand Down
Loading

0 comments on commit e6ccc9e

Please sign in to comment.