alphalintw / as3-commons

Automatically exported from code.google.com/p/as3-commons
0 stars 0 forks source link

Type fields cache may be set to bogus contents in certain circumstances #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Way back I submitted a patch related to the way constructor introspection was 
implemented by as3-commons-reflect:

(see note in XmlTypeProvider#getType())
// Add the Type to the cache before assigning any values to prevent looping.
// Due to the work-around implemented for constructor argument types
// in getTypeDescription(), an instance is created, which could also
// lead to infinite recursion if the constructor uses Type.forName().
// Therefore it is important to seed the cache before calling
// getTypeDescription.

Starting with revision 284, a related problem was introduced in class Type by 
caching the fields HashArray. The cache isn't invalidated if any of the 
constituent member arrays change.

For example, if a constructor of class X uses Type.getField() (directly or 
indirectly) and Type.forClass(X) is called, then the fields cache of the Type 
instance for X will be bogus (e.g., an empty HashArray). Since the fields cache 
is never invalidated, it remains bogus even after the end of the introspection 
recursion.

I'm attaching a patch file to fix this issue. The patch is based on rev. 521.

Original issue reported on code.google.com by jfailens...@gmail.com on 5 Dec 2010 at 3:49

Attachments:

GoogleCodeExporter commented 9 years ago
Fixes are in the trunk, thanks a lot for this one, good catch!

Original comment by ihatelivelyids on 5 Dec 2010 at 5:51