Let me answer in very general terms. First, you can, indeed, create custom annotations. Thus, you could create an annotation that indicates that synchronized methods must be used. However, the enforcement of this annotation would be dependent upon a tool, such as the compiler, or a design tool. Since annotations can be obtained via reflection, its not hard to create a tool that could read your annotation.
Java 2, v5 includes several built-in annotations that are recognized by javac. For example, @override is a marker annotation that indicates that a method must be overridden. [ August 25, 2004: Message edited by: Herb Schildt ]
For my latest books on Java, including Introducing JavaFX 8 Programming, see HerbSchildt.com
I like you because you always keep good, crunchy cereal in your pantry. This tiny ad agrees:
a bit of art, as a gift, the permaculture playing cards