Monday, June 22, 2009

Having problems with Adium and Yahoo IM?

Yahoo has changed its login protocol, breaking a number of third party IM clients including Adium.

The Adium team has released 1.3.5.rc1 which solves the issue. Check it out. If you use Adium 1.4 beta, upgrade to beta7.

Hope this will save you some time.

Thursday, April 30, 2009

Java generics end of mystery

Remember my puzzlement in front of http://blog.emmanuelbernard.com/2009/04/java-generics-mystery.html?

I usually try to make sense of the unknown type by looking at what should be allowed when two incompatible types are used as the unknown type, and then using the generic type using the unknown type as a reference to a known type to see what incorrect things can be done through the reference. If the assignment your questioning was allowed, you would be able to add two incompatible ConstraintValidators to the validatedAddresses as in:

class Address {}
class Person {}

// A set of ConstraintValidator for Address
Set<ConstraintValidator<Address>> validatedAddresses =
    new HashSet<ConstraintValidator<Address>>();

// A set of ConstraintValidator of a single unknown type (*)
Set<ConstraintValidator<?>> validatedThings = validatedAddresses;

ConstraintValidator<Address> a;
ConstraintValidator<Person> p;

// A ConstraintValidator of unknown type, ? = Address
ConstraintValidator<?> thingA = a;

// A ConstraintValidator of unknown type, ? = Person
ConstraintValidator<?> thingP = p;

// This would be allowed if (*) was a valid assignment, which puts a ConstraintValidator<Person> in a set of ConstraintValidator<Address>

validatedThings.add(thingP);


What I missed initially is that I cannot add new (and potentially heterogeneous) elements in Set<?> or Set<? extends X>, but I am free to add elements in Set<X<?>>:


Set<A<?>> c1 = new HashSet<A<?>>();
c1.add( new A<B>() );
c1.add( new A<C>() );

Set<? extends A<?>> c1 = new HashSet<A<?>>();
c1.add( new A<B>() ); <-- compilation error
c1.add( new A<C>() ); <-- compilation error

While the first example compiles, the second does not.

So to answer my initial mystery, I need to use the <? extends X<?>> approach (thanks Vivien for pointing that out).

Set<? extends ConstraintValidator<?>> valiatedThings = ...;

Wednesday, April 29, 2009

Java generics mystery

Here is a puzzle for Generics gurus.

Can somebody explain why

Set<Address> addresses = new HashSet<Address>();
Set<?> things = addresses;

compiles but

Set<ConstraintValidator<Address>> validatedAddresses = 
    new HashSet<ConstraintValidator<Address>>();
Set<ConstraintValidator<?>> validatedThings =
    validatedAddresses;

does not compile?

More specifically, the assignment on the second line breaks.

Monday, April 20, 2009

Oracle is buying Sun: best quotes of the day

Alex Miller: "Next version of Java will be Java SE 7.0.0.0.17832"

Emmanuel Bernard: "The day an Oracle swallows the Sun and in front the Business Machine. No kidding it's a Titans fight."

Max Andersen: Thinking when Orsun will introduce a String in Java that says null == ""

Alexis MP: "Checking my blog posts tagged with "oracle". No need to MarcF' them ;)"

Bruno Georges: "yes, this came out of the Blue :-)"

Stomp Rasta: "There'll have Java SE 7 Lite (300 MB) and Java SE 7 Full (600 MB). And we'll have to pay for each VM installed."

Add your own...

Tuesday, April 14, 2009

Les Cast Codeurs Podcast is born

I have just started a new podcast with a few French open source activists. All about Java, all in French. If you know French, read on ; otherwise, well... learn :)

Les Cast Codeurs Podcast est dans les bacs!

Le podcast en français dans le code sur Java par Emmanuel Bernard (JBoss, Hibernate), Guillaume Laforge (SpringSource, Groovy), Antonio Goncalves (freelance, auteur), Vincent Massol (XWiki, Maven).

Restez informés sur les sujets brûlants de l'industrie Java. Plongez sur un sujet précis avec l'interview de l'épisode. Supportez les radotages de vos hôtes.

Ecoutez-nous et faites passer le message autour de vous !

web: http://lescastcodeurs.com
itunes: http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=312239675
podcast syndication: http://lescastcodeurs.com/podcast-rss
blog feed: http://lescastcodeurs.com/feed/
feedback: commentaire@lescastcodeurs.com

Friday, April 3, 2009

Podcast on Bean Validation lastest PFD

I have recently been interviewed by Kenneth Rimple for the Chariot TechCast.

In this podcast, we speak to JBoss's Emmanuel Bernard on the future of validation using JSR-303, the Bean Validation framework. JSR-303 aims to provide an annotation-driven mechanism to mark plain old java beans with annotations, such as @NotNull, @Min, @Max, and can support custom validation annotations as well.

JSR-303 is part of the Java EE 6 suite of JSRs and will be used automatically out of the box by frameworks such as JSF 2.0. Emmanuel also goes into some detail about the current state of Hibernate Search.

You can listen to it here or register to iTunes.

Monday, February 2, 2009

Go us

I am usually not the kind of person that likes patting one another on the back. I am always prompt to point out what's left to be done rather that what has been done. But reading Sacha's newsletter to our customer made me proud.

JBoss AS 5 has had record downloads. People were eager to get AS 5 out, so were we.

A fully TCK compliant OpenJDK based Java SE 6 made it into Red Hat Enterprise Linux 5.3. As far as I know, this is the first fully Open Source Java SE implementation certified against the TCK (might be wrong, so don't quote me on that).

JSR 299 (ex Web Beans, newly named Java Contexts and Dependency Injection) is now in its latest public draft review. Gavin and the EG have worked *very* hard to address the EE 6 expert group concerns and pave the road to include this technology in Java EE 6.

The JSR-299 reference implementation is in pretty good shape and releases steadily. I am personally impressed by the quality of the reference guide (alpha 2 here).

RESTEasy, the JBoss JAX-RS implementation is now fully certified and has reached 1.0. I know Bill Burke has been waiting to grab and pass the TCK for a long time.

Bean Validation public draft is out. I also worked very hard too, damn it! ;) We had a lot of positive feedbacks from you guys in our forum. If you want to look at the cutting edge, I release spec snapshots quite regularly on the hibernate-dev mailing list. The latest work includes finalized JPA and JSF integration, type-safe constraint validators, XML support and clearer names.

Also the reference implementation is developped in the open. We hope to get a first milestone release this week or the next one: we did add cool new features you requested in the spec recently (like type-safe validators) and we want to have them in the RI.

A little while ago, Navin released JBoss Cache Searchable 1.0 GA which is based on Hibernate Search. Good stuff: a full-text searchable distributed object cache.

A cool project named JBoss Negociation brings desktop Single Sign On to web apps. Basically, by login to your Windows 2000/XP machine that is secured by an Active Directory and then go to any of the kerberos aware web applications that are hosted by your company in the network, you will have seamless SSO. Their latest GA is here.

That's just my selection of January news. Who said JBoss was sleeping ;) Alright, enough self congratulation and back to work.