From 5ad37f67579e2ed2ed02e6ca68a8f28cd9d5aafa Mon Sep 17 00:00:00 2001 From: Aaron Hurst Date: Tue, 22 Nov 2022 20:15:39 +0000 Subject: [PATCH 1/6] Replace uses of Jorje types in pmd-visualforce. Summary: store and compare primitive type names instead of using BasicType enum. Udpate unit tests and add a few more cases. Change-Id: If4e5bb33d11793813839b82cf8beb043aad2ce34 --- .../pmd/lang/vf/ApexClassPropertyTypes.java | 6 +-- .../vf/ApexClassPropertyTypesVisitor.java | 20 ++++----- .../net/sourceforge/pmd/lang/vf/DataType.java | 44 +++++++++---------- .../vf/ApexClassPropertyTypesVisitorTest.java | 25 +++++------ .../sourceforge/pmd/lang/vf/DataTypeTest.java | 17 +++---- 5 files changed, 53 insertions(+), 59 deletions(-) diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ApexClassPropertyTypes.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ApexClassPropertyTypes.java index 2de3e5c277..2c8bcb78fe 100644 --- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ApexClassPropertyTypes.java +++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ApexClassPropertyTypes.java @@ -23,8 +23,6 @@ import net.sourceforge.pmd.lang.apex.ApexLanguageModule; import net.sourceforge.pmd.lang.apex.ast.ApexNode; import net.sourceforge.pmd.lang.ast.Node; -import apex.jorje.semantic.symbol.type.BasicType; - /** * Responsible for storing a mapping of Apex Class properties that can be referenced from Visualforce to the type of the * property. @@ -51,8 +49,8 @@ class ApexClassPropertyTypes extends SalesforceFieldTypes { Node node = parser.parse(apexFilePath.toString(), reader); ApexClassPropertyTypesVisitor visitor = new ApexClassPropertyTypesVisitor(); visitor.visit((ApexNode) node, null); - for (Pair variable : visitor.getVariables()) { - putDataType(variable.getKey(), DataType.fromBasicType(variable.getValue())); + for (Pair variable : visitor.getVariables()) { + putDataType(variable.getKey(), DataType.fromTypeName(variable.getValue())); } } catch (IOException e) { throw new ContextedRuntimeException(e) diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ApexClassPropertyTypesVisitor.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ApexClassPropertyTypesVisitor.java index 79a109cc48..5ba53eaee6 100644 --- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ApexClassPropertyTypesVisitor.java +++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ApexClassPropertyTypesVisitor.java @@ -12,14 +12,11 @@ import org.apache.commons.lang3.tuple.Pair; import net.sourceforge.pmd.lang.apex.ast.ASTMethod; import net.sourceforge.pmd.lang.apex.ast.ASTModifierNode; +import net.sourceforge.pmd.lang.apex.ast.ASTProperty; import net.sourceforge.pmd.lang.apex.ast.ASTUserClass; import net.sourceforge.pmd.lang.apex.ast.ApexNode; import net.sourceforge.pmd.lang.apex.ast.ApexParserVisitorAdapter; -import apex.jorje.semantic.symbol.member.method.Generated; -import apex.jorje.semantic.symbol.member.method.MethodInfo; -import apex.jorje.semantic.symbol.type.BasicType; - /** * Visits an Apex class to determine a mapping of referenceable expressions to expression type. */ @@ -37,15 +34,15 @@ final class ApexClassPropertyTypesVisitor extends ApexParserVisitorAdapter { private static final String RETURN_TYPE_VOID = "void"; /** - * Pairs of (variableName, BasicType) + * Pairs of (variableName, typeName) */ - private final List> variables; + private final List> variables; ApexClassPropertyTypesVisitor() { this.variables = new ArrayList<>(); } - public List> getVariables() { + public List> getVariables() { return this.variables; } @@ -55,11 +52,10 @@ final class ApexClassPropertyTypesVisitor extends ApexParserVisitorAdapter { */ @Override public Object visit(ASTMethod node, Object data) { - MethodInfo mi = node.getNode().getMethodInfo(); - if (mi.getParameterTypes().isEmpty() + if (node.getArity() == 0 && isVisibleToVisualForce(node) - && !RETURN_TYPE_VOID.equalsIgnoreCase(mi.getReturnType().getApexName()) - && (mi.getGenerated().equals(Generated.USER) || mi.isPropertyAccessor())) { + && !RETURN_TYPE_VOID.equalsIgnoreCase(node.getReturnType()) + && (node.hasRealLoc() || node.getFirstParentOfType(ASTProperty.class) != null)) { StringBuilder sb = new StringBuilder(); List parents = node.getParentsOfType(ASTUserClass.class); Collections.reverse(parents); @@ -74,7 +70,7 @@ final class ApexClassPropertyTypesVisitor extends ApexParserVisitorAdapter { } sb.append(name); - variables.add(Pair.of(sb.toString(), mi.getReturnType().getBasicType())); + variables.add(Pair.of(sb.toString(), node.getReturnType())); } return super.visit((ApexNode) node, data); } diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java index f7c058f771..06386d0acc 100644 --- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java +++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java @@ -12,8 +12,6 @@ import java.util.Map; import java.util.Set; import java.util.logging.Logger; -import apex.jorje.semantic.symbol.type.BasicType; - /** * Represents all data types that can be referenced from a Visualforce page. This enum consolidates the data types * available to CustomFields and Apex. It uses the naming convention of CustomFields. @@ -22,10 +20,10 @@ import apex.jorje.semantic.symbol.type.BasicType; */ public enum DataType { AutoNumber(false), - Checkbox(false, BasicType.BOOLEAN), - Currency(false, BasicType.CURRENCY), - Date(false, BasicType.DATE), - DateTime(false, BasicType.DATE_TIME), + Checkbox(false, "Boolean"), + Currency(false, "Currency"), + Date(false, "Date"), + DateTime(false, "Datetime"), Email(false), EncryptedText(true), ExternalLookup(true), @@ -35,19 +33,19 @@ public enum DataType { IndirectLookup(false), Location(false), LongTextArea(true), - Lookup(false, BasicType.ID), + Lookup(false, "ID"), MasterDetail(false), MetadataRelationship(false), MultiselectPicklist(true), Note(true), - Number(false, BasicType.DECIMAL, BasicType.DOUBLE, BasicType.INTEGER, BasicType.LONG), + Number(false, "Decimal", "Double", "Integer", "Long"), Percent(false), Phone(false), Picklist(true), Summary(false), - Text(true, BasicType.STRING), + Text(true, "String"), TextArea(true), - Time(false, BasicType.TIME), + Time(false, "Time"), Url(false), /** * Indicates that Metatada was found, but it's type was not mappable. This could because it is a type which isn't @@ -64,9 +62,10 @@ public enum DataType { public final boolean requiresEscaping; /** - * The set of {@link BasicType}s that map to this type. Multiple types can map to a single instance of this enum. + * The set of primitive type names that map to this type. Multiple types can map to a single instance of this enum. + * Note: these strings are not case-normalized. */ - private final Set basicTypes; + private final Set basicTypeNames; /** * A case insensitive map of the enum name to its instance. The case metadata is not guaranteed to have the correct @@ -75,15 +74,15 @@ public enum DataType { private static final Map CASE_INSENSITIVE_MAP = new HashMap<>(); /** - * Map of BasicType to DataType. Multiple BasicTypes may map to one DataType. + * A case insensitive map of the primitive type names to DataType. Multiple types may map to one DataType. */ - private static final Map BASIC_TYPE_MAP = new HashMap<>(); + private static final Map BASIC_TYPE_MAP = new HashMap<>(); static { for (DataType dataType : DataType.values()) { CASE_INSENSITIVE_MAP.put(dataType.name().toLowerCase(Locale.ROOT), dataType); - for (BasicType basicType : dataType.basicTypes) { - BASIC_TYPE_MAP.put(basicType, dataType); + for (String typeName : dataType.basicTypeNames) { + BASIC_TYPE_MAP.put(typeName.toLowerCase(Locale.ROOT), dataType); } } } @@ -106,8 +105,9 @@ public enum DataType { /** * Map to correct instance, returns {@code Unknown} if the value can't be mapped. */ - public static DataType fromBasicType(BasicType value) { - DataType dataType = value != null ? BASIC_TYPE_MAP.get(value) : null; + public static DataType fromTypeName(String value) { + value = value != null ? value : ""; + DataType dataType = BASIC_TYPE_MAP.get(value.toLowerCase(Locale.ROOT)); if (dataType == null) { dataType = DataType.Unknown; @@ -121,11 +121,11 @@ public enum DataType { this(requiresEscaping, null); } - DataType(boolean requiresEscaping, BasicType... basicTypes) { + DataType(boolean requiresEscaping, String... basicTypeNames) { this.requiresEscaping = requiresEscaping; - this.basicTypes = new HashSet<>(); - if (basicTypes != null) { - this.basicTypes.addAll(Arrays.asList(basicTypes)); + this.basicTypeNames = new HashSet<>(); + if (basicTypeNames != null) { + this.basicTypeNames.addAll(Arrays.asList(basicTypeNames)); } } } diff --git a/pmd-visualforce/src/test/java/net/sourceforge/pmd/lang/vf/ApexClassPropertyTypesVisitorTest.java b/pmd-visualforce/src/test/java/net/sourceforge/pmd/lang/vf/ApexClassPropertyTypesVisitorTest.java index ef74216593..c1e3b8f5e8 100644 --- a/pmd-visualforce/src/test/java/net/sourceforge/pmd/lang/vf/ApexClassPropertyTypesVisitorTest.java +++ b/pmd-visualforce/src/test/java/net/sourceforge/pmd/lang/vf/ApexClassPropertyTypesVisitorTest.java @@ -7,6 +7,7 @@ package net.sourceforge.pmd.lang.vf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import java.io.BufferedReader; import java.io.IOException; @@ -28,8 +29,6 @@ import net.sourceforge.pmd.lang.apex.ApexLanguageModule; import net.sourceforge.pmd.lang.apex.ast.ApexNode; import net.sourceforge.pmd.lang.ast.Node; -import apex.jorje.semantic.symbol.type.BasicType; - public class ApexClassPropertyTypesVisitorTest { @Test public void testApexClassIsProperlyParsed() throws IOException { @@ -46,21 +45,21 @@ public class ApexClassPropertyTypesVisitorTest { visitor.visit((ApexNode) node, null); } - List> variables = visitor.getVariables(); + List> variables = visitor.getVariables(); assertEquals(7, variables.size()); - Map variableNameToVariableType = new Hashtable<>(); - for (Pair variable : variables) { + Map variableNameToVariableType = new Hashtable<>(); + for (Pair variable : variables) { // Map the values and ensure there were no duplicates - BasicType previous = variableNameToVariableType.put(variable.getKey(), variable.getValue()); + String previous = variableNameToVariableType.put(variable.getKey(), variable.getValue()); assertNull(variable.getKey(), previous); } - assertEquals(BasicType.ID, variableNameToVariableType.get("ApexController.AccountIdProp")); - assertEquals(BasicType.ID, variableNameToVariableType.get("ApexController.AccountId")); - assertEquals(BasicType.STRING, variableNameToVariableType.get("ApexController.AccountName")); - assertEquals(BasicType.APEX_OBJECT, variableNameToVariableType.get("ApexController.InnerController")); - assertEquals(BasicType.ID, variableNameToVariableType.get("ApexController.InnerController.InnerAccountIdProp")); - assertEquals(BasicType.ID, variableNameToVariableType.get("ApexController.InnerController.InnerAccountId")); - assertEquals(BasicType.STRING, variableNameToVariableType.get("ApexController.InnerController.InnerAccountName")); + assertTrue("ID".equalsIgnoreCase(variableNameToVariableType.get("ApexController.AccountIdProp"))); + assertTrue("ID".equalsIgnoreCase(variableNameToVariableType.get("ApexController.AccountId"))); + assertTrue("String".equalsIgnoreCase(variableNameToVariableType.get("ApexController.AccountName"))); + assertTrue("ApexController.InnerController".equalsIgnoreCase(variableNameToVariableType.get("ApexController.InnerController"))); + assertTrue("ID".equalsIgnoreCase(variableNameToVariableType.get("ApexController.InnerController.InnerAccountIdProp"))); + assertTrue("ID".equalsIgnoreCase(variableNameToVariableType.get("ApexController.InnerController.InnerAccountId"))); + assertTrue("String".equalsIgnoreCase(variableNameToVariableType.get("ApexController.InnerController.InnerAccountName"))); } } diff --git a/pmd-visualforce/src/test/java/net/sourceforge/pmd/lang/vf/DataTypeTest.java b/pmd-visualforce/src/test/java/net/sourceforge/pmd/lang/vf/DataTypeTest.java index 0accbd9625..a3f043c278 100644 --- a/pmd-visualforce/src/test/java/net/sourceforge/pmd/lang/vf/DataTypeTest.java +++ b/pmd-visualforce/src/test/java/net/sourceforge/pmd/lang/vf/DataTypeTest.java @@ -10,8 +10,6 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; -import apex.jorje.semantic.symbol.type.BasicType; - public class DataTypeTest { @Test public void testFromString() { @@ -22,12 +20,15 @@ public class DataTypeTest { } @Test - public void testFromBasicType() { - assertEquals(DataType.Checkbox, DataType.fromBasicType(BasicType.BOOLEAN)); - assertEquals(DataType.Number, DataType.fromBasicType(BasicType.DECIMAL)); - assertEquals(DataType.Number, DataType.fromBasicType(BasicType.DOUBLE)); - assertEquals(DataType.Unknown, DataType.fromBasicType(BasicType.APEX_OBJECT)); - assertEquals(DataType.Unknown, DataType.fromBasicType(null)); + public void testFromTypeName() { + assertEquals(DataType.Checkbox, DataType.fromTypeName("Boolean")); + assertEquals(DataType.Currency, DataType.fromTypeName("Currency")); + assertEquals(DataType.DateTime, DataType.fromTypeName("Datetime")); + assertEquals(DataType.Number, DataType.fromTypeName("DECIMAL")); + assertEquals(DataType.Number, DataType.fromTypeName("double")); + assertEquals(DataType.Text, DataType.fromTypeName("string")); + assertEquals(DataType.Unknown, DataType.fromTypeName("Object")); + assertEquals(DataType.Unknown, DataType.fromTypeName(null)); } @Test From c9e21cd4eb3ee069d76c0fc7f28de34bb37737ec Mon Sep 17 00:00:00 2001 From: Aaron Hurst Date: Tue, 22 Nov 2022 20:28:10 +0000 Subject: [PATCH 2/6] Tweak terminology: the map is case-normalized not case-insensitive. Change-Id: I3499dc615262612b6c220b7840d3ab8cca87c226 --- .../java/net/sourceforge/pmd/lang/vf/DataType.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java index 06386d0acc..ffb4528a9b 100644 --- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java +++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java @@ -68,19 +68,19 @@ public enum DataType { private final Set basicTypeNames; /** - * A case insensitive map of the enum name to its instance. The case metadata is not guaranteed to have the correct + * A map of the lower-case-normalized enum name to its instance. The case metadata is not guaranteed to have the correct * case. */ - private static final Map CASE_INSENSITIVE_MAP = new HashMap<>(); + private static final Map CASE_NORMALIZED_MAP = new HashMap<>(); /** - * A case insensitive map of the primitive type names to DataType. Multiple types may map to one DataType. + * A map of the lower-case-normalized primitive type names to DataType. Multiple types may map to one DataType. */ private static final Map BASIC_TYPE_MAP = new HashMap<>(); static { for (DataType dataType : DataType.values()) { - CASE_INSENSITIVE_MAP.put(dataType.name().toLowerCase(Locale.ROOT), dataType); + CASE_NORMALIZED_MAP.put(dataType.name().toLowerCase(Locale.ROOT), dataType); for (String typeName : dataType.basicTypeNames) { BASIC_TYPE_MAP.put(typeName.toLowerCase(Locale.ROOT), dataType); } @@ -92,7 +92,7 @@ public enum DataType { */ public static DataType fromString(String value) { value = value != null ? value : ""; - DataType dataType = CASE_INSENSITIVE_MAP.get(value.toLowerCase(Locale.ROOT)); + DataType dataType = CASE_NORMALIZED_MAP.get(value.toLowerCase(Locale.ROOT)); if (dataType == null) { dataType = DataType.Unknown; From e62b71f89a473d489b6962b115f4ba725e558825 Mon Sep 17 00:00:00 2001 From: Aaron Hurst Date: Thu, 24 Nov 2022 15:55:43 +0000 Subject: [PATCH 3/6] Add back DataType.fromBasicType(BasicType) and test. Isolate references to BasicType inside method implementation. Change-Id: I4be2ad5b8b42fb7a84da0755106d8f0b08034690 --- .../net/sourceforge/pmd/lang/vf/DataType.java | 38 +++++++++++++++++++ .../sourceforge/pmd/lang/vf/DataTypeTest.java | 11 ++++++ 2 files changed, 49 insertions(+) diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java index ffb4528a9b..0ebe6cdaab 100644 --- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java +++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java @@ -12,6 +12,8 @@ import java.util.Map; import java.util.Set; import java.util.logging.Logger; +import apex.jorje.semantic.symbol.type.BasicType; + /** * Represents all data types that can be referenced from a Visualforce page. This enum consolidates the data types * available to CustomFields and Apex. It uses the naming convention of CustomFields. @@ -102,6 +104,42 @@ public enum DataType { return dataType; } + /** + * Map to correct instance, returns {@code Unknown} if the value can't be mapped. + * + * Use {@link fromTypeName} instead. + */ + @Deprecated + public static DataType fromBasicType(BasicType value) { + if (value != null) { + switch(value) { + case BOOLEAN: + return Checkbox; + case CURRENCY: + return Currency; + case DATE: + return Date; + case DATE_TIME: + return DateTime; + case ID: + return Lookup; + case DECIMAL: + case DOUBLE: + case INTEGER: + case LONG: + return Number; + case STRING: + return Text; + case TIME: + return Time; + default: + break; + } + } + LOGGER.fine("Unable to determine DataType of " + value); + return Unknown; + } + /** * Map to correct instance, returns {@code Unknown} if the value can't be mapped. */ diff --git a/pmd-visualforce/src/test/java/net/sourceforge/pmd/lang/vf/DataTypeTest.java b/pmd-visualforce/src/test/java/net/sourceforge/pmd/lang/vf/DataTypeTest.java index a3f043c278..9a9d50ce4d 100644 --- a/pmd-visualforce/src/test/java/net/sourceforge/pmd/lang/vf/DataTypeTest.java +++ b/pmd-visualforce/src/test/java/net/sourceforge/pmd/lang/vf/DataTypeTest.java @@ -10,6 +10,8 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; +import apex.jorje.semantic.symbol.type.BasicType; + public class DataTypeTest { @Test public void testFromString() { @@ -31,6 +33,15 @@ public class DataTypeTest { assertEquals(DataType.Unknown, DataType.fromTypeName(null)); } + @Test + public void testDeprecatedFromBasicType() { + assertEquals(DataType.Checkbox, DataType.fromBasicType(BasicType.BOOLEAN)); + assertEquals(DataType.Number, DataType.fromBasicType(BasicType.DECIMAL)); + assertEquals(DataType.Number, DataType.fromBasicType(BasicType.DOUBLE)); + assertEquals(DataType.Unknown, DataType.fromBasicType(BasicType.APEX_OBJECT)); + assertEquals(DataType.Unknown, DataType.fromBasicType(null)); + } + @Test public void testRequiresEncoding() { assertFalse(DataType.AutoNumber.requiresEscaping); From 1029d6b24d0b3640a9d1a3ea7e988adb88d0256e Mon Sep 17 00:00:00 2001 From: Aaron Hurst Date: Thu, 24 Nov 2022 20:35:42 +0000 Subject: [PATCH 4/6] Fix checkstyle violations. Change-Id: I0aa6ecfeb343f2e0b48d2ebfd176a877a72f40f6 --- .../src/main/java/net/sourceforge/pmd/lang/vf/DataType.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java index 0ebe6cdaab..bc753ef272 100644 --- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java +++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java @@ -112,9 +112,9 @@ public enum DataType { @Deprecated public static DataType fromBasicType(BasicType value) { if (value != null) { - switch(value) { + switch (value) { case BOOLEAN: - return Checkbox; + return Checkbox; case CURRENCY: return Currency; case DATE: From faa5bf6e00bd3ddc43f63fedb11de665c804f53f Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 25 Nov 2022 15:10:30 +0100 Subject: [PATCH 5/6] [doc] Document deprecated API --- docs/pages/release_notes.md | 34 ++++++++++--------- .../net/sourceforge/pmd/lang/vf/DataType.java | 2 +- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 1fb0639b26..c2be84a879 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -65,23 +65,25 @@ PMD 7 will remove support for `--files` in favor of these new flags. #### Deprecated API -The following APIs have been marked as deprecated for removal in PMD 7: +* The following core APIs have been marked as deprecated for removal in PMD 7: + - {% jdoc core::PMD %} and {% jdoc core::PMD.StatusCode %} - PMD 7 will ship with a revamped CLI split from pmd-core. To programatically launch analysis you can use {% jdoc core::PmdAnalysis %}. + - {% jdoc !!core::PMDConfiguration#getAllInputPaths() %} - It is now superceded by {% jdoc !!core::PMDConfiguration#getInputPathList() %} + - {% jdoc !!core::PMDConfiguration#setInputPaths(List) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#setInputPathList(List) %} + - {% jdoc !!core::PMDConfiguration#addInputPath(String) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#addInputPath(Path) %} + - {% jdoc !!core::PMDConfiguration#getInputFilePath() %} - It is now superceded by {% jdoc !!core::PMDConfiguration#getInputFile() %} + - {% jdoc !!core::PMDConfiguration#getIgnoreFilePath() %} - It is now superceded by {% jdoc !!core::PMDConfiguration#getIgnoreFile() %} + - {% jdoc !!core::PMDConfiguration#setInputFilePath(String) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#setInputFilePath(Path) %} + - {% jdoc !!core::PMDConfiguration#setIgnoreFilePath(String) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#setIgnoreFilePath(Path) %} + - {% jdoc !!core::PMDConfiguration#getInputUri() %} - It is now superceded by {% jdoc !!core::PMDConfiguration#getUri() %} + - {% jdoc !!core::PMDConfiguration#setInputUri(String) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#setInputUri(URI) %} + - {% jdoc !!core::PMDConfiguration#getReportFile() %} - It is now superceded by {% jdoc !!core::PMDConfiguration#getReportFilePath() %} + - {% jdoc !!core::PMDConfiguration#setReportFile(String) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#setReportFile(Path) %} + - {% jdoc !!core::PMDConfiguration#isStressTest() %} and {% jdoc !!core::PMDConfiguration#setStressTest(boolean) %} - Will be removed with no replacement. + - {% jdoc !!core::PMDConfiguration#isBenchmark() %} and {% jdoc !!core::PMDConfiguration#setBenchmark(boolean) %} - Will be removed with no replacement, the CLI will still support it. + - {% jdoc core::cpd.CPD %} and {% jdoc core::cpd.CPD.StatusCode %} - PMD 7 will ship with a revamped CLI split from pmd-core. An alterative to programatically launch CPD analysis will be added in due time. -- {% jdoc core::PMD %} and {% jdoc core::PMD.StatusCode %} - PMD 7 will ship with a revamped CLI split from pmd-core. To programatically launch analysis you can use {% jdoc core::PmdAnalysis %}. -- {% jdoc !!core::PMDConfiguration#getAllInputPaths() %} - It is now superceded by {% jdoc !!core::PMDConfiguration#getInputPathList() %} -- {% jdoc !!core::PMDConfiguration#setInputPaths(List) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#setInputPathList(List) %} -- {% jdoc !!core::PMDConfiguration#addInputPath(String) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#addInputPath(Path) %} -- {% jdoc !!core::PMDConfiguration#getInputFilePath() %} - It is now superceded by {% jdoc !!core::PMDConfiguration#getInputFile() %} -- {% jdoc !!core::PMDConfiguration#getIgnoreFilePath() %} - It is now superceded by {% jdoc !!core::PMDConfiguration#getIgnoreFile() %} -- {% jdoc !!core::PMDConfiguration#setInputFilePath(String) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#setInputFilePath(Path) %} -- {% jdoc !!core::PMDConfiguration#setIgnoreFilePath(String) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#setIgnoreFilePath(Path) %} -- {% jdoc !!core::PMDConfiguration#getInputUri() %} - It is now superceded by {% jdoc !!core::PMDConfiguration#getUri() %} -- {% jdoc !!core::PMDConfiguration#setInputUri(String) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#setInputUri(URI) %} -- {% jdoc !!core::PMDConfiguration#getReportFile() %} - It is now superceded by {% jdoc !!core::PMDConfiguration#getReportFilePath() %} -- {% jdoc !!core::PMDConfiguration#setReportFile(String) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#setReportFile(Path) %} -- {% jdoc !!core::PMDConfiguration#isStressTest() %} and {% jdoc !!core::PMDConfiguration#setStressTest(boolean) %} - Will be removed with no replacement. -- {% jdoc !!core::PMDConfiguration#isBenchmark() %} and {% jdoc !!core::PMDConfiguration#setBenchmark(boolean) %} - Will be removed with no replacement, the CLI will still support it. -- {% jdoc core::cpd.CPD %} and {% jdoc core::cpd.CPD.StatusCode %} - PMD 7 will ship with a revamped CLI split from pmd-core. An alterative to programatically launch CPD analysis will be added in due time. +* In order to reduce the dependency on Apex Jorje classes, the method {% jdoc !!visualforce::lang.vf.DataType#fromBasicType(apex.jorje.semantic.symbol.type.BasicType) %} + has been deprecated. The equivalent method {% jdoc visualforce::lang.vf.DataType#fromTypeName(java.lang.String) %} should be used instead. ### External Contributions * [#4184](https://github.com/pmd/pmd/pull/4184): \[java]\[doc] TestClassWithoutTestCases - fix small typo in description - [Valery Yatsynovich](https://github.com/valfirst) (@valfirst) diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java index bc753ef272..bf46c74b20 100644 --- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java +++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/DataType.java @@ -107,7 +107,7 @@ public enum DataType { /** * Map to correct instance, returns {@code Unknown} if the value can't be mapped. * - * Use {@link fromTypeName} instead. + * @deprecated Use {@link #fromTypeName(String)} instead. */ @Deprecated public static DataType fromBasicType(BasicType value) { From 3bd1283ab15897f588606e7ff418b8959abd071f Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 25 Nov 2022 15:11:51 +0100 Subject: [PATCH 6/6] [doc] Update release notes (#4226) --- docs/pages/release_notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index c2be84a879..96c97cbeb4 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -90,6 +90,7 @@ PMD 7 will remove support for `--files` in favor of these new flags. * [#4198](https://github.com/pmd/pmd/pull/4198): \[doc] Add supported CPD languages - [Jeroen van Wilgenburg](https://github.com/jvwilge) (@jvwilge) * [#4202](https://github.com/pmd/pmd/pull/4202): \[java] Fix #4200 and #4201: ClassWithOnlyPrivateConstructorsShouldBeFinal, CommentDefaultAccessModifier: Exclude lombok @Value annotation - [Lynn](https://github.com/LynnBroe) (@LynnBroe) * [#4205](https://github.com/pmd/pmd/pull/4205): \[doc] Clarify Scala support (no built-in rules) - [Eldrick Wega](https://github.com/Eldrick19) (@Eldrick19) +* [#4226](https://github.com/pmd/pmd/pull/4226): \[visualforce] Replace uses of Jorje types in pmd-visualforce - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google) {% endtocmaker %}