Skip to content

Commit

Permalink
Move createErrorToSubclass method to subclass (#246)
Browse files Browse the repository at this point in the history
This PR is a cleanup that is required before the upcoming major PR that adds support for taint checker inference.

Method `checker#createErrorToSubclass` is only used in subclass instance. This PR moves the declaration to the subclass that uses this method and removes it from the super class.
  • Loading branch information
nimakarimipour authored Oct 3, 2024
1 parent 7cfb5c6 commit c493546
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
import edu.ucr.cs.riple.core.module.ModuleConfiguration;
import edu.ucr.cs.riple.core.module.ModuleInfo;
import edu.ucr.cs.riple.core.registries.index.Error;
import edu.ucr.cs.riple.core.registries.index.Fix;
import edu.ucr.cs.riple.core.registries.region.Region;
import java.util.Set;

/**
Expand Down Expand Up @@ -63,25 +61,6 @@ public interface Checker<T extends Error> {
*/
void preprocess(AnnotationInjector injector);

/**
* Creates an {@link Error} instance from the given parameters.
*
* @param errorType Error type.
* @param errorMessage Error message.
* @param region Region where the error is reported,
* @param offset offset of program point in original version where error is reported.
* @param resolvingFixes Set of fixes that resolve the error.
* @param module Module where the error is reported.
* @return The corresponding error.
*/
T createError(
String errorType,
String errorMessage,
Region region,
int offset,
ImmutableSet<Fix> resolvingFixes,
ModuleInfo module);

/**
* Verifies that the checker representation in Annotator is compatible with the actual running
* checker on the target module.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,20 @@ public void preprocess(AnnotationInjector injector) {
injector.injectAnnotations(initializers);
}

@Override
public NullAwayError createError(
/**
* Creates a {@link NullAwayError} instance using the provided arguments. It also removes
* annotation change requests that are on an element with explict nonnull annotation.
*
* @param errorType Error Type from NullAway.
* @param errorMessage Error Message from NullAway.
* @param region Region where the error is reported.
* @param offset Offset of program point in the source file where the error is reported.
* @param resolvingFixes Resolving fixes that can fix the error if all applied to source code.
* @param module Module where this error is reported.
* @return Creates and returns the corresponding {@link NullAwayError} instance using the provided
* information.
*/
private NullAwayError createError(
String errorType,
String errorMessage,
Region region,
Expand Down

0 comments on commit c493546

Please sign in to comment.