felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r1346929 - in /felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation: ClassChecker.java Manipulator.java
Date Wed, 06 Jun 2012 15:01:47 GMT
Author: clement
Date: Wed Jun  6 15:01:47 2012
New Revision: 1346929

URL: http://svn.apache.org/viewvc?rev=1346929&view=rev
Log:
Fixed FELIX-3539

If the class version is 1.6. or 1.7, launch the class manipulator with the EXPAND_FRAMES flag.

Modified:
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java

Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java?rev=1346929&r1=1346928&r2=1346929&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
(original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
Wed Jun  6 15:01:47 2012
@@ -80,6 +80,12 @@ public class ClassChecker extends EmptyV
     private boolean m_supportAnnotation = false;
 
     /**
+     * Class Version.
+     * Used to determine the frame format.
+     */
+    private int m_classVersion;
+
+    /**
      * Check if the _cm field already exists.
      * Update the field list.
      * @param access : access of the field
@@ -155,6 +161,14 @@ public class ClassChecker extends EmptyV
     }
 
     /**
+     * Gets the extracted class version
+     * @return the class version.
+     */
+    public int getClassVersion() {
+        return m_classVersion;
+    }
+
+    /**
      * Visit the class.
      * Update the implemented interface list.
      * @param version : version of the class
@@ -168,6 +182,7 @@ public class ClassChecker extends EmptyV
     public void visit(int version, int access, String name, String signature,
             String superName, String[] interfaces) {
 
+        m_classVersion = version;
         m_supportAnnotation = version > V1_4 && version < V1_1;
 
         if (! superName.equals("java/lang/Object")) {

Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java?rev=1346929&r1=1346928&r2=1346929&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
(original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
Wed Jun  6 15:01:47 2012
@@ -29,6 +29,7 @@ import org.apache.felix.ipojo.metadata.A
 import org.apache.felix.ipojo.metadata.Element;
 import org.objectweb.asm.ClassReader;
 import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.Opcodes;
 
 /**
  * iPOJO Byte code Manipulator.
@@ -97,7 +98,11 @@ public class Manipulator {
             ClassWriter cw0 = new ClassWriter(ClassWriter.COMPUTE_MAXS);
             //CheckClassAdapter ch = new CheckClassAdapter(cw0);
             MethodCreator preprocess = new MethodCreator(cw0, m_fields, m_methods);
-            cr0.accept(preprocess, 0);
+            if (ck.getClassVersion() >= Opcodes.V1_6) {
+                cr0.accept(preprocess, ClassReader.EXPAND_FRAMES);
+            } else {
+                cr0.accept(preprocess, 0);
+            }
             is2.close();
             finalWriter = cw0;
         }



Mime
View raw message