List of usage examples for org.eclipse.jdt.core.util IConstantPoolConstant CONSTANT_Fieldref
int CONSTANT_Fieldref
To view the source code for org.eclipse.jdt.core.util IConstantPoolConstant CONSTANT_Fieldref.
Click Source Link
From source file:edu.uci.ics.sourcerer.tools.java.extractor.eclipse.NamingAdvisor.java
License:Open Source License
private void addClassFile(IClassFile classFile) { IClassFileReader reader = ToolFactory.createDefaultClassFileReader(classFile, IClassFileReader.CONSTANT_POOL | IClassFileReader.METHOD_INFOS); IConstantPool constants = reader.getConstantPool(); for (int i = 0, max = constants.getConstantPoolCount(); i < max; i++) { switch (constants.getEntryKind(i)) { case IConstantPoolConstant.CONSTANT_Class: { IConstantPoolEntry constant = constants.decodeEntry(i); addClass(new String(constant.getClassInfoName()).replace('/', '.')); break; }/*w ww .j a va2s. c o m*/ case IConstantPoolConstant.CONSTANT_Fieldref: { IConstantPoolEntry constant = constants.decodeEntry(i); addClassSig(constant.getFieldDescriptor()); break; } case IConstantPoolConstant.CONSTANT_Methodref: { IConstantPoolEntry constant = constants.decodeEntry(i); addMethod(new String(constant.getClassName()), new String(constant.getMethodName()), constant.getMethodDescriptor()); break; } case IConstantPoolConstant.CONSTANT_InterfaceMethodref: { IConstantPoolEntry constant = constants.decodeEntry(i); addMethod(new String(constant.getClassName()), new String(constant.getMethodName()), constant.getMethodDescriptor()); break; } default: } } // Add the method parameter / return types for (IMethodInfo method : reader.getMethodInfos()) { for (char[] p : Signature.getParameterTypes(method.getDescriptor())) { addClassSig(p); } addClassSig(Signature.getReturnType(method.getDescriptor())); } }