17 lines
423 B
Plaintext
17 lines
423 B
Plaintext
![]() |
include::../description.adoc[]
|
||
|
|
||
|
== Noncompliant Code Example
|
||
|
|
||
|
----
|
||
|
public void makeItPublic(String methodName) throws NoSuchMethodException {
|
||
|
|
||
|
this.getClass().getMethod(methodName).setAccessible(true); // Noncompliant
|
||
|
}
|
||
|
|
||
|
public void setItAnyway(String fieldName, int value) {
|
||
|
this.getClass().getDeclaredField(fieldName).setInt(this, value); // Noncompliant; bypasses controls in setter
|
||
|
}
|
||
|
----
|
||
|
|
||
|
include::../see.adoc[]
|