polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [1/3] zest-java git commit: Uniform naming formatting code style in Fragment/Transient class loaders
Date Sun, 12 Jun 2016 14:37:14 GMT
Repository: zest-java
Updated Branches:
  refs/heads/develop 21baf180e -> eb9ec0db0


Uniform naming formatting code style in Fragment/Transient class loaders

No code change
So they can easily be diff'ed


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/5f261098
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/5f261098
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/5f261098

Branch: refs/heads/develop
Commit: 5f26109842e0e5cceb6219c0b005e81b99d45ed2
Parents: 21baf18
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Sun Jun 12 15:29:48 2016 +0200
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Sun Jun 12 15:29:48 2016 +0200

----------------------------------------------------------------------
 .../runtime/composite/FragmentClassLoader.java  | 28 +++++++++-----------
 .../runtime/composite/TransientClassLoader.java | 26 +++++++-----------
 2 files changed, 22 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/5f261098/core/runtime/src/main/java/org/apache/zest/runtime/composite/FragmentClassLoader.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/composite/FragmentClassLoader.java
b/core/runtime/src/main/java/org/apache/zest/runtime/composite/FragmentClassLoader.java
index a5215fc..7e54ed1 100644
--- a/core/runtime/src/main/java/org/apache/zest/runtime/composite/FragmentClassLoader.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/composite/FragmentClassLoader.java
@@ -144,7 +144,7 @@ public class FragmentClassLoader
                     }
                 }
             }
-//  To Allow JDK classes to be composed.
+            //  To Allow JDK classes to be composed.
             if( name.startsWith( "java." ) )
             {
                 name = "zest." + name;
@@ -183,8 +183,8 @@ public class FragmentClassLoader
             {
                 if( isOverridden( method, baseClass ) )
                 {
-                    cw.visitField( ACC_PRIVATE + ACC_STATIC, "m" + idx++, "Ljava/lang/reflect/Method;",
null,
-                                   null ).visitEnd();
+                    cw.visitField( ACC_PRIVATE + ACC_STATIC, "m" + idx++, "Ljava/lang/reflect/Method;",
null, null )
+                        .visitEnd();
                     hasProxyMethods = true;
                 }
             }
@@ -196,9 +196,9 @@ public class FragmentClassLoader
             if( Modifier.isPublic( constructor.getModifiers() ) || Modifier.isProtected(
constructor.getModifiers() ) )
             {
                 String desc = org.objectweb.asm.commons.Method.getMethod( constructor ).getDescriptor();
-                MethodVisitor cmv = cw.visitMethod( ACC_PUBLIC, "<init>", desc, null,
null );
-                cmv.visitCode();
-                cmv.visitVarInsn( ALOAD, 0 );
+                MethodVisitor mv = cw.visitMethod( ACC_PUBLIC, "<init>", desc, null,
null );
+                mv.visitCode();
+                mv.visitVarInsn( ALOAD, 0 );
 
                 int idx = 1;
                 for( Class aClass : constructor.getParameterTypes() )
@@ -224,13 +224,13 @@ public class FragmentClassLoader
                     {
                         opcode = ALOAD;
                     }
-                    cmv.visitVarInsn( opcode, idx++ );
+                    mv.visitVarInsn( opcode, idx++ );
                 }
 
-                cmv.visitMethodInsn( INVOKESPECIAL, baseClassSlash, "<init>", desc,
false );
-                cmv.visitInsn( RETURN );
-                cmv.visitMaxs( idx, idx );
-                cmv.visitEnd();
+                mv.visitMethodInsn( INVOKESPECIAL, baseClassSlash, "<init>", desc,
false );
+                mv.visitInsn( RETURN );
+                mv.visitMaxs( idx, idx );
+                mv.visitEnd();
             }
         }
 
