Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

fix issue where strings containing scope keywords were being matched incorrectly #72

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/org/salesforce/apexdoc/ApexDoc.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class ApexDoc {
public static String[] rgstrScope;
public static String[] rgstrArgs;

public static final String[] KEYWORDS = {"static ","final ","public ","private ","void ",""};

public ApexDoc() {
try {
File file = new File("apex_doc_log.txt");
Expand Down Expand Up @@ -348,8 +350,11 @@ public static ClassModel parseFileContents(String filePath) {
public static String strContainsScope(String str) {
str = str.toLowerCase();
for (int i = 0; i < rgstrScope.length; i++) {
if (str.toLowerCase().contains(rgstrScope[i].toLowerCase() + " ")) {
return rgstrScope[i];
// prevent matching strings containing scope keywords that aren't class, method, or property definitions
for (String kw : KEYWORDS) {
if (str.toLowerCase().startsWith(kw + rgstrScope[i].toLowerCase() + " ")) {
return rgstrScope[i];
}
}
}
return null;
Expand Down