Bug 297336 - Improve the preverifier error messages
Summary: Improve the preverifier error messages
Status: NEW
Alias: None
Product: MTJ (Archived)
Classification: Tools
Component: General (show other bugs)
Version: 0.9.1   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: Future   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: ui
Depends on:
Blocks:
 
Reported: 2009-12-09 08:52 EST by Heiko Selber CLA
Modified: 2010-11-15 04:37 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Heiko Selber CLA 2009-12-09 08:52:57 EST
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
Build Identifier: 20090920-1017

I wanted to re-use some Java SE classes in a Java ME project.

In a first step, I corrected all kinds of obvious errors that Eclipse showed me, like the slightly different Collection APIs.

That was easy, but the next step was harder than necessary:

After all indicated errors were removed, I tried to build the project, but preverification failed with a very un-verbose message:

"Error preverifying class my.path.Class"

After some searching I found the culprits: The classes used keywords like native and finalize(), which are not allowed in Java ME. (There might me more such keyword, but I don't have a complete list.)

It took me quite some time to find them, because I didn't get a hint from Eclipse whatsoever, and the offending keywords were hidden somewhere deep in the code.

Isn't it possible to flag these keywords as errors when they are used in an Java ME project? I guess it should be possible to modify or plug something into the Java editor/compiler.

Alternatively (but not preferred), could the preverification perhaps give more verbose error messages, which indicate the root of the problem? But I'd guess that's more difficult to do properly.

Reproducible: Always

Steps to Reproduce:
1. Write a class with a method public void finalize(){}.
2. The editor shows no error and it compiles well, but preverification fails, saying: "Error preverifying class my.path.Class"
Comment 1 Gorkem Ercan CLA 2010-07-07 13:48:30 EDT
CLDC compatibility is checked by the preverifier not by the compiler. Unfortunately preverifiers do not give out the line number where the error is caused. So it will not be possible to put an error marker similar to compile errors. 

However it is possible to make the error string more verbose to indicate the problem, preverifiers do give some more information and that information can be added.
Comment 2 Gorkem Ercan CLA 2010-11-15 04:37:47 EST
Bug 319177 is also related, and if resolved provides the best solution.