gordonad / powermock

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

Whitebox.invokeConstructor and newInstance should check for abstract type #193

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Neither Whitebox.invokeConstructor or newInstance can instantiate abstract
classes. In the first case we could create a CgLib proxy around the class
(if the constructor is public, otherwise a javassist proxy? The latter will
be hard though because powermock-reflect has no dependency on javassist. We
could also byte-code manipulate the constructor so that it becomes pulic.)
using the ProxyFramework. 

Original issue reported on code.google.com by johan.ha...@gmail.com on 4 Nov 2009 at 10:00

GoogleCodeExporter commented 9 years ago
newInstance should check if the type is abstract and throw a good expecption

Original comment by johan.ha...@gmail.com on 4 Nov 2009 at 10:00

GoogleCodeExporter commented 9 years ago
We can make use of the ConcreteClassGenerator! It needs to be exetended a bit 
to generate ctors that call the correct super-class ctor as well though in the 
case of invokeConstructor.

Original comment by johan.ha...@gmail.com on 22 Jul 2010 at 9:22

GoogleCodeExporter commented 9 years ago
Since ConcreteClassGenerator is in the support module Whitebox cannot use it. 
An exception is thrown if abstract.

Original comment by johan.ha...@gmail.com on 30 Aug 2010 at 10:15