Mercurial > hg > graal-compiler
diff 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 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/ElementUtils.java Mon Aug 18 14:05:05 2014 +0200 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/ElementUtils.java Fri Aug 22 15:56:51 2014 +0200 @@ -900,19 +900,29 @@ return null; } - private static boolean isDeclaredMethod(TypeElement element, String name, TypeMirror[] params) { - return getDeclaredMethod(element, name, params) != null; + public static boolean isDeclaredMethodInSuperType(TypeElement element, String name, TypeMirror[] params) { + return !getDeclaredMethodsInSuperTypes(element, name, params).isEmpty(); } - public static boolean isDeclaredMethodInSuperType(TypeElement element, String name, TypeMirror[] params) { - List<TypeElement> superElements = getSuperTypes(element); + /** + * Gets the methods in the super type hierarchy (excluding interfaces) that are overridden by a + * method in a subtype. + * + * @param declaringElement the subtype element declaring the method + * @param name the name of the method + * @param params the signature of the method + */ + public static List<ExecutableElement> getDeclaredMethodsInSuperTypes(TypeElement declaringElement, String name, TypeMirror... params) { + List<ExecutableElement> superMethods = new ArrayList<>(); + List<TypeElement> superElements = getSuperTypes(declaringElement); - for (TypeElement typeElement : superElements) { - if (isDeclaredMethod(typeElement, name, params)) { - return true; + for (TypeElement superElement : superElements) { + ExecutableElement superMethod = getDeclaredMethod(superElement, name, params); + if (superMethod != null) { + superMethods.add(superMethod); } } - return false; + return superMethods; } public static boolean typeEquals(TypeMirror type1, TypeMirror type2) {