public boolean usesField ( String className , String fieldName ) { int classIndex = findClass ( className ) ; if ( classIndex == NOT_FOUND ) return false ; int fieldNameIndex = findUtf8 ( fieldName ) ; if ( fieldNameIndex == NOT_FOUND ) return false ; for ( int i = 1 ; i < maxPoolSize ; i ++ ) { if ( types [ i ] == FIELD && readValue ( offsets [ i ] ) == classIndex ) { int nameAndTypeIndex = readValue ( offsets [ i ] + 2 ) ; if ( readValue ( offsets [ nameAndTypeIndex ] ) == fieldNameIndex ) return true ; } } return false ; }
Checks if the constant pool contains a reference to a given field either for writing or reading .