package com.example.hugo;

import android.app.Activity;
import android.os.Bundle;
import android.os.SystemClock;
import android.util.Log;
import android.widget.TextView;
import hugo.weaving.DebugLog;

public class HugoActivity extends Activity {
  @Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    TextView tv = new TextView(this);
    tv.setText("Check logcat!");
    setContentView(tv);

    printArgs("The", "Quick", "Brown", "Fox");

    Log.i("Fibonacci", "fibonacci's 4th number is " + fibonacci(4));

    Greeter greeter = new Greeter("Jake");
    Log.d("Greeting", greeter.sayHello());

    Charmer charmer = new Charmer("Jake");
    Log.d("Charming", charmer.askHowAreYou());

    startSleepyThread();
  }

  @DebugLog
  private void printArgs(String... args) {
    for (String arg : args) {
      Log.i("Args", arg);
    }
  }

  @DebugLog
  private int fibonacci(int number) {
    if (number <= 0) {
      throw new IllegalArgumentException("Number must be greater than zero.");
    }
    if (number == 1 || number == 2) {
      return 1;
    }
    // NOTE: Don't ever do this. Use the iterative approach!
    return fibonacci(number - 1) + fibonacci(number - 2);
  }

  private void startSleepyThread() {
    new Thread(new Runnable() {
      private static final long SOME_POINTLESS_AMOUNT_OF_TIME = 50;

      @Override public void run() {
        sleepyMethod(SOME_POINTLESS_AMOUNT_OF_TIME);
      }

      @DebugLog
      private void sleepyMethod(long milliseconds) {
        SystemClock.sleep(milliseconds);
      }
    }, "I'm a lazy thr.. bah! whatever!").start();
  }

  static class Greeter {
    private final String name;

    @DebugLog
    Greeter(String name) {
      this.name = name;
    }

    @DebugLog
    public String sayHello() {
      return "Hello, " + name;
    }
  }

  @DebugLog
  static class Charmer {
    private final String name;

    Charmer(String name) {
      this.name = name;
    }

    public String askHowAreYou() {
      return "How are you " + name + "?";
    }
  }
}

@@ -1640,16 +1640,28 @@
 );%0A  %7D%0A%0A
+  @DebugLog%0A
   static
@@ -1673,24 +1673,24 @@
 s Greeter %7B%0A
-
     private 
@@ -1709,30 +1709,16 @@
  name;%0A%0A
-    @DebugLog%0A
     Gree
@@ -1775,28 +1775,15 @@
     
-@DebugLog%0A    public
+private
  Str

Update example to have synthetics when compiled