24 ms·
While I'm really glad to see Java (the language) slowly evolving in a positive direction, and it might bring me some joy at work if/when we switch to 7, I can't
by ldh 17y ago
While I'm really glad to see Java (the language) slowly evolving in a positive direction, and it might bring me some joy at work if/when we switch to 7, I can't imagine starting new projects in Java anymore if I had my way. Once you've been exposed to the much nicer languages thriving on the JVM now, it's hard to get excited about Java anymore.
I mean, I can't see this sort of thing as being very enjoyable to write all the time.
JComboBox combo = new JComboBox();
MethodHandle handle = MethodHandles.lookup().findVirtual(JComboBox.class, "setModel", MethodType.make(void.class, ComboBoxModel.class));
handle.invoke(combo, new CustomComboModel());
- Periodic 17y ago> With that new bytecode keyword, we can call method only known at runtime. I don't know much about Java, but it sounds like they're extending the bytecode to better support those alternate languages which currently are sort of hack-ish.
- lukev 17y agoI think these dynamic features are actually intended for alternative JVM languages. If they're exposed via the Java reflection API at all, it's incidental to their actual purpose.
- jimbokun 17y agoI think they could also be useful in creating little DSLs, building parser combinators, etc.