suuhas / as3-commons

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

ApplicationDomain not taken into account using Type.forName() method #94

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Implement an application using child application domains modules
2.You may want to load a class using introspection in another ApplicationDomain 
than current one
3.The use of method forName() of class Type will allways instantiate the target 
class in current ApplicationDomain

What is the expected output? What do you see instead?
Loaded Class should be present in target ApplicationDomain. As it is not the 
case, it is not possible to load another implementation of this class in 
another child ApplicationDomain

What version of the product are you using? On what operating system?
as3common 1.4.2

Please provide any additional information below.
To fix it, we suggest to do the following:
* Class Type, line 144:
Add "applicationDomain" parameter to method contains
* Class Type, line 145:
Add "applicationDomain" parameter to method get
* Class Type, line 168:
Add "applicationDomain" parameter to method contains
* Class Type, line 169:
Add "applicationDomain" parameter to method get

Original issue reported on code.google.com by gregoire...@gmail.com on 29 Sep 2011 at 9:04

GoogleCodeExporter commented 9 years ago

Original comment by ihatelivelyids on 29 Sep 2011 at 9:12

GoogleCodeExporter commented 9 years ago
You must also modify TpeCache class so that it accepts ApplicationDomain as 
parameter, as visible in enclosed class

Original comment by gregoire...@gmail.com on 29 Sep 2011 at 10:11

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by martin.h...@gmail.com on 29 Sep 2011 at 12:35

GoogleCodeExporter commented 9 years ago
Hi there,

thanks for bringing this up. Indeed the Type cache didn't take the application 
domains properly into account. I have implemented this and the get, contain and 
put methods from TypeCache now also take an extra ApplicationDomain parameter.
Type itself now has a static currentApplicationDomain property where 
Application.currentDomain is once retrieved and cached. (Multiple calls to 
Application.currentDomain actually yields different references, so if you need 
Application.currentDomain just refer to Type.currentApplicationDomain).

Changea re available in the trunk, give it a try and let me know your findings.

cheers!

Roland

Original comment by ihatelivelyids on 29 Sep 2011 at 5:02

GoogleCodeExporter commented 9 years ago
Hi,

This has been tested, and it works.
Many thanks for your help.

Original comment by gregoire...@gmail.com on 5 Oct 2011 at 3:37

GoogleCodeExporter commented 9 years ago
Alright, thanks for confirming!

Original comment by ihatelivelyids on 5 Oct 2011 at 11:03