1 // Copyright 2018 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 package com.google.devtools.build.android.desugar.testdata.java8; 15 16 /** Regression test data for b/73355452 that also includes calling static methods. */ 17 public interface InterfaceWithInheritedMethods { name()18 default String name() { 19 return "Base"; 20 } 21 staticSuffix()22 static String staticSuffix() { 23 return "!"; 24 } 25 26 static interface Passthrough extends InterfaceWithInheritedMethods { 27 // inherits name(). Note that desugar doesn't produce a companion class for this interface 28 // since it doesn't define any default or static interface methods itself. 29 } 30 31 static class Impl implements Passthrough { 32 @Override name()33 public String name() { 34 // Even though Passthrough itself doesn't define name(), bytecode refers to Passthrough.name. 35 return Passthrough.super.name(); 36 } 37 suffix()38 public String suffix() { 39 // Note that Passthrough.defaultSuffix doesn't compile and bytecode refers to 40 // InterfaceWithInheritedMethods.staticSuffix, so this shouldn't cause issues like b/73355452 41 return staticSuffix(); 42 } 43 } 44 } 45