Shevek (shevek) wrote,

[javac] /home/shevek/.../ unexpected type
[javac] found : java.lang.Object
[javac] required: reference

44: assertTrue(prog.getMeta("model") instanceof TreeModel);

An Object is a reference, as I understand it.

getMeta(String) is of type T. Methods of type T are not typed until they're cast by assignment context provided by an lvalue. It's odd that the call context does not provide the minimal reference cast to Object. This may be because there is an implicit supertype used for automatic unboxing, that is, I could type a method T and assign it to an integer, presumably via an automatic cast to Integer or Number. But in that case why does it say "found Object" not "found Thing"?

I know of several other ways to trigger related bugs.
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.