xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From santiag...@apache.org
Subject cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util ObjectType.java StringType.java Type.java
Date Thu, 24 Jun 2004 16:13:55 GMT
santiagopg    2004/06/24 09:13:55

  Modified:    java/src/org/apache/xalan/xsltc/compiler CastExpr.java
               java/src/org/apache/xalan/xsltc/compiler/util
                        ObjectType.java StringType.java Type.java
  Log:
  Patch for Bugzilla 27539 and related problems. The main problem was that hashCode() was
not implemented correctly in ObjectType. To eleminate further problems I also removed Type.ObjectString
as this type is the same as Type.String and the latter can be used in place of the former.
  
  Revision  Changes    Path
  1.22      +1 -3      xml-xalan/java/src/org/apache/xalan/xsltc/compiler/CastExpr.java
  
  Index: CastExpr.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/CastExpr.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- CastExpr.java	16 Feb 2004 22:24:29 -0000	1.21
  +++ CastExpr.java	24 Jun 2004 16:13:55 -0000	1.22
  @@ -76,7 +76,6 @@
   	InternalTypeMap.put(Type.String, Type.Real);
   	InternalTypeMap.put(Type.String, Type.Reference);
           InternalTypeMap.put(Type.String, Type.Object);
  -        InternalTypeMap.put(Type.String, Type.ObjectString);
   
   	InternalTypeMap.put(Type.NodeSet, Type.NodeSet);
   	InternalTypeMap.put(Type.NodeSet, Type.Boolean);
  @@ -113,7 +112,6 @@
   	InternalTypeMap.put(Type.Reference, Type.Object);
   
   	InternalTypeMap.put(Type.Object, Type.String);
  -	InternalTypeMap.put(Type.ObjectString, Type.String);
   
   	InternalTypeMap.put(Type.Void, Type.String);
       }
  
  
  
  1.10      +8 -4      xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ObjectType.java
  
  Index: ObjectType.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ObjectType.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ObjectType.java	23 Feb 2004 10:29:35 -0000	1.9
  +++ ObjectType.java	24 Jun 2004 16:13:55 -0000	1.10
  @@ -61,11 +61,15 @@
           _clazz = clazz;
           _javaClassName = clazz.getName();	
       }
  -
  +    
  +    /**
  +     * Must return the same value for all ObjectType instances. This is
  +     * needed in CastExpr to ensure the mapping table is used correctly.
  +     */
       public int hashCode() {
  -        return toString().hashCode();
  +        return java.lang.Object.class.hashCode();
       }
  -
  +    
       public boolean equals(Object obj) {
           return (obj instanceof ObjectType);
       }
  
  
  
  1.13      +1 -4      xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/StringType.java
  
  Index: StringType.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/StringType.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- StringType.java	16 Feb 2004 22:26:45 -0000	1.12
  +++ StringType.java	24 Jun 2004 16:13:55 -0000	1.13
  @@ -79,9 +79,6 @@
   	else if (type == Type.Reference) {
   	    translateTo(classGen, methodGen, (ReferenceType) type);
   	}
  -        else if (type == Type.ObjectString) {
  -            // NOP -> same representation
  -        }
   	else {
   	    ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
   					toString(), type.toString());
  
  
  
  1.16      +6 -8      xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/Type.java
  
  Index: Type.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/Type.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Type.java	16 Feb 2004 22:26:44 -0000	1.15
  +++ Type.java	24 Jun 2004 16:13:55 -0000	1.16
  @@ -38,10 +38,8 @@
       public static final Type String     = new StringType();
       public static final Type ResultTree = new ResultTreeType();
       public static final Type Reference  = new ReferenceType();
  -    public static final Type Void       = new VoidType();
  -    
  -    public static final Type Object       = new ObjectType(java.lang.Object.class);
  -    public static final Type ObjectString = new ObjectType(java.lang.String.class);
  +    public static final Type Void       = new VoidType();    
  +    public static final Type Object     = new ObjectType(java.lang.Object.class);
   
       public static final Type Node       = new NodeType(NodeTest.ANODE);
       public static final Type Root       = new NodeType(NodeTest.ROOT);
  @@ -60,8 +58,8 @@
               return Type.Object;
           }
           else if (javaClassName == "java.lang.String") {
  -            return Type.ObjectString;
  -        }
  +            return Type.String;
  +        } 
           else {
               return new ObjectType(javaClassName);
           }
  @@ -76,7 +74,7 @@
               return Type.Object;
           }
           else if (clazz == java.lang.String.class) {
  -            return Type.ObjectString;
  +            return Type.String;
           }
           else {
               return new ObjectType(clazz);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message