You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Unused_Variable.java 595 B

3 years ago
123456789101112131415161718192021222324252627282930313233
  1. package Unused_Variable;
  2. import java.util.logging.Logger;
  3. public class Unused_Variable
  4. {
  5. static final Logger log = Logger.getLogger("logger");
  6. /* use badsource and badsink */
  7. public void bad()
  8. {
  9. Integer data;
  10. /* POTENTIAL FLAW: Initialize, but do not use data */
  11. data = 5; // bad 变量赋值后未使用
  12. }
  13. public void good()
  14. {
  15. Integer data;
  16. /* POTENTIAL FLAW: Initialize, but do not use data */
  17. data = 5; // good 变量赋值后未使用
  18. /* FIX: Use data */
  19. log.info("" + data);
  20. }
  21. }

No Description

Contributors (1)