Thursday, October 1, 2015

Oracle Java JDK 7 Source Files

Introduction

              When you are debugging your Java program in your favourite IDE (mine is Eclipse) you sometimes happen to debug into the Java class libraries. This is not bad per se, usually from looking at the code you learn something about the class library's implementation and why it does not do what you might have expected.
              But often you end up in Java class libraries, where there is debug information attached in the class files (at least those shipped with the JDK) but no source is present in src.zip. Official statement is that src.zip only contains publicly documented classes (i. e. the same ones that are covered by the official Javadoc). But since JDK7 is based on OpenJDK, and almost every class in JDK7 is identical to the one shipped with or generated by OpenJDK, why not take the classes from OpenJDK instead?
That's what I was doing – and it cost me approximately one week time to find all classes in the huge code base of OpenJDK, find the scripts that generated those classes that were not included and create an ant script to automatically scavenge those files from the published OpenJDK resources. For updated JDK7 versions like jdk7u1 there are no official OpenJDK source downloads available, but they are included in the JDK7 Mercurial Repository.


























            Ketika Anda debugging program Java Anda dalam IDE favorit Anda (saya adalah Eclipse) Anda kadang-kadang terjadi untuk debug ke perpustakaan kelas Java. Ini tidak buruk per se, biasanya dari melihat kode Anda belajar sesuatu tentang pelaksanaan kelas perpustakaan dan mengapa itu tidak melakukan apa yang Anda mungkin telah diharapkan.

              Tapi sering Anda berakhir di perpustakaan kelas Jawa, di mana ada debug informasi yang melekat dalam file kelas (setidaknya mereka dikirim dengan JDK) tapi ada sumber hadir dalam src.zip. Pernyataan resmi adalah bahwa src.zip hanya berisi kelas didokumentasikan publik (yaitu orang-orang yang sama yang tercakup oleh Javadoc resmi). Tapi karena JDK7 didasarkan pada OpenJDK, dan hampir setiap kelas di JDK7 identik dengan satu dikirimkan dengan atau yang dihasilkan oleh OpenJDK, mengapa tidak mengambil kelas dari OpenJDK bukan?

          Itulah apa yang saya lakukan - dan harganya sekitar satu minggu waktu untuk menemukan semua kelas di basis kode besar OpenJDK, menemukan script yang dihasilkan kelas-kelas yang tidak termasuk dan membuat skrip semut untuk secara otomatis mengais file-file dari diterbitkan sumber OpenJDK. Untuk update JDK7 versi seperti jdk7u1 tidak ada resmi download sumber OpenJDK tersedia, tetapi mereka termasuk dalam JDK7 Mercurial Repository.
  
 



Artikel Terkait

Esok Adalah Misteri, Manusia Hanya Merencanakan Alloh Yang AKan Menakdirkan


EmoticonEmoticon