Remove the TaskTree.Root class

Since there is very little custom code left in the TaskTree.Root class,
eliminate it by pushing its functionality into NodeList and thus making
it share more code with the Node class.

Change-Id: I739935ee599870aca810098b033a8cb72eee5f8a
diff --git a/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java b/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java
index 8445796..5a8bc5f 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java
@@ -65,7 +65,7 @@
   protected final AllUsersNameProvider allUsers;
   protected final CurrentUser user;
   protected final TaskConfigFactory taskFactory;
-  protected final Root root = new Root();
+  protected final NodeList root = new NodeList();
   protected final Provider<ChangeQueryBuilder> changeQueryBuilderProvider;
   protected final Provider<ChangeQueryProcessor> changeQueryProcessorProvider;
 
@@ -98,14 +98,15 @@
     return root.getSubNodes();
   }
 
-  protected abstract class NodeList {
+  protected class NodeList {
     protected NodeList parent = null;
     protected LinkedList<String> path = new LinkedList<>();
     protected List<Node> nodes;
     protected Set<String> names = new HashSet<>();
 
-    protected abstract void addSubDefinitions()
-        throws ConfigInvalidException, IOException, OrmException;
+    protected void addSubDefinitions() throws ConfigInvalidException, IOException, OrmException {
+      addSubDefinitions(taskFactory.getRootConfig().getRootTasks());
+    }
 
     protected void addSubDefinitions(List<Task> defs) {
       for (Task def : defs) {
@@ -148,13 +149,6 @@
     }
   }
 
-  protected class Root extends NodeList {
-    @Override
-    protected void addSubDefinitions() throws ConfigInvalidException, IOException {
-      addSubDefinitions(getRootDefinitions());
-    }
-  }
-
   public class Node extends NodeList {
     public final Task task;
     protected final Properties.Task properties;