ictvmt / mvp4g

Automatically exported from code.google.com/p/mvp4g
0 stars 0 forks source link

Error message needed when parent module is not correct #29

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If you set the wrong class for the parent module with the setParentModule 
method, a class cast exception occurs.

Instead Mvp4g should display an error message.

Original issue reported on code.google.com by plcoir...@gmail.com on 1 May 2010 at 9:51

GoogleCodeExporter commented 8 years ago
Attached is a patch that eliminates this problem by adding a setParentModule 
method to 
the Mvp4gModule interface. The parameter is a Mvp4gModule which is casted back 
to the 
proper type in child module method definition. Rather than using the parameter 
to 
determine the parent module type, it is saved into ChildModuleElement when they 
are 
loaded.

Original comment by HebnerN@gmail.com on 19 May 2010 at 7:39

GoogleCodeExporter commented 8 years ago
Thanks for the patch.

I have a question about your correction. For a child module, in 
Mvp4gConfiguration.java, findParentModule will always return null since a child 
module won't have an annotation @ChildModule with its class. Then you won't 
have 
access to parent module & parent event bus classes and won't be able to do the 
right 
cast. Am I missing something?

Original comment by plcoir...@gmail.com on 20 May 2010 at 2:50

GoogleCodeExporter commented 8 years ago
Indeed you are correct. I guess it was a bit too late to be coding... Anyway I 
have 
attached a patch that should be correct. This patch finds the parent type by 
searching 
through the annotation scan results for a class annotated with @ChildModules 
containing 
the module in question.

Original comment by HebnerN@gmail.com on 20 May 2010 at 4:02

Attachments:

GoogleCodeExporter commented 8 years ago
Included in the last snapshot

Original comment by plcoir...@gmail.com on 8 Jun 2010 at 10:19