@@ -225,6 +225,18 @@ public static void resolveSingleType(IJavaProject javaProject, String typeName,
225225 }
226226 }
227227
228+ /**
229+ * Helper method to check if a string is not empty (null or zero-length).
230+ * Note: This does NOT trim or check for whitespace-only strings.
231+ * Use this instead of StringUtils.isNotBlank() when you want to preserve whitespace.
232+ *
233+ * @param str the string to check
234+ * @return true if the string is not null and not empty
235+ */
236+ private static boolean isNotEmpty (String str ) {
237+ return str != null && !str .isEmpty ();
238+ }
239+
228240 /**
229241 * Check if a type belongs to a common JDK package that should be skipped.
230242 * Uses package-level matching for efficient filtering.
@@ -660,7 +672,7 @@ private static String extractBriefJavaDoc(org.eclipse.jdt.core.IType type) {
660672
661673 try {
662674 String javadoc = type .getAttachedJavadoc (null );
663- if (javadoc == null || javadoc . isEmpty ( )) {
675+ if (! isNotEmpty ( javadoc )) {
664676 return null ;
665677 }
666678 return getFirstSentenceOrLimit (javadoc , 120 );
@@ -898,7 +910,7 @@ private static String extractRelevantJavaDocContent(org.eclipse.jdt.core.IType t
898910 }
899911 rawJavadoc = type .getCompilationUnit ().getSource ().substring (javadocRange .getOffset (), javadocRange .getOffset () + javadocRange .getLength ());
900912
901- if (StringUtils . isBlank (rawJavadoc )) {
913+ if (! isNotEmpty (rawJavadoc )) {
902914 return "" ;
903915 }
904916
@@ -959,7 +971,7 @@ private static String extractRelevantJavaDocContent(org.eclipse.jdt.core.IType t
959971 * Returns the first paragraph of descriptive text, limited to reasonable length.
960972 */
961973 private static String extractClassDescription (String cleanedJavadoc ) {
962- if (cleanedJavadoc == null || cleanedJavadoc . isEmpty ( )) {
974+ if (! isNotEmpty ( cleanedJavadoc )) {
963975 return "" ;
964976 }
965977
@@ -990,7 +1002,7 @@ private static String extractClassDescription(String cleanedJavadoc) {
9901002 * Clean up raw JavaDoc comment by removing comment markers and asterisks
9911003 */
9921004 private static String cleanJavadocComment (String rawJavadoc ) {
993- if (rawJavadoc == null || rawJavadoc . isEmpty ( )) {
1005+ if (! isNotEmpty ( rawJavadoc )) {
9941006 return "" ;
9951007 }
9961008
@@ -1030,7 +1042,7 @@ private static String cleanJavadocComment(String rawJavadoc) {
10301042 * Convert HTML entities to their plain text equivalents
10311043 */
10321044 private static String convertHtmlEntities (String text ) {
1033- if (text == null || text . isEmpty ( )) {
1045+ if (! isNotEmpty ( text )) {
10341046 return text ;
10351047 }
10361048 return text .replace (" " , " " )
@@ -1049,7 +1061,7 @@ private static String convertHtmlEntities(String text) {
10491061 * Preserves line breaks for block-level tags like <p>, <br>, <div>.
10501062 */
10511063 private static String removeHtmlTags (String text ) {
1052- if (text == null || text . isEmpty ( )) {
1064+ if (! isNotEmpty ( text )) {
10531065 return text ;
10541066 }
10551067
@@ -1081,7 +1093,7 @@ private static String extractMethodJavaDocSummary(IMethod method) {
10811093 String rawJavadoc = method .getCompilationUnit ().getSource ()
10821094 .substring (javadocRange .getOffset (), javadocRange .getOffset () + javadocRange .getLength ());
10831095
1084- if (StringUtils . isBlank (rawJavadoc )) {
1096+ if (! isNotEmpty (rawJavadoc )) {
10851097 return "" ;
10861098 }
10871099
@@ -1099,7 +1111,7 @@ private static String extractMethodJavaDocSummary(IMethod method) {
10991111 * Extract the main description part from JavaDoc (before @tags)
11001112 */
11011113 private static String extractJavadocDescription (String cleanedJavadoc ) {
1102- if (cleanedJavadoc == null || cleanedJavadoc . isEmpty ( )) {
1114+ if (! isNotEmpty ( cleanedJavadoc )) {
11031115 return "" ;
11041116 }
11051117
@@ -1132,7 +1144,7 @@ private static String extractJavadocDescription(String cleanedJavadoc) {
11321144 * Get the first sentence or limit the text to maxLength characters
11331145 */
11341146 private static String getFirstSentenceOrLimit (String text , int maxLength ) {
1135- if (text == null || text . isEmpty ( )) {
1147+ if (! isNotEmpty ( text )) {
11361148 return "" ;
11371149 }
11381150
@@ -1202,7 +1214,7 @@ private static String extractFieldJavaDocSummary(org.eclipse.jdt.core.IField fie
12021214 String rawJavadoc = field .getCompilationUnit ().getSource ()
12031215 .substring (javadocRange .getOffset (), javadocRange .getOffset () + javadocRange .getLength ());
12041216
1205- if (StringUtils . isBlank (rawJavadoc )) {
1217+ if (! isNotEmpty (rawJavadoc )) {
12061218 return "" ;
12071219 }
12081220
@@ -1234,7 +1246,7 @@ public static String generateFieldSignature(org.eclipse.jdt.core.IField field) {
12341246 * Convert JDT type signature to human-readable format
12351247 */
12361248 public static String convertTypeSignature (String jdtSignature ) {
1237- if (jdtSignature == null || jdtSignature . isEmpty ( )) {
1249+ if (! isNotEmpty ( jdtSignature )) {
12381250 return "void" ;
12391251 }
12401252
0 commit comments