prohibit field of certain types
This commit is contained in:
@@ -338,6 +338,12 @@ public class DependencyInjectorGenerator {
|
|||||||
|
|
||||||
Field dependency;
|
Field dependency;
|
||||||
if (fields.isEmpty()) {
|
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);
|
dependency = addField(parameterType);
|
||||||
satisfyDependenciesFor(dependency, neededFor);
|
satisfyDependenciesFor(dependency, neededFor);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user