Skip to content

Commit 9133df5

Browse files
committed
Fix checkstyle
1 parent 62f1b6c commit 9133df5

2 files changed

Lines changed: 41 additions & 30 deletions

File tree

codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -280,26 +280,34 @@ private List<MethodSpec> buildFunctionDefinitions(
280280
// constructor will not be specified in ABI file if its empty
281281
if (!constructor) {
282282
MethodSpec.Builder credentialsMethodBuilder =
283-
getDeployMethodSpec(className, Credentials.class, CREDENTIALS, false, true);
283+
getDeployMethodSpec(className, Credentials.class, CREDENTIALS,
284+
false, true);
284285
methodSpecs.add(buildDeployNoParams(
285-
credentialsMethodBuilder, className, CREDENTIALS, false, true));
286+
credentialsMethodBuilder, className, CREDENTIALS,
287+
false, true));
286288

287289
MethodSpec.Builder credentialsMethodBuilderNoGasProvider =
288-
getDeployMethodSpec(className, Credentials.class, CREDENTIALS, false, false);
290+
getDeployMethodSpec(className, Credentials.class, CREDENTIALS,
291+
false, false);
289292
methodSpecs.add(buildDeployNoParams(
290-
credentialsMethodBuilderNoGasProvider, className, CREDENTIALS, false, false));
293+
credentialsMethodBuilderNoGasProvider, className, CREDENTIALS,
294+
false, false));
291295

292296
MethodSpec.Builder transactionManagerMethodBuilder =
293297
getDeployMethodSpec(
294-
className, TransactionManager.class, TRANSACTION_MANAGER, false, true);
298+
className, TransactionManager.class, TRANSACTION_MANAGER,
299+
false, true);
295300
methodSpecs.add(buildDeployNoParams(
296-
transactionManagerMethodBuilder, className, TRANSACTION_MANAGER, false, true));
301+
transactionManagerMethodBuilder, className, TRANSACTION_MANAGER,
302+
false, true));
297303

298304
MethodSpec.Builder transactionManagerMethodBuilderNoGasProvider =
299305
getDeployMethodSpec(
300-
className, TransactionManager.class, TRANSACTION_MANAGER, false, false);
306+
className, TransactionManager.class, TRANSACTION_MANAGER,
307+
false, false);
301308
methodSpecs.add(buildDeployNoParams(
302-
transactionManagerMethodBuilderNoGasProvider, className, TRANSACTION_MANAGER, false, false));
309+
transactionManagerMethodBuilderNoGasProvider, className, TRANSACTION_MANAGER,
310+
false, false));
303311
}
304312

305313
return methodSpecs;
@@ -328,14 +336,15 @@ Iterable<FieldSpec> buildFuncNameConstants(List<AbiDefinition> functionDefinitio
328336
return fields;
329337
}
330338

