Hi, it's me again :)

I noticed that when parsing a class with fields these fields are stored as 
JavaQNames, but the Classname e.g. "java.lang.String" is not split into 
package (java.lang) and class (String), but kept as a whole as classname. 
This behavior can be changed when using 
JavaQNameImpl.getInstance(classname) with the form 
JavaQNameImpl.getInstance(classname, true).

I checked JavaSource.newJavaField and found it in three places. Below is a 
diff.

I don't know if this will break anything, I assume it will not and it was 
merely forgotten. Please correct me if I'm wrong and it was intentionally 
done.

Jochen: this fixes the problem for me. It still is not a complete parser 
and still doesn't add the current package if no package is given. And it 
was not JavaParser.getQName(String) - there the true-parameter is used.


--- JavaSource_old.java 2005-07-27 18:28:45.000000000 +0200
+++ JavaSource.java     2005-07-27 18:33:51.000000000 +0200
@@ -1164,14 +1164,14 @@
      * protection.
      */
     public JavaField newJavaField(String pName, String pType, Protection 
pProtection) {
-       return newJavaField(pName, JavaQNameImpl.getInstance(pType), 
pProtection);
+       return newJavaField(pName, JavaQNameImpl.getInstance(pType, true), 
pProtection);
     }
 
     /** Creates a new JavaField with the given name, type and
      * protection.
      */
     public JavaField newJavaField(String pName, String pType, String 
pProtection) {
-       return newJavaField(pName, JavaQNameImpl.getInstance(pType),
+       return newJavaField(pName, JavaQNameImpl.getInstance(pType, true),
                        Protection.valueOf(pProtection));
     }
 
@@ -1179,7 +1179,7 @@
      * default protection.
      */
     public JavaField newJavaField(String pName, String pType) {
-       return newJavaField(pName, JavaQNameImpl.getInstance(pType), 
(Protection) null);
+       return newJavaField(pName, JavaQNameImpl.getInstance(pType, true), 
(Protection) null);
     }
 
     /** Creates a new JavaField with the given name, type and


:Frederic:

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to