Skip to content

Commit

Permalink
fix: DIFF自定义函数寻找类字段使用!isSynthetic() log-record-starter Javadoc默认JDK1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
qqxx6661 committed Apr 7, 2024
1 parent 7ebe8f9 commit efb58ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions log-record-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@
</activation>
<properties>
<!-- JDK1.8 -->
<!-- <doc.path>${java.home}/../bin/javadoc</doc.path>-->
<doc.path>${java.home}/../bin/javadoc</doc.path>
<!-- JDK17 -->
<doc.path>${java.home}/bin/javadoc</doc.path>
<!-- <doc.path>${java.home}/bin/javadoc</doc.path>-->
</properties>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ private static boolean isJsonArray(Object obj) {
*/
private static Field[] getAllFields(Class<?> type) {
List<Field> fields = new ArrayList<>();
for (Class<?> c = type; c != null; c = c.getSuperclass()) {
for (Class<?> c = type; c != null && !c.isSynthetic(); c = c.getSuperclass()) {
Collections.addAll(fields, c.getDeclaredFields());
}
return fields.toArray(new Field[0]);
Expand All @@ -270,7 +270,7 @@ private static Field[] getAllFields(Class<?> type) {
* 使用了一个设计为通过异常来指示特定条件的Java标准库方法,这确实是一个特殊情况,通常不会使用异常来做业务逻辑。
*/
private static Field getFieldByName(Class<?> type, String fieldName) {
for (Class<?> c = type; c != null; c = c.getSuperclass()) {
for (Class<?> c = type; c != null && !c.isSynthetic(); c = c.getSuperclass()) {
try {
return c.getDeclaredField(fieldName);
} catch (NoSuchFieldException ignored) {
Expand Down

0 comments on commit efb58ca

Please sign in to comment.