Merge remote-tracking branch 'upstream/pmd/7.0.x' into text-utils-simple

This commit is contained in:
Clément Fournier
2022-07-09 11:59:43 +02:00
225 changed files with 8878 additions and 2980 deletions

View File

@@ -13,7 +13,7 @@
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<version>7.0.0-SNAPSHOT</version>
<relativePath>../</relativePath>
<relativePath>../pom.xml</relativePath>
</parent>
<build>
@@ -112,10 +112,6 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<!--
the following dependencies are all scope compile,

View File

@@ -13,7 +13,7 @@ import net.sourceforge.pmd.processor.AbstractPMDProcessor
import net.sourceforge.pmd.reporting.GlobalAnalysisListener
import net.sourceforge.pmd.lang.document.TextDocument
import net.sourceforge.pmd.lang.document.TextFile
import org.apache.commons.io.IOUtils
import net.sourceforge.pmd.util.IOUtil
import java.io.InputStream
import java.nio.charset.StandardCharsets
import java.nio.file.Files
@@ -150,7 +150,7 @@ abstract class BaseParsingHelper<Self : BaseParsingHelper<Self, T>, T : RootNode
*/
@JvmOverloads
open fun parseFile(path: Path, version: String? = null): T =
parse(IOUtils.toString(Files.newBufferedReader(path)), version, fileName = path.toAbsolutePath().toString())
parse(IOUtil.readToString(Files.newBufferedReader(path)), version, fileName = path.toAbsolutePath().toString())
/**
* Fetches the source of the given [clazz].
@@ -168,7 +168,7 @@ abstract class BaseParsingHelper<Self : BaseParsingHelper<Self, T>, T : RootNode
}
private fun consume(input: InputStream) =
IOUtils.toString(input, StandardCharsets.UTF_8)
IOUtil.readToString(input, StandardCharsets.UTF_8)
.replace(Regex("\\R"), "\n") // normalize line-endings
/**