Error for non-static replacement. More tests.
Added generic type support.