fix issue #17132 in pants, created test case#23242
Open
Shubham-Developer02 wants to merge 1 commit intopantsbuild:mainfrom
Open
fix issue #17132 in pants, created test case#23242Shubham-Developer02 wants to merge 1 commit intopantsbuild:mainfrom
Shubham-Developer02 wants to merge 1 commit intopantsbuild:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title: Reject targets that register multiple SourcesField subclasses (#17132)
Description:
Pants assumes each target exposes at most one field in the SourcesField hierarchy (e.g. MultipleSourcesField, SingleSourceField). Call sites use tgt.get(SourcesField) and related APIs as if that field were unique. If a target type accidentally registers two or more such fields, behavior is ambiguous and hard to debug.
This change fails fast during target construction: Target.validate() now raises a clear InvalidFieldException (wrapped as InvalidTargetException by Target.init) when more than one registered field type subclasses SourcesField.
Fixes pantsbuild/pants#17132.