pombreda / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 1 forks source link

Minor optimization to TypeConverterBindingProcessor #723

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
TypeConverterBindingProcessor has two responsibilities: 1) prepare built-in 
type converters for primitives, enums, classes, etc. and 2) process 
TypeConverter bindings and register them with the containing injector.

The first responsibility only needs the injector reference, it doesn't need 
access to the processor's Errors cache. However, the current implementation 
runs in the context of the processor and creates a number of anonymous classes, 
and they all contain an implicit reference (this$0) back to the processor. This 
can lead to some Errors instances being kept alive longer than necessary by 
these anonymous classes, but not a large number.

Changing the prepareBuiltInConverters implementation over to use static methods 
that pass the injector as an argument fixes this problem by removing the 
implicit reference to the processor, since the anonymous classes are now 
created from a static context.

Original issue reported on code.google.com by mccu...@gmail.com on 8 Aug 2012 at 12:28

GoogleCodeExporter commented 9 years ago
Candidate patch, tested locally and analyzed using Eclipse MAT 
(Memory-Analysis-Tool)

Original comment by mccu...@gmail.com on 8 Aug 2012 at 12:33

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by sberlin on 9 Dec 2013 at 7:28