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

0
7 comments

Please share a sample project to reproduce.

0
Avatar
Permanently deleted user

I reproduced on the supplied example class.

0

Forum breaks the formatting, please zip and share a complete sample project.

0

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.

0
Avatar
Permanently deleted user
 
Thanks.
 
Maybe it is a bug of javac?
 
0

It's not a bug, tab size is hardcoded to 8 in javac.

0

Please sign in to leave a comment.