It might look like duplicate question, but i have posted the code sample suggested by sonar rule Compliant one. When evaluating the below highlighted code with SonarQube it results in squid:S1948 rule violation.
Result,
Still its a mystery that why its showing violation for compliant code, plz clarify.
UPDATE
transient or serializable issue not resolved even with sonar.java.binaries
Sonar Scan is success but throws class loader warn:
08:26:44.984 INFO - Java bytecode scan...
08:26:44.992 WARN - Class 'dummyserial/Address' is not accessible through the C
lassLoader.
08:26:44.993 WARN - Class 'dummyserial/Person' is not accessible through the Cl
assLoader.
08:26:44.993 WARN - Class 'dummyserial/Address' is not accessible through the C
lassLoader.
08:26:44.994 WARN - Class 'dummyserial/Person' is not accessible through the Cl
assLoader.
08:26:44.994 WARN - Class 'dummyserial/Address' is not accessible through the C
lassLoader.
08:26:44.997 WARN - Class 'dummyserial/Person' is not accessible through the Cl
assLoader.
08:26:44.998 INFO - Java bytecode scan done: 14 ms
As previously responded, you should fill the sonar.java.binaries
property in order to allow bytecode analysis and symbol resolution. Having this property filled, the analysis would not raise any issue on that case.
Now, it is indeed annoying that we raise an issue when we can not resolve the symbol type of a field. I created the following ticket to handle the issue: SONARJAVA-1266
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With