You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-dev@jakarta.apache.org by en...@apache.org on 2003/08/20 14:36:18 UTC
cvs commit: jakarta-bcel/src/java/org/apache/bcel/verifier/statics Pass3aVerifier.java
enver 2003/08/20 05:36:17
Modified: src/java/org/apache/bcel/verifier/statics
Pass3aVerifier.java
Log:
Darn obfuscators. Sun really allows them to create multiple fields
of the same name with different types! So we do, too.
Revision Changes Path
1.5 +16 -9 jakarta-bcel/src/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java
Index: Pass3aVerifier.java
===================================================================
RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/verifier/statics/Pass3aVerifier.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Pass3aVerifier.java 23 May 2003 07:55:34 -0000 1.4
+++ Pass3aVerifier.java 20 Aug 2003 12:36:17 -0000 1.5
@@ -505,8 +505,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){
@@ -518,13 +525,13 @@
What does Sun do? */
Type f_type = Type.getType(f.getSignature());
Type o_type = o.getType(cpg);
+
+ // Argh. Sun's implementation allows us to have multiple fields of
+ // the same name but wirth a different signature.
+ //if (! f_type.equals(o_type)){
+ // constraintViolated(o, "Referenced field '"+field_name+"' has type '"+f_type+"' instead of '"+o_type+"' as expected.");
+ //}
- /* TODO: Is there a way to make BCEL tell us if a field
- has a void method's signature, i.e. "()I" instead of "I"? */
-
- if (! f_type.equals(o_type)){
- constraintViolated(o, "Referenced field '"+field_name+"' has type '"+f_type+"' instead of '"+o_type+"' as expected.");
- }
/* TODO: Check for access modifiers here. */
}
} catch (ClassNotFoundException e) {