Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 313802

Summary: Stack overflow when compiling projects with circular dependency
Product: [Tools] MTJ Reporter: Martin Döring <MathsMadness>
Component: Project BuilderAssignee: Gorkem Ercan <gorkem.ercan>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eresquigal, MathsMadness
Version: 1.0.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Stack traces of the original error and follow-up errors none

Description Martin Döring CLA 2010-05-20 15:46:39 EDT
Build Identifier: Eclipse M20100211-1343, MTJ 1.0.1.v200909181641

In my environment, I have two projects which depend on each other. When building those projects with MTJ, I get the following error:

'Building workspace' has encountered a problem.

An internal error occurred during: "Building workspace".
java.lang.StackOverflowError

For exception stack trace and session data, see attachment.

The error occurs both with the Sun Java Wireless Toolkit 2.5.2 and the Java ME platform SDK 3.0. With former versions of EclipseME, the compile did work, as it does with Java SE.

Reproducible: Always

Steps to Reproduce:
1. Compile two MIDlet projects which depend on each other
Comment 1 Martin Döring CLA 2010-05-20 15:53:09 EDT
Created attachment 169408 [details]
Stack traces of the original error and follow-up errors
Comment 2 Gorkem Ercan CLA 2010-06-10 11:23:49 EDT
I think the default setting for circular dependency is to mark it as error and stop compilation. I have actually lowered circular dependencies to warning in compiler settings to test this case. 

Unfortunately, I could not get the stack overflow with the simple Midlet projects that I have. Can you provide example projects for reproducing the problem.
Comment 3 Martin Döring CLA 2010-06-10 16:09:31 EDT
I also could not reproduce the error with simple projects. However, further research showed that the follow-up problem (java.lang.IllegalArgumentException: Path must include project and resource name: /Test1) is not caused by circular project dependencies.

Instead, it occurs when using the project root as (only) source folder, even when setting the inclusion/exclusion filters to only include the source packages and exclude everything else (i.e. bin/**, .settings/**, .mjt.tmp/**, .classpath, .mtj, .project, Application Descriptor, build.properties).

It can be reproduced by creating a new MIDlet project (e.g. "Test1" as above) and setting the source folder to the project root, and maybe cleaning the project. It is even not necessary to add a single Java class.

It might be the case that the original problem disappears when this follow-up error can be resolved.

But maybe I should reorganize my SVN projects to use separate "src" and "res" folders anyway (and provide fellow developers with some documentation :-)).
Comment 4 Gorkem Ercan CLA 2010-06-11 11:08:20 EDT
There is a builder bug when the projects have no source folder, stackoverflow seems to be a side effect. 

I guess you are gonna have to reorganize until there is a fix for this.
Comment 5 Gorkem Ercan CLA 2010-06-16 10:12:54 EDT
I have released a fix for this problem... But still using the project root as the source folder requires a lot of tweaking to get the packaging right. So not recommended.
Comment 6 Gorkem Ercan CLA 2010-06-17 17:23:24 EDT
*** Bug 306801 has been marked as a duplicate of this bug. ***