Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.997 Dev OS, Z30 (STA100-5)-10.3.1.997 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: Preprocessor problem, variable exists

Artifacts have been cleaned out, I've learned all the different files (not individually) that are installed or created by the Eclipse Plugin so I knew which ones to delete or move.

 

I know the pre-processor is working because some elements that are not supposed to run don't run and those that are currently defined do.

 

I just don't know why stuff like this happens, is it Eclipse's "auto-build" or something else? I am certain that it has to do with Eclipse because, as stated before, the compile is coming out correct (for the classes/projects that do compile) but Eclipse complains about other stuff.

 

At the rate that I'm going it might be better to write my own pre-processor and have it execute before the Resource Builder. At least then I can implement support for define operations (//#ifdef DEFINE1 || DEFINE2) and the like.

 

I'll bring this post up tomorrow when MSohm roams the forums (about 12PM-3PM my time).

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.997 Dev OS, Z30 (STA100-5)-10.3.1.997 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: Preprocessor problem, variable exists

So has anybody have a fix or know what might cause something like this? Is it an Eclipse thing or a Plug-In thing?

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
New Contributor
nsx_nawe
Posts: 3
Registered: ‎07-13-2010
My Device: Blackberry 9000

Re: Preprocessor problem, variable exists

IM having this same issue =(

 

i imported a project from Eclipse 3.4.2 Plugin 1.0  

into Eclipse 3.5 Plugin 1.1

 

its really important for me since the debugger wasnt working but now i got this =( on my new setup and it wont compile...

 

"Errors Ocurred during the build.
Errors running builder 'Blackberry Pre-Process Builder' on project '[MY PROJECTS NAME]'

An error ocurred while traversing resources:
java.lang.NullPointerException

An error ocurred while traversing resources:
java.lang.NullPointerException"

 

yes, it says that twice.

 

i have no clue on this =( 

 

any help will be very appreciated.

 

thanks!

Developer
dnepr
Posts: 723
Registered: ‎03-12-2009
My Device: Playbook

Re: Preprocessor problem, variable exists

[ Edited ]

If all else fails you can use Netbeans to create pre-processed files and use Eclipse for building the final pre-processed code.

 

Preprocessing support in Eclipse plug in is so bad that I gave up on it long ago.   Using a third party tool is much more efficient and allows a lot more freedom of action.

Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.997 Dev OS, Z30 (STA100-5)-10.3.1.997 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: Preprocessor problem, variable exists

I have not found a solution for this yet but do have to agree that it needs to be improved heavily.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Developer
Ted_Hopp
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: Preprocessor problem, variable exists

The problem is that Eclipse does not know about the preprocessor and just ignores the directives. If you take them away, it has to still be valid Java. This trick works:

 

//#ifdef DEFINE
public CLASS1 item = new CLASS1();
/*
//#else
public CLASS2 item = new CLASS1();
//#endif
//#ifdef DEFINE
*/
//#endif

 




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.
Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.997 Dev OS, Z30 (STA100-5)-10.3.1.997 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: Preprocessor problem, variable exists

Hmm, I had learned that trick a little after making this post but "in one ear, out the other". I will give that a try next time I can get to the problematic code.

 

On a side note, I wonder if there is a way to get Eclipse to see the preprocessed code instead of the unprocessed code. The preprocessor is a Java application that can be modified (with some work since it is obfuscated) to work better.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Developer
Ted_Hopp
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: Preprocessor problem, variable exists

It seems to me that it should be possible to integrate the preprocessor and Eclipse a little better. The Antenna preprocessor, for instance, manages to tell Eclipse about itself. Perhaps someday RIM will rewrite their plugin to use the same tricks that Antenna uses.




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.
Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.997 Dev OS, Z30 (STA100-5)-10.3.1.997 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: Preprocessor problem, variable exists

Antenna definitly looks nice and would be a vast improvment over the current plugin. I'll see if I can mix the two, use the intergration of the BB Preprocessor (so you don't need to change your source code files if you already use the BB Preprocessor though that doesn't seem like a challenging thing) and the actual preprocessing of Antenna.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Visitor
fuelcell
Posts: 1
Registered: ‎01-24-2011
My Device: Not Specified

Re: Preprocessor problem, variable exists

i have this same error message. Has this been resolved by anyone?

 


nsx_nawe wrote:

IM having this same issue =(

 

i imported a project from Eclipse 3.4.2 Plugin 1.0  

into Eclipse 3.5 Plugin 1.1

 

its really important for me since the debugger wasnt working but now i got this =( on my new setup and it wont compile...

 

"Errors Ocurred during the build.
Errors running builder 'Blackberry Pre-Process Builder' on project '[MY PROJECTS NAME]'

An error ocurred while traversing resources:
java.lang.NullPointerException

An error ocurred while traversing resources:
java.lang.NullPointerException"

 

yes, it says that twice.

 

i have no clue on this =( 

 

any help will be very appreciated.

 

thanks!