Java Code Examples for org.apache.bcel.classfile.ConstantNameAndType#getName()
The following examples show how to use
org.apache.bcel.classfile.ConstantNameAndType#getName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InnerClassAccessMap.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
/** * Called to indicate that a field load or store was encountered. * * @param cpIndex * the constant pool index of the fieldref * @param isStatic * true if it is a static field access * @param isLoad * true if the access is a load */ private void setField(int cpIndex, boolean isStatic, boolean isLoad) { // We only allow one field access for an accessor method. accessCount++; if (accessCount != 1) { access = null; return; } ConstantPool cp = javaClass.getConstantPool(); ConstantFieldref fieldref = (ConstantFieldref) cp.getConstant(cpIndex); ConstantClass cls = (ConstantClass) cp.getConstant(fieldref.getClassIndex()); String className = cls.getBytes(cp).replace('/', '.'); ConstantNameAndType nameAndType = (ConstantNameAndType) cp.getConstant(fieldref.getNameAndTypeIndex()); String fieldName = nameAndType.getName(cp); String fieldSig = nameAndType.getSignature(cp); XField xfield = Hierarchy.findXField(className, fieldName, fieldSig, isStatic); if (xfield != null && xfield.isStatic() == isStatic && isValidAccessMethod(methodSig, xfield, isLoad)) { access = new InnerClassAccess(methodName, methodSig, xfield, isLoad); } }
Example 2
Source File: ClassDumper.java From cloud-opensource-java with Apache License 2.0 | 5 votes |
private static MethodSymbol makeSymbol( ConstantCP constantMethodref, ConstantPool constantPool) { String className = constantMethodref.getClass(constantPool); ConstantNameAndType constantNameAndType = constantNameAndType(constantMethodref, constantPool); String methodName = constantNameAndType.getName(constantPool); String descriptor = constantNameAndType.getSignature(constantPool); // constantMethodref is either ConstantMethodref or ConstantInterfaceMethodref boolean isInterfaceMethod = constantMethodref instanceof ConstantInterfaceMethodref; return new MethodSymbol(className, methodName, descriptor, isInterfaceMethod); }
Example 3
Source File: ClassDumper.java From cloud-opensource-java with Apache License 2.0 | 5 votes |
private static FieldSymbol makeSymbol( ConstantFieldref constantFieldref, ConstantPool constantPool) { // Either a class type or an interface type String className = constantFieldref.getClass(constantPool); ConstantNameAndType constantNameAndType = constantNameAndType(constantFieldref, constantPool); String fieldName = constantNameAndType.getName(constantPool); String descriptor = constantNameAndType.getSignature(constantPool); return new FieldSymbol(className, fieldName, descriptor); }
Example 4
Source File: CloneIdiom.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void visit(ConstantNameAndType obj) { String methodName = obj.getName(getConstantPool()); String methodSig = obj.getSignature(getConstantPool()); if (!"clone".equals(methodName)) { return; } if (!methodSig.startsWith("()")) { return; } referencesCloneMethod = true; }