11 new factor suggested for morden java language
/**
* 1. NullPointer Suppress, according to [Nullable] annotation
* need JVM support
* avoid many null judgment code.
*/
[Nullable]
public void testNullable(A a){
return a.b().c.d(); //how many line it will cost using "if-else" null check?
}
/**
* 2. Dynamic property, for better IDE and compile time check
* need Compiler support
* @param a: A implements DynamicBean, "c" property is not defined.
*/
public void dynamicProperty(A a){
assert a != null;
a.b.c = "abc"; //same as: a.getProperty("b").setProperty("c","abc");
ResultSet rs; //for database:
String name = rs.name; //if ResultSet defined getStringProperty(): String name = rs.getStringProperty("a");
Element order; //for xml, element auto-created in getProperty() method.
order.address.phone = "1234"; //order.getProperty("address").setProperty("phone","1234");
}
/**
* 3. Dynamic method invocation, for better IDE and compile time check
* need Compiler support
* @param a: A implements DynamicInvoke, b() method is not defined.
*/
public void dynamicMethod(A a){
a.b(1,"x"); //same as: a.invoke("b",new Object[]{1,"x"]);
}
/**
* 4. extend "class" usage, for better IDE and compiler time check
* need Compiler support
* @param a: A defined b(),c property
*/
public void fastReflection(A a){
Annotation[] mas = a.b().class.getAnnotations(); //a.getClass().getMethod("b").getAnnotations();
Annotation[] mas = a.c.class.getAnnotations(); // a.getClass().getField("c").getAnnotations();
}
/**
* 5. indexed property visit, for clean code
* need Compiler support
* @param a: A 实现了List接口,Map接口
*/
public void indexVisit(A a){
Element order ; //xml element
Element first = order[0]; //order.get(0);
Element address = order["address"]; //order.getElement("address")
}
/**
* 6. JVM built-in AOP
* need Runtime support
* Trace,Role,Transactional is annotation
*/
[Trace]
[Role("admin")][Transactional]
public void jvmAOP(A a){
}
/**
* 7. Conditional compile, different compile result for diffrent condition
* need Compiler support
* Conditional anotation may be used on field, method, class and package
*/
[Condition("Test")]
public void testSomeMethod(){
//this method will not be include in delivery compile result.
}
/**
* 8. XML Schema,DataBase compile time check
* need Compiler support
*/
public static void schemaSupport() {
[Schema(url="file://test.xsd")]
Document doc;
Element c = doc.a.b.c; //compiler should raise error if /a/b/c is not defined in schema
}
/**
* 9. build-in object database,xml schema knolege-base worked like DNS server.
* need Runtime support
*/
public void databaseSupport(){
Database.default.find("...");
Schema.get("http://xxx.yyy/zzz.xsd").validate(xml);
}
/**
* 10. local platform support
* need Runtime support
* allow developer control windows service,visit registry/log/file association/schedule/menu、tool bar、desktop...
*/
public void platformSupport(){
PlatformRegistry.getString("....");
}
/**
* 11. provide minium JRE install package to compete with Flash/Windows buildin .net CLR
* mininum JRE install package provide basic classes.
* deployer may configure other package together, such as UI/javamail/xml.
*/
it's my own idea, pls tell out your hope for java in new year too :)

