Home | History | Annotate | Download | only in src
      1 /*
      2  * Copyright (C) 2015 The Android Open Source Project
      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 
     17 
     18 public class Main {
     19 
     20   /// CHECK-START: java.lang.Object Main.boundTypeForIf(java.lang.Object) builder (after)
     21   /// CHECK:     BoundType
     22   public static Object boundTypeForIf(Object a) {
     23     if (a != null) {
     24       return a.toString();
     25     } else {
     26       return null;
     27     }
     28   }
     29 
     30   /// CHECK-START: java.lang.Object Main.boundTypeForInstanceOf(java.lang.Object) builder (after)
     31   /// CHECK:     BoundType
     32   public static Object boundTypeForInstanceOf(Object a) {
     33     if (a instanceof Main) {
     34       return (Main)a;
     35     } else {
     36       return null;
     37     }
     38   }
     39 
     40   /// CHECK-START: java.lang.Object Main.noBoundTypeForIf(java.lang.Object) builder (after)
     41   /// CHECK-NOT: BoundType
     42   public static Object noBoundTypeForIf(Object a) {
     43     if (a == null) {
     44       return new Object();
     45     } else {
     46       return null;
     47     }
     48   }
     49 
     50   /// CHECK-START: java.lang.Object Main.noBoundTypeForInstanceOf(java.lang.Object) builder (after)
     51   /// CHECK-NOT: BoundType
     52   public static Object noBoundTypeForInstanceOf(Object a) {
     53     if (a instanceof Main) {
     54       return new Object();
     55     } else {
     56       return null;
     57     }
     58   }
     59 
     60   public static void main(String[] args) {  }
     61 }
     62