You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
868 B
46 lines
868 B
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
package codetoanalyze.java.infer;
|
|
|
|
public class IntegerExample {
|
|
|
|
private static void testIntegerEqualsGood() {
|
|
Integer a = new Integer(42);
|
|
Integer b = new Integer(42);
|
|
Integer c = null;
|
|
|
|
if (!a.equals(b)) {
|
|
c.intValue();
|
|
}
|
|
|
|
if (a != 42) {
|
|
c.intValue();
|
|
}
|
|
}
|
|
|
|
private static void testIntegerEqualsBad() {
|
|
Integer a = new Integer(42);
|
|
Integer b = new Integer(42);
|
|
Integer c = null;
|
|
|
|
if (a.equals(b)) {
|
|
c.intValue();
|
|
}
|
|
}
|
|
|
|
private static void testIntegerEqualsOk() {
|
|
Integer a = new Integer(42);
|
|
Integer b = new Integer(42);
|
|
Integer c = null;
|
|
|
|
if (a == b) {
|
|
c.intValue();
|
|
}
|
|
}
|
|
}
|