comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/ElementUtils.java @ 16897:f90dcdbbb75e

switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors changed Node fields to be protected or package-private (they can no longer be private) generate isLeafNode() and isOptionalInput()
author Doug Simon <doug.simon@oracle.com>
date Fri, 22 Aug 2014 15:56:51 +0200
parents 7de44804d9fa
children 433ece7d941d
comparison
equal deleted inserted replaced
16896:6872ea9cb853 16897:f90dcdbbb75e
898 return method; 898 return method;
899 } 899 }
900 return null; 900 return null;
901 } 901 }
902 902
903 private static boolean isDeclaredMethod(TypeElement element, String name, TypeMirror[] params) {
904 return getDeclaredMethod(element, name, params) != null;
905 }
906
907 public static boolean isDeclaredMethodInSuperType(TypeElement element, String name, TypeMirror[] params) { 903 public static boolean isDeclaredMethodInSuperType(TypeElement element, String name, TypeMirror[] params) {
908 List<TypeElement> superElements = getSuperTypes(element); 904 return !getDeclaredMethodsInSuperTypes(element, name, params).isEmpty();
909 905 }
910 for (TypeElement typeElement : superElements) { 906
911 if (isDeclaredMethod(typeElement, name, params)) { 907 /**
912 return true; 908 * Gets the methods in the super type hierarchy (excluding interfaces) that are overridden by a
913 } 909 * method in a subtype.
914 } 910 *
915 return false; 911 * @param declaringElement the subtype element declaring the method
912 * @param name the name of the method
913 * @param params the signature of the method
914 */
915 public static List<ExecutableElement> getDeclaredMethodsInSuperTypes(TypeElement declaringElement, String name, TypeMirror... params) {
916 List<ExecutableElement> superMethods = new ArrayList<>();
917 List<TypeElement> superElements = getSuperTypes(declaringElement);
918
919 for (TypeElement superElement : superElements) {
920 ExecutableElement superMethod = getDeclaredMethod(superElement, name, params);
921 if (superMethod != null) {
922 superMethods.add(superMethod);
923 }
924 }
925 return superMethods;
916 } 926 }
917 927
918 public static boolean typeEquals(TypeMirror type1, TypeMirror type2) { 928 public static boolean typeEquals(TypeMirror type1, TypeMirror type2) {
919 if (type1 == type2) { 929 if (type1 == type2) {
920 return true; 930 return true;