com.surelogic
Annotation Type Starts


@Documented
@Target(value={CONSTRUCTOR,METHOD})
public @interface Starts

Declares what threads, if any, are started, i.e., by Thread.start(), during the execution of the method or constructor to which this annotation is applied. We refer to this as the thread effects of the method or constructor.

Presently this annotation has only one legal form, @Starts("nothing"), that indicates that the method/constructor does not cause any threads to be started. It is a modeling error if value() is not "nothing".

Methods that override a method annotated with @Starts("nothing") must also be explicitly annotated @Starts("nothing"). It is a modeling error if they are not.

Semantics:

Execution of the annotated method, or any methods that it calls, transitively, do not cause start() to be invoked on any java.lang.Thread object.

Examples:

A method called init that promises to start no threads. Because init() calls the method internalInit() that method must also promise to start no threads.
 class Example {
   private Object state;
 
   @Starts("nothing")
   public void init() {
     internalInit();
   }
 
   @Starts("nothing")
   private void internalInit() {
     state = new Object();
   }
 }
 

Javadoc usage notes:

This annotation may placed in Javadoc, which can be useful for Java 1.4 code which does not include language support for annotations, via the @annotate tag.
 class Example {
   private Object state;
 
   /**
    * @annotate Starts("nothing")
    */
   public void init() {
     internalInit();
   }
 
   /**
    * @annotate Starts("nothing")
    */
   private void internalInit() {
     state = new Object();
   }
 }
 


Required Element Summary
 String value
          Must be "nothing".
 

Element Detail

value

public abstract String value
Must be "nothing". Additional values are reserved for future use.

The value of this attribute must conform to the following grammar (in Augmented Backus–Naur Form):

 value = "nothing"
 



Copyright © 2011 Surelogic, Inc.. All Rights Reserved.