# HG changeset patch # User Christian Wimmer # Date 1415918412 28800 # Node ID 18b19a6f985156eed7b655b8bac159af2b54432c # Parent 837e4c31f9d8b98e34f2c01b1e9f459ebe569991 Add default implementation for Kind accessors of Signature and JavaField diff -r 837e4c31f9d8 -r 18b19a6f9851 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaField.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaField.java Thu Nov 13 14:30:15 2014 -0800 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaField.java Thu Nov 13 14:40:12 2014 -0800 @@ -44,7 +44,9 @@ * Returns the kind of this field. This is the same as calling {@link #getType}. * {@link JavaType#getKind getKind}. */ - Kind getKind(); + default Kind getKind() { + return getType().getKind(); + } /** * Returns the {@link JavaType} object representing the class or interface that declares this diff -r 837e4c31f9d8 -r 18b19a6f9851 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java Thu Nov 13 14:30:15 2014 -0800 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java Thu Nov 13 14:40:12 2014 -0800 @@ -59,7 +59,9 @@ * @param index the index into the parameters, with {@code 0} indicating the first parameter * @return the kind of the parameter at the specified position */ - Kind getParameterKind(int index); + default Kind getParameterKind(int index) { + return getParameterType(index, null).getKind(); + } /** * Gets the return type of this signature. @@ -77,7 +79,9 @@ * Gets the return kind of this signature. This is the same as calling {@link #getReturnType}. * {@link JavaType#getKind getKind}. */ - Kind getReturnKind(); + default Kind getReturnKind() { + return getReturnType(null).getKind(); + } /** * Gets the size, in Java slots, of the parameters to this signature. diff -r 837e4c31f9d8 -r 18b19a6f9851 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaFieldImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaFieldImpl.java Thu Nov 13 14:30:15 2014 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaFieldImpl.java Thu Nov 13 14:40:12 2014 -0800 @@ -298,11 +298,6 @@ } @Override - public Kind getKind() { - return getType().getKind(); - } - - @Override public String getName() { return name; } diff -r 837e4c31f9d8 -r 18b19a6f9851 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotUnresolvedField.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotUnresolvedField.java Thu Nov 13 14:30:15 2014 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotUnresolvedField.java Thu Nov 13 14:40:12 2014 -0800 @@ -47,10 +47,6 @@ return type; } - public Kind getKind() { - return type.getKind(); - } - public JavaType getDeclaringClass() { return holder; } diff -r 837e4c31f9d8 -r 18b19a6f9851 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleDebugJavaMethod.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleDebugJavaMethod.java Thu Nov 13 14:30:15 2014 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleDebugJavaMethod.java Thu Nov 13 14:40:12 2014 -0800 @@ -72,10 +72,6 @@ return declaringClass; } - public Kind getReturnKind() { - return declaringClass.getKind(); - } - public JavaType getParameterType(int index, ResolvedJavaType accessingClass) { throw new IndexOutOfBoundsException(); } @@ -84,10 +80,6 @@ return 0; } - public Kind getParameterKind(int index) { - throw new IndexOutOfBoundsException(); - } - public int getParameterCount(boolean receiver) { return 0; }