Quick evaluation of some obvious cases in ClassWriter.getCommonSuperClass
Apache Aries needs to override ClassWriter.getCommonSuperClass to use
osgi-friendly class "loading"(using ClassReaders) rather than the default. We
need some obvious special case short-circuit evaluations that are generally
applicable but no longer as easy to implemnt by overriding without duplicating
information. Perhaps these special-case evaluations could be included in
ClassWriter itself, speeding up the method and simplifying the task of
overriding getCommonSuperClass.
The special cases are:
types are equal
one type is java/lang/Object (so the common superclass must be too)
one type is the class being written, in which case we can move directly to the
known superclass.
This proposed change makes the
ClassWriterUnitTest.testIllegalGetCommonSuperClassArguments less meaningful,
but I fail to see much point in the test anyway.
The superclass name must be in the constant pool somewhere, but I don't
immediately see how to find it, so I added a String field to hold it.