File tree 1 file changed +5
-1
lines changed
lib/src/main/java/com/diffplug/spotless/kotlin
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -101,13 +101,17 @@ FormatterFunc createFormat() throws Exception {
101
101
Class <?> function2Interface = classLoader .loadClass ("kotlin.jvm.functions.Function2" );
102
102
Class <?> lintErrorClass = classLoader .loadClass ("com.github.shyiko.ktlint.core.LintError" );
103
103
Method detailGetter = lintErrorClass .getMethod ("getDetail" );
104
+ Method lineGetter = lintErrorClass .getMethod ("getLine" );
105
+ Method colGetter = lintErrorClass .getMethod ("getCol" );
104
106
Object formatterCallback = Proxy .newProxyInstance (classLoader , new Class []{function2Interface },
105
107
(proxy , method , args ) -> {
106
108
Object lintError = args [0 ]; // com.github.shyiko.ktlint.core.LintError
107
109
boolean corrected = (Boolean ) args [1 ];
108
110
if (!corrected ) {
109
111
String detail = (String ) detailGetter .invoke (lintError );
110
- throw new AssertionError (detail );
112
+ int line = (Integer ) lineGetter .invoke (lintError );
113
+ int col = (Integer ) colGetter .invoke (lintError );
114
+ throw new AssertionError ("Error on line: " + line + " col " + col + "\n " + detail );
111
115
}
112
116
return null ;
113
117
});
You can’t perform that action at this time.
0 commit comments