3
Oracle Announced Plans to Open Source All Features of Their JDK and Address Shortcomings in Java EE (www.infoq.com)
natsu 積分 0 編輯於

We need to do a lot more to modernise; to get you to that world of cloud and microservices and serverless. Because the reality is EE is the bedrock of mission critical systems; it does power enterprise. And if we look at why it isn’t getting us there it is pretty self evident. Is it open? No, it’s a vendor consortium, last time I checked those aren’t that open. Is it nimble? Well is shipped four years ago, that’s not very fast. We’re going to change everything about this.

將來可以透過 Java EE 來開發免伺服器的雲端服務,不用依靠某廠商 (指的是 AWS?)

// Java 9
URL url = new URL("http://openjdk.java.net");
URLConnection conn = url.openConnection();
Scanner scanner = new Scanner(conn.getInputStream(), "UTF-8");

// Java 18.3
var url = new URL("http://openjdk.java.net");
var conn = url.openConnection();
var scanner = new Scanner(conn.getInputStream(), "UTF-8");

感覺這樣的寫法不是很好,沒有強型別的檢查:(學 javascript 的 ?)

URL url = new Scanner(conn.getInputStream(), "UTF-8"); //complier error

var url = new Scanner(conn.getInputStream(), "UTF-8"); //pass !?
caterpillar 積分 1

文中就寫了… local-variable type inference…像是 Scala、Kotlin 那樣吧!

natsu 積分 0

原來之前就有討論1過了...

雖然 Java 有限制 var 只能在 local 變數上使用,但我還是不太喜歡...

koji 積分 0

第一個是說發展不夠快吧,而且都比較偏大廠制定規格。 第二個還是會檢查,你不能寫 url.foo() 這種程式,會編譯不過。

natsu 積分 0

第一個是說發展不夠快吧,而且都比較偏大廠制定規格。

原來如此

第二個還是會檢查,你不能寫 url.foo() 這種程式,會編譯不過。

那可以這樣寫嗎?

var url = new URL("http://openjdk.java.net");
...
url = new Scanner(conn.getInputStream(), "UTF-8");
koji 積分 0

應該不行!!