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 package com.google.devtools.build.android.desugar.testdata.java8; 15 16 /** Interface for testing default methods overridden by extending interfaces. */ 17 public interface InterfaceWithDefaultMethod { version()18 default int version() { 19 return 1; 20 } 21 22 /** Interface that overrides {@link #version}. */ 23 public interface Redefine extends InterfaceWithDefaultMethod { 24 @Override version()25 default int version() { 26 return 2; 27 } 28 } 29 30 /** Class that implements both interfaces, supertype before subtype. */ 31 public static class Version2 implements InterfaceWithDefaultMethod, Redefine {} 32 33 /** Base class that just implements {@link Redefine}. */ 34 static class Version2Base implements Redefine {} 35 36 /** 37 * Subclass that implements an interface explicitly that the superclass also implements, 38 * but the superclass implements a more specific interface that overrides a defautl method. 39 */ 40 public static class AlsoVersion2 extends Version2Base implements InterfaceWithDefaultMethod {} 41 } 42