package org.mutabilitydetector.runtime;

import org.mutabilitydetector.AnalysisResult;
import org.mutabilitydetector.AnalysisSession;
import org.mutabilitydetector.IsImmutable;
import org.mutabilitydetector.ThreadUnsafeAnalysisSession;
import org.mutabilitydetector.AnalysisSession.RequestedAnalysis;
import org.mutabilitydetector.locations.Dotted;

public final class RuntimeAnalysisExample {
    private final AnalysisSession analysisSession = ThreadUnsafeAnalysisSession.createWithCurrentClassPath();

    private void run(Object requiredToBeImmutable) {
        Dotted runtimeClassOfGivenObject = Dotted.fromClass(requiredToBeImmutable.getClass());
		RequestedAnalysis requestedAnalysis = analysisSession.resultFor(runtimeClassOfGivenObject);
        AnalysisResult result = requestedAnalysis.result;
        
        if(result.isImmutable.equals(IsImmutable.IMMUTABLE)) {
            // rest safe in the knowledge the class is 
        	// immutable, share across threads with joyful abandon
        } else if(result.isImmutable.equals(IsImmutable.NOT_IMMUTABLE)) {
            // be careful here: make defensive copies, 
        	// don't publish the reference, 
        	// read Java Concurrency In Practice right away!
        }
    }
    
    public static void main(String[] args) {
        new RuntimeAnalysisExample().run(makeParam());
    }
    
    private static Object makeParam() {
        return new java.util.Date();
    }

}

@@ -263,360 +263,932 @@
 tor.
-AnalysisSession.RequestedAnalysis;%0Aimport org.mutabilitydetector.locations.Dotted;%0A%0Apublic final class RuntimeAnalysisExample %7B%0A    private final AnalysisSession analysisSession = ThreadUnsafeAnalysisSession.createWithCurrentClassPath();%0A%0A    private void run(Object requiredToBeImmutable) %7B%0A        Dotted runtimeClassOfGivenObject = Dotted.fromClass(
+locations.Dotted;%0A%0Apublic final class RuntimeAnalysisExample %7B%0A    /*%0A     * Create an instance of AnalysisSession. This is the object%0A     * that can tell you if a class is immutable or not.%0A     * %0A     * Note there is only currently a thread unsafe implementation, %0A     * however, it's intended there is no static state. So there %0A     * should be no problem in creating one per thread. Since%0A     * analysisSessions cache their result, this will result in a %0A     * cache miss per thread. This should amortize over time.%0A     */%0A    private final AnalysisSession analysisSession = ThreadUnsafeAnalysisSession.createWithCurrentClassPath();%0A%0A    private void run(Object requiredToBeImmutable) %7B%0A        %0A        /* %0A         * Even though the parameter is defined to be java.lang.Object %0A         * we are interested in what the actual class is, at runtime.%0A         */%0A        Class%3C?%3E actualClassOfParameterAtRuntime = 
 requ
@@ -1219,154 +1219,448 @@
 ss()
-)
 ;%0A
-%09%09RequestedAnalysis requestedAnalysis = analysisSession.resultFor(
+        %0A        /*%0A         * Convert class object into its a representation of its%0A         * dotted class name. %0A         */%0A        Dotted dottedClassName = Dotted.fromClass(actualClassOfParameterAtRuntime);%0A        %0A        /*%0A         * Request an analysis of the 
 runtime
-C
+ c
 lass
-OfGivenObject);%0A        AnalysisResult result = requestedAnalysis
+, to discover if this%0A         * instance will be immutable or not. %0A         */%0A        AnalysisResult result = analysisSession.resultFor(dottedClassName)
 .res
@@ -1664,24 +1664,16 @@
 result;%0A
-        
 %0A       
@@ -1675,16 +1675,17 @@
       if
+ 
 (result.
@@ -1742,17 +1742,32 @@
        /
-/
+*%0A             *
  rest sa
@@ -1798,17 +1798,16 @@
 class is
- 
 %0A       
@@ -1807,19 +1807,22 @@
         
-%09//
+     *
  immutab
@@ -1866,16 +1866,32 @@
 abandon%0A
+             */%0A
         
@@ -1899,16 +1899,17 @@
  else if
+ 
 (result.
@@ -1970,17 +1970,32 @@
        /
-/
+*%0A             *
  be care
@@ -2026,17 +2026,16 @@
  copies,
- 
 %0A       
@@ -2035,19 +2035,22 @@
         
-%09//
+     *
  don't p
@@ -2070,17 +2070,16 @@
 ference,
- 
 %0A       
@@ -2083,11 +2083,14 @@
     
-%09//
+     *
  rea
@@ -2132,16 +2132,32 @@
 t away!%0A
+             */%0A
         
@@ -2160,28 +2160,24 @@
     %7D%0A    %7D%0A
-    
 %0A    public 
@@ -2271,20 +2271,16 @@
 ;%0A    %7D%0A
-    
 %0A    pri

Try to make example more readable.