public static LinkedHashSet<ClassNode> collectAllInterfacesReverseOrder(ClassNode cNode,LinkedHashSet<ClassNode> interfaces){
  if (cNode.isInterface())   interfaces.add(cNode);
  ClassNode[] directInterfaces=cNode.getInterfaces();
  for (int i=directInterfaces.length - 1; i >= 0; i--) {
    final ClassNode anInterface=directInterfaces[i];
    interfaces.add(GenericsUtils.parameterizeType(cNode,anInterface));
    collectAllInterfacesReverseOrder(anInterface,interfaces);
  }
  return interfaces;
}

public static LinkedHashSet < ClassNode > collectAllInterfacesReverseOrder ( ClassNode cNode , LinkedHashSet < ClassNode > interfaces ) { if ( cNode . isInterface ( ) ) interfaces . add ( cNode ) ; ClassNode [ ] directInterfaces = cNode . getInterfaces ( ) ; for ( int i = directInterfaces . length - 1 ; i >= 0 ; i -- ) { final ClassNode anInterface = directInterfaces [ i ] ; interfaces . add ( GenericsUtils . parameterizeType ( cNode , anInterface ) ) ; collectAllInterfacesReverseOrder ( anInterface , interfaces ) ; } return interfaces ; }
collects all interfaces of a class node , but reverses the order of the declaration of direct interfaces of this class node . this is used to make sure a trait implementing a , b where both a and b have the same method will take the method from b ( latest ) , aligning the behavior with categories .
