Bug 110176 - [buildpath] Investigate allowing variables/containers in container entries
Summary: [buildpath] Investigate allowing variables/containers in container entries
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P5 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 148844 73957
  Show dependency tree
 
Reported: 2005-09-21 09:51 EDT by Jerome Lanneluc CLA
Modified: 2011-03-29 09:08 EDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jerome Lanneluc CLA 2005-09-21 09:51:56 EDT
I20050920

We should investigate whether it is possible to open classpath entries in a
container to be classpath variables, or classpath containers.
Comment 1 Olivier Thomann CLA 2006-10-10 11:40:30 EDT
Build path issue.
Comment 2 Philipe Mulet CLA 2007-08-31 12:16:25 EDT
What is the motivation in 3.4 for doing this ?
Comment 3 Martin Aeschlimann CLA 2007-09-03 04:14:17 EDT
I think the focus should be on containers in containers. This would allow PDE to rebuild the plugin dependency hierarchy on the classpath similar to the load time hierarchy in runtime.
With this, it will be possible to correctly resolve types and build hierarchies of elements in the PDE container as now all their references can be resolved correctly. This is bug 73957 in PDE with lots of duplicates.

Comment 4 Philipe Mulet CLA 2007-09-03 10:15:28 EDT
I think this would simplify PDE's life by letting JDT flatten the classpath on its own; but in theory PDE could do the flattening on its own, and have its container answer this flat list of entry.

So technically speaking, I don't see containers-in-containers as solving new kind of problems, but rather as a helper so minimize code on the client side.
Am I missing something ?
Comment 5 Martin Aeschlimann CLA 2007-09-03 11:15:05 EDT
I believe a flattened list can not rebuild a hierarchical lookup path.

Problems are:
- visibility of types that aren't supposed to be visible
- shadowing of types with same qualified name that didn't exist in the hierarchical lookup

Assume this dependency tree:

A   requires
  B1 requires C1, D1
  B2 requires C1new, E1
  B3
  C1new

(A requires B1, B2, B3 and C1new. B1 requires C1, D1. ...
C1new is a newer version of C1, think JUnit 3.8.1 and 4.0))

If you flatten the list to: (depth first)

A requires
   B1
   C1
   D1
   B2
   C1new
   E1
   B3
   
you have the following problems:
- Suddenly C1, D1 or E1 are on the classpath of A. These types should not be visible to elements in A. 
- Types in C1, D1, and E1 can hide types of the same qualified name in B2, B3 and C1new 
- C1new was specified to be after B3. Now it is suddenly before. Again this can be a problem with type hiding

If you flatten the list to: (breath first)

A requires
   B1
   B2
   B3
   C1new
   C1
   D1
   B2
   E1

- Again the visibility problems.
- resolving in B1 will not find C1, but the newer version C1new
- resolving in B1 might find types in all other projects (B2, B3) although they are not on its class path.

Maybe I'm missing something.

I think what containers in containers allow is to rebuild the same dependencies tree and export features that you can express with Java projects.

Besides correctness, it also allows us in the UI to present the plug-in dependencies tree in the form is has been defined. A flattened list is confusing for the user as well.

Having the same plug-in twice with different version is not a corner case anymore.  See the Orbit project that want to have org.junit in versions {3.8.1 and 4.3)
Comment 6 Philipe Mulet CLA 2007-09-03 11:39:48 EDT
I see now what you meant. Indeed, issues arise in presence of multiple versions of a bundle.

+1 for 3.4
Comment 7 Jerome Lanneluc CLA 2007-09-11 06:27:01 EDT
To be investigated for 3.4
Comment 8 Jeff McAffer CLA 2007-09-20 14:26:39 EDT
This is fantastic news (that you are investigating for 3.4)
Comment 9 Jerome Lanneluc CLA 2008-02-13 11:48:39 EST
After investigation, it appears that this item would involve a complete rewrite of a good part of the Java model. The Java model currently assumes that the classpath is flat. Optimizations are all over the place with this assumption. Introducing a recursive classpath is a major change that cannot be done for 3.4.

Differing to early 3.5
Comment 10 Jerome Lanneluc CLA 2008-09-11 06:39:13 EDT
After more investigation, it goes even further than rewriting the Java model. The compiler would also need to be rewritten to handle the fact that bindings with the same full qualified name are no longer identical. This is too big of a change given what we have on our plate (not speaking about the huge performance degradation that would result from this change).

Another solution will need to be investigated for resolving bug 73957 and bug 148844. 

Maybe creating a hidden Java project for each plugin would work? Of course, one would have to consider the scalability of such solution.