Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ARIES-994: Semantic versioning seralization check incorrect when no s…

…erialVersionUID variable present

git-svn-id: https://svn.apache.org/repos/asf/aries/trunk@1426500 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 84181ac18c857500b093694ae5fd3e483330a369 1 parent 388e801
Emily Jiang authored
View
5 ...rsioning-checker/src/main/java/org/apache/aries/versioning/check/BundleCompatibility.java
@@ -46,6 +46,7 @@
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 @@ private String readXsdFile(InputStream is) {
}
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);
View
21 .../versioning-checker/src/main/java/org/apache/aries/versioning/utils/ClassDeclaration.java
@@ -405,17 +405,20 @@ private void getSerializableBackCompatable(ClassDeclaration old, List<String> re
}
- 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) {
Please sign in to comment.
Something went wrong with that request. Please try again.