Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » DSDP - Mobile Tools for Java (MTJ) » preverify error with float[]
preverify error with float[] [message #566526] Mon, 23 July 2007 15:17
Eclipse UserFriend
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:I'm new in mobile devices
Next Topic:preverify error with float[]
Goto Forum:
  


Current Time: Thu Apr 25 01:08:17 GMT 2024

Powered by FUDForum. Page generated in 0.03370 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top