Change the API and/or use defensive copy to prevent the user from modifying…
Change the API and/or use defensive copy to prevent the user from modifying internal data structures. This requires one backward incompatible change, namely the removal of the ClassReader.b field. I think this is acceptable, as this should normally be rarely used. The changes to ConstantDynamic are not backward incompatible, because this API was experimental up to now. The (unrelated) change of TypePath to a final class is also not an issue, because its unique constructor was package private. There is an inevitable performance impact, especially on ClassReader, but only when using the constructors using a byte array (the stream constructors don't use defensive copy).
This fixes some issues found with PMD in !222 (merged). Benchmark results:
Benchmark Mode Cnt Score Error Units
AdapterBenchmark.getClassInfo_asm6_1 thrpt 30 14077,888 ± 33,809 ops/s
AdapterBenchmark.getClassInfo_asmCurrent thrpt 30 10941,547 ± 23,452 ops/s
AdapterBenchmark.read_asm6_1 thrpt 30 643,338 ± 1,550 ops/s
AdapterBenchmark.read_asmCurrent thrpt 30 640,690 ± 1,481 ops/s