Kotlin继承/泛型声明

时间:2018-11-10 17:45:52

标签: generics inheritance kotlin

我正在尝试在RepoInit 1和2中启动version: '3.3' services: neo4jESdock: restart: always image: neo4j:3.4.7 container_name: neo4j environment: - NEO4J_ACCEPT_LICENSE_AGREEMENT=yes - NEO4J_AUTH=none - NEO4J_dbms_connector_http_listen__address=:7474 - NEO4J_dbms_connector_https_listen__address=:6477 - NEO4J_dbms_connector_bolt_listen__address=:7687 - elastic="http://elastic_container" volumes: - ./neo4j/data:/data - ./neo4j/plugins:/plugins - ./neo4j/conf:/conf - ./neo4j/logs:/neologs ports: - 7474:7474 - 6477:6477 - 7687:7687 networks: - neo-elk elastic: image: elasticsearch:6.4.2 restart: always container_name: elastic_container ports: - 9200:9200 volumes: - ./elasticsearch/data:/usr/share/elasticsearch/data - ./elasticsearch/config/elasticsearch.yml:/etc/elasticsearch/config/elasticsearch.yml environment: - "ES_JAVA_OPTS=-Xmx256m -Xms256m" - neo4j="http://neo4j" networks: - neo-elk networks: neo-elk: driver: bridge

第一个显示“类型不匹配”,并且不允许我编译。也就是说,除非我像在RoomAlarmRepository中那样进行强制转换,否则它将告诉我强制转换未选中。

RepoInit2

我当前正在使用第二个,因为它实际有效。我知道我在声明变量的地方丢失了东西,但是我不确定它是什么。

Type mismatch Unchecked Cast

1 个答案:

答案 0 :(得分:2)

使用let term = $("#getaddy").val(); $.ajax({ url: "https://maps.googleapis.com/maps/api/geocode/json?address="+encodeURIComponent(term) +"&key=GOOGLEKEY", type: 'get', success: function(data) { if (data.status === 'OK') { // Get the lat/lng from the response let lat = data.results[0].geometry.location.lat; let lng = data.results[0].geometry.location.lng; console.log(lat); } }, error: function(msg) { console.log("not sure what to ask for here to check issue"); } }); 修饰符将其声明为泛型作为协变。 有关详细信息,请参见https://kotlinlang.org/docs/reference/generics.html

out