1919
2020import edu .umd .cs .findbugs .annotations .SuppressFBWarnings ;
2121import org .apache .commons .jcs3 .JCS ;
22- import org .jetbrains .annotations .NotNull ;
23- import org .jetbrains .annotations .Nullable ;
22+ import org .jspecify .annotations .NonNull ;
23+ import org .jspecify .annotations .Nullable ;
2424import org .owasp .dependencycheck .analyzer .AnalysisPhase ;
2525import org .owasp .dependencycheck .analyzer .Analyzer ;
2626import org .owasp .dependencycheck .analyzer .AnalyzerService ;
@@ -145,7 +145,7 @@ public class Engine implements FileFilter, AutoCloseable {
145145 *
146146 * @param settings reference to the configured settings
147147 */
148- public Engine (@ NotNull final Settings settings ) {
148+ public Engine (@ NonNull final Settings settings ) {
149149 this (Mode .STANDALONE , settings );
150150 }
151151
@@ -155,7 +155,7 @@ public Engine(@NotNull final Settings settings) {
155155 * @param mode the mode of operation
156156 * @param settings reference to the configured settings
157157 */
158- public Engine (@ NotNull final Mode mode , @ NotNull final Settings settings ) {
158+ public Engine (@ NonNull final Mode mode , @ NonNull final Settings settings ) {
159159 this (Thread .currentThread ().getContextClassLoader (), mode , settings );
160160 }
161161
@@ -165,7 +165,7 @@ public Engine(@NotNull final Mode mode, @NotNull final Settings settings) {
165165 * @param serviceClassLoader a reference the class loader being used
166166 * @param settings reference to the configured settings
167167 */
168- public Engine (@ NotNull final ClassLoader serviceClassLoader , @ NotNull final Settings settings ) {
168+ public Engine (@ NonNull final ClassLoader serviceClassLoader , @ NonNull final Settings settings ) {
169169 this (serviceClassLoader , Mode .STANDALONE , settings );
170170 }
171171
@@ -176,7 +176,7 @@ public Engine(@NotNull final ClassLoader serviceClassLoader, @NotNull final Sett
176176 * @param mode the mode of the engine
177177 * @param settings reference to the configured settings
178178 */
179- public Engine (@ NotNull final ClassLoader serviceClassLoader , @ NotNull final Mode mode , @ NotNull final Settings settings ) {
179+ public Engine (@ NonNull final ClassLoader serviceClassLoader , @ NonNull final Mode mode , @ NonNull final Settings settings ) {
180180 this .settings = settings ;
181181 this .serviceClassLoader = serviceClassLoader ;
182182 this .mode = mode ;
@@ -277,7 +277,7 @@ public synchronized void sortDependencies() {
277277 *
278278 * @param dependency the dependency to remove.
279279 */
280- public synchronized void removeDependency (@ NotNull final Dependency dependency ) {
280+ public synchronized void removeDependency (@ NonNull final Dependency dependency ) {
281281 dependencies .remove (dependency );
282282 dependenciesExternalView = null ;
283283 }
@@ -300,7 +300,7 @@ public synchronized Dependency[] getDependencies() {
300300 *
301301 * @param dependencies the dependencies
302302 */
303- public synchronized void setDependencies (@ NotNull final List <Dependency > dependencies ) {
303+ public synchronized void setDependencies (@ NonNull final List <Dependency > dependencies ) {
304304 this .dependencies .clear ();
305305 this .dependencies .addAll (dependencies );
306306 dependenciesExternalView = null ;
@@ -315,7 +315,7 @@ public synchronized void setDependencies(@NotNull final List<Dependency> depende
315315 * @return the list of dependencies scanned
316316 * @since v0.3.2.5
317317 */
318- public List <Dependency > scan (@ NotNull final String [] paths ) {
318+ public List <Dependency > scan (@ NonNull final String [] paths ) {
319319 return scan (paths , null );
320320 }
321321
@@ -330,7 +330,7 @@ public List<Dependency> scan(@NotNull final String[] paths) {
330330 * @return the list of dependencies scanned
331331 * @since v1.4.4
332332 */
333- public List <Dependency > scan (@ NotNull final String [] paths , @ Nullable final String projectReference ) {
333+ public List <Dependency > scan (@ NonNull final String [] paths , @ Nullable final String projectReference ) {
334334 final List <Dependency > deps = new ArrayList <>();
335335 for (String path : paths ) {
336336 final List <Dependency > d = scan (path , projectReference );
@@ -349,7 +349,7 @@ public List<Dependency> scan(@NotNull final String[] paths, @Nullable final Stri
349349 * @param path the path to a file or directory to be analyzed
350350 * @return the list of dependencies scanned
351351 */
352- public List <Dependency > scan (@ NotNull final String path ) {
352+ public List <Dependency > scan (@ NonNull final String path ) {
353353 return scan (path , null );
354354 }
355355
@@ -364,7 +364,7 @@ public List<Dependency> scan(@NotNull final String path) {
364364 * @return the list of dependencies scanned
365365 * @since v1.4.4
366366 */
367- public List <Dependency > scan (@ NotNull final String path , String projectReference ) {
367+ public List <Dependency > scan (@ NonNull final String path , String projectReference ) {
368368 final File file = new File (path );
369369 return scan (file , projectReference );
370370 }
@@ -461,7 +461,7 @@ public List<Dependency> scan(File file) {
461461 * @since v1.4.4
462462 */
463463 @ Nullable
464- public List <Dependency > scan (@ NotNull final File file , String projectReference ) {
464+ public List <Dependency > scan (@ NonNull final File file , String projectReference ) {
465465 if (file .exists ()) {
466466 if (file .isDirectory ()) {
467467 return scanDirectory (file , projectReference );
@@ -498,7 +498,7 @@ protected List<Dependency> scanDirectory(File dir) {
498498 * @return the list of Dependency objects scanned
499499 * @since v1.4.4
500500 */
501- protected List <Dependency > scanDirectory (@ NotNull final File dir , @ Nullable final String projectReference ) {
501+ protected List <Dependency > scanDirectory (@ NonNull final File dir , @ Nullable final String projectReference ) {
502502 final File [] files = dir .listFiles ();
503503 final List <Dependency > deps = new ArrayList <>();
504504 if (files != null ) {
@@ -526,7 +526,7 @@ protected List<Dependency> scanDirectory(@NotNull final File dir, @Nullable fina
526526 * @param file The file to scan
527527 * @return the scanned dependency
528528 */
529- protected Dependency scanFile (@ NotNull final File file ) {
529+ protected Dependency scanFile (@ NonNull final File file ) {
530530 return scanFile (file , null );
531531 }
532532
@@ -541,7 +541,7 @@ protected Dependency scanFile(@NotNull final File file) {
541541 * @return the scanned dependency
542542 * @since v1.4.4
543543 */
544- protected synchronized Dependency scanFile (@ NotNull final File file , @ Nullable final String projectReference ) {
544+ protected synchronized Dependency scanFile (@ NonNull final File file , @ Nullable final String projectReference ) {
545545 Dependency dependency = null ;
546546 if (file .isFile ()) {
547547 if (accept (file )) {
@@ -681,7 +681,7 @@ public void analyzeDependencies() throws ExceptionCollection {
681681 * @param exceptions a collection to store non-fatal exceptions
682682 * @throws ExceptionCollection thrown if fatal exceptions occur
683683 */
684- private void initializeAndUpdateDatabase (@ NotNull final List <Throwable > exceptions ) throws ExceptionCollection {
684+ private void initializeAndUpdateDatabase (@ NonNull final List <Throwable > exceptions ) throws ExceptionCollection {
685685 if (!mode .isDatabaseRequired ()) {
686686 return ;
687687 }
@@ -741,7 +741,7 @@ private void throwFatalDatabaseException(DatabaseException ex, final List<Throwa
741741 * @param analyzer the analyzer to execute
742742 * @throws ExceptionCollection thrown if exceptions occurred during analysis
743743 */
744- protected void executeAnalysisTasks (@ NotNull final Analyzer analyzer , List <Throwable > exceptions ) throws ExceptionCollection {
744+ protected void executeAnalysisTasks (@ NonNull final Analyzer analyzer , List <Throwable > exceptions ) throws ExceptionCollection {
745745 LOGGER .debug ("Starting {}" , analyzer .getName ());
746746 final List <AnalysisTask > analysisTasks = getAnalysisTasks (analyzer , exceptions );
747747 final ExecutorService executorService = getExecutorService (analyzer );
@@ -805,7 +805,7 @@ protected ExecutorService getExecutorService(Analyzer analyzer) {
805805 * @throws InitializationException thrown when there is a problem
806806 * initializing the analyzer
807807 */
808- protected void initializeAnalyzer (@ NotNull final Analyzer analyzer ) throws InitializationException {
808+ protected void initializeAnalyzer (@ NonNull final Analyzer analyzer ) throws InitializationException {
809809 try {
810810 LOGGER .debug ("Initializing {}" , analyzer .getName ());
811811 analyzer .prepare (this );
@@ -837,7 +837,7 @@ protected void initializeAnalyzer(@NotNull final Analyzer analyzer) throws Initi
837837 *
838838 * @param analyzer the analyzer to close
839839 */
840- protected void closeAnalyzer (@ NotNull final Analyzer analyzer ) {
840+ protected void closeAnalyzer (@ NonNull final Analyzer analyzer ) {
841841 LOGGER .debug ("Closing Analyzer '{}'" , analyzer .getName ());
842842 try {
843843 analyzer .close ();
@@ -1029,7 +1029,7 @@ public CveDB getDatabase() {
10291029 *
10301030 * @return a list of Analyzers
10311031 */
1032- @ NotNull
1032+ @ NonNull
10331033 public List <Analyzer > getAnalyzers () {
10341034 final List <Analyzer > analyzerList = new ArrayList <>();
10351035 //insteae of forEach - we can just do a collect
@@ -1129,7 +1129,7 @@ public Mode getMode() {
11291129 *
11301130 * @param fta the file type analyzer to add
11311131 */
1132- protected void addFileTypeAnalyzer (@ NotNull final FileTypeAnalyzer fta ) {
1132+ protected void addFileTypeAnalyzer (@ NonNull final FileTypeAnalyzer fta ) {
11331133 this .fileTypeAnalyzers .add (fta );
11341134 }
11351135
@@ -1154,8 +1154,8 @@ private void ensureDataExists() throws NoDataException {
11541154 * @throws ExceptionCollection a collection of exceptions that occurred
11551155 * during analysis
11561156 */
1157- private void throwFatalExceptionCollection (String message , @ NotNull final Throwable throwable ,
1158- @ NotNull final List <Throwable > exceptions ) throws ExceptionCollection {
1157+ private void throwFatalExceptionCollection (String message , @ NonNull final Throwable throwable ,
1158+ @ NonNull final List <Throwable > exceptions ) throws ExceptionCollection {
11591159 LOGGER .error (message );
11601160 LOGGER .debug ("" , throwable );
11611161 exceptions .add (throwable );
@@ -1212,7 +1212,7 @@ public void writeReports(String applicationName, File outputDir, String format,
12121212 @ Deprecated
12131213 public synchronized void writeReports (String applicationName , @ Nullable final String groupId ,
12141214 @ Nullable final String artifactId , @ Nullable final String version ,
1215- @ NotNull final File outputDir , String format ) throws ReportException {
1215+ @ NonNull final File outputDir , String format ) throws ReportException {
12161216 writeReports (applicationName , groupId , artifactId , version , outputDir , format , null );
12171217 }
12181218
@@ -1233,7 +1233,7 @@ public synchronized void writeReports(String applicationName, @Nullable final St
12331233 */
12341234 public synchronized void writeReports (String applicationName , @ Nullable final String groupId ,
12351235 @ Nullable final String artifactId , @ Nullable final String version ,
1236- @ NotNull final File outputDir , String format , ExceptionCollection exceptions ) throws ReportException {
1236+ @ NonNull final File outputDir , String format , ExceptionCollection exceptions ) throws ReportException {
12371237 if (mode == Mode .EVIDENCE_COLLECTION ) {
12381238 throw new UnsupportedOperationException ("Cannot generate report in evidence collection mode." );
12391239 }
0 commit comments