public static JavaKind selectComponentKind(BasicArrayCopyNode arraycopy, boolean exact) { ResolvedJavaType srcType = StampTool.typeOrNull(arraycopy.getSource().stamp()); ResolvedJavaType destType = StampTool.typeOrNull(arraycopy.getDestination().stamp()); if (srcType == null || !srcType.isArray() || destType == null || !destType.isArray()) { if (!exact) { JavaKind component = getComponentKind(srcType); if (component != null) { return component; } return getComponentKind(destType); } return null; } if (exact) { if (!destType.getComponentType().isAssignableFrom(srcType.getComponentType())) { return null; } if (!arraycopy.isExact()) { return null; } } return srcType.getComponentType().getJavaKind(); }
private static JavaKind getComponentKind(ResolvedJavaType type) { if (type != null && type.isArray()) { return type.getComponentType().getJavaKind(); } return null; }