Skip to content

Commit

Permalink
Merge pull request #785 from suihe1/master
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
shalousun authored Apr 26, 2024
2 parents 20a427c + 1b9e931 commit 5526a06
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 5526a06

Please sign in to comment.