views:

323

answers:

1

I am using a UI component from J2ME Polish. I found a simple bug in the code, and want to quickly fix it but cannot find any build scripts in the download package, although source-code is included.

The problem cannot be solved by extending the class as it involves members with private access.

How should I go about fixing it? Should I simply compile the class in question with Javac or should try to locate build script in their repository?

+1  A: 

There is no binary code for J2MEPolish UI library, because these classes are also preprocessed during your application compilation. This is why there is also no build script for J2MEPolish UI part - the resulting binary, if it compiles, would not make any sense :)

If you are using this UI class directly (there is no Polish magic involved) I would suggest to copy it into your own project, make the changes there and you should be just fine.

But there is a small issue. I'm not 100% sure, but Polish build process should be as follows: first your classes are preprocessed and then Polish classes will be preprocessed. If the UI component, that you copied into your project, will stay in the same java package, it could happen that your changes will be overwritten by buggy Polish implementation. You can check it by running the application or looking at the final java code in build directory.

If the overwriting problem happens, then you have two options - move UI class in your project into different package (I'm 99% sure this should be fine if you use it directly) or you need to modify Polish build process, so that it would preprocess Polish classes first and you could overwrite changes done by it.

/JaanusSiim

JaanusSiim
Thanks Jannus.Your explanation makes a lot of sense. I will try your solution and will let you everyone how it goes.
Tahir Akhtar
The class involves Polish pre-processing. I already tried the different package idea but got stuck due to dependencies on other classes that expose package-private members.
Tahir Akhtar
Is it imported with Polish preprocessing or are you using it directly? Anyway - it looks like your best option should be changing Polish build handling. This should not be too difficult.
JaanusSiim
I tried the idea and it worked. Simply copied the class with the bug into my project's source folder under original package. Fixed the bug and did the polish build on the project.Thanks
Tahir Akhtar