Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Java: Somebody Please Help Me :-(
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
wswartzendruber
Veteran
Veteran


Joined: 23 Mar 2004
Posts: 1261
Location: Idaho, USA

PostPosted: Mon Jul 02, 2012 11:18 pm    Post subject: Java: Somebody Please Help Me :-( Reply with quote

I have no idea what the problem is:

Code:
package com.example.fragmentfun;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;

public class MainActivity extends FragmentActivity
{
   @Override
   public void onCreate(Bundle savedInstanceState)
   {
      
      //super.onCreate(savedInstanceState);
      
      
      
      
      ---> "Syntax error, insert 'AssignmentOperator Expression' to complete assignment. <---
      
      
      
      //setContentView(R.id.fragment_container);
      
      if (findViewById(R.id.fragment_container) != null)
      {
         if (savedInstanceState != null)
            return;
         
         FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
         FunFragment1 ff1 = new FunFragment1();
         FunFragment2 ff2 = new FunFragment2();
         
         ff1.setArguments(getIntent().getExtras());
         ff2.setArguments(getIntent().getExtras());
         
         ft.add(R.id.fragment_container, ff1);
         ft.add(R.id.fragment_container, ff2);
         
         ft.commit();
      }
   }
}

What you see is exactly the code I have, including whitespace. The only difference is that I've marked where the error is. I cannot figure out what the problem is. This is happening in Eclipse. I'm no Java master. Most of my experience is with C# and C.
Back to top
View user's profile Send private message
Goverp
Veteran
Veteran


Joined: 07 Mar 2007
Posts: 1993

PostPosted: Tue Jul 03, 2012 9:07 am    Post subject: Re: Java: Somebody Please Help Me :-( Reply with quote

wswartzendruber wrote:
I have no idea what the problem is:

Code:

...
      //super.onCreate(savedInstanceState);
      
      
      
      
      ---> "Syntax error, insert 'AssignmentOperator Expression' to complete assignment. <---
      
      
      
      //setContentView(R.id.fragment_container);
...

What you see is exactly the code I have, including whitespace. The only difference is that I've marked where the error is. I cannot figure out what the problem is. This is happening in Eclipse. I'm no Java master. Most of my experience is with C# and C.


If that's literally correct, i.e. the error message is connected to a line of whitespace, some things come to mind:
  1. Eclipse is doing something screwy.
  2. Your code is being generated by some preprocessor, and the error message relates to the original source whereas it's being displayed against the processed code.
  3. The "whitespace" isn't white - i.e. there are some non-displaying characters that Java thinks are source code atoms, and is trying to parse them into a valid assignment statement.
  4. The lines are much longer than displayed, and contain something non-blank hidden off to the right.

It's a while since I Javad, but I don't recall that form of error message from Eclipse or Java, so I wonder if some preprocessor generated it, hence that option, otherwise there's something being parsed that we can't see, or Eclipse is sick.
_________________
Greybeard
Back to top
View user's profile Send private message
ce110ut
Apprentice
Apprentice


Joined: 27 Sep 2002
Posts: 200

PostPosted: Tue Jul 03, 2012 2:11 pm    Post subject: Reply with quote

I agree - that white space probably isn't sanitized.

That or what eclipse is compiling against and what you're looking at are not the same thing. As silly as they may sound, try closing eclipse, view the file with another editor, remove the unnecessary whitespace and then go back to eclipse. Make sure to refresh the project.

Let us know what happens after that.
Back to top
View user's profile Send private message
wswartzendruber
Veteran
Veteran


Joined: 23 Mar 2004
Posts: 1261
Location: Idaho, USA

PostPosted: Tue Jul 03, 2012 2:23 pm    Post subject: Reply with quote

I'm used to Indigo. I'm using this version called Juno, and it appears to come with this thing called Lint. And Lint wasn't updating the error status.
Back to top
View user's profile Send private message
ce110ut
Apprentice
Apprentice


Joined: 27 Sep 2002
Posts: 200

PostPosted: Thu Jul 05, 2012 2:06 pm    Post subject: Reply with quote

Ahh. So it's working as expected now?
Back to top
View user's profile Send private message
wswartzendruber
Veteran
Veteran


Joined: 23 Mar 2004
Posts: 1261
Location: Idaho, USA

PostPosted: Thu Jul 05, 2012 2:38 pm    Post subject: Reply with quote

Yeah. It was an Eclipse bug.
_________________
Git has obsoleted SVN.
10mm Auto has obsoleted 45 ACP.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum