Subscribed unsubscribe Subscribe Subscribe

Kengo's blog

Technical articles about original projects, JVM, Static Analysis and JavaScript.

jitescript reading

javascript java

 Reading OSS gives you new experience and discovery. It is just like exploring a library you don't know well. I explored the jitescript today, so I note how to explore and my impressions about them.

what is the jitescript?

 The jitescript is a Java API for Bytecode. I will not use this because I can use the ObjectWeb ASM directly, but its interface and static methods are interesting.
 jitescriptはJVMバイトコードを作るためのJavaAPIです。私はObjectWeb ASMを使えるのできっと使わないと思いますが、インタフェースやstaticメソッド群が大変興味深かったです。

creating Eclipse project to read

$ git clone
$ cd jitescript
$ mvn eclipse:eclipse -DdownloadSources -DdownloadJavadocs

how to shorten our Java codes

 What surprised me is the 'the pre-constructor style'. Can you explain '{{ ... }}' in this code?
 最も驚いたのは「プレコンストラクタスタイル」と呼ばれているコードの書き方です。次のコードが使っている'{{ ... }}'を説明できますか?

JiteClass jiteClass = new JiteClass(className, superClass, new String[]{}) {{

jitescript/src/test/java/me/qmx/jitescript/ at master · qmx/jitescript · GitHub

 This code uses instance initializer which runs between field initialization and constructor.
 これはフィールド初期化とコンストラクタの間に実行されるinstance initializerを利用した書き方です。

 I feel it's overdone a little, but very interesting. How to shorten Java codes is eternal theme for us.