Home | History | Annotate | Download | only in lang
      1 // Copyright 2017 The Bazel Authors. All rights reserved.
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use this file except in compliance with the License.
      5 // You may obtain a copy of the License at
      6 //
      7 //    http://www.apache.org/licenses/LICENSE-2.0
      8 //
      9 // Unless required by applicable law or agreed to in writing, software
     10 // distributed under the License is distributed on an "AS IS" BASIS,
     11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 // See the License for the specific language governing permissions and
     13 // limitations under the License.
     14 
     15 // This test class is in the java.lang namespace to trigger the hardcoded JVM restrictions that
     16 // desugar --core_library works around
     17 package java.lang;
     18 
     19 /**
     20  * This class will be desugared with --core_library and then functionally tested by {@code
     21  * DesugarCoreLibraryFunctionalTest}
     22  */
     23 public class AutoboxedTypes {
     24   /**
     25    * Dummy functional interface for autoboxedTypeLambda to return without introducing a dependency
     26    * on any other java.* classes.
     27    */
     28   @FunctionalInterface
     29   public interface Lambda {
     30     String charAt(String s);
     31   }
     32 
     33   public static Lambda autoboxedTypeLambda(Integer i) {
     34     return n -> n.substring(i, i + 1);
     35   }
     36 }
     37