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

Implement workaround for MCOMPILER-503 #149

Merged
merged 2 commits into from
Aug 2, 2022

Conversation

rickie
Copy link
Member

@rickie rickie commented Jul 7, 2022

Currently used MCOMIPLER-XXX as we first need to create the ticket, that is a WIP.

@rickie rickie requested review from Stephan202 and Badbond July 7, 2022 07:28
@Stephan202 Stephan202 force-pushed the rossendrijver/annotation_processor_path_work_around branch from 4f1d397 to 716b003 Compare July 31, 2022 19:41
Copy link
Member

@Stephan202 Stephan202 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased and added a commit. Will approve once we've updated the ticket reference.

pom.xml Outdated
Comment on lines 773 to 789
<!-- This is a dependency of some Error Prone
plugins, but for licensing reasons it is not
packaged with the artifact. -->
<path>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jFormatString</artifactId>
<version>${version.findbugs-format-string}</version>
</path>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems we don't need this anymore; let's drop it :)

pom.xml Outdated
Comment on lines 758 to 771
<path>
<groupId>${groupId.error-prone}</groupId>
<artifactId>error_prone_annotations</artifactId>
<version>${version.error-prone}</version>
</path>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can omit this one now.

pom.xml Outdated
Comment on lines 752 to 765
<!-- XXX: MCOMPILER-XXX: The annotation processor's
dependency resolution results in a highly unintuitive
classpath. We can work around this by listing all
dependencies here, if possible, to be able to control
the resolution order. -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<!-- XXX: MCOMPILER-XXX: The annotation processor's
dependency resolution results in a highly unintuitive
classpath. We can work around this by listing all
dependencies here, if possible, to be able to control
the resolution order. -->
<!-- XXX: MCOMPILER-YYY: The plugin contructs a highly
unintuitive annotation processor classpath, in which
some indirect dependencies take precedence over
explicitly defined dependencies. This can largely be
mitigated through careful ordering of the dependencies,
but this prevents (where relevant) declaring these
dependencies as part of their corresponding Maven
profile. -->

Copy link
Member

@Badbond Badbond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this and opening a ticket upstream (soon) 🙏 I got one question before ✔️

Suggested commit message:

Order `annotationProcessorPaths` for `maven-compiler-plugin` (#149)

To circumvent an issue in which indirect dependencies take precedence over
explicitly defined dependency on the annotation processor's classpath. 

<groupId>org.mockito</groupId>
<artifactId>mockito-errorprone</artifactId>
<version>${version.mockito}</version>
</path>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So to my understanding, we just need to have error_prone_core entry before auto-service to workaround the compiler issues. Does this also hold for the other artifacts included here? Asking this because now I think some build checks (from guava, nopen, nullaway) will still happen even though verification.skip is provided. Otherwise, reading the comment, I believe these could just stay in said profile.

I assume error-prone is still not enabled when providing verification.skip as configured in the error-prone profile, so that is nice.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

guava-beta-checker, nopen-checker, nullaway, errorprone-slf4j and mockito-errorprone are all Error Prone checks, so without the error-prone profile their declaration is a no-op (and thus they're not active with -Dverification.skip).

It's true that likely it's safe to keep them in their original location, but this way we have a clearer control over the annotation classpath. The logic is now: declare centrally unless that's really not possible (which applies to the two other annotationProcessorPaths declarations).

We plan to simply revert this PR once the issue is fixed in maven-compiler-plugin.

Copy link
Member

@Stephan202 Stephan202 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tnx for the suggested commit message! I might tweak it a bit when approving :)

<groupId>org.mockito</groupId>
<artifactId>mockito-errorprone</artifactId>
<version>${version.mockito}</version>
</path>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

guava-beta-checker, nopen-checker, nullaway, errorprone-slf4j and mockito-errorprone are all Error Prone checks, so without the error-prone profile their declaration is a no-op (and thus they're not active with -Dverification.skip).

It's true that likely it's safe to keep them in their original location, but this way we have a clearer control over the annotation classpath. The logic is now: declare centrally unless that's really not possible (which applies to the two other annotationProcessorPaths declarations).

We plan to simply revert this PR once the issue is fixed in maven-compiler-plugin.

@rickie rickie force-pushed the rossendrijver/annotation_processor_path_work_around branch from 716b003 to 0f28fc0 Compare August 1, 2022 13:45
@rickie
Copy link
Member Author

rickie commented Aug 1, 2022

So the ticket is there now: https://issues.apache.org/jira/browse/MCOMPILER-503.
Updated the ticket number and it should be good to go now!

@rickie rickie added this to the 0.1.0 milestone Aug 1, 2022
@rickie rickie changed the title Introduce workaround for MCOMPILER-XXX by updating the annotationProcessorPaths Introduce workaround for MCOMPILER-503 by updating the annotationProcessorPaths Aug 1, 2022
Copy link
Member

@Stephan202 Stephan202 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternative suggested commit message:

Implement workaround for MCOMPILER-503 (#149)

By moving around some annotation processor classpath entries we ensure that the
`maven-compiler-plugin` uses the appropriate version of Error Prone.

See https://issues.apache.org/jira/browse/MCOMPILER-503

Copy link
Member

@Badbond Badbond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternative suggested commit message LGTM. Thanks for the explanation @Stephan202 and @rickie for creating the issue upstream! 🚀

@rickie rickie changed the title Introduce workaround for MCOMPILER-503 by updating the annotationProcessorPaths Implement workaround for MCOMPILER-503 Aug 2, 2022
@rickie rickie merged commit 3712a15 into master Aug 2, 2022
@rickie rickie deleted the rossendrijver/annotation_processor_path_work_around branch August 2, 2022 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants