Skip to content

[apex] Deprecate ApexRootNode.getApexVersion#4280

Merged
adangel merged 2 commits into
pmd:masterfrom
aaronhurst-google:deprecate-apex-version
Jan 14, 2023
Merged

[apex] Deprecate ApexRootNode.getApexVersion#4280
adangel merged 2 commits into
pmd:masterfrom
aaronhurst-google:deprecate-apex-version

Conversation

@aaronhurst-google

@aaronhurst-google aaronhurst-google commented Jan 4, 2023

Copy link
Copy Markdown
Contributor

Update the rules that utilize it. Assume Apex version is >= V176.

Describe the PR

This was discussed in #4251 in the context of replacing the Apex AST. This functionality is [feasible but] not planned for the new AST. It's also not fully certain how it behaves in the existing AST.

The two uses of ApexRootNode.getApexVersion are in AbstractApexUnitTestRule.java and ApexUnitTestShouldNotUseSeeAllDataTrueRule.java. It determines whether to also visit test methods without @IsTest if they predate the @isTest introduction API version 24. Assuming that getApexVersion actually parses the metadata API, this could lead to false negatives in rules that would otherwise fire on test-only code.

Assume Apex version is >= V176.
@ghost

ghost commented Jan 5, 2023

Copy link
Copy Markdown
1 Message
📖 Compared to master:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report

Generated by 🚫 Danger

@adangel adangel self-requested a review January 10, 2023 11:48
@adangel adangel changed the title Deprecate ApexRootNode.getApexVersion. [apex] Deprecate ApexRootNode.getApexVersion Jan 14, 2023
@adangel adangel added the is:deprecation The main focus is deprecating public APIs or rules, eg to make them internal, or removing them label Jan 14, 2023
@adangel adangel added this to the 6.54.0 milestone Jan 14, 2023

@adangel adangel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@adangel

adangel commented Jan 14, 2023

Copy link
Copy Markdown
Member

Note: I didn't find any indication, that the metadata would be parsed by jorje/lsp implementation. It's probably safe to say, that this Apex version never worked as intended.

adangel added a commit to adangel/pmd that referenced this pull request Jan 14, 2023
adangel added a commit to adangel/pmd that referenced this pull request Jan 14, 2023
…sion

[apex] Deprecate ApexRootNode.getApexVersion pmd#4280
@adangel adangel merged commit 0715bd9 into pmd:master Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

is:deprecation The main focus is deprecating public APIs or rules, eg to make them internal, or removing them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants