Skip to content

Commit

Permalink
Update JavaClassUtil.java
Browse files Browse the repository at this point in the history
Import enum class, comment @see after writing only the class name can not find the corresponding enum
  • Loading branch information
suihe1 authored Apr 25, 2024
1 parent 20a427c commit 1b9e931
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/com/ly/doc/utils/JavaClassUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -394,16 +394,18 @@ public static JavaClass getSeeEnum(JavaField javaField, ProjectDocConfigBuilder
return null;
}
String value = see.getValue();
if (!JavaClassValidateUtil.isClassName(value)) {
return null;
}

// not FullyQualifiedName
if (!StringUtils.contains(value, ".")) {
List<String> imports = javaField.getDeclaringClass().getSource().getImports();
String finalValue = value;
value = imports.stream().filter(i -> StringUtils.endsWith(i, finalValue)).findFirst().orElse(StringUtils.EMPTY);
}

if (!JavaClassValidateUtil.isClassName(value)) {
return null;
}

JavaClass enumClass = builder.getJavaProjectBuilder().getClassByName(value);
if (enumClass.isEnum()) {
return enumClass;
Expand Down

0 comments on commit 1b9e931

Please sign in to comment.