331-
private static MethodSpec buildConstructor(Class authType, String authName, boolean withGasProvider) {
339+
private static MethodSpec buildConstructor(Class authType, String authName,
340+
boolean withGasProvider) {
332341
MethodSpec.Builder toReturn = MethodSpec.constructorBuilder()
333342
.addModifiers(Modifier.PROTECTED)
334343
.addParameter(String.class, CONTRACT_ADDRESS)
335344
.addParameter(Web3j.class, WEB3J)
336345
.addParameter(authType, authName);
337346

338-
if(withGasProvider) {
347+
if (withGasProvider) {
339348
toReturn.addParameter(ContractGasProvider.class, CONTRACT_GAS_PROVIDER)
340349
.addStatement("super($N, $N, $N, $N, $N)",
341350
BINARY, CONTRACT_ADDRESS, WEB3J, authName, CONTRACT_GAS_PROVIDER);
@@ -362,9 +371,11 @@ private MethodSpec buildDeploy(
362371

363372
if (!inputParams.isEmpty()) {
364373
return buildDeployWithParams(
365-
methodBuilder, className, inputParams, authName, isPayable, withGasProvider);
374+
methodBuilder, className, inputParams, authName,
375+
isPayable, withGasProvider);
366376
} else {
367-
return buildDeployNoParams(methodBuilder, className, authName, isPayable, withGasProvider);
377+
return buildDeployNoParams(methodBuilder, className, authName,
378+
isPayable, withGasProvider);
368379
}
369380
}
370381

@@ -428,7 +439,8 @@ private static MethodSpec buildDeployNoParams(
428439
}
429440

430441
private static MethodSpec.Builder getDeployMethodSpec(
431-
String className, Class authType, String authName, boolean isPayable, boolean withGasProvider) {
442+
String className, Class authType, String authName,
443+
boolean isPayable, boolean withGasProvider) {
432444
MethodSpec.Builder builder = MethodSpec.methodBuilder("deploy")
433445
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
434446
.returns(
@@ -444,8 +456,7 @@ private static MethodSpec.Builder getDeployMethodSpec(
444456
.addParameter(BigInteger.class, INITIAL_VALUE);
445457
} else if (!isPayable && withGasProvider) {
446458
return builder.addParameter(ContractGasProvider.class, CONTRACT_GAS_PROVIDER);
447-
}
448-
else {
459+
} else {
449460
return builder.addParameter(BigInteger.class, GAS_PRICE)
450461
.addParameter(BigInteger.class, GAS_LIMIT);
451462
}
@@ -460,7 +471,7 @@ private static MethodSpec buildLoad(
460471
.addParameter(Web3j.class, WEB3J)
461472
.addParameter(authType, authName);
462473

463-
if(withGasProvider) {
474+
if (withGasProvider) {
464475
toReturn.addParameter(ContractGasProvider.class, CONTRACT_GAS_PROVIDER)
465476
.addStatement("return new $L($L, $L, $L, $L)", className,
466477
CONTRACT_ADDRESS, WEB3J, authName, CONTRACT_GAS_PROVIDER);

core/src/main/java/org/web3j/tx/Contract.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,19 @@ protected static <T extends Contract> T deploy(
398398
binary, encodedConstructor, value);
399399
}
400400

401+
@Deprecated
402+
protected static <T extends Contract> T deploy(
403+
Class<T> type,
404+
Web3j web3j, TransactionManager transactionManager,
405+
BigInteger gasPrice, BigInteger gasLimit,
406+
String binary, String encodedConstructor, BigInteger value)
407+
throws IOException, TransactionException {
408+
409+
return deploy(type, web3j, transactionManager,
410+
new StaticGasProvider(gasPrice, gasLimit),
411+
binary, encodedConstructor, value);
412+
}
413+
401414
public static <T extends Contract> RemoteCall<T> deployRemoteCall(
402415
Class<T> type,
403416
Web3j web3j, Credentials credentials,
@@ -417,6 +430,7 @@ public static <T extends Contract> RemoteCall<T> deployRemoteCall(
417430
type, web3j, credentials, gasPrice, gasLimit,
418431
binary, encodedConstructor, BigInteger.ZERO);
419432
}
433+
420434
public static <T extends Contract> RemoteCall<T> deployRemoteCall(
421435
Class<T> type,
422436
Web3j web3j, Credentials credentials,
@@ -437,20 +451,6 @@ public static <T extends Contract> RemoteCall<T> deployRemoteCall(
437451
encodedConstructor, BigInteger.ZERO));
438452
}
439453

440-
@Deprecated
441-
protected static <T extends Contract> T deploy(
442-
Class<T> type,
443-
Web3j web3j, TransactionManager transactionManager,
444-
BigInteger gasPrice, BigInteger gasLimit,
445-
String binary, String encodedConstructor, BigInteger value)
446-
throws IOException, TransactionException {
447-
448-
return deploy(type, web3j, transactionManager,
449-
new StaticGasProvider(gasPrice, gasLimit),
450-
binary, encodedConstructor, value);
451-
}
452-
453-
454454
public static <T extends Contract> RemoteCall<T> deployRemoteCall(
455455
Class<T> type,
456456
Web3j web3j, TransactionManager transactionManager,

0 commit comments

Comments
 (0)