< prev index next >

src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java

Print this page
@  rev 3601 : 8061305: Javadoc crashes when method name ends with "Property"
|  Reviewed-by: jjg
~


 647                 }
 648             }
 649             return null;
 650         }
 651 
 652         private FieldDoc fieldForProperty(FieldDoc[] fields, MethodDoc property) {
 653 
 654             for (FieldDoc field : fields) {
 655                 final String fieldName = field.name();
 656                 final String propertyName = fieldName + "Property";
 657                 if (propertyName.equals(property.name())) {
 658                     return field;
 659                 }
 660             }
 661             return null;
 662         }
 663 
 664         // properties aren't named setA* or getA*
 665         private final Pattern pattern = Pattern.compile("[sg]et\\p{Upper}.*");
 666         private boolean isPropertyMethod(MethodDoc method) {



 667             if (!method.name().endsWith("Property")) {
 668                 return false;
 669             }
 670 
 671             if (! memberIsVisible(method)) {
 672                 return false;
 673             }
 674 
 675             if (pattern.matcher(method.name()).matches()) {
 676                 return false;
 677             }
 678 


 679             return 0 == method.parameters().length
 680                     && !"void".equals(method.returnType().simpleTypeName());
 681         }
 682 
 683         private void checkOnPropertiesTags(MethodDoc[] members) {
 684             for (MethodDoc methodDoc: members) {
 685                 if (methodDoc.isIncluded()) {
 686                     for (Tag tag: methodDoc.tags()) {
 687                         String tagName = tag.name();
 688                         if (tagName.equals("@propertySetter")
 689                                 || tagName.equals("@propertyGetter")
 690                                 || tagName.equals("@propertyDescription")) {
 691                             if (!isPropertyGetterOrSetter(members, methodDoc)) {
 692                                 configuration.message.warning(tag.position(),
 693                                         "doclet.javafx_tag_misuse");
 694                             }
 695                             break;
 696                         }
 697                     }
 698                 }




 647                 }
 648             }
 649             return null;
 650         }
 651 
 652         private FieldDoc fieldForProperty(FieldDoc[] fields, MethodDoc property) {
 653 
 654             for (FieldDoc field : fields) {
 655                 final String fieldName = field.name();
 656                 final String propertyName = fieldName + "Property";
 657                 if (propertyName.equals(property.name())) {
 658                     return field;
 659                 }
 660             }
 661             return null;
 662         }
 663 
 664         // properties aren't named setA* or getA*
 665         private final Pattern pattern = Pattern.compile("[sg]et\\p{Upper}.*");
 666         private boolean isPropertyMethod(MethodDoc method) {
 667             if (!configuration.javafx) {
 668                return false;
 669             }
 670             if (!method.name().endsWith("Property")) {
 671                 return false;
 672             }
 673 
 674             if (! memberIsVisible(method)) {
 675                 return false;
 676             }
 677 
 678             if (pattern.matcher(method.name()).matches()) {
 679                 return false;
 680             }
 681             if (method.typeParameters().length > 0) {
 682                 return false;
 683             }
 684             return 0 == method.parameters().length
 685                     && !"void".equals(method.returnType().simpleTypeName());
 686         }
 687 
 688         private void checkOnPropertiesTags(MethodDoc[] members) {
 689             for (MethodDoc methodDoc: members) {
 690                 if (methodDoc.isIncluded()) {
 691                     for (Tag tag: methodDoc.tags()) {
 692                         String tagName = tag.name();
 693                         if (tagName.equals("@propertySetter")
 694                                 || tagName.equals("@propertyGetter")
 695                                 || tagName.equals("@propertyDescription")) {
 696                             if (!isPropertyGetterOrSetter(members, methodDoc)) {
 697                                 configuration.message.warning(tag.position(),
 698                                         "doclet.javafx_tag_misuse");
 699                             }
 700                             break;
 701                         }
 702                     }
 703                 }


< prev index next >