aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eji...@apache.org
Subject svn commit: r1426500 - in /aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning: check/BundleCompatibility.java utils/ClassDeclaration.java
Date Fri, 28 Dec 2012 13:15:50 GMT
Author: ejiang
Date: Fri Dec 28 13:15:50 2012
New Revision: 1426500

URL: http://svn.apache.org/viewvc?rev=1426500&view=rev
Log:
ARIES-994:  Semantic versioning seralization check incorrect when no serialVersionUID variable
present

Modified:
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/check/BundleCompatibility.java
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/ClassDeclaration.java

Modified: aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/check/BundleCompatibility.java
URL: http://svn.apache.org/viewvc/aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/check/BundleCompatibility.java?rev=1426500&r1=1426499&r2=1426500&view=diff
==============================================================================
--- aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/check/BundleCompatibility.java
(original)
+++ aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/check/BundleCompatibility.java
Fri Dec 28 13:15:50 2012
@@ -46,6 +46,7 @@ import org.apache.aries.versioning.utils
 import org.apache.aries.versioning.utils.MethodDeclaration;
 import org.apache.aries.versioning.utils.SemanticVersioningClassVisitor;
 import org.apache.aries.versioning.utils.SemanticVersioningUtils;
+import org.apache.aries.versioning.utils.SerialVersionClassVisitor;
 import org.objectweb.asm.ClassReader;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
@@ -533,7 +534,9 @@ public class BundleCompatibility {
   }
 
   private SemanticVersioningClassVisitor getVisitor(IFile file, URLClassLoader loader) {
-    SemanticVersioningClassVisitor oldcv = new SemanticVersioningClassVisitor(loader);
+   
+    SerialVersionClassVisitor sv = new SerialVersionClassVisitor(null);
+    SemanticVersioningClassVisitor oldcv = new SemanticVersioningClassVisitor(loader, sv);
     try {
       ClassReader cr = new ClassReader(file.open());
       cr.accept(oldcv, 0);

Modified: aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/ClassDeclaration.java
URL: http://svn.apache.org/viewvc/aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/ClassDeclaration.java?rev=1426500&r1=1426499&r2=1426500&view=diff
==============================================================================
--- aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/ClassDeclaration.java
(original)
+++ aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/ClassDeclaration.java
Fri Dec 28 13:15:50 2012
@@ -405,17 +405,20 @@ public class ClassDeclaration extends Ge
 
     }
 
-    private Long getSerialVersionUID(ClassDeclaration cd) {
-        FieldDeclaration serialID = cd.getAllFields().get(SemanticVersioningUtils.SERIAL_VERSION_UTD);
-        if (serialID != null) {
-            if (serialID.isFinal() && serialID.isStatic() && Type.LONG_TYPE.equals(Type.getType(serialID.getDesc())))
{
-                if (serialID.getValue() != null) {
-                    return (Long) (serialID.getValue());
-                }
-            }
+    private long getSerialVersionUID(ClassDeclaration cd) {
+      FieldDeclaration serialID = cd.getAllFields().get(SemanticVersioningUtils.SERIAL_VERSION_UTD);
+      if (serialID != null) {
+        if (serialID.isFinal() && serialID.isStatic() && Type.LONG_TYPE.equals(Type.getType(serialID.getDesc())))
{
+          if (serialID.getValue() != null) {
+            return (Long)serialID.getValue();
+
+          } else {
+            return 0;
+          }
         }
+      }
         // get the generated value
-        return cd.getSerialVisitor() == null? null: cd.getSerialVisitor().getComputeSerialVersionUID();
+        return cd.getSerialVisitor().getComputeSerialVersionUID();
     }
 
     private boolean isFieldTypeSame(FieldDeclaration bef_fd, FieldDeclaration cur_fd) {



Mime
View raw message