Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DSDP - Mobile Tools for Java (MTJ) » preverify error with float[]
preverify error with float[] [message #19651] Mon, 23 July 2007 11:17
Eclipse User
Originally posted by: Mark.Tarlton.motorola.com

I'm seeing a problem with unexpected compiler errors when declaring float
arrays.

Platform: Java 1.6, Eclipse 3.3.0, Sun WTK 2.5, MTJ 0.7

The target device is the Sun "DefaultColorPhone" with CLDC1.1 and MIDP2.0
enabled.

I created the default "Hello_World_MIDP" MIDlet and it compiled and ran
properly.

I then added two floating point declarations and recompiled. The first
declaration of a simple float variable was accepted, but the declaration
of a float array generates an error:

"Errors found in preverification. Build Canceled.
Reason:
org.eclipse.mtj.exception.PreverificationException: Errors found in
preverification. Build Canceled"

It also displays a message to the effect that "floating point not allowed
in method definition for startApp."

The example code is below



------------------------------------------------------------ ---------------
package hello_world_midp_package;

import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

/**
* hello world MIDP
*/
public class Hello_World_MIDP extends MIDlet {

protected Form form;
/**
*
*/
protected TextField textField;

/**
* @see MIDlet#startApp()
*/
protected void startApp() throws MIDletStateChangeException {
Display d = Display.getDisplay(this);
d.setCurrent(getForm());
float fVar = 1.0f; // THIS WORKS *****************
float[] fVarArray = new float[4]; // THIS DOESN'T **********
form.append("Hello World!" + fVar);


}

/**
* @see MIDlet#pauseApp()
*/
protected void pauseApp() {
}

/**
* @see MIDlet#destroyApp(boolean)
*/
protected void destroyApp(boolean flag) throws MIDletStateChangeException
{
}

/**
* Method getForm.
* @return Form
*/
protected Form getForm() {
if (form == null) {
form = new Form("Title");
form.append("Hello World");
}
return form;
}
}
Previous Topic:preverify error with float[]
Next Topic:WSDD Replacement?
Goto Forum:
  


Current Time: Mon Apr 21 00:49:00 EDT 2014

Powered by FUDForum. Page generated in 0.01739 seconds