Weird exception “Invalid receiver type class java.lang.Object; not a subtype of …”

前端 未结 2 1410
暗喜
暗喜 2020-12-08 16:12

I\'m getting this strange exception in code run using jre1.8.0_66:

Exception in thread \"main\" java.lang.BootstrapMethodError: call site initialization exce         


        
2条回答
  •  北海茫月
    2020-12-08 16:56

    I believe you are just trying to reference a method from the interface with no return.

    ie:

    Fruit::getPickingMonth; //cant return anything
    

    I would imagine you would want something like

    Apple::getPickingMonth;
    or
    Orange::getPickingMonth;
    

    Instead

    If the above isn't the solution it might be a casting issue where the compiler doesn't know what to return on the bytecode level.

    There are questions like this on StackOverflow

    Lambda Referencing

    Lambda Conversion Exception

提交回复
热议问题