@@ -173,7 +173,7 @@ public String getLiteFlowComponentNameByPsiClass(@NotNull PsiClass psiClass, boo
173173 String componentValue = javaService .getAnnotationAttributeValue (psiClass , Annotation .Component , "value" );
174174 if (componentValue != null ){
175175 /* 如果获取的value值为空,则默认使用字符串首字母小写的Class名称 */
176- if (componentValue .equals ( "" )){
176+ if (componentValue .isEmpty ( )){
177177 componentValue = StringUtils .lowerFirst (className );
178178 }
179179 return componentValue ;
@@ -187,7 +187,7 @@ public String getLiteFlowComponentNameByPsiClass(@NotNull PsiClass psiClass, boo
187187 String name = StringUtil .isEmpty (liteFlowComponentValue )? liteFlowComponentId : liteFlowComponentValue ;
188188 if (name != null ){
189189 /* 如果获取的value或者id值为空,则默认使用字符串首字母小写的Class名称 */
190- if (name .equals ( "" )){
190+ if (name .isEmpty ( )){
191191 name = StringUtils .lowerFirst (className );
192192 }
193193 return name ;
@@ -200,10 +200,11 @@ public String getLiteFlowComponentNameByPsiClass(@NotNull PsiClass psiClass, boo
200200 for (Node node : nodes .getNodeList ()) {
201201 String clazzValue = node .getClazz ().getStringValue ();
202202 String idValue = node .getId ().getStringValue ();
203- if (psiClass .getQualifiedName ()==null || clazzValue == null || idValue ==null ) {
203+ String psiClassQualifiedName = psiClass .getQualifiedName ();
204+ if (psiClassQualifiedName == null || clazzValue == null || idValue == null ) {
204205 continue ;
205206 }
206- if (psiClass . getQualifiedName () .equals (clazzValue )){
207+ if (psiClassQualifiedName .equals (clazzValue )){
207208 return idValue ;
208209 }
209210 }
@@ -213,8 +214,12 @@ public String getLiteFlowComponentNameByPsiClass(@NotNull PsiClass psiClass, boo
213214 }
214215
215216 private boolean _isLiteFlow (PsiElement psiElement , String clazz , String nodeTypeEnum ){
216- if (psiElement instanceof PsiClass psiClass ){
217+ if (psiElement instanceof PsiClass ){
218+ PsiClass psiClass = (PsiClass ) psiElement ;
217219 // 判断是否类组件
220+ if (psiClass .getQualifiedName () == null ){
221+ return false ;
222+ }
218223 // 排除所有包名以 com.yomahub.liteflow.core. 开头的Class
219224 if (psiClass .getQualifiedName ().indexOf ("com.yomahub.liteflow.core." ) == 0 ){
220225 return false ;
@@ -232,8 +237,12 @@ private boolean _isLiteFlow(PsiElement psiElement, String clazz, String nodeType
232237 return false ;
233238 }
234239 return nodeTypeEnum .equals (nodeType .split ("\\ (" )[0 ]);
235- } else if (psiElement instanceof PsiMethod psiMethod ) {
240+ } else if (psiElement instanceof PsiMethod ) {
241+ PsiMethod psiMethod = (PsiMethod ) psiElement ;
236242 // 判断是否方法声明组件
243+ if (psiMethod .getContainingClass () == null || psiMethod .getContainingClass ().getQualifiedName () == null ){
244+ return false ;
245+ }
237246 // 排除所有包名以 com.yomahub.liteflow.core. 开头的Class
238247 if (psiMethod .getContainingClass ().getQualifiedName ().indexOf ("com.yomahub.liteflow.core." ) == 0 ){
239248 return false ;
0 commit comments