changeset 16493:b45bb90c0192

added forwarding methods to MetaUtil and marked them with @Deprecated to simplify adapting new API
author Doug Simon <doug.simon@oracle.com>
date Fri, 11 Jul 2014 14:19:21 +0200
parents 8853b9304083
children d8d90184ec66
files graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaType.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java
diffstat 2 files changed, 77 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaType.java	Fri Jul 11 13:47:47 2014 +0200
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaType.java	Fri Jul 11 14:19:21 2014 +0200
@@ -127,8 +127,8 @@
     /**
      * Returns this type's name in the same format as {@link Class#getName()}.
      */
-    default String toClassName(JavaType type) {
-        return internalNameToJava(type.getName(), true, true);
+    default String toClassName() {
+        return internalNameToJava(getName(), true, true);
     }
 
 }
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java	Fri Jul 11 13:47:47 2014 +0200
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java	Fri Jul 11 14:19:21 2014 +0200
@@ -23,6 +23,7 @@
 package com.oracle.graal.api.meta;
 
 import java.io.*;
+import java.lang.annotation.*;
 import java.util.*;
 
 /**
@@ -332,4 +333,78 @@
         }
         return indentation + lines.replace(newLine, newLine + indentation);
     }
+
+    // The methods below here will be soon removed. They exist to simplify updating
+    // clients of the old API to switch to using the default methods that replace
+    // these utility methods. In Eclipse will show calls to these methods as warnings.
+
+    @Deprecated
+    public static boolean isJavaLangObject(ResolvedJavaType type) {
+        return type.isJavaLangObject();
+    }
+
+    @Deprecated
+    public static ResolvedJavaType[] lookupJavaTypes(MetaAccessProvider metaAccess, Class<?>[] classes) {
+        return metaAccess.lookupJavaTypes(classes);
+    }
+
+    @Deprecated
+    public static ResolvedJavaType getElementalType(ResolvedJavaType type) {
+        return type.getElementalType();
+    }
+
+    @Deprecated
+    public static String toJavaName(JavaType type, boolean qualified) {
+        return type.toJavaName(qualified);
+    }
+
+    @Deprecated
+    public static String toJavaName(JavaType type) {
+        return type.toJavaName();
+    }
+
+    @Deprecated
+    public static String toClassName(JavaType type) {
+        return type.toClassName();
+    }
+
+    @Deprecated
+    public static String format(String format, JavaMethod method) throws IllegalFormatException {
+        return method.format(format);
+    }
+
+    @Deprecated
+    public static String format(String format, JavaField field) throws IllegalFormatException {
+        return field.format(format);
+    }
+
+    @Deprecated
+    public static <T extends Annotation> T[] getParameterAnnotations(Class<T> annotationClass, ResolvedJavaMethod method) {
+        return method.getParameterAnnotations(annotationClass);
+    }
+
+    @Deprecated
+    public static <T extends Annotation> T getParameterAnnotation(Class<T> annotationClass, int parameterIndex, ResolvedJavaMethod method) {
+        return method.getParameterAnnotation(annotationClass, parameterIndex);
+    }
+
+    @Deprecated
+    public static JavaType[] signatureToTypes(Signature signature, JavaType receiverType) {
+        return signature.toParameterTypes(receiverType);
+    }
+
+    @Deprecated
+    public static JavaType[] signatureToTypes(ResolvedJavaMethod method) {
+        return method.toParameterTypes();
+    }
+
+    @Deprecated
+    public static String signatureToMethodDescriptor(Signature sig) {
+        return sig.toMethodDescriptor();
+    }
+
+    @Deprecated
+    public static String profileToString(ProfilingInfo info, ResolvedJavaMethod method, String sep) {
+        return info.toString(method, sep);
+    }
 }