Got IDE red mark errors while JDK will compile fine.

Hi there,

I understand below is not good code, but JDK compiler did not complains, however the IntelliJ won't leave it alone and labeled it with a red mark that I can not remove!

public class test {
     public static void main(String[] args) {
          Integer i = 0;
          System.out.println((i++).toString());
     }
}


It says "toString()" is not defined.

Thanks,
Zemian

4 comments
Comment actions Permalink

Thats a good one - Can confirm it; The compiler is the one at Fault though..

0
Comment actions Permalink

I think i++ returns int not Integer. Seems right to me that it indicates an error.

0
Comment actions Permalink

Thanks guys for the replies. True that's IDE is good at cathing it and it's bad code, but the problem is that we often use IDE to read other "READ ONLY" source, and it's not fun to have a RED mark floating around at all time! It's annoying. To me it's still a IntelliJ bug to show as RED.

0

Please sign in to leave a comment.