• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017. Uber Technologies
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *    http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.uber.myapplication;
17 
18 import android.os.Bundle;
19 import android.support.annotation.NonNull;
20 import android.support.annotation.Nullable;
21 import android.support.v7.app.AppCompatActivity;
22 import org.utilities.StringUtils;
23 
24 /** Sample activity. */
25 @SuppressWarnings("UnusedVariable") // This is sample code
26 public class MainActivity extends AppCompatActivity {
27   @NonNull private Object mOnCreateInitialiedField;
28 
29   @Override
onCreate(Bundle savedInstanceState)30   protected void onCreate(Bundle savedInstanceState) {
31     super.onCreate(savedInstanceState);
32     setContentView(R.layout.activity_main);
33     mOnCreateInitialiedField = new Object();
34     // uncomment to show that NullAway is actually running
35     // Object x = null;
36     // x.hashCode();
37   }
38 
checkModel(@ullable String s)39   static int checkModel(@Nullable String s) {
40     if (!StringUtils.isEmptyOrNull(s)) {
41       return s.hashCode();
42     }
43     return 0;
44   }
45 }
46