[#2766]fix: clean up deprecation warnings (#3511)

* clean up deprecation warnings
*Quantity Interface getValue()
* LegacyPrivateStateStorage
* GraphQLDataFetcherContext

Signed-off-by: Sandra Wang <yx97.wang@gmail.com>

Co-authored-by: Sally MacFarlane <sally.macfarlane@consensys.net>
pull/3573/head
Sandra Wang 3 years ago committed by GitHub
parent f81fa43c27
commit 69a375b823
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/PayloadIdentifier.java
  2. 2
      consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/PayloadIdentifierTest.java
  3. 6
      errorprone-checks/src/main/java/org/hyperledger/errorpronechecks/PrivateStaticFinalLoggers.java
  4. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ClassicDifficultyCalculators.java
  5. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetDifficultyCalculators.java
  6. 4
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/sorter/BaseFeePendingTransactionsSorter.java
  7. 4
      ethereum/ethstats/src/main/java/org/hyperledger/besu/ethstats/EthStatsService.java
  8. 4
      nat/src/main/java/org/hyperledger/besu/nat/upnp/OkHttpStreamClient.java

@ -72,7 +72,7 @@ public class PayloadIdentifier implements Quantity {
@Override
public boolean equals(final Object o) {
if (o instanceof PayloadIdentifier) {
return getValue().equals(((PayloadIdentifier) o).getValue());
return getAsBigInteger().equals(((PayloadIdentifier) o).getAsBigInteger());
}
return false;
}

@ -41,6 +41,6 @@ public class PayloadIdentifierTest {
public void conversionCoverage() {
var idTest = PayloadIdentifier.forPayloadParams(Hash.ZERO, 1337L);
assertThat(new PayloadIdentifier(idTest.getAsBigInteger().longValue())).isEqualTo(idTest);
assertThat(new PayloadIdentifier(idTest.getValue().longValue())).isEqualTo(idTest);
assertThat(new PayloadIdentifier(idTest.getAsBigInteger().longValue())).isEqualTo(idTest);
}
}

@ -21,6 +21,7 @@ import static com.google.errorprone.util.ASTHelpers.getType;
import static com.google.errorprone.util.ASTHelpers.isSubtype;
import java.util.List;
import java.util.Optional;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.Modifier;
@ -29,6 +30,7 @@ import com.google.errorprone.BugPattern;
import com.google.errorprone.VisitorState;
import com.google.errorprone.bugpatterns.BugChecker;
import com.google.errorprone.bugpatterns.BugChecker.VariableTreeMatcher;
import com.google.errorprone.fixes.SuggestedFix;
import com.google.errorprone.matchers.Description;
import com.google.errorprone.suppliers.Supplier;
import com.google.errorprone.suppliers.Suppliers;
@ -60,8 +62,10 @@ public class PrivateStaticFinalLoggers extends BugChecker implements VariableTre
if (!isSubtype(getType(tree), ORG_SLF4J_LOGGER.get(state), state)) {
return NO_MATCH;
}
Optional<SuggestedFix> fixes =
addModifiers(tree, state, Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL);
return buildDescription(tree)
.addFix(addModifiers(tree, state, Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL))
.addFix(fixes.isPresent() ? fixes.get() : SuggestedFix.emptyFix())
.build();
}
}

@ -103,6 +103,6 @@ public abstract class ClassicDifficultyCalculators {
}
private static BigInteger difficulty(final Quantity value) {
return (BigInteger) value.getValue();
return value.getAsBigInteger();
}
}

@ -138,6 +138,6 @@ public abstract class MainnetDifficultyCalculators {
}
private static BigInteger difficulty(final Quantity value) {
return (BigInteger) value.getValue();
return value.getAsBigInteger();
}
}

@ -84,7 +84,7 @@ public class BaseFeePendingTransactionsSorter extends AbstractPendingTransaction
.getMaxPriorityFeePerGas()
// safe to .get() here because only 1559 txs can be in the static range
.get()
.getValue()
.getAsBigInteger()
.longValue())
.thenComparing(TransactionInfo::getSequence)
.reversed());
@ -97,7 +97,7 @@ public class BaseFeePendingTransactionsSorter extends AbstractPendingTransaction
transactionInfo
.getTransaction()
.getMaxFeePerGas()
.map(maxFeePerGas -> maxFeePerGas.getValue().longValue())
.map(maxFeePerGas -> maxFeePerGas.getAsBigInteger().longValue())
.orElse(transactionInfo.getGasPrice().toLong()))
.thenComparing(TransactionInfo::getSequence)
.reversed());

@ -440,9 +440,9 @@ public class EthStatsService {
return block.getBody().getTransactions().stream()
.min(Comparator.comparing(t -> t.getEffectiveGasPrice(block.getHeader().getBaseFee())))
.map(t -> t.getEffectiveGasPrice(block.getHeader().getBaseFee()))
.filter(wei -> wei.getValue().longValue() > 0)
.filter(wei -> wei.getAsBigInteger().longValue() > 0)
.orElse(miningCoordinator.getMinTransactionGasPrice())
.getValue()
.getAsBigInteger()
.longValue();
}
}

@ -50,9 +50,9 @@ public class OkHttpStreamClient extends AbstractStreamClient<StreamClientConfigu
if (method == UpnpRequest.Method.POST || method == UpnpRequest.Method.NOTIFY) {
final MediaType mediaType = MediaType.get(requestMessage.getContentTypeHeader().getString());
if (requestMessage.getBodyType() == UpnpMessage.BodyType.STRING) {
body = RequestBody.create(mediaType, requestMessage.getBodyString());
body = RequestBody.create(requestMessage.getBodyString(), mediaType);
} else {
body = RequestBody.create(mediaType, requestMessage.getBodyBytes());
body = RequestBody.create(requestMessage.getBodyBytes(), mediaType);
}
} else {
body = null;

Loading…
Cancel
Save