言語関連の変更点 (予定 ) Array Syntax for Collections Closures Property Literals Type Interface Factory Methods instead of Constructors Arbitrary Precision Arithmetic Sub-package Access
5.
Array Syntax forCollections Collections を配列のように扱う List list = new ArrayList(); list.add(0, “tencho”); list.add(1, “ono”); String name = list.get(0); List list = new ArrayList(); list[0] = “tencho”; list[1] = “ono”; String name = list[0]; List list = {“tencho”, “ono”}; コンパイラの変更のみ VM の変更はなし
Properties Literals 簡単なプロパティアクセスPoint p = new Point(); p.setX(56); p.setY(87); int z = p.getX(); Point p = new Point(); p->X = 56; p->Y = 87; int z = p->X ; -> の代わりに . や # も提案されている property キーワードの追加 public class Point { public int property x; public int property y; } フィールド名と setter/getter が同名の場合、 setter/getter にディスパッチ
Type Interface コンパイラが推測できる型の省略可能ローカル変数の型 など void method() { List<String> list = new ArrayList<String>(); … } void method() { list := new ArrayList<String>(); … } final として宣言される??
19.
Arbitrary Precision Arithmetic無限精度の演算の簡略化 BigInteger low = BigInteger.ONE; BigInteger high = BigInteger.ONE; high = high.add(low); BigInteger low = BigInteger.ONE; BigInteger high = BigInteger.ONE; high = high + low;
20.
Factory Methods insteadof Constructors new キーワードの追加?? Foo f1 = Foo.new(1, 2); Foo f2 = Foo.new(subclass of Foo.class, 1, 2);
21.
今後の Java でサポートされない可能性の高い機能 多重継承 演算子オーバーロード AOP プリプロセッサ / マクロ 多重ディスパッチ 複数戻り値 By Peter von der Ahe at JavaOne Tokyo 2005 「可読性」「シンプルさ」「互換性」の維持