Mercurial > hg > truffle
changeset 18372:18b19a6f9851
Add default implementation for Kind accessors of Signature and JavaField
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Thu, 13 Nov 2014 14:40:12 -0800 |
parents | 837e4c31f9d8 |
children | 91283d4a1218 |
files | graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaField.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaFieldImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotUnresolvedField.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleDebugJavaMethod.java |
diffstat | 5 files changed, 9 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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.
--- 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; }
--- 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; }
--- 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; }