/**
* NOTE: Without this method present and returning LanguageVersion.JAVA_1_5,
* Javadoc will not process generics because it assumes LanguageVersion.JAVA_1_1
* @return language version (hard coded to LanguageVersion.JAVA_1_5)
*/
public static LanguageVersion languageVersion() {
return LanguageVersion.JAVA_1_5;
}
From Understanding Weak References, by Ethan Nicholas:
... An object which is only weakly reachable (the strongest references to it are WeakReferences) will be discarded at the next garbage collection cycle, but an object which is softly reachable will generally stick around for a while.
@SafeVarargs
Is a cure for the warning: [unchecked] Possible heap pollution from parameterized vararg type Foo.
Is part of the method's contract, hence why the annotation has runtime retention.
Is a promise to the caller of the method that the method will not mess up the heap using the generic varargs argument.
Two numerically equivalent BigDecimals will map to the same Double, and get the same hashCode. Some BigDecimal values that are very slightly different will get the same hashcode because of double rounding
/**
* Called when a null model is about to be retrieved in order to allow a subclass to provide an
* initial model.
* <p>
* By default this implementation looks components in the parent chain owning a
* {@link IComponentInheritedModel} to provide a model for this component via
* {@link IComponentInheritedModel#wrapOnInheritance(Component)}.
* <p>
* For example a {@link FormComponent} has the opportunity to instantiate a model on the fly
* using its {@code id} and the containing {@link Form}'s model, if the form holds a
* {@link CompoundPropertyModel}.
*
* @return The model
*/
protected IModel<?> initModel()
{
IModel<?> foundModel = null;
// Search parents for IComponentInheritedModel (i.e. CompoundPropertyModel)
for (Component current = getParent(); current != null; current = current.getParent())
{
// Get model
// Don't call the getModel() that could initialize many in between
// completely useless models.
// IModel model = current.getDefaultModel();
IModel<?> model = current.getModelImpl();
if (model instanceof IWrapModel && !(model instanceof IComponentInheritedModel))
{
model = ((IWrapModel<?>)model).getWrappedModel();
}
if (model instanceof IComponentInheritedModel)
{
// return the shared inherited
foundModel = ((IComponentInheritedModel<?>)model).wrapOnInheritance(this);
setFlag(FLAG_INHERITABLE_MODEL, true);
break;
}
}
// No model for this component!
return foundModel;
}
W. Scholz, T. Thüm, S. Apel, and C. Lengauer. Proceedings of the 15th International Software Product Line Conference, Volume 2, page 7:1--7:8. New York, NY, USA, ACM, (2011)