Skip to content

Commit 46cf406

Browse files
committed
update formatting
1 parent 546233a commit 46cf406

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+192
-0
lines changed

annotator-core/src/main/java/edu/ucr/cs/riple/core/Annotator.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,13 @@ public class Annotator {
5151

5252
/** Injector instance. */
5353
private final AnnotationInjector injector;
54+
5455
/** Annotator context. */
5556
public final Context context;
57+
5658
/** Reports cache. */
5759
public final ReportCache cache;
60+
5861
/** Annotator configuration. */
5962
public final Config config;
6063

annotator-core/src/main/java/edu/ucr/cs/riple/core/Config.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,86 +68,111 @@ public class Config {
6868
* zero or less.
6969
*/
7070
public final boolean bailout;
71+
7172
/** If activated, impact of fixes will be computed in parallel. */
7273
public final boolean useParallelGraphProcessor;
74+
7375
/** If activated, impact of fixes will be cached. */
7476
public final boolean useImpactCache;
77+
7578
/**
7679
* If activated, all suggested fixes from the checker will be applied to the source code
7780
* regardless of their effectiveness.
7881
*/
7982
public final boolean exhaustiveSearch;
83+
8084
/**
8185
* If activated, all containing fixes in the fix tree will be applied to the source code,
8286
* otherwise only the root fix will be applied.
8387
*/
8488
public final boolean chain;
89+
8590
/**
8691
* If enabled, at each iteration fixes with effectiveness will be tagged to exclude them in
8792
* further iterations.
8893
*/
8994
public final boolean useCache;
95+
9096
/** If true, build outputs will be redirected to STD Err. */
9197
public final boolean redirectBuildOutputToStdErr;
98+
9299
/** If activated, it will disable the outer loop. */
93100
public final boolean disableOuterLoop;
101+
94102
/** Info of target module. */
95103
public final ModuleConfiguration target;
104+
96105
/** Path to directory where all outputs of checker and scanner checker is located. */
97106
public final Path globalDir;
107+
98108
/** Command to build the target module. */
99109
public final String buildCommand;
110+
100111
/** Fully qualified name of the {@code nullable} annotation. */
101112
public final String nullableAnnot;
113+
102114
/** Fully qualified name of the {@code initializer} annotation. */
103115
public final String initializerAnnot;
116+
104117
/** If enabled, effects of public API on downstream dependencies will be considered. */
105118
public final boolean downStreamDependenciesAnalysisActivated;
119+
106120
/** Sets of context path information for all downstream dependencies. */
107121
public final ImmutableSet<ModuleConfiguration> downstreamConfigurations;
122+
108123
/**
109124
* Path to NullAway library model loader resource directory, which enables the communication
110125
* between annotator and NullAway when processing downstream dependencies. Annotator will write
111126
* annotation on files in this directory and the using Library Model Loader reads them.
112127
*/
113128
public final Path nullawayLibraryModelLoaderPath;
129+
114130
/** Command to build the all downstream dependencies at once. */
115131
public final String downstreamDependenciesBuildCommand;
132+
116133
/**
117134
* Analysis mode. Will impact inference decisions when downstream dependency analysis is
118135
* activated.
119136
*/
120137
public final AnalysisMode mode;
138+
121139
/** Global counter for assigning unique id for each instance. */
122140
private int moduleCounterID;
141+
123142
/**
124143
* If activated, Annotator will try to suppress all remaining errors. The logic is specific to the
125144
* checker suppression mechanism. Annotator will simply call {@link
126145
* edu.ucr.cs.riple.core.checkers.Checker#suppressRemainingErrors} methods.
127146
*/
128147
public final boolean suppressRemainingErrors;
148+
129149
/** Fully qualified NullUnmarked annotation. */
130150
public final String nullUnMarkedAnnotation;
151+
131152
/**
132153
* Set of {@code @Nonnull} annotations to be acknowledged by Annotator. If an element is annotated
133154
* with these annotations along any other annotation ending with {@code "nonnull"}, Annotator will
134155
* acknowledge the annotation and will not add any {@code @Nullable} annotation to the element.
135156
*/
136157
public final ImmutableSet<String> nonnullAnnotations;
158+
137159
/** Depth of the analysis. Default to 5 if not set by the user */
138160
public final int depth;
161+
139162
/**
140163
* Activates inference to add {@code @Nullable} qualifiers.
141164
*
142165
* <p>Note: Inference mode is mostly deactivated for experiments purposes and the default value is
143166
* {@code true} in production.
144167
*/
145168
public final boolean inferenceActivated;
169+
146170
/**
147171
* Generated code detectors. Responsible for detecting regions that are not present in the source
148172
* code and are generated by a processor.
149173
*/
150174
public final ImmutableSet<SourceType> generatedCodeDetectors;
175+
151176
/**
152177
* Checker name to retrieve the {@link edu.ucr.cs.riple.core.checkers.Checker} specific instance.
153178
*/
@@ -685,6 +710,7 @@ public static class Builder {
685710
public String initializerAnnotation;
686711
public String nullableAnnotation;
687712
public String outputDir;
713+
688714
/**
689715
* List of modules, did not use {@link java.util.Set} to preserve order. First project is the
690716
* target project.

annotator-core/src/main/java/edu/ucr/cs/riple/core/Context.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,25 @@ public class Context {
4747

4848
/** Annotator configuration. */
4949
public final Config config;
50+
5051
/** Log instance. Responsible for logging all the information about the build time and count. */
5152
public final Log log;
53+
5254
/** Handler for computing the original offset of reported errors with existing changes. */
5355
public final OffsetHandler offsetHandler;
56+
5457
/** The moduleInfo of target module. */
5558
public final ModuleInfo targetModuleInfo;
59+
5660
/**
5761
* Configuration of the target module, required for building the target module and collecting
5862
* checkers output.
5963
*/
6064
public final ModuleConfiguration targetConfiguration;
65+
6166
/** Sets of context path information for all downstream dependencies. */
6267
public final ImmutableSet<ModuleConfiguration> downstreamConfigurations;
68+
6369
/** Checker instance. Used to execute checker specific tasks. */
6470
public final Checker<? extends Error> checker;
6571

annotator-core/src/main/java/edu/ucr/cs/riple/core/Report.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,34 @@ public class Report {
4343

4444
/** Effect on target module. */
4545
public int localEffect;
46+
4647
/** Root of fix tree associated to this report instance. */
4748
public Fix root;
49+
4850
/** Fix tree associated to this report instance. */
4951
public Set<Fix> tree;
52+
5053
/**
5154
* Set of errors that will be triggered in target module if fix tree is applied to the source
5255
* code.
5356
*/
5457
public ImmutableSet<Error> triggeredErrors;
58+
5559
/**
5660
* Set of triggered fixes on target module that will be triggered if fix tree is applied due to
5761
* errors in downstream dependencies.
5862
*/
5963
public ImmutableSet<Fix> triggeredFixesFromDownstreamErrors;
64+
6065
/** If true, this report's tree has been processed for at least one iteration */
6166
public boolean hasBeenProcessedOnce;
67+
6268
/**
6369
* Lower bound of number of errors in downstream dependencies if fix tree is applied to the target
6470
* module.
6571
*/
6672
private int lowerBoundEffectOnDownstreamDependencies;
73+
6774
/**
6875
* Upper bound of number of errors in downstream dependencies if fix tree is applied to the target
6976
* module.

annotator-core/src/main/java/edu/ucr/cs/riple/core/ReportCache.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public class ReportCache {
3838
* efficiently.
3939
*/
4040
private final Map<Fix, Report> store;
41+
4142
/** Cache activation switch. */
4243
private boolean enabled;
4344

annotator-core/src/main/java/edu/ucr/cs/riple/core/cache/Impact.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ public class Impact {
3636

3737
/** Target fix. */
3838
public final Fix fix;
39+
3940
/** Set of triggered errors, if this fix is applied to source code. */
4041
protected ImmutableSet<Error> triggeredErrors;
42+
4143
/**
4244
* Set of triggered fixes on the target module from downstream dependencies errors if containing
4345
* fix is applied.

annotator-core/src/main/java/edu/ucr/cs/riple/core/checkers/CheckerBaseClass.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public abstract class CheckerBaseClass<T extends Error> implements Checker<T> {
3737

3838
/** Annotator config. */
3939
protected final Config config;
40+
4041
/** Annotator context. */
4142
protected final Context context;
4243

annotator-core/src/main/java/edu/ucr/cs/riple/core/checkers/nullaway/NullAway.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public class NullAway extends CheckerBaseClass<NullAwayError> {
6060
* The name of the checker. To select this checker, this name must be used in the configurations.
6161
*/
6262
public static final String NAME = "NULLAWAY";
63+
6364
/** Supported version of NullAway serialization. */
6465
public static final int VERSION = 3;
6566

annotator-core/src/main/java/edu/ucr/cs/riple/core/checkers/nullaway/NullAwayError.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public class NullAwayError extends Error {
3737

3838
/** Error type for method initialization errors from NullAway in {@code String}. */
3939
public static final String METHOD_INITIALIZER_ERROR = "METHOD_NO_INIT";
40+
4041
/** Error type for field initialization errors from NullAway in {@code String}. */
4142
public static final String FIELD_INITIALIZER_ERROR = "FIELD_NO_INIT";
4243

annotator-core/src/main/java/edu/ucr/cs/riple/core/evaluators/AbstractEvaluator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,16 @@ public abstract class AbstractEvaluator implements Evaluator {
4848

4949
/** Annotator context. */
5050
protected final Context context;
51+
5152
/** Conflict graph to storing unprocessed fixes. */
5253
protected final ConflictGraph graph;
54+
5355
/** Depth of analysis. */
5456
protected final int depth;
57+
5558
/** Graph processor to process the graph. */
5659
protected ConflictGraphProcessor processor;
60+
5761
/** Supplier used for initialization. */
5862
protected final Supplier supplier;
5963

annotator-core/src/main/java/edu/ucr/cs/riple/core/evaluators/graph/ConflictGraph.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public class ConflictGraph {
4545

4646
/** Nodes in this graph */
4747
public final Multimap<Integer, Node> nodes;
48+
4849
/**
4950
* Groups in this graph, nodes which does not have any conflict in regions will in the same group.
5051
* Please note that this is a graph coloring problem, set of groups is calculated using a greedy

annotator-core/src/main/java/edu/ucr/cs/riple/core/evaluators/graph/Node.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,31 @@ public class Node {
4949

5050
/** Root fix of the tree. */
5151
public final Fix root;
52+
5253
/** Set of all fixes in tree. */
5354
public final Set<Fix> tree;
55+
5456
/** Set of potentially impacted by any node in tree. */
5557
public final Set<Region> regions;
58+
5659
/** Set of triggered errors if tree is applied on target module. */
5760
public ImmutableSet<Error> triggeredErrors;
61+
5862
/**
5963
* Set of triggered fixes on target module that will be triggered if fix tree is applied due to
6064
* errors in downstream dependencies.
6165
*/
6266
public ImmutableSet<Fix> triggeredFixesFromDownstreamErrors;
67+
6368
/** Unique id of Node across all nodes. */
6469
public int id;
70+
6571
/** Effect of applying containing change */
6672
public int effect;
73+
6774
/** Corresponding report of processing root. */
6875
public Report report;
76+
6977
/** Regions where original errors reported and NullAway suggested root for that. */
7078
private ImmutableSet<Region> origins;
7179

annotator-core/src/main/java/edu/ucr/cs/riple/core/evaluators/graph/processors/AbstractConflictGraphProcessor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,19 @@ public abstract class AbstractConflictGraphProcessor implements ConflictGraphPro
4242

4343
/** Injector used in the processor to inject / remove fixes. */
4444
protected final AnnotationInjector injector;
45+
4546
/** Error store instance to store state of fixes before and after of injections. */
4647
protected final ErrorStore errorStore;
48+
4749
/** Downstream impact cache to retrieve impacts of fixes globally. */
4850
protected final DownstreamImpactCache downstreamImpactCache;
51+
4952
/** Annotator context. */
5053
protected final Context context;
54+
5155
/** Handler to re-run compiler. */
5256
protected final CompilerRunner compilerRunner;
57+
5358
/** ModuleInfo of the input module which the impact of fixes are computed on. */
5459
protected final ModuleInfo moduleInfo;
5560

annotator-core/src/main/java/edu/ucr/cs/riple/core/evaluators/suppliers/AbstractSupplier.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,16 @@ public abstract class AbstractSupplier implements Supplier {
3535

3636
/** Error Store instance. */
3737
protected final ErrorStore errorStore;
38+
3839
/** Injector instance. */
3940
protected final AnnotationInjector injector;
41+
4042
/** ModuleInfo of the module which the impact of fixes are computed on. */
4143
protected final ModuleInfo moduleInfo;
44+
4245
/** Depth of analysis. */
4346
protected final int depth;
47+
4448
/** Annotator context. */
4549
protected final Context context;
4650

annotator-core/src/main/java/edu/ucr/cs/riple/core/injectors/VirtualInjector.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,16 @@ public class VirtualInjector extends AnnotationInjector {
4848

4949
/** Path to library model loader resources directory */
5050
private final Path libraryModelResourcesDirectoryPath;
51+
5152
/**
5253
* Annotator configuration, required to check if downstream dependencies analysis is activated or
5354
* retrieve the path to library model loader.
5455
*/
5556
private final Config config;
57+
5658
/** Name of the resource file in library model loader which contains list of nullable methods. */
5759
public static final String NULLABLE_METHOD_LIST_FILE_NAME = "nullable-methods.tsv";
60+
5861
/** Name of the resource file in library model loader which contains list of nullable fields. */
5962
public static final String NULLABLE_FIELD_LIST_FILE_NAME = "nullable-fields.tsv";
6063

annotator-core/src/main/java/edu/ucr/cs/riple/core/log/Log.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,16 @@ public class Log {
3535

3636
/** Sum of number of nodes constructed in each {@link ConflictGraph}. */
3737
private long nodes;
38+
3839
/** Number of build requests. */
3940
private long requested;
41+
4042
/** Total time spent for annotator from start to finish. */
4143
private long totalTime;
44+
4245
/** Total time spent in building targets. */
4346
private long buildTime = 0;
47+
4448
/**
4549
* Set of approved and injected annotations. These annotations are evaluated and approved and will
4650
* not get removed from the source code.

annotator-core/src/main/java/edu/ucr/cs/riple/core/module/ModuleConfiguration.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@ public class ModuleConfiguration {
3636

3737
/** Path to checker config. */
3838
public final Path checkerConfig;
39+
3940
/** Path to scanner config. */
4041
public final Path scannerConfig;
42+
4143
/** Directory where all serialized data from checkers are located. */
4244
public final Path dir;
45+
4346
/**
4447
* Global unique ID for this module. 0 is for the target module, and the i-th module is for the
4548
* i-th downstream dependency.

0 commit comments

Comments
 (0)