bolson: (Default)
Java's generics are hard. And I think they're defined wrong.
HashMap<String,String>[] arrayOfHashMap; // Ok, I can declare this
arrayOfHashMap[0] = new HashMap<String,String>(); // this compiles just fine
HashMap<String,String> instanceOfHashMap = arrayOfHashMap[0]; // this works fine in code too
arrayOfHashMap = new HashMap<String,String>[]; // but this always is a compiler error!
arrayOfHashMap = new HashMap[]; // and this is a warning! I can't win!

This is clearly a bug in the design of the language.

Also, ObjectInputStream.readObject(), which returns Object, appears to have no way of assigning to a templated type without warning without adding the annotation @SuppressWarnings({"unchecked"}) to the function. Hmpf. Shoulda stuck with Java 1.4
bolson: (Default)
Developing a Java Servlet webapp with DB back-end in parallel for portability between PostgreSQL, MySQL and Derby (and I'd be using Oracle too if their free demo worked on Mac). I don't know what it is about these exercises I find so engaging, but I do it anyway.

Profile

bolson: (Default)
bolson

September 2017

S M T W T F S
     12
3456789
1011121314 1516
17181920212223
24252627282930

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 27th, 2025 12:50 am
Powered by Dreamwidth Studios