@Test public void testClone() { UserPreferences sut = UserPreferences.createDefaultUserPreferences(); UserPreferences clone = sut.clone(); Assert.assertEquals(sut, clone); Assert.assertEquals(sut.getClass(), clone.getClass()); }
@Override public UserPreferences clone() { try { UserPreferences dup = (UserPreferences) super.clone(); dup.recentProjectsList = new LinkedList<>(recentProjectsList); dup.detectorEnablementMap = new HashMap<>(detectorEnablementMap); dup.filterSettings = (ProjectFilterSettings) this.filterSettings.clone(); dup.includeFilterFiles = new TreeMap<>(includeFilterFiles); dup.excludeFilterFiles = new TreeMap<>(excludeFilterFiles); dup.excludeBugsFiles = new TreeMap<>(excludeBugsFiles); dup.customPlugins = new TreeMap<>(customPlugins); return dup; } catch (CloneNotSupportedException e) { throw new AssertionError(e); } }
UserPreferences implements Cloneable { @Override public UserPreferences clone() { try { UserPreferences dup = (UserPreferences) super.clone(); dup.recentProjectsList = new LinkedList<>(recentProjectsList); dup.detectorEnablementMap = new HashMap<>(detectorEnablementMap); dup.filterSettings = (ProjectFilterSettings) this.filterSettings.clone(); dup.includeFilterFiles = new TreeMap<>(includeFilterFiles); dup.excludeFilterFiles = new TreeMap<>(excludeFilterFiles); dup.excludeBugsFiles = new TreeMap<>(excludeBugsFiles); dup.customPlugins = new TreeMap<>(customPlugins); return dup; } catch (CloneNotSupportedException e) { throw new AssertionError(e); } } }
UserPreferences implements Cloneable { @Override public UserPreferences clone() { try { UserPreferences dup = (UserPreferences) super.clone(); dup.recentProjectsList = new LinkedList<>(recentProjectsList); dup.detectorEnablementMap = new HashMap<>(detectorEnablementMap); dup.filterSettings = (ProjectFilterSettings) this.filterSettings.clone(); dup.includeFilterFiles = new TreeMap<>(includeFilterFiles); dup.excludeFilterFiles = new TreeMap<>(excludeFilterFiles); dup.excludeBugsFiles = new TreeMap<>(excludeBugsFiles); dup.customPlugins = new TreeMap<>(customPlugins); return dup; } catch (CloneNotSupportedException e) { throw new AssertionError(e); } } private  UserPreferences(); }
UserPreferences implements Cloneable { @Override public UserPreferences clone() { try { UserPreferences dup = (UserPreferences) super.clone(); dup.recentProjectsList = new LinkedList<>(recentProjectsList); dup.detectorEnablementMap = new HashMap<>(detectorEnablementMap); dup.filterSettings = (ProjectFilterSettings) this.filterSettings.clone(); dup.includeFilterFiles = new TreeMap<>(includeFilterFiles); dup.excludeFilterFiles = new TreeMap<>(excludeFilterFiles); dup.excludeBugsFiles = new TreeMap<>(excludeBugsFiles); dup.customPlugins = new TreeMap<>(customPlugins); return dup; } catch (CloneNotSupportedException e) { throw new AssertionError(e); } } private  UserPreferences(); static UserPreferences createDefaultUserPreferences(); void read(); void read(@WillClose InputStream in); void write(); void write(@WillClose OutputStream out); List<String> getRecentProjects(); void useProject(String projectName); void removeProject(String projectName); void enableDetector(DetectorFactory factory, boolean enable); boolean isDetectorEnabled(DetectorFactory factory); void enableAllDetectors(boolean enable); void setProjectFilterSettings(ProjectFilterSettings filterSettings); ProjectFilterSettings getFilterSettings(); int getUserDetectorThreshold(); void setUserDetectorThreshold(int threshold); void setRunAtFullBuild(boolean enable); boolean isRunAtFullBuild(); void setUserDetectorThreshold(String threshold); @Override boolean equals(Object obj); @Override int hashCode(); @Override UserPreferences clone(); String getEffort(); void setEffort(String effort); Map<String, Boolean> getIncludeFilterFiles(); void setIncludeFilterFiles(Map<String, Boolean> includeFilterFiles); Map<String, Boolean> getExcludeBugsFiles(); void setExcludeBugsFiles(Map<String, Boolean> excludeBugsFiles); void setExcludeFilterFiles(Map<String, Boolean> excludeFilterFiles); Map<String, Boolean> getExcludeFilterFiles(); void setCustomPlugins(Map<String, Boolean> customPlugins); Map<String, Boolean> getCustomPlugins(); Set<String> getCustomPlugins(boolean enabled); AnalysisFeatureSetting[] getAnalysisFeatureSettings(); }
UserPreferences implements Cloneable { @Override public UserPreferences clone() { try { UserPreferences dup = (UserPreferences) super.clone(); dup.recentProjectsList = new LinkedList<>(recentProjectsList); dup.detectorEnablementMap = new HashMap<>(detectorEnablementMap); dup.filterSettings = (ProjectFilterSettings) this.filterSettings.clone(); dup.includeFilterFiles = new TreeMap<>(includeFilterFiles); dup.excludeFilterFiles = new TreeMap<>(excludeFilterFiles); dup.excludeBugsFiles = new TreeMap<>(excludeBugsFiles); dup.customPlugins = new TreeMap<>(customPlugins); return dup; } catch (CloneNotSupportedException e) { throw new AssertionError(e); } } private  UserPreferences(); static UserPreferences createDefaultUserPreferences(); void read(); void read(@WillClose InputStream in); void write(); void write(@WillClose OutputStream out); List<String> getRecentProjects(); void useProject(String projectName); void removeProject(String projectName); void enableDetector(DetectorFactory factory, boolean enable); boolean isDetectorEnabled(DetectorFactory factory); void enableAllDetectors(boolean enable); void setProjectFilterSettings(ProjectFilterSettings filterSettings); ProjectFilterSettings getFilterSettings(); int getUserDetectorThreshold(); void setUserDetectorThreshold(int threshold); void setRunAtFullBuild(boolean enable); boolean isRunAtFullBuild(); void setUserDetectorThreshold(String threshold); @Override boolean equals(Object obj); @Override int hashCode(); @Override UserPreferences clone(); String getEffort(); void setEffort(String effort); Map<String, Boolean> getIncludeFilterFiles(); void setIncludeFilterFiles(Map<String, Boolean> includeFilterFiles); Map<String, Boolean> getExcludeBugsFiles(); void setExcludeBugsFiles(Map<String, Boolean> excludeBugsFiles); void setExcludeFilterFiles(Map<String, Boolean> excludeFilterFiles); Map<String, Boolean> getExcludeFilterFiles(); void setCustomPlugins(Map<String, Boolean> customPlugins); Map<String, Boolean> getCustomPlugins(); Set<String> getCustomPlugins(boolean enabled); AnalysisFeatureSetting[] getAnalysisFeatureSettings(); static final String EFFORT_MIN; static final String EFFORT_DEFAULT; static final String EFFORT_MAX; static final String KEY_PLUGIN; static final String KEY_INCLUDE_FILTER; static final String KEY_EXCLUDE_FILTER; static final String KEY_EXCLUDE_BUGS; }