Skip to content

Commit

Permalink
Merge pull request #4686 from adangel/remove-apexversion
Browse files Browse the repository at this point in the history
[apex] Remove ApexNode.getApexVersion()
  • Loading branch information
jsotuyod committed Oct 20, 2023
2 parents b355e11 + 8e3d60a commit 981f444
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 116 deletions.
14 changes: 14 additions & 0 deletions docs/pages/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,20 @@ The remaining section describes the complete release notes for 7.0.0.

#### API Changes

**Removed classes and methods**

The following previously deprecated classes have been removed:

* pmd-apex
* {%jdoc apex::lang.apex.ast.ApexNode %} and {% jdoc apex::lang.apex.ast.ASTApexFile %}
* `#getApexVersion()`: In PMD 6, this method has been deprecated but was defined in the class `ApexRootNode`.
The version returned is always "Version.CURRENT", as the apex compiler integration
doesn't use additional information which Apex version actually is used. Therefore, this method can't be
used to determine the Apex version of the project that is being analyzed.

If the current version is needed, then `Node.getTextDocument().getLanguageVersion()` can be used. This
is the version that has been selected via CLI `--use-version` parameter.

#### External Contributions

* [#4640](https://github.com/pmd/pmd/pull/4640): \[cli] Launch script fails if run via "bash pmd" - [Shai Bennathan](https://github.com/shai-bennathan) (@shai-bennathan)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ public AstInfo<ASTApexFile> getAstInfo() {
return astInfo;
}

@Override
public double getApexVersion() {
return getNode().getDefiningType().getCodeUnitDetails().getVersion().getExternal();
}

public ASTUserClassOrInterface<?> getMainNode() {
return (ASTUserClassOrInterface<?>) getChild(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import net.sourceforge.pmd.lang.ast.impl.GenericNode;

import apex.jorje.semantic.ast.AstNode;
import apex.jorje.services.Version;

/**
* Root interface implemented by all Apex nodes. Apex nodes wrap a tree
Expand Down Expand Up @@ -55,15 +54,4 @@ default Object jjtAccept(ApexParserVisitor visitor, Object data) {

@Override
@NonNull ASTApexFile getRoot();

/**
* Gets the apex version this class has been compiled with.
* Use {@link Version} to compare, e.g.
* {@code node.getApexVersion() >= Version.V176.getExternal()}
*
* @return the apex version
*/
default double getApexVersion() {
return getRoot().getApexVersion();
}
}

0 comments on commit 981f444

Please sign in to comment.