diff --git a/todolist/fxutil/src/main/java/fxutil/SuppressFBWarnings.java b/todolist/fxutil/src/main/java/fxutil/SuppressFBWarnings.java new file mode 100644 index 0000000000000000000000000000000000000000..72071ed7468e7b618c0de75b47ac14d310e8f894 --- /dev/null +++ b/todolist/fxutil/src/main/java/fxutil/SuppressFBWarnings.java @@ -0,0 +1,22 @@ +package fxutil; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** + * Annontation to suppress spotbugs warnings. + * Must have this specific name to be considered by spotbugs. + */ +@Retention(RetentionPolicy.CLASS) +public @interface SuppressFBWarnings { + /** + * The set of FindBugs warnings that are to be suppressed in + * annotated element. The value can be a bug category, kind or pattern. + */ + String[] value() default {}; + + /** + * Optional documentation of the reason why the warning is suppressed. + */ + String justification() default ""; +} diff --git a/todolist/fxutil/src/main/java/fxutil/doc/FileMenuController.java b/todolist/fxutil/src/main/java/fxutil/doc/FileMenuController.java index a91dd76257626e5803115c1ae7ce58e90caeb417..ab3af83b82666846fbfee5f8d6f47840844325be 100644 --- a/todolist/fxutil/src/main/java/fxutil/doc/FileMenuController.java +++ b/todolist/fxutil/src/main/java/fxutil/doc/FileMenuController.java @@ -1,5 +1,6 @@ package fxutil.doc; +import fxutil.SuppressFBWarnings; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -35,13 +36,16 @@ public class FileMenuController { * * @param documentStorage the document storage */ + @SuppressFBWarnings( + value = "EI_EXPOSE_REP2", + justification = "We intentioanlly don't deep copy documentStorage") public void setDocumentStorage(final DocumentStorage<File> documentStorage) { this.documentStorage = documentStorage; if (importMenu != null) { importMenu.setDisable(documentStorage.getDocumentImporters().isEmpty()); } } - + @FXML public void handleNewAction() { documentStorage.newDocument();