facebook

Unnecessary Semicolon error

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #279386 Reply

    parasjain01
    Member

    Hi,
    I am facing a strange problem with MyEclipse 5.1.0.

    When I type to consecutive semicolon (;;) in a Java Class it gives me Unnecessary Semicolon error at compile-time. But when I type two consecutive semicolon (;;) in a Java Interface I don’t get any warning/error. Is this a bug? Where are the settings for this. I did not find any such setting in compiler errors/warnings preferences.

    My colleague is getting error in both Java Class and Java Interface. He is using MyEclipse6+

    Paras

    #279404 Reply

    Loyal Water
    Member

    What code are you adding the semicolon after? I did not get any errors when I added a double Semicolon in a java class. I tried this on MyEclipse 6.0.1.

    #279405 Reply

    parasjain01
    Member

    Anywhere at the end of line when you tye two semicolons ;; in the end instead of one semicolon ; that validation error appears.

    There should be some validation setting somewhere but we are not able to figure out where.

    One more example
    if one one line we say somethinge like

    
    if(someVariable==nul){
    //do something here and return 
    return;
    }
    

    and in the next line if I check for null

    
    if(someVariable != null){
    }
    

    It (rightly) gives me validation error saying that
    The variable someVariable cannot be null; it was either set to a non-null value or assumed to be non-null when last used

    Our problem is, some validation works in my version and does not work in his version. Where is the settings for that?

    #279407 Reply

    Loyal Water
    Member

    Can you paste the entire file here for me. I want to try this at my end.

    #279413 Reply

    parasjain01
    Member
    
    public class TestValidation {
    public static void main(String args[]){
        
        String myVal = args[0];
        if(myVal == null){
            return;
        }
    
        if(myVal != null){
            
        }
        System.out.println("Test");;
    }
    }
    

    Interestingly I get only one error at a time. In the above code I am getting error on System.out.println line saying Unnecessary semicolon.

    When I comment out or remove System.out.println line it gives me error on

    if(myVal != null){

    Saying the varialbe myVal cannot be null

    #279445 Reply

    Loyal Water
    Member

    My colleague is getting error in both Java Class and Java Interface. He is using MyEclipse6+

    I tried this out at my en d and I didn’t get any errors. I tried this on MyEclipse 5.5.1 and 6.0.1.

    This might have been a bug with the old version of MyEclipse. I suggest you upgrade to MyEclipse 6.0.1 and continue working.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Unnecessary Semicolon error

You must be logged in to post in the forum log in