本文整理汇总了Java中edu.umd.cs.findbugs.internalAnnotations.SlashedClassName类的典型用法代码示例。如果您正苦于以下问题:Java SlashedClassName类的具体用法?Java SlashedClassName怎么用?Java SlashedClassName使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SlashedClassName类属于edu.umd.cs.findbugs.internalAnnotations包,在下文中一共展示了SlashedClassName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import edu.umd.cs.findbugs.internalAnnotations.SlashedClassName; //导入依赖的package包/类
@Override
public void visit(ConstantPool pool) {
for (Constant constant : pool.getConstantPool()) {
if (constant instanceof ConstantClass) {
ConstantClass cc = (ConstantClass) constant;
@SlashedClassName String className = cc.getBytes(pool);
if (className.equals("java/util/Calendar") || className.equals("java/text/DateFormat")) {
sawDateClass = true;
break;
}
try {
ClassDescriptor cDesc = DescriptorFactory.createClassDescriptor(className);
if (subtypes2.isSubtype(cDesc, calendarType) || subtypes2.isSubtype(cDesc, dateFormatType)) {
sawDateClass = true;
break;
}
} catch (ClassNotFoundException e) {
reporter.reportMissingClass(e);
}
}
}
}
示例2: extractReferencedClassesFromSignature
import edu.umd.cs.findbugs.internalAnnotations.SlashedClassName; //导入依赖的package包/类
/**
* @param referencedClassSet
* @param signature
*/
public static void extractReferencedClassesFromSignature(Set<ClassDescriptor> referencedClassSet, String signature) {
while (signature.length() > 0) {
int start = signature.indexOf('L');
if (start < 0) {
break;
}
int end = signature.indexOf(';', start);
if (end < 0) {
break;
}
@SlashedClassName
String className = signature.substring(start + 1, end);
if (ClassName.isValidClassName(className)) {
referencedClassSet.add(DescriptorFactory.instance().getClassDescriptor(className));
}
signature = signature.substring(end + 1);
}
}
示例3: getClassName
import edu.umd.cs.findbugs.internalAnnotations.SlashedClassName; //导入依赖的package包/类
/**
* Get a class name from a CONSTANT_Class. Note that this may be an array
* (e.g., "[Ljava/lang/String;").
*
* @param index
* index of the constant
* @return the class name
* @throws InvalidClassFileFormatException
*/
private @SlashedClassName
String getClassName(int index) throws InvalidClassFileFormatException {
if (index == 0) {
return null;
}
checkConstantPoolIndex(index);
Constant constant = constantPool[index];
checkConstantTag(constant, IClassConstants.CONSTANT_Class);
int refIndex = ((Integer) constant.data[0]).intValue();
String stringValue = getUtf8String(refIndex);
return stringValue;
}
示例4: getClassName
import edu.umd.cs.findbugs.internalAnnotations.SlashedClassName; //导入依赖的package包/类
/**
* Get a class name from a CONSTANT_Class. Note that this may be an array
* (e.g., "[Ljava/lang/String;").
*
* @param index
* index of the constant
* @return the class name
* @throws InvalidClassFileFormatException
*/
private @SlashedClassName
String getClassName(int index) throws InvalidClassFileFormatException {
if (index == 0) {
return null;
}
checkConstantPoolIndex(index);
Constant constant = constantPool[index];
checkConstantTag(constant, IClassConstants.CONSTANT_Class);
int refIndex = ((Integer) constant.data[0]).intValue();
String stringValue = getUtf8String(refIndex);
return stringValue;
}
示例5: getClassConstantOperand
import edu.umd.cs.findbugs.internalAnnotations.SlashedClassName; //导入依赖的package包/类
/**
* If the current opcode has a class constant operand, get the classname,
* slash-formatted.
*/
public @SlashedClassName
String getClassConstantOperand() {
if (classConstantOperand == NOT_AVAILABLE)
throw new IllegalStateException("getClassConstantOperand called but value not available");
return classConstantOperand;
}
示例6: getClassDescriptor
import edu.umd.cs.findbugs.internalAnnotations.SlashedClassName; //导入依赖的package包/类
/**
* 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;
}
示例7: ClassDescriptor
import edu.umd.cs.findbugs.internalAnnotations.SlashedClassName; //导入依赖的package包/类
/**
* Constructor.
*
* @param className
* class name in VM format, e.g. "java/lang/String"
*/
protected ClassDescriptor(@SlashedClassName String className) {
if (className.indexOf('.') >= 0) {
throw new IllegalArgumentException("Class name " + className + " not in VM format");
}
if (!ClassName.isValidClassName(className)) {
throw new IllegalArgumentException("Invalid class name " + className);
}
this.className = className;
}
示例8: FieldOrMethodDescriptor
import edu.umd.cs.findbugs.internalAnnotations.SlashedClassName; //导入依赖的package包/类
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);
}
示例9: MethodInfo
import edu.umd.cs.findbugs.internalAnnotations.SlashedClassName; //导入依赖的package包/类
MethodInfo(@SlashedClassName String className, String methodName, String methodSignature, String methodSourceSignature,
int accessFlags, boolean isUnconditionalThrower, boolean isUnsupported, boolean usesConcurrency,
boolean hasBackBranch, boolean isStub, boolean isIdentity,
int methodCallCount, @CheckForNull String[] exceptions, @CheckForNull MethodDescriptor accessMethodForMethod,
@CheckForNull FieldDescriptor accessMethodForField,
Map<ClassDescriptor, AnnotationValue> methodAnnotations,
Map<Integer, Map<ClassDescriptor, AnnotationValue>> methodParameterAnnotations, long variableIsSynthetic) {
super(className, methodName, methodSignature, (accessFlags & Constants.ACC_STATIC) != 0);
this.accessFlags = accessFlags;
this.exceptions = exceptions;
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);
if (isUnconditionalThrower)
unconditionalThrowers.put(this, null);
if (isUnsupported)
unsupportedMethods.put(this, null);
if (accessMethodForMethod != null)
MethodInfo.accessMethodForMethod.put(this, accessMethodForMethod);
if (accessMethodForField!= null)
MethodInfo.accessMethodForField.put(this, accessMethodForField);
if (isIdentity) {
MethodInfo.identifyMethods.put(this, null);
}
this.usesConcurrency = usesConcurrency;
this.hasBackBranch = hasBackBranch;
this.isStub = isStub;
this.methodCallCount = methodCallCount;
this.variableIsSynthetic = variableIsSynthetic;
}
示例10: FieldInfo
import edu.umd.cs.findbugs.internalAnnotations.SlashedClassName; //导入依赖的package包/类
/**
* @param className
* @param fieldName
* @param fieldSignature
* @param isStatic
* @param accessFlags
* @param fieldAnnotations
* @param isResolved
*/
private FieldInfo(@SlashedClassName String className, String fieldName, String fieldSignature,
@CheckForNull String fieldSourceSignature, int accessFlags, Map<ClassDescriptor, AnnotationValue> fieldAnnotations,
boolean isResolved) {
super(className, fieldName, fieldSignature, (accessFlags & Constants.ACC_STATIC) != 0);
this.accessFlags = accessFlags | (fieldName.startsWith("this$") ? Constants.ACC_FINAL : 0);
this.fieldSourceSignature = fieldSourceSignature;
this.fieldAnnotations = Util.immutableMap(fieldAnnotations);
this.isResolved = isResolved;
}
示例11: createXMethodUsingSlashedClassName
import edu.umd.cs.findbugs.internalAnnotations.SlashedClassName; //导入依赖的package包/类
/**
* @param className
* @param methodName
* @param methodSig
* @param isStatic
* @return the created XMethod
*/
public static XMethod createXMethodUsingSlashedClassName(@SlashedClassName String className, String methodName,
String methodSig, boolean isStatic) {
assertSlashedClassName(className);
MethodDescriptor desc = DescriptorFactory.instance().getMethodDescriptor(className, methodName, methodSig, isStatic);
return createXMethod(desc);
}
示例12: toSignature
import edu.umd.cs.findbugs.internalAnnotations.SlashedClassName; //导入依赖的package包/类
public static String toSignature(@SlashedClassName String className) {
if (className.length() == 0)
throw new IllegalArgumentException("classname can't be empty");
if (className.charAt(0) == '[' || className.endsWith(";"))
return className;
return "L" + className + ";";
}
示例13: fromFieldSignature
import edu.umd.cs.findbugs.internalAnnotations.SlashedClassName; //导入依赖的package包/类
/**
* Converts from signature to slashed class name
* (e.g., from Ljava/lang/String; to java/lang/String).
* Returns null if it is the signature for an array or
* primitive type.
*/
public static @javax.annotation.CheckForNull
@SlashedClassName
String fromFieldSignature(String signature) {
if (signature.charAt(0) != 'L') {
return null;
}
return signature.substring(1, signature.length() - 1);
}
示例14: extractClassName
import edu.umd.cs.findbugs.internalAnnotations.SlashedClassName; //导入依赖的package包/类
/**
* Extract a slashed classname from a JVM classname or signature.
*
* @param originalName
* JVM classname or signature
* @return a slashed classname
*/
public static @SlashedClassName
String extractClassName(String originalName) {
String name = originalName;
if (name.charAt(0) != '[' && name.charAt(name.length() - 1) != ';')
return name;
while (name.charAt(0) == '[')
name = name.substring(1);
if (name.charAt(0) == 'L' && name.charAt(name.length() - 1) == ';')
name = name.substring(1, name.length() - 1);
if (name.charAt(0) == '[')
throw new IllegalArgumentException("Bad class name: " + originalName);
return name;
}
示例15: sawOpcode
import edu.umd.cs.findbugs.internalAnnotations.SlashedClassName; //导入依赖的package包/类
@Override
public void sawOpcode(int seen) {
// only acts on constructor invoke
if (seen != INVOKESPECIAL) {
return;
}
if (!"<init>".equals(getNameConstantOperand())) {
return;
}
@SlashedClassName String cls = getClassConstantOperand();
XMethod shouldCall = getShouldCall();
if (shouldCall == null)
return;
int prio;
String type;
if (cls.equals("java/lang/Float") || cls.equals("java/lang/Double")) {
prio = LOW_PRIORITY;
type = "DM_FP_NUMBER_CTOR";
} else {
prio = NORMAL_PRIORITY;
Object constantValue = stack.getStackItem(0).getConstant();
if (constantValue instanceof Number) {
long value = ((Number) constantValue).longValue();
if (value < -128 || value > 127)
prio = LOW_PRIORITY;
}
type = "DM_NUMBER_CTOR";
}
BugInstance bug = new BugInstance(this, type, prio).addClass(this).addMethod(this).addCalledMethod(this)
.addMethod(shouldCall).describe("SHOULD_CALL");
bugAccumulator.accumulateBug(bug, this);
}