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

Create exactly one associated subsystem per checkstyle plugin #6634

Merged
merged 3 commits into from Oct 16, 2018

Conversation

Projects
None yet
3 participants
@stuhood
Copy link
Member

stuhood commented Oct 16, 2018

Problem

Each call to the default_subsystem_for_plugin method created a new instance of an anonymous class, which caused multiple identically named/scoped subsystem classes, and a namespace scope collision when the Checkstyle task was installed multiple times. Twitter internally install Checkstyle in multiple places with different configuration.

Solution

Memoize the anonymous class creation, resulting in exactly one Subsystem class type being created per plugin class type.

Result

Checkstyle can be installed multiple times again.

Each call to this method created a new instance of the class, which c…
…aused multiple classes and namespace collision in cases where the Checkstyle task was installed multiple times.

@stuhood stuhood added this to the 1.11.x milestone Oct 16, 2018

@stuhood stuhood requested review from jsirois , benjyw and CMLivingston Oct 16, 2018

@jsirois
Copy link
Member

jsirois left a comment

A test would be wonderful. This is exactly the sort of internal testing that could be external. As things stand its unclear why we need to memoize a method we call once without looking at the git log.

@benjyw

benjyw approved these changes Oct 16, 2018

Copy link
Contributor

benjyw left a comment

Yep, a comment explaining why this is memoized would be great.

stuhood added some commits Oct 16, 2018

@stuhood stuhood merged commit c5c4f26 into pantsbuild:master Oct 16, 2018

1 check failed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details

@stuhood stuhood deleted the twitter:stuhood/avoid-redundant-checkstyle-classes branch Oct 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment