# HG changeset patch # User Doug Simon # Date 1352838062 -3600 # Node ID 5bbe9618118e78d23dadd19d91a36514fe361ba3 # Parent 536dbb4dd21213fe09e16ccc0e7c534ac7398d0e 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 diff -r 536dbb4dd212 -r 5bbe9618118e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java --- 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()); } } diff -r 536dbb4dd212 -r 5bbe9618118e 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 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(); diff -r 536dbb4dd212 -r 5bbe9618118e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java --- 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();