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.

  • (no subject)

    I have yet to read a Java vs python comparison which was written by anyone with any serious enterprise development experience. If enterprises were…

  • (no subject)

    Today I was browsing my screenshots, and I found that I had failed the UK citizenship test. I took it again, just for fun, and failed with flying…

  • (no subject)

    Nobody in the USA has heard of Flanders and Swann. If the country had an editor, I would write to him to express my unmitigated disgust.

  • 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.