/** * Get a string from the constant pool, and interpret it as a class name by replacing '/' with '.'. */ private String getConstantPoolClassName(final int CpIdx) { return getConstantPoolString(CpIdx, /* replaceSlashWithDot = */ true, /* stripLSemicolon = */ false); }
final String classNamePath = getConstantPoolString(readUnsignedShort()); final String className = classNamePath.replace('/', '.'); if ("java.lang.Object".equals(className)) { fieldName = getConstantPoolString(fieldNameCpIdx); if (matchThisStaticFinalField && staticFinalFieldsToMatch.contains(fieldName)) { isMatchedFieldName = true; fieldTypeDescriptor = getConstantPoolString(fieldTypeDescriptorCpIdx); } else if (scanSpec.enableFieldInfo && fieldIsVisible && constantPoolStringEquals(attributeNameCpIdx, "Signature")) { fieldTypeSignature = getConstantPoolString(readUnsignedShort()); } else if ((scanSpec.enableFieldInfo || scanSpec.enableFieldAnnotationIndexing) && (constantPoolStringEquals(attributeNameCpIdx, "RuntimeVisibleAnnotations") if (!isStaticFinalField) { log.log("Requested static final field match " // + classInfoUnlinked.className + "." + getConstantPoolString(fieldNameCpIdx) + " is not declared as static final"); reasonFound = true; + classInfoUnlinked.className + "." + getConstantPoolString(fieldNameCpIdx) + " is not declared as public, and ignoreFieldVisibility was not set to" + " true before scan"); + classInfoUnlinked.className + "." + getConstantPoolString(fieldNameCpIdx) + " does not have a constant literal initializer value");
/** * Get a string from the constant pool representing an internal string descriptor for a class name * ("Lcom/xyz/MyClass;"), and interpret it as a class name by replacing '/' with '.', and removing the leading * "L" and the trailing ";". */ private String getConstantPoolClassDescriptor(final int CpIdx) { return getConstantPoolString(CpIdx, /* replaceSlashWithDot = */ true, /* stripLSemicolon = */ true); }
/** Get a string from the constant pool. */ private String getConstantPoolString(final int cpIdx) { return getConstantPoolString(cpIdx, /* subFieldIdx = */ 0); }
case 8: // String return getConstantPoolString(cpIdx, /* subFieldIdx = */ 0); case 3: // int, short, char, byte, boolean are all represented by Constant_INTEGER
/** Read annotation entry from classfile. */ private AnnotationInfo readAnnotation() throws IOException, InterruptedException { // Lcom/xyz/Annotation; -> Lcom.xyz.Annotation; final String annotationClassName = getConstantPoolClassDescriptor(readUnsignedShort()); final int numElementValuePairs = readUnsignedShort(); List<AnnotationParamValue> paramVals = null; if (numElementValuePairs > 0) { paramVals = new ArrayList<>(numElementValuePairs); } for (int i = 0; i < numElementValuePairs; i++) { final String paramName = getConstantPoolString(readUnsignedShort()); // skip(2); // element_name_index final Object paramValue = readAnnotationElementValue(); paramVals.add(new AnnotationParamValue(paramName, paramValue)); } return new AnnotationInfo(annotationClassName, paramVals); }
return Boolean.valueOf(readInt(offset[readUnsignedShort()]) != 0); case 's': return getConstantPoolString(readUnsignedShort()); case 'e': { final String constName = getConstantPoolString(readUnsignedShort()); return new AnnotationEnumValue(className, constName); final String classRefTypeDescriptor = getConstantPoolString(readUnsignedShort()); return new AnnotationClassRef(classRefTypeDescriptor); case '@':