@@ -374,8 +374,7 @@ public class FragmentClassLoader
                     if( !Modifier.isAbstract( method.getModifiers() ) )
                     {
                         // Add method with _ as prefix
-                        MethodVisitor mv;
-                        mv = cw.visitMethod( ACC_PUBLIC, "_" + method.getName(), desc, null,
exceptions );
+                        MethodVisitor mv = cw.visitMethod( ACC_PUBLIC, "_" + method.getName(),
desc, null, exceptions );
                         mv.visitCode();
                         mv.visitVarInsn( ALOAD, 0 );
 
@@ -407,8 +406,7 @@ public class FragmentClassLoader
 
             // Class initializer
             {
-                MethodVisitor mv;
-                mv = cw.visitMethod( ACC_STATIC, "<clinit>", "()V", null, null );
+                MethodVisitor mv = cw.visitMethod( ACC_STATIC, "<clinit>", "()V", null,
null );
                 mv.visitCode();
                 Label l0 = new Label();
                 Label l1 = new Label();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/5f261098/core/runtime/src/main/java/org/apache/zest/runtime/composite/TransientClassLoader.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/composite/TransientClassLoader.java
b/core/runtime/src/main/java/org/apache/zest/runtime/composite/TransientClassLoader.java
index cfd698a..503349b 100644
--- a/core/runtime/src/main/java/org/apache/zest/runtime/composite/TransientClassLoader.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/composite/TransientClassLoader.java
@@ -25,7 +25,6 @@ import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.ArrayList;
 import java.util.List;
-import org.apache.zest.api.composite.Composite;
 import org.apache.zest.api.entity.Lifecycle;
 import org.apache.zest.api.mixin.Initializable;
 import org.apache.zest.api.util.Methods;
@@ -162,17 +161,14 @@ import static org.objectweb.asm.Type.getInternalName;
         String baseClassSlash = getInternalName( baseClass );
 
         ClassWriter cw = new ClassWriter( ClassWriter.COMPUTE_MAXS );
-        FieldVisitor fv;
-        MethodVisitor mv;
-        AnnotationVisitor av0;
 
         // Class definition start
         cw.visit( JDK_VERSION, ACC_PUBLIC + ACC_SUPER, classSlash, null, baseClassSlash,
new String[] { "org/apache/zest/api/composite/Composite" } );
 
         // Composite reference
         {
-            fv = cw.visitField( ACC_PUBLIC, "_instance", "Lorg/apache/zest/api/composite/CompositeInvoker;",
null, null );
-            fv.visitEnd();
+            cw.visitField( ACC_PUBLIC, "_instance", "Lorg/apache/zest/api/composite/CompositeInvoker;",
null, null )
+                .visitEnd();
         }
 
         // Static Method references
@@ -182,9 +178,8 @@ import static org.objectweb.asm.Type.getInternalName;
             {
                 if( isOverloaded( method, baseClass ) )
                 {
-                    fv = cw.visitField( ACC_PRIVATE + ACC_STATIC, "m" + idx++, "Ljava/lang/reflect/Method;",
null,
-                                        null );
-                    fv.visitEnd();
+                    cw.visitField( ACC_PRIVATE + ACC_STATIC, "m" + idx++, "Ljava/lang/reflect/Method;",
null, null )
+                        .visitEnd();
                 }
             }
         }
@@ -195,7 +190,7 @@ import static org.objectweb.asm.Type.getInternalName;
             if( Modifier.isPublic( constructor.getModifiers() ) || Modifier.isProtected(
constructor.getModifiers() ) )
             {
                 String desc = org.objectweb.asm.commons.Method.getMethod( constructor ).getDescriptor();
-                mv = cw.visitMethod( ACC_PUBLIC, "<init>", desc, null, null );
+                MethodVisitor mv = cw.visitMethod( ACC_PUBLIC, "<init>", desc, null,
null );
                 mv.visitCode();
                 mv.visitVarInsn( ALOAD, 0 );
 
@@ -227,7 +222,7 @@ import static org.objectweb.asm.Type.getInternalName;
 
                 String[] exceptions = null;
                 {
-                    mv = cw.visitMethod( ACC_PUBLIC, methodName, desc, null, exceptions );
+                    MethodVisitor mv = cw.visitMethod( ACC_PUBLIC, methodName, desc, null,
exceptions );
                     if( isInternalZestMethod( method, baseClass ) )
                     {
                         // generate a NoOp method...
@@ -351,7 +346,7 @@ import static org.objectweb.asm.Type.getInternalName;
                 if( !Modifier.isAbstract( method.getModifiers() ) )
                 {
                     // Add method with _ as prefix
-                    mv = cw.visitMethod( ACC_PUBLIC, "_" + method.getName(), desc, null,
exceptions );
+                    MethodVisitor mv = cw.visitMethod( ACC_PUBLIC, "_" + method.getName(),
desc, null, exceptions );
                     mv.visitCode();
                     mv.visitVarInsn( ALOAD, 0 );
 
@@ -383,7 +378,7 @@ import static org.objectweb.asm.Type.getInternalName;
 
         // Class initializer
         {
-            mv = cw.visitMethod( ACC_STATIC, "<clinit>", "()V", null, null );
+            MethodVisitor mv = cw.visitMethod( ACC_STATIC, "<clinit>", "()V", null,
null );
             mv.visitCode();
             Label l0 = new Label();
             Label l1 = new Label();
@@ -398,8 +393,7 @@ import static org.objectweb.asm.Type.getInternalName;
                 if( isOverloaded( method, baseClass ) )
                 {
                     method.setAccessible( true );
-                    Class methodClass;
-                    methodClass = method.getDeclaringClass();
+                    Class methodClass = method.getDeclaringClass();
 
                     midx++;
 
@@ -437,9 +431,7 @@ import static org.objectweb.asm.Type.getInternalName;
             mv.visitMaxs( 6, 1 );
             mv.visitEnd();
         }
-
         cw.visitEnd();
-
         return cw.toByteArray();
     }
 


Mime
View raw message