Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fields on parceler breaks Incremental annotation processor. #376

Open
doniwinata0309 opened this issue Oct 2, 2019 · 3 comments
Open

Fields on parceler breaks Incremental annotation processor. #376

doniwinata0309 opened this issue Oct 2, 2019 · 3 comments

Comments

@doniwinata0309
Copy link

Hi, i found some cases where parceler breaks the incremental compilation.
I have sample project for this issue:

Parceler-test.zip

There are 3 modules: app (application module), depends to: basemodule and mylibrary1.

Supposed on basemodule we have these:

package com.test.basemodule;

import org.parceler.Parcel;

@Parcel
public class FieldClassParcel {
}

and


import org.parceler.Parcel;

@Parcel
public class BaseClassParcel {
    //it working fine if private, but protected will cause all files recompiled
    protected FieldClassParcel testField;
}

Those two class used on app module:

public class ExampleParcel extends BaseClassParcel {

    private final String message;

    @ParcelFactory
    public static ExampleParcel create(String message) {
        return new ExampleParcel(message);
    }

    public ExampleParcel(String message) {
        this.message = message;
    }

    public String getMessage(){
        return message;
    }
}

Those classes will breaks incremental annotation processor on app module.

Step to repro:

  1. Unzip and open the project.
  2. Run clean build (./gradlew clean app:assembleD)
  3. Change public ABI on LibClass.java
    public void method1changed2(){

    }
    //uncomment this for test public ABI change (incremental), or change the method name `method1`)

//    public void method2(){
//
//    }
}
  1. Run the project and print the compiled class during kapt process with this command:
    ./gradlew app:assembleD --debug --Pkapt.verbose=true > log1.txt

  2. The result should be similar with file: incremental-test1.txt on attached file.
    the part i: [kapt] Java source files: on module app should contains lot of files.

  3. Change BaseClassParcel field to private

public class BaseClassParcel {
    //it working fine if private, but protected will cause all files recompiled
    private FieldClassParcel testField;
}
  1. clean the project, and repeat step 1-5. The result of this test will be similar to incremental-test2.txt. the part i: [kapt] Java source files: should be empty in this test.

The files that recompile will be all java source file in the module, including another annotation processor. For a module with large annotated files it taking so long to build.

Hopefully this is clear enough to explain our issue, let me know if you need additional information.
Thanks.

@doniwinata0309
Copy link
Author

I also reporting here:
https://youtrack.jetbrains.com/issue/KT-34340
we can use kotlin 1.3.70 to spot the files that causing full recompilation.

Seems to be those classes always extending the class from another module, and generating:
$$PackageHelper. This fails the incremental compilation.

@johncarl81
Copy link
Owner

Hmm, any ideas on a fix?

@doniwinata0309
Copy link
Author

I manage to fix this by moving affected class into the same module, or change the field into public (instead protected).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants