public static boolean isArrayDescriptor(ImmutableByteArray b) { if (b == null) { throw new IllegalArgumentException("b is null"); } if (b.length() == 0) { return false; } return b.get(0) == '['; }
public static boolean isArrayDescriptor(ImmutableByteArray b) { if (b == null) { throw new IllegalArgumentException("b is null"); } if (b.length() == 0) { return false; } return b.get(0) == '['; }
public static TypeName findOrCreate(ImmutableByteArray name) throws IllegalArgumentException { if (name == null) { throw new IllegalArgumentException("name is null"); } return findOrCreate(name, 0, name.length()); }
/** * Given that name[start:start+length] is a Type name in JVM format, parse it for the package * * @return an ImmutableByteArray that represents the package, or null if it's the unnamed package * @throws IllegalArgumentException if name is null */ public static ImmutableByteArray parseForPackage(ImmutableByteArray name) { if (name == null) { throw new IllegalArgumentException("name is null"); } return parseForPackage(name, 0, name.length()); }
/** * Given that name[start:start+length] is a Type name in JVM format, strip the package and return the "package-free" class name * * @return an ImmutableByteArray that represents the package, or null if it's the unnamed package * @throws IllegalArgumentException if name is null */ public static ImmutableByteArray parseForClass(ImmutableByteArray name) throws IllegalArgumentException { if (name == null) { throw new IllegalArgumentException("name is null"); } return parseForClass(name, 0, name.length()); }
public static TypeName findOrCreate(ImmutableByteArray name) throws IllegalArgumentException { if (name == null) { throw new IllegalArgumentException("name is null"); } return findOrCreate(name, 0, name.length()); }
public static ImmutableByteArray concat(byte b, ImmutableByteArray b1) { if (b1 == null) { throw new IllegalArgumentException("b1 is null"); } byte[] arr = new byte[b1.length() + 1]; arr[0] = b; System.arraycopy(b1.b, 0, arr, 1, b1.b.length); return new ImmutableByteArray(arr); }
/** * Given that name[start:start+length] is a Type name in JVM format, parse it for the package * * @return an ImmutableByteArray that represents the package, or null if it's the unnamed package * @throws IllegalArgumentException if name is null */ public static ImmutableByteArray parseForPackage(ImmutableByteArray name) { if (name == null) { throw new IllegalArgumentException("name is null"); } return parseForPackage(name, 0, name.length()); }
/** * Given that name[start:start+length] is a Type name in JVM format, strip the package and return the "package-free" class name * * @return an ImmutableByteArray that represents the package, or null if it's the unnamed package * @throws IllegalArgumentException if name is null */ public static ImmutableByteArray parseForClass(ImmutableByteArray name) throws IllegalArgumentException { if (name == null) { throw new IllegalArgumentException("name is null"); } return parseForClass(name, 0, name.length()); }
public static ImmutableByteArray concat(byte b, ImmutableByteArray b1) { if (b1 == null) { throw new IllegalArgumentException("b1 is null"); } byte[] arr = new byte[b1.length() + 1]; arr[0] = b; System.arraycopy(b1.b, 0, arr, 1, b1.b.length); return new ImmutableByteArray(arr); }
static TypeName getTypeName(String fieldType) { ImmutableByteArray fieldTypeArray = ImmutableByteArray.make(fieldType); TypeName T = null; if (fieldTypeArray.get(fieldTypeArray.length() - 1) == ';') { T = TypeName.findOrCreate(fieldTypeArray, 0, fieldTypeArray.length() - 1); } else { T = TypeName.findOrCreate(fieldTypeArray); } return T; }
static TypeName getTypeName(String fieldType) { ImmutableByteArray fieldTypeArray = ImmutableByteArray.make(fieldType); TypeName T = null; if (fieldTypeArray.get(fieldTypeArray.length() - 1) == ';') { T = TypeName.findOrCreate(fieldTypeArray, 0, fieldTypeArray.length() - 1); } else { T = TypeName.findOrCreate(fieldTypeArray); } return T; }
/** * Parse an array descriptor to obtain number of dimensions in corresponding array type. b: descriptor - something like * "[Ljava/lang/String;" or "[[I" * * @return dimensionality - something like "Ljava/lang/String;" or "I" * @throws IllegalArgumentException if a is null */ public static ImmutableByteArray parseForInnermostArrayElementDescriptor(Atom a) { if (a == null) { throw new IllegalArgumentException("a is null"); } ImmutableByteArray b = new ImmutableByteArray(a.getValArray()); return parseForInnermostArrayElementDescriptor(b, 0, b.length()); }
/** * Parse an array descriptor to obtain number of dimensions in corresponding array type. b: descriptor - something like * "[Ljava/lang/String;" or "[[I" * * @return dimensionality - something like "Ljava/lang/String;" or "I" * @throws IllegalArgumentException if a is null */ public static ImmutableByteArray parseForInnermostArrayElementDescriptor(Atom a) { if (a == null) { throw new IllegalArgumentException("a is null"); } ImmutableByteArray b = new ImmutableByteArray(a.getValArray()); return parseForInnermostArrayElementDescriptor(b, 0, b.length()); }
/** * @param type a type as a String returned by Shrike */ public static TypeReference makeTypeReference(ClassLoaderReference loader, String type) throws IllegalArgumentException { if (type == null) { throw new IllegalArgumentException("null type"); } TypeReference p = primitiveMap.get(type); if (p != null) { return p; } ImmutableByteArray b = ImmutableByteArray.make(type); TypeName T = null; /*if (b.get(0) != '[') { T = TypeName.findOrCreate(b, 0, b.length() - 1); } else {*/ if (b.get(b.length() - 1) == ';') { T = TypeName.findOrCreate(b, 0, b.length() - 1); } else { T = TypeName.findOrCreate(b); } //} return TypeReference.findOrCreate(loader, T); } }
/** * @param type a type as a String returned by Shrike */ public static TypeReference makeTypeReference(ClassLoaderReference loader, String type) throws IllegalArgumentException { if (type == null) { throw new IllegalArgumentException("null type"); } TypeReference p = primitiveMap.get(type); if (p != null) { return p; } ImmutableByteArray b = ImmutableByteArray.make(type); TypeName T = null; /*if (b.get(0) != '[') { T = TypeName.findOrCreate(b, 0, b.length() - 1); } else {*/ if (b.get(b.length() - 1) == ';') { T = TypeName.findOrCreate(b, 0, b.length() - 1); } else { T = TypeName.findOrCreate(b); } //} return TypeReference.findOrCreate(loader, T); } }
protected void addFieldToList(List<FieldImpl> L, Atom name, ImmutableByteArray fieldType, int accessFlags, Collection<Annotation> annotations, Collection<TypeAnnotation> typeAnnotations, TypeSignature sig) { TypeName T = null; if (fieldType.get(fieldType.length() - 1) == ';') { T = TypeName.findOrCreate(fieldType, 0, fieldType.length() - 1); } else { T = TypeName.findOrCreate(fieldType); } TypeReference type = TypeReference.findOrCreate(getClassLoader().getReference(), T); FieldReference fr = FieldReference.findOrCreate(getReference(), name, type); FieldImpl f = new FieldImpl(this, fr, accessFlags, annotations, typeAnnotations, sig); L.add(f); }
protected void addFieldToList(List<FieldImpl> L, Atom name, ImmutableByteArray fieldType, int accessFlags, Collection<Annotation> annotations, Collection<TypeAnnotation> typeAnnotations, TypeSignature sig) { TypeName T = null; if (fieldType.get(fieldType.length() - 1) == ';') { T = TypeName.findOrCreate(fieldType, 0, fieldType.length() - 1); } else { T = TypeName.findOrCreate(fieldType); } TypeReference type = TypeReference.findOrCreate(getClassLoader().getReference(), T); FieldReference fr = FieldReference.findOrCreate(getReference(), name, type); FieldImpl f = new FieldImpl(this, fr, accessFlags, annotations, typeAnnotations, sig); L.add(f); }
throw new IllegalArgumentException("name is null"); if (name.length() == 0) { throw new IllegalArgumentException("invalid class name: zero length");
throw new IllegalArgumentException("name is null"); if (name.length() == 0) { throw new IllegalArgumentException("invalid class name: zero length");