mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-13 08:15:48 +00:00
[fixes #3940] Add missing stripIndent method
This commit is contained in:
1 parent
dfd8ff7577
commit
3bd1bba4f4
3 files changed
+18
-3
No files matched your search
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2009-2024 The Project Lombok Authors.
|
||||
* Copyright (C) 2009-2025 The Project Lombok Authors.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -134,6 +134,10 @@ public class DocCommentIntegrator {
|
||||
return docCommentContent_;
|
||||
}
|
||||
|
||||
@Override public Comment stripIndent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override public DiagnosticPosition getPos() {
|
||||
return new DiagnosticPosition() {
|
||||
public JCTree getTree() {
|
||||
|
||||
@@ -14,6 +14,8 @@ public class Tokens {
|
||||
|
||||
String getText();
|
||||
|
||||
Comment stripIndent();
|
||||
|
||||
JCDiagnostic.DiagnosticPosition getPos();
|
||||
|
||||
int getSourcePos(int index);
|
||||
|
||||
@@ -348,7 +348,7 @@ public class Javac {
|
||||
public static boolean validateJavadoc(Object dc, JCTree node) {
|
||||
DocCommentTable dct = (DocCommentTable) dc;
|
||||
Comment javadoc = dct.getComment(node);
|
||||
return javadoc == null || javadoc.getText() == null || javadoc.getSourcePos(0) >= 0;
|
||||
return javadoc == null || javadoc.getText() == null || (javadoc.getSourcePos(0) >= 0 && hasParseableDocComment(dct, node));
|
||||
}
|
||||
|
||||
static void setJavadoc(Object dc, JCTree node, String javadoc) {
|
||||
@@ -366,12 +366,21 @@ public class Javac {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean hasParseableDocComment(Object dc, JCTree node) {
|
||||
DocCommentTable dct = (DocCommentTable) dc;
|
||||
return Permit.invokeSneaky(Permit.permissiveGetMethod(DocCommentTable.class, "getCommentTree", JCTree.class), dct, node) != null;
|
||||
}
|
||||
|
||||
private static Comment createJavadocComment(final String text, final JCTree field) {
|
||||
return new Comment() {
|
||||
@Override public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override public Comment stripIndent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override public int getSourcePos(int index) {
|
||||
return field == null ? -1 : field.getStartPosition();
|
||||
}
|
||||
@@ -383,7 +392,7 @@ public class Javac {
|
||||
@Override public boolean isDeprecated() {
|
||||
return text.contains("@deprecated") && field instanceof JCVariableDecl && isFieldDeprecated(field);
|
||||
}
|
||||
|
||||
|
||||
@Override public DiagnosticPosition getPos() {
|
||||
return field;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user