make get_javadoc_ref perform according to docs

Store current match so that we do longest match
instead of last match as currently.

This was impeding match of "javax.servlet" in a different
place than, say, "javax.sql".
Merge pull request #22 from sgala/forbronto

make get_javadoc_ref perform according to docs