Eclipse/javac disagree on compiling signature with default method collision; who is right?

前端 未结 4 706
-上瘾入骨i
-上瘾入骨i 2020-12-03 13:54

Here\'s a simple class that demonstrates the issue:

package com.mimvista.debug;

public class DefaultCollisionTest {
    public static interface Interface1 {         


        
4条回答
  •  醉酒成梦
    2020-12-03 14:36

    As I understand it, the question is about passing an object of an already compiled class as a parameter. Since you cannot call the extractName(X) method with an abstract class or an interface, the argument object must have it's getName() method resolved and unambiguous. Java uses a late binding for resolving which overridden method is called at runtime, so I would agree with BonusLord that the method could be correctly compiled and run even if javac throws the error.

提交回复
热议问题