Skip to content

Commit

Permalink
rename parameters to clarify that injection rule targets fields
Browse files Browse the repository at this point in the history
Signed-off-by: Manfred Hanke <Manfred.Hanke@tngtech.com>
  • Loading branch information
hankem committed Apr 8, 2024
1 parent 4de808e commit 8266ffe
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,39 @@ public class ClassViolatingInjectionRules {
}

@Autowired
ClassViolatingInjectionRules(Object badBecauseAutowiredField) {
ClassViolatingInjectionRules(Object okayBecauseAutowiredConstructor) {
}

ClassViolatingInjectionRules(@Value("${name}") List<?> badBecauseValueField) {
ClassViolatingInjectionRules(@Value("${name}") List<?> okayBecauseValueConstructorParameter) {
}

@javax.inject.Inject
ClassViolatingInjectionRules(Set<?> badBecauseJavaxInjectField) {
ClassViolatingInjectionRules(Set<?> okayBecauseJavaxInjectConstructor) {
}

@com.google.inject.Inject
ClassViolatingInjectionRules(Map<?, ?> badBecauseComGoogleInjectField) {
ClassViolatingInjectionRules(Map<?, ?> okayBecauseComGoogleInjectConstructor) {
}

void someMethod(String okayBecauseNotInjected) {
}

@Autowired
void someMethod(Object badBecauseAutowiredField) {
void someMethod(Object okayBecauseAutowiredMethod) {
}

void someMethod(@Value("${name}") List<?> badBecauseValueField) {
void someMethod(@Value("${name}") List<?> okayBecauseValueMethodParameter) {
}

@javax.inject.Inject
void someMethod(Set<?> badBecauseJavaxInjectField) {
void someMethod(Set<?> okayBecauseJavaxInjectMethod) {
}

@com.google.inject.Inject
void someMethod(Map<?, ?> badBecauseComGoogleInjectField) {
void someMethod(Map<?, ?> okayBecauseComGoogleInjectMethod) {
}

@Resource
void someMethod(File badBecauseResourceField) {
void someMethod(File okayBecauseResourceMethod) {
}
}

0 comments on commit 8266ffe

Please sign in to comment.