/[classpath]/gjdoc/src/gnu/classpath/tools/gjdoc/ClassDocImpl.java
ViewVC logotype

Diff of /gjdoc/src/gnu/classpath/tools/gjdoc/ClassDocImpl.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.25 by julian, Wed Oct 12 00:25:46 2005 UTC revision 1.26 by julian, Sat Oct 22 12:38:50 2005 UTC
# Line 24  import com.sun.javadoc.*; Line 24  import com.sun.javadoc.*;
24  import java.util.*;  import java.util.*;
25  import java.io.*;  import java.io.*;
26  import gnu.classpath.tools.gjdoc.expr.EvaluatorEnvironment;  import gnu.classpath.tools.gjdoc.expr.EvaluatorEnvironment;
27    import gnu.classpath.tools.gjdoc.expr.IllegalExpressionException;
28  import gnu.classpath.tools.gjdoc.expr.UnknownIdentifierException;  import gnu.classpath.tools.gjdoc.expr.UnknownIdentifierException;
29    
30  public class ClassDocImpl  public class ClassDocImpl
# Line 955  public class ClassDocImpl Line 956  public class ClassDocImpl
956    
957     private Object findFieldValue(String identifier,     private Object findFieldValue(String identifier,
958                                   ClassDoc classDoc,                                   ClassDoc classDoc,
959                                   String fieldName)                                   String fieldName,
960        throws UnknownIdentifierException                                   Set visitedFields)
961          throws UnknownIdentifierException, IllegalExpressionException
962     {     {
963        while (classDoc != null) {        while (classDoc != null) {
964           if (classDoc instanceof ClassDocImpl) {           if (classDoc instanceof ClassDocImpl) {
965              FieldDoc fieldDoc              FieldDocImpl fieldDoc
966                 = ((ClassDocImpl)classDoc).getFieldDoc(fieldName);                 = (FieldDocImpl)((ClassDocImpl)classDoc).getFieldDoc(fieldName);
967              if (null != fieldDoc) {              if (visitedFields.contains(fieldDoc)) {
968                 return fieldDoc.constantValue();                 throw new CircularExpressionException("Circular reference detected");
969                }
970                else if (null != fieldDoc) {
971                   return fieldDoc.constantValue(visitedFields);
972              }              }
973           }           }
974           else {           else {
# Line 971  public class ClassDocImpl Line 976  public class ClassDocImpl
976              if (null != _interfaces) {              if (null != _interfaces) {
977                 for (int i=0; i<_interfaces.length; ++i) {                 for (int i=0; i<_interfaces.length; ++i) {
978                    if (_interfaces[i] instanceof ClassDocImpl) {                    if (_interfaces[i] instanceof ClassDocImpl) {
979                       FieldDoc fieldDoc                       FieldDocImpl fieldDoc
980                          = ((ClassDocImpl)_interfaces[i]).getFieldDoc(fieldName);                          = (FieldDocImpl)((ClassDocImpl)_interfaces[i]).getFieldDoc(fieldName);
981                       if (null != fieldDoc) {                       if (visitedFields.contains(fieldDoc)) {
982                          return fieldDoc.constantValue();                          throw new CircularExpressionException("Circular reference detected");
983                         }
984                         else if (null != fieldDoc) {
985                            return fieldDoc.constantValue(visitedFields);
986                       }                       }
987                    }                    }
988                 }                 }
# Line 985  public class ClassDocImpl Line 993  public class ClassDocImpl
993        throw new UnknownIdentifierException(identifier);        throw new UnknownIdentifierException(identifier);
994     }     }
995        
996     public Object getValue(String identifier)     public Object getValue(String identifier, Set visitedFields)
997        throws UnknownIdentifierException        throws UnknownIdentifierException, IllegalExpressionException
998     {     {
999        int ndx = identifier.lastIndexOf('.');        int ndx = identifier.lastIndexOf('.');
1000        if (ndx >= 0) {        if (ndx >= 0) {
# Line 995  public class ClassDocImpl Line 1003  public class ClassDocImpl
1003    
1004           ClassDoc _classDoc = findClass(_className);           ClassDoc _classDoc = findClass(_className);
1005           if (null != _classDoc) {           if (null != _classDoc) {
1006              return findFieldValue(identifier, _classDoc, _fieldName);              return findFieldValue(identifier, _classDoc, _fieldName, visitedFields);
1007           }           }
1008           else {           else {
1009              throw new UnknownIdentifierException(identifier);              throw new UnknownIdentifierException(identifier);
1010           }           }
1011        }        }
1012        else {        else {
1013           return findFieldValue(identifier, this, identifier);           return findFieldValue(identifier, this, identifier, visitedFields);
1014        }        }
1015     }     }
1016    

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26