cvs commit: jakarta-bcel/src/java/org/apache/bcel/verifier/structurals InstConstraintVisitor.java

[email protected]
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
enver       2003/08/20 06:31:14

  Modified:    src/java/org/apache/bcel/verifier/structurals
                        InstConstraintVisitor.java
  Log:
  PR: Allow more than one field of the same name; with different
      types.
  
  Revision  Changes    Path
  1.7       +28 -7     jakarta-bcel/src/java/org/apache/bcel/verifier/structurals/InstConstraintVisitor.java
  
  Index: InstConstraintVisitor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/verifier/structurals/InstConstraintVisitor.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- InstConstraintVisitor.java	23 May 2003 07:55:34 -0000	1.6
  +++ InstConstraintVisitor.java	20 Aug 2003 13:31:14 -0000	1.7
  @@ -1193,8 +1193,15 @@
   		Field f = null;
   		for (int i=0; i<fields.length; i++){
   			if (fields[i].getName().equals(field_name)){
  -				f = fields[i];
  -				break;
  +				  Type f_type = Type.getType(fields[i].getSignature());
  +				  Type o_type = o.getType(cpg);
  +					/* TODO: Check if assignment compatibility is sufficient.
  +				   * What does Sun do?
  +				   */
  +				  if (f_type.equals(o_type)){
  +						f = fields[i];
  +						break;
  +					}
   			}
   		}
   		if (f == null){
  @@ -2475,8 +2482,15 @@
   		Field f = null;
   		for (int i=0; i<fields.length; i++){
   			if (fields[i].getName().equals(field_name)){
  -				f = fields[i];
  -				break;
  +				  Type f_type = Type.getType(fields[i].getSignature());
  +				  Type o_type = o.getType(cpg);
  +					/* TODO: Check if assignment compatibility is sufficient.
  +				   * What does Sun do?
  +				   */
  +				  if (f_type.equals(o_type)){
  +						f = fields[i];
  +						break;
  +					}
   			}
   		}
   		if (f == null){
  @@ -2557,8 +2571,15 @@
   		Field f = null;
   		for (int i=0; i<fields.length; i++){
   			if (fields[i].getName().equals(field_name)){
  -				f = fields[i];
  -				break;
  +					Type f_type = Type.getType(fields[i].getSignature());
  +				  Type o_type = o.getType(cpg);
  +					/* TODO: Check if assignment compatibility is sufficient.
  +				   * What does Sun do?
  +				   */
  +				  if (f_type.equals(o_type)){
  +						f = fields[i];
  +						break;
  +					}
   			}
   		}
   		if (f == null){
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.