提交 66c826b2 编写于 作者: 如梦技术's avatar 如梦技术 🐛

🐛 修复 spi,去除注释

上级 c04cd468
......@@ -51,11 +51,12 @@ class ServicesFiles {
) {
String line;
while ((line = r.readLine()) != null) {
line = line.trim();
// 跳过注释行
if (line.startsWith("#")) {
int commentStart = line.indexOf('#');
if (commentStart >= 0) {
continue;
}
line = line.trim();
// 校验是否删除文件
if (!line.isEmpty() && Objects.nonNull(elementUtils.getTypeElement(line))) {
serviceClasses.add(line);
......@@ -74,7 +75,6 @@ class ServicesFiles {
*/
protected static void writeServiceFile(Collection<String> services, OutputStream output) throws IOException {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output, UTF_8));
writer.write("# Generated by mica-auto www.dreamlu.net\n");
for (String service : services) {
writer.write(service);
writer.newLine();
......
......@@ -36,7 +36,7 @@ public class AutoServiceProcessorTest {
// 转换成 utf-8 字符串然后进行比较
.contentsAsUtf8String()
// 由于生成的文件尾部有个 writer.newLine() 在各个平台不一样,所以采用 startsWith
.startsWith("# Generated by mica-auto www.dreamlu.net\ntest.MyProcessor");
.contains("test.MyProcessor");
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册