public static String canonicalizeString(String s) { return DescriptorFactory.canonicalizeString(s); }
/** * Create a GenericObjectType that represents a Wildcard with extensions * * @param variable * the type variable e.g. <code>T</code> */ GenericObjectType(@Nonnull String wildcard, @CheckForNull ReferenceType extension) { super(DescriptorFactory.canonicalizeString(Type.OBJECT.getClassName())); this.variable = DescriptorFactory.canonicalizeString(wildcard); this.extension = extension; parameters = null; }
public FieldOrMethodDescriptor(@SlashedClassName String slashedClassName, String name, String signature, boolean isStatic) { assert slashedClassName.indexOf('.') == -1 : "class name not in VM format: " + slashedClassName; this.slashedClassName = DescriptorFactory.canonicalizeString(slashedClassName); this.name = DescriptorFactory.canonicalizeString(name); this.signature = DescriptorFactory.canonicalizeString(signature); this.isStatic = isStatic; this.nameSigHashCode = getNameSigHashCode(this.name, this.signature); }
public Item(String signature, FieldAnnotation f, int fieldLoadedFromRegister) { this.signature = DescriptorFactory.canonicalizeString(signature); if (f != null) { source = XFactory.createXField(f); } this.fieldLoadedFromRegister = fieldLoadedFromRegister; }
protected AbstractClassMember(@DottedClassName String className, String name, String signature, int accessFlags) { if (className.indexOf('.') >= 0) { // className = className.replace('.','/'); // dottedCountClass++; } else if (className.indexOf('/') >= 0) { assert false; // slashCountClass++; className = className.replace('/', '.'); } if (signature.indexOf('.') >= 0) { assert false; signature = signature.replace('.', '/'); // dottedCountSignature++; } // else if (signature.indexOf('/') >= 0) { // slashCountSignature++; // } this.className = DescriptorFactory.canonicalizeString(className); this.name = DescriptorFactory.canonicalizeString(name); this.signature = DescriptorFactory.canonicalizeString(signature); this.accessFlags = accessFlags; }
/** * Create a GenericObjectType that represents a parameterized class * * @param class_name * the class that is parameterized. e.g. * <code>java.util.List</code> * @param parameters * the parameters of this class, must be at least 1 parameter */ GenericObjectType(@DottedClassName String class_name, List<? extends ReferenceType> parameters) { super(DescriptorFactory.canonicalizeString(class_name)); variable = null; extension = null; if (parameters == null || parameters.size() == 0) { throw new IllegalStateException("argument 'parameters' must contain at least 1 parameter"); } this.parameters = parameters; }
/** * Convert class name to slashed format. If the class name is already in * slashed format, it is returned unmodified. * * @param className * a class name * @return the same class name in slashed format */ @SlashedClassName @SuppressFBWarnings("TQ_EXPLICIT_UNKNOWN_SOURCE_VALUE_REACHES_ALWAYS_SINK") public static String toSlashedClassName(@SlashedClassName(when = When.UNKNOWN) String className) { if (className.indexOf('.') >= 0) { return DescriptorFactory.canonicalizeString(className.replace('.', '/')); } return className; }
/** * Convert class name to dotted format. If the class name is already in * dotted format, it is returned unmodified. * * @param className * a class name * @return the same class name in dotted format */ @DottedClassName @SuppressFBWarnings("TQ_EXPLICIT_UNKNOWN_SOURCE_VALUE_REACHES_NEVER_SINK") public static String toDottedClassName(@SlashedClassName(when = When.UNKNOWN) String className) { if (className.indexOf('/') >= 0) { return DescriptorFactory.canonicalizeString(className.replace('/', '.')); } return className; }
/** * Constructor. * * @param className * name of the class */ protected PackageMemberAnnotation(@DottedClassName String className, String description, String sourceFileName) { if (className.length() == 0) { throw new IllegalArgumentException("Empty classname not allowed"); } if (className.indexOf('/') >= 0) { assert false : "classname " + className + " should be dotted"; className = className.replace('/', '.'); } this.className = DescriptorFactory.canonicalizeString(className); this.sourceFileName = sourceFileName; if (description != null) { description = description.intern(); } this.description = description; }
public Item(Item it, String signature) { this(it); this.signature = DescriptorFactory.canonicalizeString(signature); if (constValue instanceof Number) { Number constantNumericValue = (Number) constValue; if ("B".equals(signature)) { this.constValue = constantNumericValue.byteValue(); } else if ("S".equals(signature)) { this.constValue = constantNumericValue.shortValue(); } else if ("C".equals(signature)) { this.constValue = (char) constantNumericValue.intValue(); } else if ("I".equals(signature)) { this.constValue = constantNumericValue.intValue(); } else if ("D".equals(signature)) { this.constValue = constantNumericValue.doubleValue(); } else if ("F".equals(signature)) { this.constValue = constantNumericValue.floatValue(); } } char s = signature.charAt(0); if (s != 'L' && s != '[') { this.source = null; } setSpecialKindFromSignature(); }
/** * Get a ClassDescriptor for a class name in VM (slashed) format. * * @param className * a class name in VM (slashed) format * @return ClassDescriptor for that class */ public @Nonnull ClassDescriptor getClassDescriptor(@SlashedClassName String className) { assert className.indexOf('.') == -1; className = canonicalizeString(className); ClassDescriptor classDescriptor = classDescriptorMap.get(className); if (classDescriptor == null) { classDescriptor = new ClassDescriptor(className); classDescriptorMap.put(className, classDescriptor); } return classDescriptor; }
public Item(String signature, FieldAnnotation f) { this.signature = DescriptorFactory.canonicalizeString(signature); setSpecialKindFromSignature(); if (f != null) { source = XFactory.createXField(f); } fieldLoadedFromRegister = -1; }
public Item(String signature, Object constantValue) { this.signature = DescriptorFactory.canonicalizeString(signature); setSpecialKindFromSignature(); constValue = constantValue; if (constantValue instanceof Integer) { int value = ((Integer) constantValue).intValue(); if (value != 0 && (value & 0xff) == 0) { specialKind = LOW_8_BITS_CLEAR; } if (value == 0) { setCouldBeZero(true); } } else if (constantValue instanceof Long) { long value = ((Long) constantValue).longValue(); if (value != 0 && (value & 0xff) == 0) { specialKind = LOW_8_BITS_CLEAR; } if (value == 0) { setCouldBeZero(true); } } }
if (exceptions != null) { for (int i = 0; i < exceptions.length; i++) { exceptions[i] = DescriptorFactory.canonicalizeString(exceptions[i]); this.methodSourceSignature = DescriptorFactory.canonicalizeString(methodSourceSignature); this.methodAnnotations = Util.immutableMap(methodAnnotations); this.methodParameterAnnotations = Util.immutableMap(methodParameterAnnotations);