mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-03 09:13:36 +00:00
Merge pull request #2548 from rosti-il/master
Fix tests under Windows, fix test.javac11 and test.javac14, fix issue #1745
This commit is contained in:
5 files changed
+26
-25
No files matched your search
@@ -35,6 +35,7 @@ Robbert Jan Grootjans <grootjans@gmail.com>
|
||||
Robert Wertman <robert.wertman@gmail.com>
|
||||
Roel Spilker <r.spilker@gmail.com>
|
||||
Roland Praml <pram@gmx.de>
|
||||
Rostislav Krasny <45571812+rosti-il@users.noreply.github.com>
|
||||
Samuel Pereira <samuel.p.araujo@gmail.com>
|
||||
Sander Koning <askoning@gmail.com>
|
||||
Szymon Pacanowski <spacanowski@gmail.com>
|
||||
|
||||
@@ -119,6 +119,7 @@ This buildfile is part of projectlombok.org. It takes care of compiling and runn
|
||||
<classpath refid="cp.stripe" />
|
||||
<classpath location="build/lombok" />
|
||||
<classpath location="build/tests" />
|
||||
<classpath location="build/teststubs" />
|
||||
<test name="lombok.TestJavac" />
|
||||
</junit>
|
||||
</sequential>
|
||||
|
||||
@@ -2005,6 +2005,7 @@ public class JavacHandlerUtil {
|
||||
}
|
||||
|
||||
private static final Pattern SECTION_FINDER = Pattern.compile("^\\s*\\**\\s*[-*][-*]+\\s*([GS]ETTER|WITH(?:ER)?)\\s*[-*][-*]+\\s*\\**\\s*$", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
|
||||
private static final Pattern LINE_BREAK_FINDER = Pattern.compile("(\\r?\\n)?");
|
||||
|
||||
public static String stripLinesWithTagFromJavadoc(String javadoc, String regexpFragment) {
|
||||
Pattern p = Pattern.compile("^\\s*\\**\\s*" + regexpFragment + "\\s*\\**\\s*$", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
|
||||
@@ -2013,27 +2014,29 @@ public class JavacHandlerUtil {
|
||||
}
|
||||
|
||||
public static String stripSectionsFromJavadoc(String javadoc) {
|
||||
Matcher m = SECTION_FINDER.matcher(javadoc);
|
||||
if (!m.find()) return javadoc;
|
||||
Matcher sectionMatcher = SECTION_FINDER.matcher(javadoc);
|
||||
if (!sectionMatcher.find()) return javadoc;
|
||||
|
||||
return javadoc.substring(0, m.start());
|
||||
return javadoc.substring(0, sectionMatcher.start());
|
||||
}
|
||||
|
||||
public static String getJavadocSection(String javadoc, String sectionNameSpec) {
|
||||
String[] sectionNames = sectionNameSpec.split("\\|");
|
||||
Matcher m = SECTION_FINDER.matcher(javadoc);
|
||||
Matcher sectionMatcher = SECTION_FINDER.matcher(javadoc);
|
||||
Matcher lineBreakMatcher = LINE_BREAK_FINDER.matcher(javadoc);
|
||||
int sectionStart = -1;
|
||||
int sectionEnd = -1;
|
||||
while (m.find()) {
|
||||
while (sectionMatcher.find()) {
|
||||
boolean found = false;
|
||||
for (String sectionName : sectionNames) if (m.group(1).equalsIgnoreCase(sectionName)) {
|
||||
for (String sectionName : sectionNames) if (sectionMatcher.group(1).equalsIgnoreCase(sectionName)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
if (found) {
|
||||
sectionStart = m.end() + 1;
|
||||
lineBreakMatcher.find(sectionMatcher.end());
|
||||
sectionStart = lineBreakMatcher.end();
|
||||
} else if (sectionStart != -1) {
|
||||
sectionEnd = m.start();
|
||||
sectionEnd = sectionMatcher.start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -188,12 +188,6 @@ public class PrettyPrinter extends JCTree.Visitor {
|
||||
return getEndPosition(tree, compilationUnit);
|
||||
}
|
||||
|
||||
private static int lineEndPos(String s, int start) {
|
||||
int pos = s.indexOf('\n', start);
|
||||
if (pos < 0) pos = s.length();
|
||||
return pos;
|
||||
}
|
||||
|
||||
private boolean needsAlign, needsNewLine, onNewLine = true, needsSpace, aligned;
|
||||
|
||||
public static final class UncheckedIOException extends RuntimeException {
|
||||
@@ -434,23 +428,25 @@ public class PrettyPrinter extends JCTree.Visitor {
|
||||
private void printDocComment(JCTree tree) {
|
||||
String dc = getJavadocFor(tree);
|
||||
if (dc == null) return;
|
||||
|
||||
aPrintln("/**");
|
||||
int pos = 0;
|
||||
int endpos = lineEndPos(dc, pos);
|
||||
boolean atStart = true;
|
||||
while (pos < dc.length()) {
|
||||
String line = dc.substring(pos, endpos);
|
||||
if (line.trim().isEmpty() && atStart) {
|
||||
|
||||
for (String line : dc.split("\\r?\\n")) {
|
||||
if (atStart && line.trim().isEmpty()) {
|
||||
atStart = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
atStart = false;
|
||||
aPrint(" *");
|
||||
if (pos < dc.length() && dc.charAt(pos) > ' ') print(" ");
|
||||
println(dc.substring(pos, endpos));
|
||||
pos = endpos + 1;
|
||||
endpos = lineEndPos(dc, pos);
|
||||
if (!line.isEmpty() && !Character.isWhitespace(line.charAt(0))) {
|
||||
print(" ");
|
||||
}
|
||||
|
||||
println(line);
|
||||
}
|
||||
|
||||
aPrintln(" */");
|
||||
}
|
||||
|
||||
|
||||
@@ -65,8 +65,8 @@ public class TestConfiguration {
|
||||
outStream.flush();
|
||||
errStream.flush();
|
||||
|
||||
String out = new String(rawOut.toByteArray()).replace("\r\n", "\n").replace('\\', '/').replaceAll(Pattern.quote(normalizedName) + "|" + Pattern.quote(baseName), "BASE/").trim();
|
||||
String err = new String(rawErr.toByteArray()).replace("\r\n", "\n").replace('\\', '/').replaceAll(Pattern.quote(normalizedName) + "|" + Pattern.quote(baseName), "BASE/").trim();
|
||||
String out = new String(rawOut.toByteArray()).replace('\\', '/').replaceAll(Pattern.quote(normalizedName) + "|" + Pattern.quote(baseName), "BASE/").trim();
|
||||
String err = new String(rawErr.toByteArray()).replace('\\', '/').replaceAll(Pattern.quote(normalizedName) + "|" + Pattern.quote(baseName), "BASE/").trim();
|
||||
|
||||
checkContent(directory, out, "out");
|
||||
checkContent(directory, err, "err");
|
||||
|
||||
Reference in new issue
Block a user