1
1
package software .xdev .saveactions .model ;
2
2
3
3
import java .util .ArrayList ;
4
- import java .util .EnumSet ;
5
4
import java .util .HashSet ;
6
5
import java .util .List ;
7
6
import java .util .Objects ;
18
17
19
18
@ State (name = "SaveActionSettings" , storages = {@ com .intellij .openapi .components .Storage ("saveactions_settings.xml" )})
20
19
@ Service (Service .Level .PROJECT )
20
+ @ SuppressWarnings ("PMD.UseEnumCollections" ) // Set must be nullable!
21
21
public final class Storage implements PersistentStateComponent <Storage >
22
22
{
23
23
private boolean firstLaunch ;
24
+ // Must use a set that supports nullable values!
25
+ // For example EnumSet will crash when encountering an unknown/null value
24
26
private Set <Action > actions ;
25
27
private Set <String > exclusions ;
26
28
private Set <String > inclusions ;
@@ -31,7 +33,7 @@ public final class Storage implements PersistentStateComponent<Storage>
31
33
public Storage ()
32
34
{
33
35
this .firstLaunch = true ;
34
- this .actions = EnumSet . noneOf ( Action . class );
36
+ this .actions = new HashSet <>( );
35
37
this .exclusions = new HashSet <>();
36
38
this .inclusions = new HashSet <>();
37
39
this .configurationPath = null ;
@@ -42,7 +44,7 @@ public Storage()
42
44
public Storage (final Storage storage )
43
45
{
44
46
this .firstLaunch = storage .firstLaunch ;
45
- this .actions = EnumSet . copyOf (storage .actions );
47
+ this .actions = new HashSet <> (storage .actions );
46
48
this .exclusions = new HashSet <>(storage .exclusions );
47
49
this .inclusions = new HashSet <>(storage .inclusions );
48
50
this .configurationPath = storage .configurationPath ;
0 commit comments