1 /* 2 * Copyright (C) 2017 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 interface Base { foo(int i)18 default public int foo(int i) { 19 if (i != 1) { 20 return -2; 21 } 22 return i + 10; 23 } 24 25 // Test default method that's not inlined. $noinline$bar()26 default public int $noinline$bar() { 27 System.out.print(""); 28 System.out.print(""); 29 System.out.print(""); 30 System.out.print(""); 31 System.out.print(""); 32 System.out.print(""); 33 System.out.print(""); 34 System.out.print(""); 35 return -1; 36 } 37 printError(String msg)38 default void printError(String msg) { 39 System.out.println(msg); 40 } 41 } 42