cglibをごにょごにょする

SeasarやSpring、Hibernateで使用されているcglibを調べるために「Code Generation Library」からソースとJavaDocを取得してくる。
Enhancer#create(…)から始めてAbstractClassGenerator#create(…)、Enhancer#firstInstance(…)、Enhancer#createUsingReflection(…)、ReflectUtils#newInstance(Class, Class, Object)、ReflectUtils#getConstructor(…)、ReflectUtils#newInstance(Constructor, Object)と追って行く。
ReflectUtils#getConstructor(…)の中では取得したてのConstructorにsetAccessible(true)をしているのだが、それを受け取るReflectUtils#newInstance(Constructor, Object
)の中では「一旦Constructorのaccessibleを退避させてからtrueにし、インスタンスを取得してから退避していたのを戻す」という処理をしている。
一時的にtrueにする処理があるのにReflectUtils#getConstructor(…)の中のsetAccessible(true)って必要なの?
……っていうか、ずっとtrueになったままでいいの?
ちょっと気になったけど、眠くなったので調査は断念。
getConstructor(…)で生成したコンストラクタを他のところでアクセスしてるのか?そいでもってnewInstance(Constructor, Object[])の方は外部から呼ばれたときのために退避機構を入れてるとか?