# HG changeset patch # User Doug Simon # Date 1381398946 -7200 # Node ID c0807f5fdca59beb4f49eaaaeb3424f0a6b9671f # Parent c0c616fe3588b33a2a5f72fadfb2210c68364797 added ResolvedJavaType.getClassInititalizer() diff -r c0c616fe3588 -r c0807f5fdca5 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java Thu Oct 10 03:23:40 2013 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java Thu Oct 10 11:55:46 2013 +0200 @@ -301,6 +301,11 @@ ResolvedJavaMethod[] getDeclaredMethods(); /** + * Returns the {@code } method for this class if there is one. + */ + ResolvedJavaMethod getClassInitializer(); + + /** * Creates a new array with this type as the component type and the specified length. This * method is similar to {@link Array#newInstance(Class, int)}. */ diff -r c0c616fe3588 -r c0807f5fdca5 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java Thu Oct 10 03:23:40 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java Thu Oct 10 11:55:46 2013 +0200 @@ -561,13 +561,14 @@ return result; } - /** - * Gets all methods and constructors declared by this class, including the {@code } - * method if there is one. The latter is not made accessible via standard Java reflection. - */ - public ResolvedJavaMethod[] getMethods() { - HotSpotResolvedJavaMethod[] methods = graalRuntime().getCompilerToVM().getMethods(this); - return methods; + public ResolvedJavaMethod getClassInitializer() { + ResolvedJavaMethod[] methods = graalRuntime().getCompilerToVM().getMethods(this); + for (ResolvedJavaMethod m : methods) { + if (m.isClassInitializer()) { + return m; + } + } + return null; } @Override diff -r c0c616fe3588 -r c0807f5fdca5 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java Thu Oct 10 03:23:40 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java Thu Oct 10 11:55:46 2013 +0200 @@ -227,6 +227,11 @@ } @Override + public ResolvedJavaMethod getClassInitializer() { + return null; + } + + @Override public Constant newArray(int length) { return Constant.forObject(Array.newInstance(javaMirror, length)); }