[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[News.eclipse.dsdp.mtj] preverify error with float[]
|
- From: Mark.Tarlton@xxxxxxxxxxxx (Mark Tarlton)
- Date: Mon, 23 Jul 2007 15:17:31 +0000 (UTC)
- Newsgroups: eclipse.dsdp.mtj
- Organization: Eclipse
- User-agent: NewsPortal/0.36 (http://florian-amrhein.de/newsportal)
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;
}
}