Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 286406 - [build path] File -> New Java Project not identifying source files correctly
Summary: [build path] File -> New Java Project not identifying source files correctly
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M2   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 298622 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-08-12 12:05 EDT by Glen Mazza CLA
Modified: 2009-12-30 05:59 EST (History)
2 users (show)

See Also:


Attachments
default Java import method (346.08 KB, image/bmp)
2009-08-12 12:05 EDT, Glen Mazza CLA
no flags Details
Correct import method (346.08 KB, image/bmp)
2009-08-12 12:06 EDT, Glen Mazza CLA
no flags Details
Navigator view showing consequences of bad default -- schema package not read properly (159.42 KB, image/bmp)
2009-08-12 12:07 EDT, Glen Mazza CLA
no flags Details
project zip file that demonstrates problem (17.29 KB, application/octet-stream)
2009-08-12 12:14 EDT, Glen Mazza CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Glen Mazza CLA 2009-08-12 12:05:52 EDT
Created attachment 144251 [details]
default Java import method

Build ID: 20090619-0625

Steps To Reproduce:
1. Download the ZIP file attached, it will be in a DoubleIt folder that contains one Eclipse subproject (service-war).

2. Now, import DoubleIt into Eclipse.  File -> New -> Java Project -> Create Project from existing Source ->
Choose "DoubleIt" folder and click "Next".
 
3. The default source code import is not loading from service-war/target/generated-sources correctly--creates subsequent classpath problems if not manually changed on this page. org.example.contract.doubleit under this folder loads correctly but not org.example.schema.doubleit--unsure why one would but not the other.  

More information:
The .classpath entry of the default (incorrect) source file detection is this:

<classpath>
        ...
	<classpathentry excluding="org/example/schema/doubleit/" kind="src" path="service-war/target/generated-sources"/>
	<classpathentry kind="src" path="service-war/target/generated-sources/org/example/schema/doubleit"/>

It should be this by default:

<classpath>
...
	<classpathentry kind="src" path="service-war/target/generated-sources"/>
...

The incorrect default causes Eclipse to complain that classes in the org.example.schema.doubleit package should have a package name of "" (empty string).

I'm attaching screenshots showing the bad default and what should be the good default, as well as the Navigator view consequences of having the bad default.

(Note: screenshots from Eclipse 3.4 but verified same problem with 3.5.)
Comment 1 Glen Mazza CLA 2009-08-12 12:06:35 EDT
Created attachment 144252 [details]
Correct import method
Comment 2 Glen Mazza CLA 2009-08-12 12:07:44 EDT
Created attachment 144253 [details]
Navigator view showing consequences of bad default -- schema package not read properly
Comment 3 Glen Mazza CLA 2009-08-12 12:14:01 EDT
Created attachment 144255 [details]
project zip file that demonstrates problem
Comment 4 Markus Keller CLA 2009-08-17 10:55:22 EDT
The wizard fails to parse DoubleIt/service-war/target/generated-sources/org/example/schema/doubleit/package-info.java because it has an annotation on the package.
Comment 5 Markus Keller CLA 2009-08-17 10:57:08 EDT
Fixed in HEAD of ClassPathDetector.
Comment 6 Frederic Fusier CLA 2009-12-30 05:59:33 EST
*** Bug 298622 has been marked as a duplicate of this bug. ***