Skip to content

Commit

Permalink
Fix checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadow-Devil committed Sep 13, 2024
1 parent a44aae0 commit d115eb7
Show file tree
Hide file tree
Showing 92 changed files with 356 additions and 259 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ public static Runtime from(Module module) {
* This method needs to be called if object.getType().isIsolated() or
* object.getType().isIsolated(methodName) returns false.
*/
public abstract BFuture invokeMethodAsyncSequentially(BObject object, String methodName, @Nullable String strandName,
@Nullable StrandMetadata metadata, Callback callback, @Nullable Map<String, Object> properties,
Type returnType, Object... args);
public abstract BFuture invokeMethodAsyncSequentially(
BObject object, String methodName, @Nullable String strandName,
@Nullable StrandMetadata metadata, Callback callback, @Nullable Map<String, Object> properties,
Type returnType, Object... args);

/**
* Invoke Object method asynchronously and concurrently. Caller needs to ensure that no data race is possible for
Expand All @@ -119,9 +120,10 @@ public abstract BFuture invokeMethodAsyncSequentially(BObject object, String met
* This method needs to be called if both object.getType().isIsolated() and
* object.getType().isIsolated(methodName) returns true.
*/
public abstract BFuture invokeMethodAsyncConcurrently(BObject object, String methodName, @Nullable String strandName,
@Nullable StrandMetadata metadata, @Nullable Callback callback, @Nullable Map<String, Object> properties,
Type returnType, Object... args);
public abstract BFuture invokeMethodAsyncConcurrently(
BObject object, String methodName, @Nullable String strandName,
@Nullable StrandMetadata metadata, @Nullable Callback callback, @Nullable Map<String, Object> properties,
Type returnType, Object... args);

/**
* Invoke Object method asynchronously. This will schedule the function and block the strand.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ public static TupleType createTupleType(List<Type> typeList, int typeFlags) {
* @param readonly whether immutable
* @return the new tuple type
*/
public static TupleType createTupleType(List<Type> typeList, @Nullable Type restType, int typeFlags, boolean readonly) {
public static TupleType createTupleType(
List<Type> typeList, @Nullable Type restType, int typeFlags, boolean readonly) {
return new BTupleType(typeList, restType, typeFlags, readonly);
}

Expand Down Expand Up @@ -240,9 +241,9 @@ public static RecordType createRecordType(String typeName, Module module, long f
* @param typeFlags flags associated with the type
* @return the new record type
*/
public static RecordType createRecordType(String typeName, @Nullable Module module, long flags, Map<String, Field> fields,
@Nullable Type restFieldType,
boolean sealed, int typeFlags) {
public static RecordType createRecordType(
String typeName, @Nullable Module module, long flags, Map<String, Field> fields,
@Nullable Type restFieldType, boolean sealed, int typeFlags) {
return new BRecordType(typeName, module, flags, fields, restFieldType, sealed, typeFlags);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ public static boolean checkIsType(@Nullable Object sourceVal, Type targetType) {
* @param targetType type to be test against
* @return true if the value belongs to the given type, false otherwise
*/
public static boolean checkIsType(@Nullable List<String> errors, Object sourceVal, Type sourceType, Type targetType) {
public static boolean checkIsType(
@Nullable List<String> errors, Object sourceVal, Type sourceType, Type targetType) {
if (checkIsType(sourceVal, sourceType, targetType, null)) {
return true;
}
Expand Down Expand Up @@ -2177,9 +2178,10 @@ private static boolean checkIsLikeType(@Nullable List<String> errors, Object sou
* @param varName variable name to identify the parent of a record field
* @return True if the value confirms to the provided type. False, otherwise.
*/
private static boolean checkIsLikeOnValue(@Nullable List<String> errors, Object sourceValue, Type sourceType, Type targetType,
List<TypeValuePair> unresolvedValues, boolean allowNumericConversion,
@Nullable String varName) {
private static boolean checkIsLikeOnValue(
@Nullable List<String> errors, Object sourceValue, Type sourceType, Type targetType,
List<TypeValuePair> unresolvedValues, boolean allowNumericConversion,
@Nullable String varName) {
int sourceTypeTag = sourceType.getTag();
int targetTypeTag = targetType.getTag();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ public static BXml tableToXML(TableValueImpl table) {
* @return XMLValue Element type XMLValue
*/
@Deprecated
public static XmlValue createXMLElement(BXmlQName startTagName, BXmlQName endTagName, @Nullable String defaultNsUri) {
public static XmlValue createXMLElement(
BXmlQName startTagName, BXmlQName endTagName, @Nullable String defaultNsUri) {
if (!isEqual(startTagName.getLocalName(), endTagName.getLocalName()) ||
!isEqual(startTagName.getUri(), endTagName.getUri()) ||
!isEqual(startTagName.getPrefix(), endTagName.getPrefix())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,10 @@ public FutureValue scheduleToObjectGroup(Object[] params, Function function, Fut
* @param metadata meta data of new strand
* @return Reference to the scheduled task
*/
public FutureValue schedule(Object[] params, Function function, @Nullable Strand parent, @Nullable Callback callback,
@Nullable Map<String, Object> properties, @Nullable Type returnType, @Nullable String strandName,
@Nullable StrandMetadata metadata) {
public FutureValue schedule(
Object[] params, Function function, @Nullable Strand parent, @Nullable Callback callback,
@Nullable Map<String, Object> properties, @Nullable Type returnType, @Nullable String strandName,
@Nullable StrandMetadata metadata) {
FutureValue future = createFuture(parent, callback, properties, returnType, strandName, metadata);
return schedule(params, function, future);
}
Expand Down Expand Up @@ -504,8 +505,9 @@ private void addToRunnableList(SchedulerItem item, ItemGroup group) {
group.unlock();
}

public FutureValue createFuture(@Nullable Strand parent, @Nullable Callback callback, @Nullable Map<String, Object> properties,
@Nullable Type constraint, @Nullable String name, @Nullable StrandMetadata metadata) {
public FutureValue createFuture(
@Nullable Strand parent, @Nullable Callback callback, @Nullable Map<String, Object> properties,
@Nullable Type constraint, @Nullable String name, @Nullable StrandMetadata metadata) {
Strand newStrand = new Strand(name, metadata, this, parent, properties, parent != null ?
parent.currentTrxContext : null);
currentStrands.put(newStrand.getId(), newStrand);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ private static Object getResultValue(@Nullable Object result) {
}

@Nullable
private Object processResulAndError(Strand strand, String[] channels, @Nullable Object result, boolean allChannelsClosed) {
private Object processResulAndError(
Strand strand, String[] channels, @Nullable Object result, boolean allChannelsClosed) {
if (result == null) {
if (errors.size() == channels.length) {
result = errors.get(errors.size() - 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ public BRecordType(String typeName, String internalName, Module pkg, long flags,
* @param sealed flag to indicate whether the record is sealed
* @param typeFlags flags associated with the type
*/
public BRecordType(String typeName, @Nullable Module pkg, long flags, Map<String, Field> fields, @Nullable Type restFieldType,
boolean sealed, int typeFlags) {
public BRecordType(String typeName, @Nullable Module pkg, long flags, Map<String, Field> fields,
@Nullable Type restFieldType, boolean sealed, int typeFlags) {
super(typeName, pkg, flags, MapValueImpl.class);
this.sealed = sealed;
this.typeFlags = typeFlags;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ public ArrayValueImpl(Type type, BListInitialValueEntry[] initialValues, Typedes
this(type, ((ArrayType) TypeUtils.getImpliedType(type)).getSize(), initialValues, typedescValue);
}

public ArrayValueImpl(Type type, long size, BListInitialValueEntry[] initialValues, @Nullable TypedescValue typedescValue) {
public ArrayValueImpl(Type type, long size, BListInitialValueEntry[] initialValues,
@Nullable TypedescValue typedescValue) {
this.type = type;
this.arrayType = (ArrayType) TypeUtils.getImpliedType(type);
this.elementType = arrayType.getElementType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ public static boolean containsValueCreator(String key) {

public abstract MapValue<BString, Object> createRecordValue(String recordTypeName) throws BError;

public abstract BObject createObjectValue(String objectTypeName, @Nullable Scheduler scheduler, @Nullable Strand parent,
@Nullable Map<String, Object> properties, Object[] args) throws BError;
public abstract BObject createObjectValue(
String objectTypeName, @Nullable Scheduler scheduler, @Nullable Strand parent,
@Nullable Map<String, Object> properties, Object[] args) throws BError;

public abstract BError createErrorValue(String errorTypeName, BString message, BError cause, Object details)
throws BError;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,8 @@ protected void setAttributesOnInitialization(BMap<BString, BString> attributes)
}

@Override
protected void setAttributeOnInitialization(String localName, @Nullable String namespace, @Nullable String prefix, String value) {
protected void setAttributeOnInitialization(
String localName, @Nullable String namespace, @Nullable String prefix, String value) {
attributes.setAttribute(localName, namespace, prefix, value, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public class TransactionLocalContext {
private BArray transactionId;
private boolean isTransactional;

private TransactionLocalContext(String globalTransactionId, String url, String protocol, @Nullable Object infoRecord) {
private TransactionLocalContext(String globalTransactionId, String url, String protocol,
@Nullable Object infoRecord) {
this.globalTransactionId = globalTransactionId;
this.url = url;
this.protocol = protocol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,8 @@ public static void initPackageFromCentral(Path balaCache, Path projectPath, Stri
applyTemplate(orgName, templatePackageName, version, packageName, projectPath, balaCache, filesInDir);
}

private static void pullPackageFromRemote(String orgName, String packageName, @Nullable String version, Path destination)
throws CentralClientException {
private static void pullPackageFromRemote(String orgName, String packageName, @Nullable String version,
Path destination) throws CentralClientException {
String supportedPlatform = Arrays.stream(JvmTarget.values())
.map(JvmTarget::code)
.collect(Collectors.joining(","));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public class CreateExecutableTask implements Task {
private Target target;
private final boolean isHideTaskOutput;

public CreateExecutableTask(PrintStream out, @Nullable String output, @Nullable Target target, boolean isHideTaskOutput) {
public CreateExecutableTask(PrintStream out, @Nullable String output, @Nullable Target target,
boolean isHideTaskOutput) {
this.out = out;
this.target = target;
this.isHideTaskOutput = isHideTaskOutput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ public CentralAPIClient(String baseUrl, Proxy proxy, String accessToken) {
this.maxRetries = MAX_RETRY;
}

public CentralAPIClient(String baseUrl, @Nullable Proxy proxy, String accessToken, boolean verboseEnabled, int maxRetries,
PrintStream outStream) {
public CentralAPIClient(String baseUrl, @Nullable Proxy proxy, String accessToken, boolean verboseEnabled,
int maxRetries, PrintStream outStream) {
this.outStream = outStream;
this.baseUrl = baseUrl;
this.proxy = proxy;
Expand Down Expand Up @@ -1958,7 +1958,8 @@ public Response intercept(Chain chain) throws IOException {
return response;
}

private void logRetryVerbose(Response response, @Nullable String bodyContent, Request request, int retryCount) {
private void logRetryVerbose(Response response, @Nullable String bodyContent, Request request,
int retryCount) {
if (verboseEnabled) {
Optional<ResponseBody> body = Optional.ofNullable(response.body());
outStream.println("< HTTP " + response.code() + " " + response.message());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ public void setReason(String reason) {
this.reason = reason;
}

public Module(String organization, String moduleName, String version, @Nullable String packageName, @Nullable String reason) {
public Module(String organization, String moduleName, String version, @Nullable String packageName,
@Nullable String reason) {
this.organization = organization;
this.moduleName = moduleName;
this.version = version;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ public class BallerinaParameterSymbol extends BallerinaSymbol implements Paramet
private final TypeSymbol typeDescriptor;
private final ParameterKind paramKind;

public BallerinaParameterSymbol(@Nullable String parameterName, TypeSymbol typeDescriptor, List<Qualifier> qualifiers,
List<AnnotationSymbol> annots, List<AnnotationAttachmentSymbol> annotAttachments,
ParameterKind paramKind, BVarSymbol symbol, CompilerContext context) {
public BallerinaParameterSymbol(@Nullable String parameterName, TypeSymbol typeDescriptor,
List<Qualifier> qualifiers, List<AnnotationSymbol> annots,
List<AnnotationAttachmentSymbol> annotAttachments, ParameterKind paramKind,
BVarSymbol symbol, CompilerContext context) {
super(parameterName, PARAMETER, symbol, context);
// TODO: Add the metadata
this.typeDescriptor = typeDescriptor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ public TypeSymbol getTypeDescriptor(BType bType, @Nullable BSymbol tSymbol, bool
return getTypeDescriptor(bType, tSymbol, rawTypeOnly, true, false);
}

@Nullable TypeSymbol getTypeDescriptor(BType bType, @Nullable BSymbol tSymbol, boolean rawTypeOnly, boolean getOriginalType,
boolean typeRefFromIntersectType) {
@Nullable TypeSymbol getTypeDescriptor(BType bType, @Nullable BSymbol tSymbol, boolean rawTypeOnly,
boolean getOriginalType, boolean typeRefFromIntersectType) {
if (bType == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public Map<String, Map<String, Map<String, Tool>>> tools() {
return tools;
}

public void addTool(String id, String org, String name, String version, Boolean active, @Nullable String repository) {
public void addTool(String id, String org, String name, String version, Boolean active,
@Nullable String repository) {
if (!tools.containsKey(id)) {
tools.put(id, new HashMap<>());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,9 @@ private static void setBalToolDependencyPaths(BalToolJson balToolJson, Path bala
balToolJson.setDependencyPaths(dependencyLibPaths);
}

private static PackageManifest getPackageManifest(PackageJson packageJson,
Optional<CompilerPluginJson> compilerPluginJson,
Optional<BalToolJson> balToolJson, @Nullable String deprecationMsg) {
private static PackageManifest getPackageManifest(
PackageJson packageJson, Optional<CompilerPluginJson> compilerPluginJson, Optional<BalToolJson> balToolJson,
@Nullable String deprecationMsg) {
PackageDescriptor pkgDesc;
if (deprecationMsg != null) {
pkgDesc = PackageDescriptor.from(PackageOrg.from(packageJson.getOrganization()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,8 @@ private Toml getToml(TomlTableNode toolNode, String key) {
return new Toml(optionsNode);
}

private boolean providedPlatformDependencyIsValid(@Nullable String artifactId, @Nullable String groupId, @Nullable String version) {
private boolean providedPlatformDependencyIsValid(
@Nullable String artifactId, @Nullable String groupId, @Nullable String version) {
return artifactId != null && !artifactId.isEmpty() && groupId != null && !groupId.isEmpty()
&& version != null && !version.isEmpty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ public Map<String, List<String>> getPackages() {
}

@Override
protected List<PackageVersion> getPackageVersions(PackageOrg org, PackageName name, @Nullable PackageVersion version) {
protected List<PackageVersion> getPackageVersions(PackageOrg org, PackageName name,
@Nullable PackageVersion version) {
List<Path> versions = new ArrayList<>();
try {
Path balaPackagePath = bala.resolve(org.value()).resolve(name.value());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ public boolean isPackageExists(PackageOrg org,
}

@Override
protected List<PackageVersion> getPackageVersions(PackageOrg org, PackageName name, @Nullable PackageVersion version) {
protected List<PackageVersion> getPackageVersions(
PackageOrg org, PackageName name, @Nullable PackageVersion version) {
if (version == null) {
return Collections.emptyList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public List<CodeActionArgument> arguments() {
return this.arguments;
}

public static CodeActionExecutionContextImpl from(String fileUri, Path filePath, @Nullable LinePosition cursorPosition,
Document document, SemanticModel semanticModel,
List<CodeActionArgument> arguments) {
public static CodeActionExecutionContextImpl from(
String fileUri, Path filePath, @Nullable LinePosition cursorPosition, Document document,
SemanticModel semanticModel, List<CodeActionArgument> arguments) {
return new CodeActionExecutionContextImpl(fileUri, filePath, cursorPosition, document, semanticModel,
arguments);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public static TomlDiagnostic getBuildToolCommandNotFoundDiagnostic(String comman
* @param toolId tool id of the build tool
* @return diagnostic
*/
public static TomlDiagnostic getCannotResolveBuildToolDiagnostic(String toolId, @Nullable TomlNodeLocation location) {
public static TomlDiagnostic getCannotResolveBuildToolDiagnostic(String toolId,
@Nullable TomlNodeLocation location) {
String message = "Build tool '" + toolId + "' cannot be resolved";
DiagnosticInfo diagnosticInfo = new DiagnosticInfo(
ProjectDiagnosticErrorCode.BUILD_TOOL_NOT_FOUND.diagnosticId(),
Expand Down
Loading

0 comments on commit d115eb7

Please sign in to comment.