prohibit field of certain types

This commit is contained in:
Stepan Koltsov
2012-03-22 03:47:14 +04:00
parent 3c41df8419
commit 97549f54b3
@@ -338,6 +338,12 @@ public class DependencyInjectorGenerator {
Field dependency;
if (fields.isEmpty()) {
if (parameterType.isPrimitive() || parameterType.getPackage().getName().equals("java.lang")) {
throw new IllegalArgumentException(
"cannot declare magic field of type " + parameterType + ": " + errorMessage);
}
dependency = addField(parameterType);
satisfyDependenciesFor(dependency, neededFor);
}