Java has had annotations since version 5, which wikipedia says is 2004, and they are also heavily used in C#, where they are called attributes. They are heavily used in many places, notably in Hibernate, Spring and JUnit/TestNG. Introducing custom attributes/annotations is a very powerful way of extending a language.
It seems to me that Cache method keywords are the most similar thing to Java method annotations. Expanding them to match annotations would require a mechanism to introduce custom method keywords, to be able to fetch keywords for a method at runtime, and also to have custom keywords on properties, and for keywords to have arbitrary objects as values instead of being limited to strings. But I don't think it would be easy to do.
if the package A uses package's C version 0.0.1, and package B uses package's C version 0.1.0 (which behaves differently and is not back-and-forth compatible!)
In the Maven/Java world, there is a mechanism to exclude the dependency of Package A on Package C from Package A's dependency list. This results in both Package A and B to use the same version of Package C. If Package A really cannot use the new version of Package C, then you have no choice but to make a patched version of Package A, but at least you are alerted to the potential conflict.
Log in or create a new account to continue