List<TemplateContextType> (TemplateContextType type) { ArrayList<TemplateContextType> list = new ArrayList<>(); while (true) { type = type.getBaseContextType(); if (type == null) return list; list.add(type); } }