checker-framework icon indicating copy to clipboard operation
checker-framework copied to clipboard

not taking correct files for compiling

Open shivanshsoni opened this issue 9 years ago • 7 comments

I have a folder named winter on my desktop where I keep my codes and when I process command javac -processor NullnessChecker bladder.java then instead of processing bladder.java, it started showing results for christmas.class. When I put it in another folder it shows correct output. when I compile it with javac bladder.java it compiled it properly.

My output: screenshot 20

I think it is a big issue. Please review this.

shivanshsoni avatar Mar 26 '17 03:03 shivanshsoni

Can you please provide a complete, reproducible test case so that other people can see the same results you are seeing? You have not attached christmas.java, for example; I would assume that (and anything else in your winter folder) is needed in order to reproduce the problem. Also, have you attached the correct version of bladder.java, or might there be two different versions in the two directories?

mernst avatar Mar 26 '17 04:03 mernst

@mernst Actually I have created a file named string.java in which I have christmas1 mehod.

Something like this:

screenshot 23

Bladder.java:

import java.util.Scanner; class bladder { public static void main(String[]args) { Scanner scan=new Scanner(System.in); int t,i,j,k,l; t=scan.nextInt(); for(i=0;i<t;i++) { j=scan.nextInt(); k=scan.nextInt(); if(j%2!=0&&k%2!=0||j%2==0&&k%2==0) { if(j-k==2||k-j==2) { System.out.println("YES"); } else { System.out.println("NO"); } } else if(j%2==0&&k%2!=0) { if(j-k==1) { System.out.println("YES"); } else { System.out.println("NO"); } } else if(j%2!=0&&k%2==0) { if(k-j==1) { System.out.println("YES"); } else { System.out.println("NO"); } } else { System.out.println("NO"); } } } }

shivanshsoni avatar Mar 26 '17 04:03 shivanshsoni

Is it due to usage of String[]args inside main mehod? as it i have String[]args so instead of using library of java it is taking String.java

shivanshsoni avatar Mar 26 '17 04:03 shivanshsoni

Great, it sounds like you have solved the problem, and it wasn't related to running an annotation processor. Maybe your operating system doesn't distinguish lower-case from upper-case letters, so javac is using string.java when you use String in your program.

mernst avatar Mar 26 '17 04:03 mernst

But it is working fine with javac 8 compiler

shivanshsoni avatar Mar 26 '17 04:03 shivanshsoni

@mernst I think it is a problem as I dont think my opearing system is working fine with uppercase and lowercase letters.

shivanshsoni avatar Mar 26 '17 04:03 shivanshsoni

It seems that your string.java file contains potential null pointer exceptions. Compiling that file with javac won't issue any errors, but type-checking it with the Nullness Checker will.

mernst avatar Mar 26 '17 04:03 mernst