昨日開催されたJava読書会のフォローアップ(宿題や調査事項)
コンパイラでのインライン展開
Eclipseの内蔵コンパイラはprivateメソッドをインライン展開するオプションがあるという話しが出ていました。そこで、Eclipse(3.3)をインストールしてコンパイラ設定を調べてみたが、そのような項目を見い出せませんでした。
JNIでネイティブ側から例外をスローするサンプル
以前Webに書いていたJNIのページに例外をスローするサンプルを追記しました。
http://www.alles.or.jp/~torutk/oojava/maneuver/2001/jni/jni.html
Swingでイベント・ディスパッチ・スレッドが死んでも新しいスレッドが生成される?
JDK 6で試したところでは、RuntimeExceptionを吐いてもGUIは機能し続けており、スレッドIDがどんどん更新されているのが分かりました。
import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class ExceptionOnEDT extends JFrame { public ExceptionOnEDT() { deathButton = new JButton("Cause RuntimeException"); deathButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { System.out.println( "Current thread ID is " + Thread.currentThread().getId() ); throw new RuntimeException("death button"); } } ); add(deathButton); } public static final void main(final String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { ExceptionOnEDT frame = new ExceptionOnEDT(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } } ); } private JButton deathButton; }
NonWildTypeArgumentsの使用例
これからの予定