MavenTasksManagerState () { synchronized (myStateLock) { MavenTasksManagerState result = new MavenTasksManagerState(); result.afterCompileTasks = new HashSet<>(myState.afterCompileTasks); result.beforeCompileTasks = new HashSet<>(myState.beforeCompileTasks); result.afterRebuildTask = new HashSet<>(myState.afterRebuildTask); result.beforeRebuildTask = new HashSet<>(myState.beforeRebuildTask); return result; } }