Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

AA 4.0.0 @Trace code is not generated #1750

Description

@chpasha

Is @trace Annotation working in 4.0.0? Somehow I see not effect
this is original class

@EBean
class DbConcurrentAccessWorker
{

    @Trace(tag = PlaygroundApplication.TAG, level = AndroidConstants.LOG_WARN)
    @Background(id = "worker")
    public void doWork()
    {
        while (Thread.currentThread().isAlive())
        {
            if (random.nextBoolean())
            {
                writeToDb();
            }
            else
            {
                readFromDb();
            }
        }
        Ln.w("Stopping");
    }

    @Trace(tag = PlaygroundApplication.TAG, level = AndroidConstants.LOG_WARN)
    void writeToDb()
    {

    }

    @Trace(tag = PlaygroundApplication.TAG, level = AndroidConstants.LOG_WARN)
    void readFromDb()
    {

    }
}

and this is what I get after aa processing

public final class DbConcurrentAccessWorkerImpl
    extends DbConcurrentAccessWorker
{
    private Context context_;

    private DbConcurrentAccessWorkerImpl(Context context) {
        context_ = context;
        init_();
    }

    public static DbConcurrentAccessWorkerImpl getInstance_(Context context) {
        return new DbConcurrentAccessWorkerImpl(context);
    }

    private void init_() {
    }

    public void rebind(Context context) {
        context_ = context;
        init_();
    }

    @Trace(tag = "DE.TOMCOM.FRAMEWORK.PLAYGROUND", level = 5)
    @Override
    public void doWork() {
        BackgroundExecutor.execute(new BackgroundExecutor.Task("worker", 0L, "") {

            @Override
            public void execute() {
                try {
                    DbConcurrentAccessWorkerImpl.super.doWork();
                } catch (final Throwable e) {
                    Thread.getDefaultUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
                }
            }
        }
        );
    }
}

the first strange thing is why @trace is copied to target class. the second - there is no tracing at all.

Activity

  1. WonderCsabo commented on Apr 16, 2016

    @WonderCsabo
    Member

    You have to turn on the @Trace annotation explicitely:

    apt {
      arguments {
        trace "true" // or trace variant.name.toLowerCase().endsWith("debug") ? "true" : "false"
      }
    }

    I updated the wiki.

    Copying this annotation in any case is a bug, thanks for reporting! I will fix that soon.

  2. chpasha commented on Apr 16, 2016

    @chpasha
    Author

    great, thanks

  3. self-assigned this
    on Apr 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions