private int resolveFieldIndex ( TypeElement declaringClass , String name , String descriptor ) { int size = 0 ; int index = 0 ; constantReadLock . lock ( ) ; try { size = getConstantPoolSize ( ) ; index = getRefIndex ( Fieldref . class , declaringClass . getQualifiedName ( ) . toString ( ) , name , descriptor ) ; } finally { constantReadLock . unlock ( ) ; } if ( index == - 1 ) { // add entry to constant pool int ci = resolveClassIndex ( declaringClass ) ; int nati = resolveNameAndTypeIndex ( name , descriptor ) ; return addConstantInfo ( new Fieldref ( ci , nati ) , size ) ; } return index ; }
Returns the constant map index to field If entry doesn t exist it is created .