How can weakCompareAndSet fail spuriously if it is implemented exactly like compareAndSet?

There is a difference between implementation and specification… Whilst on a particular implementation there may not be much point in providing different implementations, future implementations perhaps on different hardware may want to. Whether this method carries its weight in the API is debatable. Also the weak methods do not have happens-before ordering defined. The non-weak … Read more

Javadoc in JUnit test classes?

I use Javadoc in my testing a lot. But it only gets really useful when you add your own tag to your javadoc. The main objective here is to make the test understandable for other developers contributing to your project. And for that we don’t even need to generate the actual javadoc. /** * Create … Read more

Javadoc @return tag comment duplication necessary?

If you (like me) really don’t like to violate DRY, then this is one of the most important lines of the javadoc ref: It is possible to have a comment with only a tag section and no main description. (@see http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/javadoc.html#tagsection) So it is perfectly valid (and working) for simple methods to write your javadoc … Read more

How to make generated classes contain Javadoc from XML Schema documentation

I’ve never been able to get regular xsd:documentation to be placed in the java source except if and only if it was a Complex Type. Documentation for elements, simple types, etc are ignored. So, I end up using jxb:javadoc. To do so, include the definition of xmlns:jxb=”http://java.sun.com/xml/ns/jaxb” in your <xsd:schema> element. Add a child to … Read more

How do you escape curly braces in javadoc inline tags, such as the {@code} tag

Not so much an answer as a workaround, but if you replace {@code …} with the old version <code>…</code> it will render curly braces how you expect. <code>{person} == ${person}</code> Unfortunately, this breaks angle brackets, so to the original question you need to escape these: <code>&lt;custom:meatball color=”&lt;%= Meatball.RED %&gt; nincompoop=”${person}” /&gt;</code> You can even cheat … Read more