2014-09-15 13:32 GMT+04:00 Konstantin Kolinko <knst.koli...@gmail.com>:
> 2014-09-14 17:42 GMT+04:00 sebb <seb...@gmail.com>:
>> It seems that Tomcat's version of BCEL is diverging significantly from
>> Commons BCEL.
>>
>> Is there any mileage in trying to re-organise Commons BCEL so it is
>> more easily usable by Tomcat?
>>
>> For example, I gather that Tomcat only uses a small portion of Commons BCEL.
>> Maybe the Commons code could be divided in some way to reflect this need?
>> There are probably other projects that just need the read-only parts of BCEL.
>>
>
> Tomcat needs only
> * super class name
> * interfaces class names
> * class-level annotations (RuntimeVisibleAnnotations attibute)
>
> All the rest are not needed and have been removed. (See how methods in
> ClassParser skip over sections of class file).
>
> In theory, other libraries may want the same and I think it boils down
> to an alternate ClassParser that has the same skip-over behaviour.
>
> (...)

One more thought, regarding future changes to class file format  and
corresponding maintenance of the code.

First,
I do not expect changes to generic structure of the class file, nor
changes to the structure of fields and methods.  There have been
changes to the constants pool - additions of new constant types,  and
changes to Attributes - additions of attributes.

The attributes are OK, they have explicit length field and can be
opaquely skipped.
The constants are bad. They have variable size and the size depends on
the type of the constant. We do not know the size unless we know the
meaning of a constant type code.

Thus when any new constant types are added to the class file format,
someone would have to update the implementation of
Constant.readConstant() method.

Without an update Tomcat will not be able to scan classes compiled
with newer versions of Java.


Second,
There is one other place where Tomcat code scans a class file:
org.apache.jasper.compiler.SmapUtil $ SDEInstaller

It is responsible for writing "SourceDebugExtension" attribute for the class.

Its copyConstantPool() method would need the same update as BCEL


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to