mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
o Fix test on Windows
This commit is contained in:
parent
50d916c370
commit
c247bfbe5b
@ -131,7 +131,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12</version>
|
||||
<version>2.14.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.mycila.maven-license-plugin</groupId>
|
||||
|
@ -16,6 +16,8 @@
|
||||
package org.mapstruct.ap.testutil.compilation.model;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.tools.Diagnostic.Kind;
|
||||
import javax.tools.JavaFileObject;
|
||||
|
||||
@ -41,18 +43,26 @@ public class DiagnosticDescriptor {
|
||||
}
|
||||
|
||||
public static DiagnosticDescriptor forDiagnostic(Diagnostic diagnostic) {
|
||||
String soureFileName = diagnostic.type().getName().replaceAll( "\\.", File.separator ) + ".java";
|
||||
String soureFileName = diagnostic.type().getName().replace( ".", File.separator ) + ".java";
|
||||
return new DiagnosticDescriptor( soureFileName, diagnostic.kind(), diagnostic.line(), "" );
|
||||
}
|
||||
|
||||
public static DiagnosticDescriptor forDiagnostic(String sourceDir, javax.tools.Diagnostic<? extends JavaFileObject> diagnostic) {
|
||||
try
|
||||
{
|
||||
String sourceName = new File(diagnostic.getSource().toUri()).getCanonicalPath();
|
||||
return new DiagnosticDescriptor(
|
||||
diagnostic.getSource().getName().substring( sourceDir.length() + 1 ),
|
||||
(sourceName.length() > sourceDir.length() ? sourceName.substring( sourceDir.length() + 1 ) : sourceName),
|
||||
diagnostic.getKind(),
|
||||
diagnostic.getLineNumber(),
|
||||
""
|
||||
);
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new RuntimeException( e );
|
||||
}
|
||||
}
|
||||
|
||||
public String getSourceFileName() {
|
||||
return sourceFileName;
|
||||
|
Loading…
x
Reference in New Issue
Block a user