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

Commit

Permalink
back out attempt to treat non-tagged comment blocks as @description. …
Browse files Browse the repository at this point in the history
…it wasn't perfect, and it introduced some bugs.
  • Loading branch information
David Habib committed Jan 19, 2015
1 parent 878f586 commit f7043f6
Showing 1 changed file with 1 addition and 51 deletions.
52 changes: 1 addition & 51 deletions src/org/salesforce/apexdoc/ApexDoc.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,6 @@ public static ClassModel parseFileContents(String filePath){
if (strContainsScope(strLine) == null &&
// interface methods don't have scope
!(cModel != null && cModel.getIsInterface() && strLine.contains("("))) {

// the comments we've been caching are just code comments.
lstComments.clear();
continue;
}

Expand Down Expand Up @@ -365,47 +362,41 @@ private static void fillPropertyModel(PropertyModel propertyModel, String name,
private static void fillMethodModel(MethodModel mModel, String name, ArrayList<String> lstComments, int iLine){
mModel.setNameLine(name, iLine);
boolean inDescription = false;
boolean tagsFound = false;
for (String comment : lstComments) {
comment = comment.trim();
int idxStart = comment.toLowerCase().indexOf("@description");
if(idxStart != -1){
if (comment.length() > idxStart + 13)
mModel.setDescription(comment.substring(idxStart + 13).trim());
inDescription = true;
tagsFound = true;
continue;
}

idxStart = comment.toLowerCase().indexOf("@author");
if(idxStart != -1){
mModel.setAuthor(comment.substring(idxStart + 8).trim());
inDescription = false;
tagsFound = true;
continue;
}

idxStart = comment.toLowerCase().indexOf("@date");
if(idxStart != -1){
mModel.setDate(comment.substring(idxStart + 5).trim());
inDescription = false;
tagsFound = true;
continue;
}

idxStart = comment.toLowerCase().indexOf("@return");
if(idxStart != -1){
mModel.setReturns(comment.substring(idxStart + 8).trim());
inDescription = false;
tagsFound = true;
continue;
}

idxStart = comment.toLowerCase().indexOf("@param");
if(idxStart != -1){
mModel.getParams().add(comment.substring(idxStart + 6).trim());
inDescription = false;
tagsFound = true;
continue;
}

Expand All @@ -423,71 +414,47 @@ private static void fillMethodModel(MethodModel mModel, String name, ArrayList<S
continue;
}
}
// if we didn't find any tags, then treat all the comments as @description
if (!tagsFound) {
String strComments = "";
for (String comment : lstComments) {
int i;
for (i = 0; i < comment.length(); i++) {
char ch = comment.charAt(i);
if (ch != '/' && ch != '*' && ch != ' ')
break;
}
if (i < comment.length()) {
strComments += comment.substring(i) + " ";
}
}
if (strComments != "")
mModel.setDescription(strComments.trim());
}
}

private static void fillClassModel(ClassModel cModelParent, ClassModel cModel, String name, ArrayList<String> lstComments, int iLine){
cModel.setNameLine(name, iLine);
if (name.toLowerCase().contains(" interface "))
cModel.setIsInterface(true);
boolean inDescription = false;
boolean tagsFound = false;

boolean inDescription = false;
for (String comment : lstComments) {
comment = comment.trim();
int idxStart = comment.toLowerCase().indexOf("@description");
if(idxStart != -1){
cModel.setDescription(comment.substring(idxStart + 12).trim());
inDescription = true;
tagsFound = true;
continue;
}

idxStart = comment.toLowerCase().indexOf("@author");
if(idxStart != -1){
cModel.setAuthor(comment.substring(idxStart + 7).trim());
inDescription = false;
tagsFound = true;
continue;
}

idxStart = comment.toLowerCase().indexOf("@date");
if(idxStart != -1){
cModel.setDate(comment.substring(idxStart + 5).trim());
inDescription = false;
tagsFound = true;
continue;
}

idxStart = comment.toLowerCase().indexOf("@group "); // needed to include space to not match group-content.
if(idxStart != -1){
cModel.setClassGroup(comment.substring(idxStart + 6).trim());
inDescription = false;
tagsFound = true;
continue;
}

idxStart = comment.toLowerCase().indexOf("@group-content");
if(idxStart != -1){
cModel.setClassGroupContent(comment.substring(idxStart + 14).trim());
inDescription = false;
tagsFound = true;
continue;
}

Expand All @@ -505,23 +472,6 @@ private static void fillClassModel(ClassModel cModelParent, ClassModel cModel, S
continue;
}
}
// if we didn't find any tags, then treat all the comments as @description
if (!tagsFound) {
String strComments = "";
for (String comment : lstComments) {
int i;
for (i = 0; i < comment.length(); i++) {
char ch = comment.charAt(i);
if (ch != '/' && ch != '*' && ch != ' ')
break;
}
if (i < comment.length()) {
strComments += comment.substring(i) + " ";
}
}
if (strComments != "")
cModel.setDescription(strComments.trim());
}
}


Expand Down

0 comments on commit f7043f6

Please sign in to comment.