Skip to content

Commit

Permalink
Merge pull request #42882 from Shadow-Devil/add-override-annotation
Browse files Browse the repository at this point in the history
Add @OverRide annotation everywhere
  • Loading branch information
SasinduDilshara authored Jun 18, 2024
2 parents 8e81723 + b6dfdaa commit eedd40d
Show file tree
Hide file tree
Showing 479 changed files with 1,380 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public String evaluate(String source) throws BallerinaShellException {
}
}

@Override
public ShellCompilation getCompilation(String source) {
PackageCompilation compilation;
ExceptionStatus exceptionStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public interface FunctionType extends AnnotatableType {

Type getReturnType();

@Override
long getFlags();

Type getReturnParameterType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
*/
public interface RemoteMethodType extends MethodType {

@Override
ObjectType getParentObjectType();

@Override
FunctionType getType();

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
*/
public interface SelectivelyImmutableReferenceType extends IntersectableReferenceType {

@Override
IntersectionType getImmutableType();

@Override
void setImmutableType(IntersectionType immutableType);
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ public interface StructureType extends AnnotatableType {

Map<String, Field> getFields();

@Override
long getFlags();
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ public interface UnionType extends SelectivelyImmutableReferenceType {

boolean isCyclic();

@Override
long getFlags();
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ public BError(BString message) {
*
* @return error cause
*/
@Override
public abstract BError getCause();

/**
* Print error stack trace to the given {@code PrintWriter}.
*
* @param printWriter {@code PrintWriter} to be used
*/
@Override
public void printStackTrace(PrintWriter printWriter) {
printWriter.print(ERROR_PRINT_PREFIX + getPrintableStackTrace());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public interface BMap<K, V> extends BRefValue, BCollection {
*
* @return the number of key-value mappings in this map
*/
@Override
int size();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public interface BObject extends BRefValue {
* @deprecated use {@link BObject#getOriginalType()} ()} instead.
* The API {@link BValue#getType()} should be used after fixing the issue #39850.
*/
@Override
@Deprecated
ObjectType getType();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public interface BRefValue extends BValue {
*
* @return A new copy of the value
*/
@Override
Object copy(Map<Object, Object> refs);

/**
Expand All @@ -51,6 +52,7 @@ public interface BRefValue extends BValue {
*
* @return A new copy of the value
*/
@Override
Object frozenCopy(Map<Object, Object> refs);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public interface BTable<K, V> extends BRefValue, BCollection {
*
* @return the number of key-value mappings in this map
*/
@Override
int size();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ public interface BXml extends BRefValue, BCollection {
*
* @return length of this XML sequence.
*/
@Override
int size();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public BalEnvironment(Strand strand, Module currentModule, String funcName, Para
*
* @return function name
*/
@Override
public String getFunctionName() {
return funcName;
}
Expand All @@ -75,6 +76,7 @@ public String getFunctionName() {
*
* @return array of {@link Parameter}
*/
@Override
public Parameter[] getFunctionPathParameters() {
return funcPathParams;
}
Expand All @@ -87,6 +89,7 @@ public Parameter[] getFunctionPathParameters() {
*
* @return BalFuture which will resume the current strand when completed.
*/
@Override
public BalFuture markAsync() {
strand.blockedOnExtern = true;
strand.setState(State.BLOCK_AND_YIELD);
Expand All @@ -98,6 +101,7 @@ public BalFuture markAsync() {
*
* @return Ballerina runtime instance.
*/
@Override
public BalRuntime getRuntime() {
return new BalRuntime(strand.scheduler, currentModule);
}
Expand All @@ -107,6 +111,7 @@ public BalRuntime getRuntime() {
*
* @return module of the environment.
*/
@Override
public Module getCurrentModule() {
return currentModule;
}
Expand All @@ -116,6 +121,7 @@ public Module getCurrentModule() {
*
* @return Strand id.
*/
@Override
public int getStrandId() {
return strand.getId();
}
Expand All @@ -126,6 +132,7 @@ public int getStrandId() {
*
* @return Optional strand name.
*/
@Override
public Optional<String> getStrandName() {
return strand.getName();
}
Expand All @@ -135,6 +142,7 @@ public Optional<String> getStrandName() {
*
* @return metadata of the strand.
*/
@Override
public StrandMetadata getStrandMetadata() {
return strand.getMetadata();
}
Expand All @@ -145,6 +153,7 @@ public StrandMetadata getStrandMetadata() {
* @param key string key
* @param value value to be store in the strand
*/
@Override
public void setStrandLocal(String key, Object value) {
strand.setProperty(key, value);
}
Expand All @@ -155,10 +164,12 @@ public void setStrandLocal(String key, Object value) {
* @param key key
* @return value stored in the strand.
*/
@Override
public Object getStrandLocal(String key) {
return strand.getProperty(key);
}

@Override
public Repository getRepository() {
return this.repository;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public BalFuture(Strand strand) {
this.strand = strand;
}

@Override
public void complete(Object returnValue) {
if (visited.getAndSet(true)) {
throw ErrorCreator.createError(StringUtils.fromString("cannot complete the same future twice."),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,30 @@ public BalRuntime(Module module) {
this.module = module;
}

@Override
public void init() {
invokeConfigInit();
invokeMethodAsync("$moduleInit", null, PredefinedTypes.TYPE_NULL, "init", new Object[1]);
moduleInitialized = true;
}

@Override
public void start() {
if (!moduleInitialized) {
throw ErrorHelper.getRuntimeException(ErrorCodes.INVALID_METHOD_CALL, "start");
}
invokeMethodAsync("$moduleStart", null, PredefinedTypes.TYPE_NULL, "start", new Object[1]);
}

@Override
public void invokeMethodAsync(String functionName, Callback callback, Object... args) {
if (!moduleInitialized) {
throw ErrorHelper.getRuntimeException(ErrorCodes.INVALID_FUNCTION_INVOCATION, functionName);
}
invokeMethodAsync(functionName, callback, PredefinedTypes.TYPE_ANY, functionName, args);
}

@Override
public void stop() {
if (!moduleInitialized) {
throw ErrorHelper.getRuntimeException(ErrorCodes.INVALID_METHOD_CALL, "stop");
Expand Down Expand Up @@ -136,6 +140,7 @@ private void invokeMethodAsync(String functionName, Callback callback, Type retu
* This method needs to be called if object.getType().isIsolated() or
* object.getType().isIsolated(methodName) returns false.
*/
@Override
public BFuture invokeMethodAsyncSequentially(BObject object, String methodName, String strandName,
StrandMetadata metadata,
Callback callback, Map<String, Object> properties,
Expand Down Expand Up @@ -183,6 +188,7 @@ public void notifyFailure(BError error) {
* This method needs to be called if both object.getType().isIsolated() and
* object.getType().isIsolated(methodName) returns true.
*/
@Override
public BFuture invokeMethodAsyncConcurrently(BObject object, String methodName, String strandName,
StrandMetadata metadata,
Callback callback, Map<String, Object> properties,
Expand Down Expand Up @@ -236,6 +242,7 @@ public void notifyFailure(BError error) {
* We can decide the object method isolation if and only if both object.getType().isIsolated() and
* object.getType().isIsolated(methodName) returns true.
*/
@Override
@Deprecated
public BFuture invokeMethodAsync(BObject object, String methodName, String strandName, StrandMetadata metadata,
Callback callback, Map<String, Object> properties,
Expand Down Expand Up @@ -288,6 +295,7 @@ public void notifyFailure(BError error) {
* We can decide the object method isolation if both object.getType().isIsolated() and
* object.getType().isIsolated(methodName) returns true.
*/
@Override
@Deprecated
public Object invokeMethodAsync(BObject object, String methodName, String strandName, StrandMetadata metadata,
Callback callback, Object... args) {
Expand All @@ -304,14 +312,17 @@ private void validateArgs(BObject object, String methodName) {
}
}

@Override
public void registerListener(BObject listener) {
scheduler.getRuntimeRegistry().registerListener(listener);
}

@Override
public void deregisterListener(BObject listener) {
scheduler.getRuntimeRegistry().deregisterListener(listener);
}

@Override
public void registerStopHandler(BFunctionPointer<?, ?> stopHandler) {
scheduler.getRuntimeRegistry().registerStopHandler(stopHandler);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public Node(Object obj, BLink parent) {
this.parent = parent;
}

@Override
public boolean hasCyclesSoFar() {
Node parent = (Node) this.parent;
while (parent != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ public void flush() throws IOException {
this.writer.flush();
}

@Override
public void close() throws IOException {
this.writer.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ private static long convertToInt(Type targetType, String inputValue) throws Pars
}
}

@Override
protected State finalizeObject() throws ParserException {
Type targetType = this.targetTypes.get(this.targetTypes.size() - 1);
switch (targetType.getTag()) {
Expand Down Expand Up @@ -448,6 +449,7 @@ private void processUnionTableFiniteType(Type targetType) {
}
}

@Override
protected State initNewObject() throws ParserException {
if (charBuffIndex != 0) {
throw new ParserException(UNRECOGNIZED_TOKEN + "{'");
Expand Down Expand Up @@ -537,6 +539,7 @@ private void handleCurrentJsonNodeForObject() throws ParserException {
}
}

@Override
protected State initNewArray() throws ParserException {
if (charBuffIndex != 0) {
throw new ParserException(UNRECOGNIZED_TOKEN + "['");
Expand Down Expand Up @@ -920,6 +923,7 @@ private void processNonStringValueAsJson(String str, ValueType type) throws Pars
setValueToJsonType(type, getNonStringValueAsJson(str));
}

@Override
void processNonStringValue(ValueType type) throws ParserException {
String str = value();
Type targetType = this.targetTypes.get(this.targetTypes.size() - 1);
Expand Down Expand Up @@ -996,6 +1000,7 @@ private void processArrayType(String str, ArrayType referredType) throws ParserE
this.listIndices.set(this.listIndices.size() - 1, listIndex + 1);
}

@Override
void setValueToJsonType(ValueType type, Object value) {
switch (type) {
case ARRAY_ELEMENT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@ public void setAnnotations(BMap<BString, Object> annotations) {
this.annotations = annotations;
}

@Override
public BMap<BString, Object> getAnnotations() {
return (BMap<BString, Object>) this.annotations.copy(new LinkedHashMap<>());
}

@Override
public Object getAnnotation(BString key) {
return this.annotations.get(key);
}

@Override
public Object getAnnotation(BString pkg, BString annotName) {
return this.annotations.get(StringUtils.fromString(pkg.getValue() + ":" + annotName.getValue()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public int getTag() {
return TypeTags.ANY_TAG;
}

@Override
public boolean isNilable() {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public int getTag() {
return TypeTags.ANYDATA_TAG;
}

@Override
public boolean isNilable() {
return true;
}
Expand Down
Loading

0 comments on commit eedd40d

Please sign in to comment.