@@ -48,7 +48,12 @@ public class JoobyProcessor extends AbstractProcessor {
4848
4949 private ProcessingEnvironment processingEnv ;
5050
51- private Map <Element , Map <TypeElement , List <ExecutableElement >>> routeMap = new LinkedHashMap <>();
51+ /**
52+ * Controller {
53+ * HTTP_METHOD: [method1, ..., methodN]
54+ * }
55+ */
56+ private Map <TypeElement , Map <TypeElement , List <ExecutableElement >>> routeMap = new LinkedHashMap <>();
5257
5358 private boolean debug ;
5459
@@ -73,6 +78,7 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
7378 try {
7479 debug ("Round #%s" , round ++);
7580 if (roundEnv .processingOver ()) {
81+
7682 build (processingEnv .getFiler ());
7783
7884 return false ;
@@ -102,7 +108,8 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
102108 .collect (Collectors .toCollection (LinkedHashSet ::new ));
103109 for (ExecutableElement method : methods ) {
104110 Map <TypeElement , List <ExecutableElement >> mapping = routeMap
105- .computeIfAbsent (method .getEnclosingElement (), k -> new LinkedHashMap <>());
111+ .computeIfAbsent ((TypeElement ) method .getEnclosingElement (),
112+ k -> new LinkedHashMap <>());
106113 mapping .computeIfAbsent (annotation , k -> new ArrayList <>()).add (method );
107114 }
108115 }
@@ -117,15 +124,15 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
117124 private void build (Filer filer ) throws Exception {
118125 Types typeUtils = processingEnv .getTypeUtils ();
119126 Map <String , List <HandlerCompiler >> classes = new LinkedHashMap <>();
120- for (Map .Entry <Element , Map <TypeElement , List <ExecutableElement >>> e : routeMap
127+ for (Map .Entry <TypeElement , Map <TypeElement , List <ExecutableElement >>> e : routeMap
121128 .entrySet ()) {
122- Element type = e .getKey ();
129+ TypeElement type = e .getKey ();
123130 boolean isAbstract = type .getModifiers ().contains (Modifier .ABSTRACT );
124131 /** Ignore abstract routes: */
125132 if (!isAbstract ) {
126133 /** Expand route method from superclass(es): */
127134 Map <TypeElement , List <ExecutableElement >> mappings = e .getValue ();
128- for (Element superType : superTypes (type )) {
135+ for (TypeElement superType : superTypes (type )) {
129136 Map <TypeElement , List <ExecutableElement >> baseMappings = routeMap
130137 .getOrDefault (superType , Collections .emptyMap ());
131138 for (Map .Entry <TypeElement , List <ExecutableElement >> be : baseMappings .entrySet ()) {
@@ -181,7 +188,7 @@ private String signature(ExecutableElement method) {
181188 return method .toString ();
182189 }
183190
184- private List <Element > superTypes (Element owner ) {
191+ private List <TypeElement > superTypes (Element owner ) {
185192 Types typeUtils = processingEnv .getTypeUtils ();
186193 List <? extends TypeMirror > supertypes = typeUtils
187194 .directSupertypes (owner .asType ());
@@ -193,9 +200,9 @@ private List<Element> superTypes(Element owner) {
193200 Element supertypeElement = typeUtils .asElement (supertype );
194201 if (!Object .class .getName ().equals (supertypeName )
195202 && supertypeElement .getKind () == ElementKind .CLASS ) {
196- List <Element > result = new ArrayList <>();
203+ List <TypeElement > result = new ArrayList <>();
197204 result .addAll (superTypes (supertypeElement ));
198- result .add (supertypeElement );
205+ result .add (( TypeElement ) supertypeElement );
199206 return result ;
200207 }
201208 return Collections .emptyList ();
@@ -238,7 +245,7 @@ private List<String> path(Element owner, TypeElement annotation, ExecutableEleme
238245 List <String > prefix = path (owner );
239246 if (prefix .isEmpty ()) {
240247 // Look at parent @path annotation
241- List <Element > superTypes = superTypes (owner );
248+ List <TypeElement > superTypes = superTypes (owner );
242249 int i = superTypes .size () - 1 ;
243250 while (prefix .isEmpty () && i >= 0 ) {
244251 prefix = path (superTypes .get (i --));
0 commit comments