diff options
author | Rostislav Krasny <45571812+rosti-il@users.noreply.github.com> | 2020-08-18 04:03:23 +0300 |
---|---|---|
committer | Rostislav Krasny <45571812+rosti-il@users.noreply.github.com> | 2020-08-18 04:09:25 +0300 |
commit | 79c3d383fd7d46ec1c6c5cf83d8b05f2238529a2 (patch) | |
tree | 83dec678a33158c003dc53b2a2643156b1a70de3 /src/core | |
parent | 7dfbe4323c15cbd88983380b27a250d2a381d148 (diff) | |
download | lombok-79c3d383fd7d46ec1c6c5cf83d8b05f2238529a2.tar.gz lombok-79c3d383fd7d46ec1c6c5cf83d8b05f2238529a2.tar.bz2 lombok-79c3d383fd7d46ec1c6c5cf83d8b05f2238529a2.zip |
Fix tests under Windows, fix test.javac11 and test.javac14, fix issue #1745
The change of the TestConfiguration.java is based on the fact that
Git for Windows is configured with 'core.autocrlf=true' by default.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/lombok/javac/handlers/JavacHandlerUtil.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index e0af0e52..2523103f 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -1964,6 +1964,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); @@ -1972,27 +1973,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(); } } |