×

Discussion Board

Results 1 to 15 of 15
  1. #1
    Regular Contributor
    Join Date
    Jun 2009
    Location
    Tel-Aviv Israel
    Posts
    410

    Error preverifying class

    I get this error almost every time I use inner classes, I do say almost, since sometimes I do not get the error, and I can't find any common base to these occasions, they are bugging the hell out of me, since there is no real error, everything is in its place yet I can't test my application, does anyone have any idea how to get rid of this?

    this is the error I get

    Type lowest.StateManager$State1 Error preverifying class lowest.StateManager$State1

    the State1 is because I tried to change the name, it has nothing to do with the name... am I missing something fundamental?
    Last edited by TacB0sS; 2010-04-27 at 06:54.
    Thanks,
    Adam Zehavi.

  2. #2
    Regular Contributor
    Join Date
    Jun 2009
    Location
    Tel-Aviv Israel
    Posts
    410

    Re: Error preverifying class

    help any one? I use Eclipse 3.5.2 Galileo? and I can't find any common base to these errors...
    Thanks,
    Adam Zehavi.

  3. #3
    Regular Contributor
    Join Date
    Jun 2009
    Location
    Tel-Aviv Israel
    Posts
    410

    Re: Error preverifying class

    I solved my problem but with out any clue for how here is what I tired:
    • delete the class file
      move the class file
      start a new project, copied the file.
      removed the class file from build path
      include the class file in build path
      create new package.
      deleted all the projects management files, that eclipse generates.
      clear workspace.
      build workspace.
      clear project.
      rebuild project.

      I can add so many things to the list, there must be an easy way to do this...


    does anyone know a quick way out of this stupid bug? I reported this a few months ago to Eclipse but this still popping up and it slows me down...

    Any help would be greatly appreciated.
    Adam.

  4. #4
    Regular Contributor
    Join Date
    Jun 2009
    Location
    Tel-Aviv Israel
    Posts
    410

    Angry Re: Error preverifying class

    60 views so far... didn't anyone encountered this at all? it's the 20th time I get this exception, but until now it came when the inner class was static so I could just move it and return it and then it would fix, but now I have an inner class that is not static and moving it, is not working so good, but this technic DOES NOT MAKE ANY SENSE, there should be an elegant solution to this, please help me... I looked on google only stupid posts of people that didn't include some jar to their build path or something, here is my object there is no reference to anything but known objects:
    Code:
    package lowest;
    
    
    import interfaces.Action;
    import interfaces.ComponentGeneratorAction;
    
    import java.util.Vector;
    
    public final class StateManager implements StateSwapHandler, Action {
    	public class State {
    		private ComponentGeneratorAction componentGenerator;
    		private Component generatedComponent;
    		private boolean garbage = false;
    		
    		public State() {}
    		public Component generateComponent() {
    			if (generatedComponent != null)
    				return generatedComponent;
    			return generatedComponent = componentGenerator.generateComponent();
    		}
    		
    		/**
    		 * Try to sets this state to the {@link StateManager}. invoking this method would cause this state to be set.
    		 * 
    		 * @return true only if this state is not added to the manager
    		 */
    		public boolean setState() {
    			if (swapHandler != null)
    				return swapHandler.changeToState(StateManager.this, this, container, generateComponent());
    			return changeToState(StateManager.this, this, container, generateComponent());
    		}
    		public void finalize() {
    			if (garbage)
    				generatedComponent = null;
    		}
    		public final ComponentGeneratorAction getComponentGenerator() {
    			return componentGenerator;
    		}
    		
    		public final void setComponentGenerator(ComponentGeneratorAction componentGenerator) {
    			this.componentGenerator = componentGenerator;
    		}
    	}
    	private Vector states = new Vector();
    	private Container container;
    	private State defaultState;
    	private StateSwapHandler swapHandler;
    	
    	/**
    	 * by default, if there is no {@link StateSwapHandler} supplied this method is executed to implement the change. this 
    	 * implementation set a "return to default state" {@link Action} as the removal action of the {@link Component} of the given {@link State}.
    	 * 
    	 */
    	public final boolean changeToState(StateManager stateManager, State toState, Container stateManagerContainer, Component component) {
    		// if(defaultState==null)
    		if(toState!=defaultState)
    			component.setRemovedAction(this);
    		stateManager.states.removeAllElements();
    		states.addElement(toState);
    		for(int i=0;i<stateManagerContainer.size();i++)
    			stateManagerContainer.getComponent(i).setRemovedAction(null);
    		stateManagerContainer.clear();
    		stateManagerContainer.add(component);
    		return true;
    	}
    	
    	public void action() {
    		changeToState(StateManager.this, defaultState, container, defaultState.generateComponent());
    	}
    	
    	public final State getDefaultState() {
    		return defaultState;
    	}
    	/**
    	 * this is the nice thing, Once this defaultState is set this method invokes the "return to default state action" and the given state becomes active and default, and does not need a return action in the component!
    	 * @param defaultState
    	 */
    	public final void setDefaultState(State defaultState) {
    		this.defaultState = defaultState;
    		action();
    	}
    	
    	public final StateSwapHandler getSwapHandler() {
    		return swapHandler;
    	}
    	
    	public final void setSwapHandler(StateSwapHandler swapHandler) {
    		this.swapHandler = swapHandler;
    	}
    	public final Container getContainer() {
    		return container;
    	}
    
    	public final void setContainer(Container container) {
    		this.container = container;
    	}
    }
    this is just unbelievable, I remove the inner class and it works, I put it back... ERROR, I could really use your help with this guys, please...
    Thanks,
    Adam Zehavi.

  5. #5
    Regular Contributor
    Join Date
    Jun 2009
    Location
    Tel-Aviv Israel
    Posts
    410

    Re: Error preverifying class

    in case anyone wonder this was causing the error
    Code:
    public void finalize() {
    ...
    }
    Thanks,
    Adam Zehavi.

  6. #6
    Registered User
    Join Date
    Nov 2009
    Posts
    188

    Re: Error preverifying class

    Quote Originally Posted by TacB0sS View Post
    in case anyone wonder this was causing the error
    Code:
    public void finalize() {
    ...
    }
    But why it's giving the error?
    What is the reason behind it?
    Can you please elaborate then it will help to other.

    Thanks and Regards,
    Ajit

  7. #7
    Regular Contributor
    Join Date
    Jun 2009
    Location
    Tel-Aviv Israel
    Posts
    410

    Thumbs up Re: Error preverifying class

    not only that... if you change the name of the method to finalize1() it would compile, everything but finalize... what would you say to that...? the error is in the preverification object that comes with Eclipse, I reported a bug, but they probably did not fixed it yet...

    the stupid thing on my side is, is that I didn't learn from my previous mistake... only after careful thought I remembered that last time I handled this, it had to do with some text so I started deleting methods until I came to that, and only then I remembered that the word finalize gives the problem!

    And it does not even have to an inner class, any class that have this method name does not work at least on my computer.

    if you up for it, try it in one of your object, and post back what happens with it...
    Last edited by TacB0sS; 2010-04-27 at 13:10.
    Thanks,
    Adam Zehavi.

  8. #8
    Registered User
    Join Date
    Nov 2009
    Posts
    188

    Re: Error preverifying class

    Quote Originally Posted by TacB0sS View Post
    not only that... if you change the name of the method to finalize1() it would compile, everything but finalize... what would you say to that...? the error is in the preverification object that comes with Eclipse, I reported a bug, but they probably did not fixed it yet...

    the stupid thing on my side is, is that I didn't learn from my previous mistake... only after careful thought I remembered that last time I handled this, it had to do with some text so I started deleting methods until I came to that, and only then I remembered that the word finalize gives the problem!

    And it does not even have to an inner class, any class that have this method name does not work at least on my computer.

    if you up for it, try it in one of your object, and post back what happens with it...
    If we put the finalize method, then it will create problem according to you.
    But now I have tried to put the finalize method in my project and it perfectly running.
    What I did is just wrote the finalize method and inside that one println statement and called from other and its behaving perfectly.One thing I have not done is the inner class.

    So what's your view on this?

    Thanks & Regards,
    Ajit

  9. #9
    Regular Contributor
    Join Date
    Jun 2009
    Location
    Tel-Aviv Israel
    Posts
    410

    Re: Error preverifying class

    try to put it in an inner class then...
    the first error occur while it was an inner class, and once I refactored it to be alone the error persisted.
    Thanks,
    Adam Zehavi.

  10. #10
    Registered User
    Join Date
    Nov 2009
    Posts
    188

    Re: Error preverifying class

    Quote Originally Posted by TacB0sS View Post
    try to put it in an inner class then...
    the first error occur while it was an inner class, and once I refactored it to be alone the error persisted.
    I wrote the finalize method in an inner class and called by the main class and it is running perfectly in the emulator.
    The way I have done is below .
    Please have a look on this that am I doing the way you told or not and let me know..

    Created inner class inside the main class

    public class State {

    private boolean garbage;

    public State() {
    garbage = true;
    }

    public void finalize() {
    if (garbage) {
    System.out.println("finalize method get called...");
    }
    }
    }

    and called the method in the startapp method

    public void startApp() {
    State state = new State();
    state.finalize();
    }
    the above code is working fine.

    Please let me know wheather I am correct or wrong !

    Thanks & Regards,
    Ajit

  11. #11
    Regular Contributor
    Join Date
    Jun 2009
    Location
    Tel-Aviv Israel
    Posts
    410

    Question Re: Error preverifying class

    you mean you wrote something like:

    class A {
    class B {
    void finalize() { ...}
    }
    }

    if you have wrote something like this, which editor do you use Eclipse, NetBeens, ver, windows?
    Thanks,
    Adam Zehavi.

  12. #12
    Registered User
    Join Date
    Nov 2009
    Posts
    188

    Re: Error preverifying class

    Quote Originally Posted by TacB0sS View Post
    you mean you wrote something like:

    class A {
    class B {
    void finalize() { ...}
    }
    }

    if you have wrote something like this, which editor do you use Eclipse, NetBeens, ver, windows?
    Yes.I am using NetBeens 6.5.

    Thanks & Regards,
    Ajit

  13. #13
    Regular Contributor
    Join Date
    Jun 2009
    Location
    Tel-Aviv Israel
    Posts
    410

    Wink Re: Error preverifying class

    not only that... if you change the name of the method to finalize1() it would compile, everything but finalize... what would you say to that...? the bug is in the preverification object that comes with Eclipse, I reported a bug, but they probably did not fixed it yet...
    as I said Eclipse bug... annoying bug, it works fine now by the way, I changed the name to terminate()..

    you my friends just can't understand how its like to have your midlet work one second, and a second later it doesn't compile because you implemented an abstract, and without it been your fault at all... and waste nearly two days for this thing...

    I'm going to report that bug again now!

    BTW, this happens only on J2Me not on desktop...
    Thanks,
    Adam Zehavi.

  14. #14
    Regular Contributor
    Join Date
    Jun 2009
    Location
    Tel-Aviv Israel
    Posts
    410

    Question Re: Error preverifying class

    if anyone here uses Eclipse, could you please check if you encounter the same error...
    Thanks,
    Adam Zehavi.

  15. #15
    Regular Contributor
    Join Date
    Jun 2009
    Location
    Tel-Aviv Israel
    Posts
    410

    Re: Error preverifying class

    does anyone else use Eclipse or am I the only one?
    please check this issue...
    Thanks,
    Adam Zehavi.

Similar Threads

  1. Accessing Canvas Class from Subclass
    By phil_mw60 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2010-05-01, 20:22
  2. Decompress then save again as contact to phone book, it is possible?
    By bytescode in forum Mobile Java Tools & SDKs
    Replies: 8
    Last Post: 2009-08-31, 16:04
  3. Error loading connection when obfuscation high?
    By ejakkk in forum Mobile Java General
    Replies: 8
    Last Post: 2009-06-26, 12:54
  4. External Linking Error (Undefined Symbol)
    By nile_mail in forum Symbian
    Replies: 2
    Last Post: 2008-08-05, 13:10
  5. Exceptions while loading application
    By avinash_rs in forum Mobile Java General
    Replies: 0
    Last Post: 2003-06-09, 10:53

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×