Incorrect jump to source from compiler error (when tab character)
Answered
When in a source code I used tab characters and had the compilation error, I press 'jump to source' from "Messages" and it jumping misses.
public class Example {
{
//Error:(6, 24) java: incompatible types: int cannot be converted to java.lang.String
\t\tmethod(3);/*pointer here*/
}
void method(String param) {}
}
In the variant with spaces compilation pointer has correct offset.
public class Example {
{
//Error:(6, 32) java: incompatible types: int cannot be converted to java.lang.String
method(/*pointer here*/3); // with spaces
}
void method(String param) {}
}
Reproduced in
IntelliJ IDEA (Community Edition) 2016.3 EAP
Build #IC-163.3983.4, built on September 7, 2016
JRE: 1.8.0_112-release-b340 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
And in the
IntelliJ IDEA 2016.2.1
Build #IC-162.1447.26, built on August 2, 2016
JRE: 1.8.0_76-release-b216 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Please sign in to leave a comment.
Please share a sample project to reproduce.
I reproduced on the supplied example class.
Forum breaks the formatting, please zip and share a complete sample project.
https://drive.google.com/open?id=0B65t6sE2WAXBb01QMTZfVkxWWG8
Error column number is reported by the Java compiler. It reports column 24 when using Java 8 and column 17 when using Java 7. IDEA just jumps to the location provided by the compiler.
It appears that javac interpretes tab size as 8 spaces.
If you change IDE code style tab size to 8 spaces, it should jump correctly.
I've reported https://youtrack.jetbrains.com/issue/IDEA-161153, please vote.
It's not a bug, tab size is hardcoded to 8 in javac.