tirsdag 15. desember 2009

Java 7 chapter 2: Language changes

Annotations
Annotations is limited to declarations in java 6 (method parameters and the declarations of packages, classes, methods, fields, and local variables). This jsr extends the annotation system to use on any type. It is limited to defining the syntax of the extended annotations, leaving the semantics out.

Modularization
Will promote testability and maintainability. Much like OO and interfaces, but at larger scale. A JAR is like a module but does not define dependencies. All classes are put on classpath, which enables interface type checking at compile time. However, the classpath can be different in runtime, i.e. different or multiple library versions. ClassLoaders can be used to segment the classpath, but they are hard to use. OSGi is a module system. It uses metadata in the manifest-file to determine inter-jar dependencies, and provides one ClassLoader per library. OSGi is a specification with several implementations. Project Jigsaw is the effort of modularizing the jdk itself. It will introduce a “module” keyword which combined with maven/ant-style dependencies can be used to create runtime module dependencies.

Coin
Project Coin defines a set of small language changes should be added to JDK 7. Seven features have been selected:


  • Strings in switch
  • Language support for collections
  • Automatic Resource Management
  • Improved Type Inference for Generic Instance Creation 
  • Better integer literals
  • Simplified Varargs Method Invocation
  • Language support for JSR 292


See i.e. http://blogs.sun.com/darcy/entry/project_coin_final_five



Ingen kommentarer:

Legg inn en kommentar