/** * Returns the number of dimensions of this array. If the type is not an * array zero is returned. * * @return zero if not an array, otherwise the number of array dimensions. */ public int getDimensions() { if (!isArray()) return 0; String name = clazz.getName(); int pos = name.length() - 1; int count = 0; while (name.charAt(pos) == ']' ) { pos -= 2; count++; } return count; }
Type getRootComponent(Type type) { while (type.isArray()) type = type.getComponent(); return type; }
/** * Returns the number of dimensions of this array. If the type is not an * array zero is returned. * * @return zero if not an array, otherwise the number of array dimensions. */ public int getDimensions() { if (!isArray()) return 0; String name = clazz.getName(); int pos = name.length() - 1; int count = 0; while (name.charAt(pos) == ']' ) { pos -= 2; count++; } return count; }
Type getRootComponent(Type type) { while (type.isArray()) type = type.getComponent(); return type; }
public boolean isAssignableTo(Type type) { if (eq(type.getCtClass(), Type.OBJECT.getCtClass())) return true; if (eq(type.getCtClass(), Type.CLONEABLE.getCtClass())) return true; if (eq(type.getCtClass(), Type.SERIALIZABLE.getCtClass())) return true; if (! type.isArray()) return false; Type typeRoot = getRootComponent(type); int typeDims = type.getDimensions(); if (typeDims > dims) return false; if (typeDims < dims) { if (eq(typeRoot.getCtClass(), Type.OBJECT.getCtClass())) return true; if (eq(typeRoot.getCtClass(), Type.CLONEABLE.getCtClass())) return true; if (eq(typeRoot.getCtClass(), Type.SERIALIZABLE.getCtClass())) return true; return false; } return component.isAssignableTo(typeRoot); }
public boolean isAssignableTo(Type type) { if (eq(type.getCtClass(), Type.OBJECT.getCtClass())) return true; if (eq(type.getCtClass(), Type.CLONEABLE.getCtClass())) return true; if (eq(type.getCtClass(), Type.SERIALIZABLE.getCtClass())) return true; if (! type.isArray()) return false; Type typeRoot = getRootComponent(type); int typeDims = type.getDimensions(); if (typeDims > dims) return false; if (typeDims < dims) { if (eq(typeRoot.getCtClass(), Type.OBJECT.getCtClass())) return true; if (eq(typeRoot.getCtClass(), Type.CLONEABLE.getCtClass())) return true; if (eq(typeRoot.getCtClass(), Type.SERIALIZABLE.getCtClass())) return true; return false; } return component.isAssignableTo(typeRoot); }
/** * Returns the number of dimensions of this array. If the type is not an * array zero is returned. * * @return zero if not an array, otherwise the number of array dimensions. */ public int getDimensions() { if (!isArray()) return 0; String name = clazz.getName(); int pos = name.length() - 1; int count = 0; while (name.charAt(pos) == ']' ) { pos -= 2; count++; } return count; }
/** * Returns the number of dimensions of this array. If the type is not an * array zero is returned. * * @return zero if not an array, otherwise the number of array dimensions. */ public int getDimensions() { if (!isArray()) return 0; String name = clazz.getName(); int pos = name.length() - 1; int count = 0; while (name.charAt(pos) == ']' ) { pos -= 2; count++; } return count; }
/** * Returns the number of dimensions of this array. If the type is not an * array zero is returned. * * @return zero if not an array, otherwise the number of array dimensions. */ public int getDimensions() { if (!isArray()) return 0; String name = clazz.getName(); int pos = name.length() - 1; int count = 0; while (name.charAt(pos) == ']' ) { pos -= 2; count++; } return count; }
/** * Returns the number of dimensions of this array. If the type is not an * array zero is returned. * * @return zero if not an array, otherwise the number of array dimensions. */ public int getDimensions() { if (!isArray()) return 0; String name = clazz.getName(); int pos = name.length() - 1; int count = 0; while (name.charAt(pos) == ']' ) { pos -= 2; count++; } return count; }
Type getRootComponent(Type type) { while (type.isArray()) type = type.getComponent(); return type; }
Type getRootComponent(Type type) { while (type.isArray()) type = type.getComponent(); return type; }
Type getRootComponent(Type type) { while (type.isArray()) type = type.getComponent(); return type; }
Type getRootComponent(Type type) { while (type.isArray()) type = type.getComponent(); return type; }
case ARRAYLENGTH: { Type array = simplePop(frame); if (! array.isArray() && array != Type.UNINIT) throw new BadBytecode("Array length passed a non-array [pos = " + pos + "]: " + array); frame.push(Type.INTEGER);
case ARRAYLENGTH: { Type array = simplePop(frame); if (! array.isArray() && array != Type.UNINIT) throw new BadBytecode("Array length passed a non-array [pos = " + pos + "]: " + array); frame.push(Type.INTEGER);
public boolean isAssignableTo(Type type) { if (eq(type.getCtClass(), Type.OBJECT.getCtClass())) return true; if (eq(type.getCtClass(), Type.CLONEABLE.getCtClass())) return true; if (eq(type.getCtClass(), Type.SERIALIZABLE.getCtClass())) return true; if (! type.isArray()) return false; Type typeRoot = getRootComponent(type); int typeDims = type.getDimensions(); if (typeDims > dims) return false; if (typeDims < dims) { if (eq(typeRoot.getCtClass(), Type.OBJECT.getCtClass())) return true; if (eq(typeRoot.getCtClass(), Type.CLONEABLE.getCtClass())) return true; if (eq(typeRoot.getCtClass(), Type.SERIALIZABLE.getCtClass())) return true; return false; } return component.isAssignableTo(typeRoot); }
public boolean isAssignableTo(Type type) { if (eq(type.getCtClass(), Type.OBJECT.getCtClass())) return true; if (eq(type.getCtClass(), Type.CLONEABLE.getCtClass())) return true; if (eq(type.getCtClass(), Type.SERIALIZABLE.getCtClass())) return true; if (! type.isArray()) return false; Type typeRoot = getRootComponent(type); int typeDims = type.getDimensions(); if (typeDims > dims) return false; if (typeDims < dims) { if (eq(typeRoot.getCtClass(), Type.OBJECT.getCtClass())) return true; if (eq(typeRoot.getCtClass(), Type.CLONEABLE.getCtClass())) return true; if (eq(typeRoot.getCtClass(), Type.SERIALIZABLE.getCtClass())) return true; return false; } return component.isAssignableTo(typeRoot); }