changeset 6717:5bbe9618118e

clarified the specification of ResolvedJavaType.getModifiers() to indicate the similarity to Class.getModifiers() and fixed the current usages and the HotSpot implementation to accommodate the spec change
author Doug Simon <doug.simon@oracle.com>
date Tue, 13 Nov 2012 21:21:02 +0100
parents 536dbb4dd212
children 67f9855dec62 b03db3c97f74 8c5333c80cfd
files graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java
diffstat 3 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java	Tue Nov 13 14:48:42 2012 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java	Tue Nov 13 21:21:02 2012 +0100
@@ -104,7 +104,16 @@
         }
     }
 
+    /**
+     * Determines if a given type can have subtypes. This analysis is purely static; no
+     * assumptions are made.
+     *
+     * @return true if {@code type} has no subtype(s)
+     */
     public static boolean isFinalClass(ResolvedJavaType type) {
-        return Modifier.isFinal(type.getModifiers()) || (type.isArrayClass() && Modifier.isFinal(type.getComponentType().getModifiers()));
+        if (type.isArrayClass()) {
+            return isFinalClass(type.getComponentType());
+        }
+        return Modifier.isFinal(type.getModifiers());
     }
 }
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java	Tue Nov 13 14:48:42 2012 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java	Tue Nov 13 21:21:02 2012 +0100
@@ -106,6 +106,7 @@
     /**
      * Returns the Java language modifiers for this type, as an integer. The {@link Modifier} class should be used to
      * decode the modifiers. Only the flags specified in the JVM specification will be included in the returned mask.
+     * This method is identical to {@link Class#getModifiers()} in terms of the value return for this type.
      */
     int getModifiers();
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java	Tue Nov 13 14:48:42 2012 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java	Tue Nov 13 21:21:02 2012 +0100
@@ -62,7 +62,7 @@
 
     @Override
     public int getModifiers() {
-        return accessFlags;
+        return javaMirror.getModifiers();
     }
 
     @Override
@@ -84,7 +84,7 @@
     @Override
     public ResolvedJavaType findUniqueConcreteSubtype() {
         if (isArrayClass()) {
-            return Modifier.isFinal(getComponentType().getModifiers()) ? this : null;
+            return getComponentType().findUniqueConcreteSubtype() != null ? this : null;
         } else {
             ResolvedJavaType subtype = (ResolvedJavaType) HotSpotGraalRuntime.getInstance().getCompilerToVM().getUniqueConcreteSubtype(this);
             assert subtype == null || !subtype.isInterface();