OpenJDK中的Coin项目(Project Coin)的目的就是为了收集对Java语言的语法进行增强的建议。在Coin项目开始之初,曾经广泛地向社区征求提议。在短短的一个月时间内就收到将近70条提议。最后又9条提议被列入考虑之中。在这9条提议中,有6条成为Java7的一部分,剩下的2条提议会在Java8中重新考虑,还有1条提议被移到其它项目中实现。这6条被采纳提议的语法新特性涉及switch语句中使用字符串、整数字面量的改进、异常处理的优化、泛型创建简化、try-with-resources语句和优化变长参数的方法调用等。
和其他对Java平台做的修改一样,Coin项目所建议的修改也需要通过JCP来完成。这些改动以JSR 334(Small Enhancements to the Java Programming Language)的形式提交到JCP。
看完书中一些基本内容后,带着疑问做了一些事,记录下来与大家分享。
一、Coin项目
官方网址 http://openjdk.java.net/projects/coin/
Project Coin
The goal of Project Coin is to determine what set of small language changes should be added to JDK 7. That list is:
- Strings in switch
- Binary integral literals and underscores in numeric literals
- Multi-catch and more precise rethrow
- Improved type inference(推断) for generic instance creation (diamond)
try
-with-resources statement- Simplified varargs method invocation
The previously selected features of collections support and unsigned literals have been deferred and will be reconsidered in JDK 8.
Coin(项目代号,由于不清楚翻译成"硬币"是否合理,因此暂时保留成英文)项目的目标是决定哪些语言特性的小范围变更将被添加到JDK 7中。变更列表如下:
- switch语句能用String,即switch(String)
- 二进制整数字面量以及数字字面量加下划线
- 多catch子句以及更精准的throw抛出
- 增强泛型实例创建时的类型推断(*)
- try-with-resources语句
- 简化的变长参数方法调用
后面的这段话对我没有任何意义,这里不翻译。
History
An open call for proposals period ran from February 27, 2009 through March 30, 2009. The nearly 70 proposal forms that were submitted received extensive discussion on the Project Coin mailing list, coin-dev.
After due consideration, five or so proposals were selected for inclusion in JDK 7; the list of selected proposals was subsequently updated. Discussion of the selected proposals continues on the coin-dev list.
This Project is sponsored by the Compiler Group.
公开的征求建议阶段在2009年2月27日---2009年3月30日(译者注:说明成富书中说的"短短1个月时间内"其实不准确,用一个月左右比较合适)。将近70份(由社区人员)提交的建议表单(被项目组收到后)在Coin项目邮件列表coin-dev中被广泛地讨论。
(在项目组成员)如期周全地考虑之后,5个左右的建议被选中加入到JDK 7中;选中的建议列表被顺序地更新。选中建议的套路继续在coin-dev列表中。
这个项目是由Compiler Group倡导发起的。
Community
- Mailing lists
- Bloggers
- Wiki
就在我写这篇文章之前,我查了一下关于JDK 9的相关内容,有兴趣的同学可以看看官方的这篇文章。
JDK 9
The goal of this Project is to produce an open-source reference implementation of the Java SE 9 Platform, to be defined by a forthcoming JSR in the Java Community Process.
The schedule and features of this release are proposed and tracked via the JEP Process, as amended by the JEP 2.0 proposal.
Schedule
2016/05/26 Feature Complete 2016/12/22 Feature Extension Complete 2017/01/05 Rampdown Start 2017/02/09 All Tests Run 2017/02/16 Zero Bug Bounce 2017/03/16 Rampdown Phase 2 2017/07/06 Final Release Candidate 2017/07/27 General Availability
The milestone(里程碑) definitions are the same as those for JDK 8, with the addition of:
- Feature Extension Complete — The date by which JEPs and small enhancements that have been granted extensions via the FC extension-request process must be integrated into the master forest.
Status
We are past the Feature Complete milestone, but that does not mean that the feature set is frozen. If you own a JEP or a small enhancement that is not yet complete then you can request an extension via the FC extension-request process.
Features
JEPs targeted to JDK 9, so far
102: Process API Updates 更新Process(进程)相关的APIs
110: HTTP 2 Client HTTP 2客户端 译者注:HTTP 2在2013年经过首测,只支持https://
143: Improve Contended Locking
158: Unified JVM Logging 统一的JVM日志
165: Compiler Control
193: Variable Handles
197: Segmented Code Cache 分段代码缓存
199: Smart Java Compilation, Phase Two
200: The Modular JDK
201: Modular Source Code
211: Elide Deprecation Warnings on Import Statements
212: Resolve Lint and Doclint Warnings
213: Milling Project Coin
214: Remove GC Combinations Deprecated in JDK 8
215: Tiered Attribution for javac
216: Process Import Statements Correctly
217: Annotations Pipeline 2.0
219: Datagram Transport Layer Security (DTLS)
220: Modular Run-Time Images
221: Simplified Doclet API 简化DocletAPIs 译者注:第一次听说Doclet,居然早就有了,惭愧
222: jshell: The Java Shell (Read-Eval-Print Loop) jshell,the java shell(REPL,读-算-打印 循环) 译者注:相比是逆天功能
223: New Version-String Scheme
224: HTML5 Javadoc HTML5 Javadoc 译者注:Javadoc生成的HTML支持HTML 5是历史潮流,不得不从
225: Javadoc Search
226: UTF-8 Property Files
227: Unicode 7.0
228: Add More Diagnostic Commands
229: Create PKCS12 Keystores by Default
231: Remove Launch-Time JRE Version Selection
232: Improve Secure Application Performance
233: Generate Run-Time Compiler Tests Automatically
235: Test Class-File Attributes Generated by javac
236: Parser API for Nashorn
237: Linux/AArch64 Port
238: Multi-Release JAR Files
240: Remove the JVM TI hprof Agent
241: Remove the jhat Tool 溢出jhat工具 译者注:虽然我没有用过jhat,不明觉厉
243: Java-Level JVM Compiler Interface
244: TLS Application-Layer Protocol Negotiation Extension
245: Validate JVM Command-Line Flag Arguments
246: Leverage CPU Instructions for GHASH and RSA
247: Compile for Older Platform Versions
248: Make G1 the Default Garbage Collector
249: OCSP Stapling for TLS
250: Store Interned Strings in CDS Archives
251: Multi-Resolution Images
252: Use CLDR Locale Data by Default
253: Prepare JavaFX UI Controls & CSS APIs for Modularization
254: Compact Strings
255: Merge Selected Xerces 2.11.0 Updates into JAXP
256: BeanInfo Annotations
257: Update JavaFX/Media to Newer Version of GStreamer
258: HarfBuzz Font-Layout Engine
259: Stack-Walking API
260: Encapsulate Most Internal APIs
261: Module System
262: TIFF Image I/O TIFF图像I/O
263: HiDPI Graphics on Windows and Linux
264: Platform Logging API and Service
265: Marlin Graphics Renderer
266: More Concurrency Updates 更多的并发编程内容更新
267: Unicode 8.0
268: XML Catalogs
269: Convenience Factory Methods for Collections
270: Reserved Stack Areas for Critical Sections
271: Unified GC Logging
272: Platform-Specific Desktop Features
273: DRBG-Based SecureRandom Implementations
274: Enhanced Method Handles
275: Modular Java Application Packaging
276: Dynamic Linking of Language-Defined Object Models
277: Enhanced Deprecation
278: Additional Tests for Humongous Objects in G1
279: Improve Test-Failure Troubleshooting
280: Indify String Concatenation
281: HotSpot C++ Unit-Test Framework HotSpot C++单元测试框架
282: jlink: The Java Linker
283: Enable GTK 3 on Linux
284: New HotSpot Build System
285: Spin-Wait Hints
287: SHA-3 Hash Algorithms
288: Disable SHA-1 Certificates
289: Deprecate the Applet API Applet APIs将会被标记为过时,Applet将正式告别曾经辉煌的历史舞台,被扔进历史的垃圾桶
290: Filter Incoming Serialization Data
292: Implement Selected ECMAScript 6 Features in Nashorn
294: Linux/s390x Port
295: Ahead-of-Time Compilation
这么多更新。。。眼花缭乱呐,以后又有的忙咯。。。
二、JCP组织
官网地址:https://www.jcp.org/en/home/index
|
JCP(Java Community Process)的定义如下:
The JCP is the mechanism for developing standard technical specifications for Java technology。
JCP是为Java技术发展标准技术规范而成立的这么一个组织。
三、OpenJDK与OracleJDK区分
如果读者平时使用Linux系统写代码,我想应该会知道OpenJDK。因为Linux系统一般都是默认预装OpenJDK的,即使在shell中下载依赖,也是只有OpenJDK选项的。
有了这种体验,其实就会产生疑惑:OpenJDK和OracleJDK这两个JDK有什么区别?
维基百科中关于OpenJDK内容:
OpenJDK原是Sun Microsystems公司为Java平台构建的Java开发环境(JDK)的开源版本,完全自由,开放源码。Sun Microsystems公司在2006年的JavaOne大会上称将对Java开放源代码,于2009年4月15日正式发布OpenJDK。甲骨文在2010年收购Sun Microsystem之后接管了这个项目。
2008年5月,Fedora 9及Ubuntu 8.04于发行版中发布OpenJDK,完整地基于自由及开放源代码的OpenJDK。
2008年6月,IcedTea 6(Fedora 9上的一个包版本的OpenJDK)宣布已通过Technology Compatibility Kit测试,可以称得上是一个完全兼容的Java 6的运行环境。
2008年7月12日,Debian接受了OpenJDK-6的不稳定版本,但目前情况已经稳定。OpenJDK也可以在openSUSE、Red Hat Enterprise Linux及其派生系统,如CentOS中找到。
自2008年7月,OpenJDK 7可以运行在Mac OS X和其他的BSD发行版。
2009年7月,Ubuntu 9.04中的二进制版本OpenJDK在Java SE 6 JCK中通过了所有的兼容性测试。
2015年12月,Google公司证实将于未来的新版Android以OpenJDK替换专属版权的JDK。
这里所谓的开源并不是说sun将所有的JDK看家内容都给开源了。OpenJDK主要用为帮助高手了解JDK实现机制,代码实现的,还有一部分商业闭源的内容作为公司的私货没有和咱们这群屌丝程序员分享,哦不,好像这里只有我是屌丝程序员。
形象点说呢,OpenJDK就是OracleJDK的私生子(bastard,美剧Game of Thrones中John Snow老是被外人这么无情地嘲讽,心疼雪诺3秒钟)。