Insert Dimensions to complete Expression/ReferenceType

后端 未结 7 1805
醉话见心
醉话见心 2021-01-03 21:55

I\'m a newbie to Java.

I have provided a short snippet from my code for BFS.

public int bfs(Person p, Person q) {
    private HashMap

        
7条回答
  •  北海茫月
    2021-01-03 22:55

    Visit Cannot Instantiate Generic Types with Primitive Types

    Replace all type parameters in generic types with their bounds or Object if the type parameters are unbounded. The produced bytecode, therefore, contains only ordinary classes, interfaces, and methods.

    The type parameter, V, actually also K, which is declared in HashMap, will be replaced with Object after erasing, because they are unbounded. While primitive type can not be store as Object.

提交回复
热议问题