|
123456789101112131415161718192021222324252627282930313233 |
- package Unused_Variable;
-
- import java.util.logging.Logger;
-
- public class Unused_Variable
- {
-
- static final Logger log = Logger.getLogger("logger");
- /* use badsource and badsink */
- public void bad()
- {
- Integer data;
-
- /* POTENTIAL FLAW: Initialize, but do not use data */
- data = 5; // bad 变量赋值后未使用
-
- }
-
- public void good()
- {
- Integer data;
-
- /* POTENTIAL FLAW: Initialize, but do not use data */
- data = 5; // good 变量赋值后未使用
-
- /* FIX: Use data */
- log.info("" + data);
-
- }
-
-
- }
-
|