[Uml-devel] java import problem

JP Fournier jfournier121 at rogers.com
Thu Jul 20 23:56:22 UTC 2006


I've been thinking about this, and I believe this can be solved 
for java.  This is what I think could work:

- the user specifies the root of the source path (ie if the code
  lives in org.mypackage and the source tree looks like
  /home/user/src/org/mypackage then the user specifies /home/user/src
  as the root of the source path

- in the java parsing code : 
   - keep track of the imports of the current class being parsed
   - when a type is encountered:
       - check first if it is a predefined DataType; if so use it
       - foreach anImport of the imports:
           - if the anImport + type already exists then use it
           - if not check if a file named: sourcepath+anImport+type+.java
             exists.  If it does parse it and use it

This works for java because java's source directory structure has to 
parallel the packaging structure.
 
Thoughts?

jp



> However, if we import n1::Child_of_n1_Ambiguous without having seen 
> n1::Ambiguous then C++ happily takes the Ambiguous from the global
> scope.

> I think I will change the logic around Import_Utils::createUMLObject()
> such that it follows the Java style, i.e. in this last case where we
> haven't seen n1::Ambiguous then Ambiguous is synthesized inside
> n1. That just means that peole importing C++ code will need to be
> aware of the class dependencies and make sure that classes closer
> to the root of the hierarchy are imported before dependent classes.
> (Or, always prefix "::" when the global scope is intended.)





More information about the umbrello-devel mailing list