001    package edu.rice.cs.cunit.instrumentors;
002    
003    import edu.rice.cs.cunit.instrumentors.record.CompactSynchronizedBlockStrategy;
004    import edu.rice.cs.cunit.instrumentors.record.CompactRecordThreadExitStrategy;
005    import edu.rice.cs.cunit.instrumentors.record.CompactRecordThreadStartStrategy;
006    import edu.rice.cs.cunit.instrumentors.util.CompoundStrategy;
007    import edu.rice.cs.cunit.instrumentors.util.ScanForObjectCtorStrategy;
008    
009    import java.util.List;
010    
011    /**
012     * Compact compound instrumentor for instrumenting regular classes for recording.
013     * @author Mathias Ricken
014     */
015    public class CompoundCompactRecordStrategy extends CompoundStrategy {
016        /**
017         * Create a new compound instrumentor for instrumenting regular classes.
018         * @param parameters parameters for the instrumentors
019         */
020        public CompoundCompactRecordStrategy(List<String> parameters) {
021            super(parameters);
022            getCombined().add(new SynchronizedMethodToBlockStrategy()); // convert synchronized methods to blocks
023            getCombined().add(new CompactSynchronizedBlockStrategy()); // instrument synchronized(o) { }
024            getCombined().add(new CompactRecordThreadStartStrategy()); // instrument java.lang.Thread.start for recording
025            getCombined().add(new CompactRecordThreadExitStrategy()); // instrument java.lang.Thread.exit for recording
026            getCombined().add(new ScanForObjectCtorStrategy()); // scan for new Object()
027            getCombined().add(new AssignThreadIDStrategy()); // add java.lang.Thread.$$$threadID$$$ field and initialize in ctor
028        }
029    }