You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by tv...@apache.org on 2014/02/19 16:48:09 UTC

svn commit: r1569795 [19/35] - in /tomee/tomee/trunk/container/openejb-core/src/main: config/pmd/ java/javax/xml/ws/ java/javax/xml/ws/wsaddressing/ java/org/apache/openejb/ java/org/apache/openejb/assembler/ java/org/apache/openejb/assembler/classic/ ...

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Generator.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Generator.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Generator.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Generator.java Wed Feb 19 15:47:58 2014
@@ -72,7 +72,7 @@ public class Cmp2Generator implements Op
      *                  keys.
      * @param cmpFields The list of fields that are managed using cmp.
      */
-    public Cmp2Generator(String cmpImplClass, Class beanClass, String pkField, Class<?> primKeyClass, String[] cmpFields) {
+    public Cmp2Generator(final String cmpImplClass, final Class beanClass, final String pkField, final Class<?> primKeyClass, final String[] cmpFields) {
 
         this.beanClass = beanClass;
         beanClassName = Type.getInternalName(beanClass);
@@ -89,29 +89,29 @@ public class Cmp2Generator implements Op
         // for the name and retrieve the type.  This a) verifies that we have at least 
         // a getter defined and b) that we know the field return type.  The created CmpField 
         // list will feed into the generation process. 
-        for (String cmpFieldName : cmpFields) {
-            Method getter = getterMethod(cmpFieldName);
+        for (final String cmpFieldName : cmpFields) {
+            final Method getter = getterMethod(cmpFieldName);
             if (getter == null) {
                 throw new IllegalArgumentException("No such property " + cmpFieldName + " defined on bean class " + beanClassName);
             }
             // if this is an abstract method, then it's one we have to generate 
             if (Modifier.isAbstract(getter.getModifiers())) {
 
-                Type type = Type.getType(getter.getReturnType());
-                CmpField cmpField = new CmpField(cmpFieldName, type, getter); 
+                final Type type = Type.getType(getter.getReturnType());
+                final CmpField cmpField = new CmpField(cmpFieldName, type, getter);
                 this.cmpFields.put(cmpFieldName, cmpField);
             }
             else {
                 // the getter is non-abstract.  We only allow this if the class that 
                 // defines the getter also has a private field with a matching type.  
                 try {
-                    Field field = getter.getDeclaringClass().getDeclaredField(cmpFieldName); 
+                    final Field field = getter.getDeclaringClass().getDeclaredField(cmpFieldName);
                     // if this is a private field, then just continue.  We don't need to generate 
                     // any code for this 
                     if (Modifier.isPrivate(field.getModifiers())) {
                         continue; 
                     }
-                } catch (NoSuchFieldException e) {
+                } catch (final NoSuchFieldException e) {
                     // no-op
                 }
                 throw new IllegalArgumentException("No such property " + cmpFieldName + " defined on bean class " + beanClassName);
@@ -130,7 +130,7 @@ public class Cmp2Generator implements Op
         }
 
         // build up the list of ejbSelectxxxx methods.  These will be generated automatically. 
-        for (Method method : beanClass.getMethods()) {
+        for (final Method method : beanClass.getMethods()) {
             if (Modifier.isAbstract(method.getModifiers()) && method.getName().startsWith("ejbSelect")) {
                 addSelectMethod(method);
             }
@@ -152,7 +152,7 @@ public class Cmp2Generator implements Op
      * @param cmrField The new CMR field definition pulled from the
      *                 EJB metadata.
      */
-    public void addCmrField(CmrField cmrField) {
+    public void addCmrField(final CmrField cmrField) {
         if (cmpFields.get(cmrField.getName()) != null) {
             cmpFields.remove(cmrField.getName());
         }
@@ -166,7 +166,7 @@ public class Cmp2Generator implements Op
      * @param selectMethod
      *               The method that needs to be processed.
      */
-    public void addSelectMethod(Method selectMethod) {
+    public void addSelectMethod(final Method selectMethod) {
         selectMethods.add(selectMethod);
     }
 
@@ -187,29 +187,29 @@ public class Cmp2Generator implements Op
 
         // public static Object deploymentInfo;
         {
-            FieldVisitor fv = cw.visitField(ACC_PUBLIC + ACC_STATIC, "deploymentInfo", "Ljava/lang/Object;", null, null);
+            final FieldVisitor fv = cw.visitField(ACC_PUBLIC + ACC_STATIC, "deploymentInfo", "Ljava/lang/Object;", null, null);
             fv.visitEnd();
         }
 
         // private transient boolean deleted;
         {
-            FieldVisitor fv = cw.visitField(ACC_PRIVATE + ACC_TRANSIENT, DELETED, "Z", null, null);
+            final FieldVisitor fv = cw.visitField(ACC_PRIVATE + ACC_TRANSIENT, DELETED, "Z", null, null);
             fv.visitEnd();
         }
 
         if (Object.class.equals(primKeyClass)) {
-            FieldVisitor fv = cw.visitField(ACC_PRIVATE, UNKNOWN_PK_NAME, UNKNOWN_PK_TYPE.getDescriptor(), null, null);
+            final FieldVisitor fv = cw.visitField(ACC_PRIVATE, UNKNOWN_PK_NAME, UNKNOWN_PK_TYPE.getDescriptor(), null, null);
             fv.visitEnd();
         }
 
         // Generate the set of cmp fields as private attributes. 
         // private ${cmpField.type} ${cmpField.name};
-        for (CmpField cmpField : cmpFields.values()) {
+        for (final CmpField cmpField : cmpFields.values()) {
             createField(cmpField);
         }
 
         // and create the corresponding CMR fields as well. 
-        for (CmrField cmrField : cmrFields) {
+        for (final CmrField cmrField : cmrFields) {
             createCmrFields(cmrField);
         }
 
@@ -217,7 +217,7 @@ public class Cmp2Generator implements Op
 
         // now for each of the CMP fields, generate the getter and setter methods 
         // from the abstract methods the bean author should have provided. 
-        for (CmpField cmpField : cmpFields.values()) {
+        for (final CmpField cmpField : cmpFields.values()) {
             // public ${cmpField.type} get${cmpField.name}() {
             //     return this.${cmpField.name};
             // }
@@ -230,7 +230,7 @@ public class Cmp2Generator implements Op
         }
 
         // and repeat this for the cmr fields. 
-        for (CmrField cmrField : cmrFields) {
+        for (final CmrField cmrField : cmrFields) {
             createCmrGetter(cmrField);
             createCmrSetter(cmrField);
         }
@@ -245,7 +245,7 @@ public class Cmp2Generator implements Op
         createOpenEJB_removeCmr();
 
         // generate the select methods 
-        for (Method selectMethod : selectMethods) {
+        for (final Method selectMethod : selectMethods) {
             createSelectMethod(selectMethod);
         }
 
@@ -271,22 +271,22 @@ public class Cmp2Generator implements Op
         return cw.toByteArray();
     }
 
-    private boolean hasMethod(Class beanClass, String name, Class... args) {
+    private boolean hasMethod(final Class beanClass, final String name, final Class... args) {
         try {
-            Method method = beanClass.getMethod(name, args);
+            final Method method = beanClass.getMethod(name, args);
             return !Modifier.isAbstract(method.getModifiers());
-        } catch (NoSuchMethodException e) {
+        } catch (final NoSuchMethodException e) {
             return false;
         }
     }
 
     private void createConstructor() {
-        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
+        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
         mv.visitCode();
         mv.visitVarInsn(ALOAD, 0);
         mv.visitMethodInsn(INVOKESPECIAL, beanClassName, "<init>", "()V");
 
-        for (CmrField cmrField : cmrFields) {
+        for (final CmrField cmrField : cmrFields) {
             initCmrFields(mv, cmrField);
         }
 
@@ -296,7 +296,7 @@ public class Cmp2Generator implements Op
     }
 
     private void createOpenEJB_isDeleted() {
-        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "OpenEJB_isDeleted", "()Z", null, null);
+        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "OpenEJB_isDeleted", "()Z", null, null);
         mv.visitCode();
         mv.visitVarInsn(ALOAD, 0);
         mv.visitFieldInsn(GETFIELD, implClassName, DELETED, "Z");
@@ -306,13 +306,13 @@ public class Cmp2Generator implements Op
     }
 
     private void createOpenEJB_deleted() {
-        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "OpenEJB_deleted", "()V", null, null);
+        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "OpenEJB_deleted", "()V", null, null);
         mv.visitCode();
 
         /* if (deleted) return; */
         mv.visitVarInsn(ALOAD, 0);
         mv.visitFieldInsn(GETFIELD, implClassName, DELETED, "Z");
-        Label notDeleted = new Label();
+        final Label notDeleted = new Label();
         mv.visitJumpInsn(IFEQ, notDeleted);
         mv.visitInsn(RETURN);
         mv.visitLabel(notDeleted);
@@ -322,7 +322,7 @@ public class Cmp2Generator implements Op
         mv.visitInsn(ICONST_1);
         mv.visitFieldInsn(PUTFIELD, implClassName, DELETED, "Z");
 
-        for (CmrField cmrField : cmrFields) {
+        for (final CmrField cmrField : cmrFields) {
             // ${cmrField.accessor}.delete(${cmrField.name});
             createOpenEJB_deleted(mv, cmrField);
         }
@@ -334,19 +334,19 @@ public class Cmp2Generator implements Op
     }
 
     private void createOpenEJB_addCmr() {
-        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "OpenEJB_addCmr", "(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;", null, null);
+        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "OpenEJB_addCmr", "(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;", null, null);
         mv.visitCode();
 
         // if (deleted) return null;
         mv.visitVarInsn(ALOAD, 0);
         mv.visitFieldInsn(GETFIELD, implClassName, DELETED, "Z");
-        Label notDeleted = new Label();
+        final Label notDeleted = new Label();
         mv.visitJumpInsn(IFEQ, notDeleted);
         mv.visitInsn(ACONST_NULL);
         mv.visitInsn(ARETURN);
         mv.visitLabel(notDeleted);
 
-        for (CmrField cmrField : cmrFields) {
+        for (final CmrField cmrField : cmrFields) {
             // if ("${cmrField.name}".equals(name)) {
             //     ${cmrField.name}.add((${cmrField.type})value);
             //     return null;
@@ -387,18 +387,18 @@ public class Cmp2Generator implements Op
     }
 
     private void createOpenEJB_removeCmr() {
-        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "OpenEJB_removeCmr", "(Ljava/lang/String;Ljava/lang/Object;)V", null, null);
+        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "OpenEJB_removeCmr", "(Ljava/lang/String;Ljava/lang/Object;)V", null, null);
         mv.visitCode();
 
         // if (deleted) return;
         mv.visitVarInsn(ALOAD, 0);
         mv.visitFieldInsn(GETFIELD, implClassName, DELETED, "Z");
-        Label notDeleted = new Label();
+        final Label notDeleted = new Label();
         mv.visitJumpInsn(IFEQ, notDeleted);
         mv.visitInsn(RETURN);
         mv.visitLabel(notDeleted);
 
-        for (CmrField cmrField : cmrFields) {
+        for (final CmrField cmrField : cmrFields) {
             // if ("${cmrField.name}".equals(name)) {
             //     ${cmrField.name}.remove(value);
             //     return;
@@ -443,8 +443,8 @@ public class Cmp2Generator implements Op
      * 
      * @param cmpField The Cmp field defined in the metadata.
      */
-    private void createField(CmpField cmpField) {
-        FieldVisitor fv = cw.visitField(ACC_PRIVATE,
+    private void createField(final CmpField cmpField) {
+        final FieldVisitor fv = cw.visitField(ACC_PRIVATE,
                 cmpField.getName(),
                 cmpField.getDescriptor(),
                 null,
@@ -463,9 +463,9 @@ public class Cmp2Generator implements Op
      * 
      * @param cmpField The CMP field backing this getter method.
      */
-    private void createGetter(CmpField cmpField) {
-        String methodName = cmpField.getGetterMethod().getName();
-        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, methodName, "()" + cmpField.getDescriptor(), null, null);
+    private void createGetter(final CmpField cmpField) {
+        final String methodName = cmpField.getGetterMethod().getName();
+        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, methodName, "()" + cmpField.getDescriptor(), null, null);
         mv.visitCode();
         mv.visitVarInsn(ALOAD, 0);
         mv.visitFieldInsn(GETFIELD, implClassName, cmpField.getName(), cmpField.getDescriptor());
@@ -483,7 +483,7 @@ public class Cmp2Generator implements Op
      * @return The string name of the getter method for the 
      *         property.
      */
-    private static String getterName(String propertyName) {
+    private static String getterName(final String propertyName) {
         return "get" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
     }
 
@@ -498,12 +498,12 @@ public class Cmp2Generator implements Op
      * 
      * @return The name to be used for generating this method. 
      */
-    private Method getterMethod(String propertyName) {
+    private Method getterMethod(final String propertyName) {
         String getterName = "get" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
         try {
             // check to see if we have the getter as an abstract class.  This might be an "is" method. 
             return beanClass.getMethod(getterName, new Class[0]); 
-        } catch (NoSuchMethodException e) {
+        } catch (final NoSuchMethodException e) {
             // no-op
         }
         
@@ -513,7 +513,7 @@ public class Cmp2Generator implements Op
         try {
             // check to see if we have the getter as an abstract class.  This might be an "is" method. 
             return beanClass.getMethod(getterName, new Class[0]); 
-        } catch (NoSuchMethodException e) {
+        } catch (final NoSuchMethodException e) {
             // no-op
         }
         return null; 
@@ -530,9 +530,9 @@ public class Cmp2Generator implements Op
      * 
      * @param cmpField The CMP field backing this setter method.
      */
-    private void createSetter(CmpField cmpField) {
-        String methodName = setterName(cmpField.getName());
-        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, methodName, "(" + cmpField.getDescriptor() + ")V", null, null);
+    private void createSetter(final CmpField cmpField) {
+        final String methodName = setterName(cmpField.getName());
+        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, methodName, "(" + cmpField.getDescriptor() + ")V", null, null);
         mv.visitCode();
         mv.visitVarInsn(ALOAD, 0);
         mv.visitVarInsn(cmpField.getType().getOpcode(ILOAD), 1);
@@ -542,7 +542,7 @@ public class Cmp2Generator implements Op
         mv.visitEnd();
     }
 
-    private String setterName(String propertyName) {
+    private String setterName(final String propertyName) {
         return "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
     }
 
@@ -565,7 +565,7 @@ public class Cmp2Generator implements Op
      * into the primary key instance. 
      */
     private void createSimplePrimaryKeyGetter() {
-        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "OpenEJB_getPrimaryKey", "()Ljava/lang/Object;", null, null);
+        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "OpenEJB_getPrimaryKey", "()Ljava/lang/Object;", null, null);
         mv.visitCode();
         
         // the primary key is identifed as a field.  We just return that value directly. 
@@ -590,7 +590,7 @@ public class Cmp2Generator implements Op
             // We have a primary key class defined.  For every field that matches one of the 
             // defined CMP fields, we generate code to copy that value into the corresponding 
             // field of the primary key class. 
-            String pkImplName = primKeyClass.getName().replace('.', '/');
+            final String pkImplName = primKeyClass.getName().replace('.', '/');
 
             // new Pk();
             mv.visitTypeInsn(NEW, pkImplName);
@@ -600,8 +600,8 @@ public class Cmp2Generator implements Op
             mv.visitVarInsn(ALOAD, 1);
 
             // copy each field from the ejb to the pk class
-            for (Field field : primKeyClass.getFields()) {
-                CmpField cmpField = cmpFields.get(field.getName());
+            for (final Field field : primKeyClass.getFields()) {
+                final CmpField cmpField = cmpFields.get(field.getName());
 
                 // only process the cmp fields
                 if (cmpField == null) {
@@ -642,7 +642,7 @@ public class Cmp2Generator implements Op
      * 
      * @param cmrField The CMR field descriptor.
      */
-    private void createCmrFields(CmrField cmrField) {
+    private void createCmrFields(final CmrField cmrField) {
         FieldVisitor fv = cw.visitField(ACC_PRIVATE,
                 cmrField.getName(),
                 cmrField.getDescriptor(),
@@ -669,9 +669,9 @@ public class Cmp2Generator implements Op
      * @param mv       The method context we're initializing in.
      * @param cmrField The CMR field to process.
      */
-    private void initCmrFields(MethodVisitor mv, CmrField cmrField) {
+    private void initCmrFields(final MethodVisitor mv, final CmrField cmrField) {
         // this.${cmrField.name} = new ${cmrField.initialValueType}();
-        Type initialValueType = cmrField.getInitialValueType();
+        final Type initialValueType = cmrField.getInitialValueType();
         if (initialValueType != null) {
             mv.visitVarInsn(ALOAD, 0);
             mv.visitTypeInsn(NEW, initialValueType.getInternalName());
@@ -726,15 +726,15 @@ public class Cmp2Generator implements Op
      * 
      * @param cmrField The field we're generating.
      */
-    private void createCmrGetter(CmrField cmrField) {
+    private void createCmrGetter(final CmrField cmrField) {
         // a synthentic method essentially means this is a relationship with 
         // no back reference.  We don't generate a getter method for this 
         if (cmrField.isSynthetic()) {
             return;
         }
 
-        String methodName = getterName(cmrField.getName());
-        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, methodName, "()" + cmrField.getProxyDescriptor(), null, null);
+        final String methodName = getterName(cmrField.getName());
+        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, methodName, "()" + cmrField.getProxyDescriptor(), null, null);
         mv.visitCode();
         mv.visitVarInsn(ALOAD, 0);
         mv.visitFieldInsn(GETFIELD, implClassName, cmrField.getName() + "Cmr", cmrField.getAccessorDescriptor());
@@ -763,15 +763,15 @@ public class Cmp2Generator implements Op
      * 
      * @param cmrField The field we're generating the setter for.
      */
-    private void createCmrSetter(CmrField cmrField) {
+    private void createCmrSetter(final CmrField cmrField) {
         // a synthentic method essentially means this is a relationship with 
         // no back reference.  We don't generate a getter method for this 
         if (cmrField.isSynthetic()) {
             return;
         }
 
-        String methodName = setterName(cmrField.getName());
-        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, methodName, "(" + cmrField.getProxyDescriptor() + ")V", null, null);
+        final String methodName = setterName(cmrField.getName());
+        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, methodName, "(" + cmrField.getProxyDescriptor() + ")V", null, null);
         mv.visitCode();
         // if this is a Many relationship, the CMR field contains a Set value.  The accessor 
         // will process the elements in the Set, removing any existing ones, and then populating 
@@ -812,7 +812,7 @@ public class Cmp2Generator implements Op
      * @param mv       The method context we're operating within.
      * @param cmrField The CMD field containing the deleted value.
      */
-    private void createOpenEJB_deleted(MethodVisitor mv, CmrField cmrField) {
+    private void createOpenEJB_deleted(final MethodVisitor mv, final CmrField cmrField) {
         // this.${cmrField.name}Cmr.deleted(this.${cmrField.name}); 
         mv.visitVarInsn(ALOAD, 0);
         mv.visitFieldInsn(GETFIELD, implClassName, cmrField.getName() + "Cmr", cmrField.getAccessorDescriptor());
@@ -831,13 +831,13 @@ public class Cmp2Generator implements Op
      * @param mv       The method we're generating within.
      * @param cmrField The CMR field definition.
      */
-    private void createOpenEJB_addCmr(MethodVisitor mv, CmrField cmrField) {
+    private void createOpenEJB_addCmr(final MethodVisitor mv, final CmrField cmrField) {
         // if (${cmrField.name}.equals(arg1))
         mv.visitLdcInsn(cmrField.getName());
         mv.visitVarInsn(ALOAD, 1);
         mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z");
         // if not equal jump to end
-        Label end = new Label();
+        final Label end = new Label();
         mv.visitJumpInsn(IFEQ, end);
 
         // collection style relationship.  Generate the code to add this object to the 
@@ -847,7 +847,7 @@ public class Cmp2Generator implements Op
             mv.visitFieldInsn(GETFIELD, implClassName, cmrField.getName(), cmrField.getDescriptor());
             mv.visitVarInsn(ASTORE, 3);
             mv.visitVarInsn(ALOAD, 3);
-            Label fieldNotNull = new Label();
+            final Label fieldNotNull = new Label();
             mv.visitJumpInsn(IFNONNULL, fieldNotNull);
             // lazy creation of the collection type if not already created. 
             mv.visitTypeInsn(NEW, cmrField.getInitialValueType().getInternalName());
@@ -918,13 +918,13 @@ public class Cmp2Generator implements Op
      * @param mv
      * @param cmrField
      */
-    private void createOpenEJB_removeCmr(MethodVisitor mv, CmrField cmrField) {
+    private void createOpenEJB_removeCmr(final MethodVisitor mv, final CmrField cmrField) {
         // if (${cmrField.name}.equals(arg1))
         mv.visitLdcInsn(cmrField.getName());
         mv.visitVarInsn(ALOAD, 1);
         mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z");
         // if not equal jump to end
-        Label end = new Label();
+        final Label end = new Label();
         mv.visitJumpInsn(IFEQ, end);
         
         // collection valued CMR field.  Remove the object from the collection. 
@@ -964,12 +964,12 @@ public class Cmp2Generator implements Op
      * @param selectMethod
      *               The abstract definition for the method we're generating.
      */
-    private void createSelectMethod(Method selectMethod) {
-        Class<?> returnType = selectMethod.getReturnType(); 
+    private void createSelectMethod(final Method selectMethod) {
+        final Class<?> returnType = selectMethod.getReturnType();
         
-        Method executeMethod = EjbSelect.getSelectMethod(returnType); 
+        final Method executeMethod = EjbSelect.getSelectMethod(returnType);
         
-        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, selectMethod.getName(), Type.getMethodDescriptor(selectMethod), null, getExceptionTypes(selectMethod));
+        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, selectMethod.getName(), Type.getMethodDescriptor(selectMethod), null, getExceptionTypes(selectMethod));
         mv.visitCode();
 
         // push deploymentInfo
@@ -990,7 +990,7 @@ public class Cmp2Generator implements Op
 
         // object[i] = arg${i}
         int i = 0;
-        for (Class<?> parameterType : selectMethod.getParameterTypes()) {
+        for (final Class<?> parameterType : selectMethod.getParameterTypes()) {
             // push arguement i on stack
             mv.visitInsn(DUP);
             bipush(mv, i);
@@ -1040,13 +1040,13 @@ public class Cmp2Generator implements Op
         mv.visitEnd();
     }
 
-    private String getSelectMethodSignature(Method selectMethod) {
-        StringBuilder signature = new StringBuilder();
+    private String getSelectMethodSignature(final Method selectMethod) {
+        final StringBuilder signature = new StringBuilder();
         signature.append(selectMethod.getName());
         if (selectMethod.getParameterTypes().length > 0) {
             signature.append('(');
             boolean first = true;
-            for (Class<?> parameterType : selectMethod.getParameterTypes()) {
+            for (final Class<?> parameterType : selectMethod.getParameterTypes()) {
                 if (!first) signature.append(',');
                 signature.append(parameterType.getCanonicalName());
                 first = false;
@@ -1056,15 +1056,15 @@ public class Cmp2Generator implements Op
         return signature.toString();
     }
 
-    private static String[] getExceptionTypes(Method method) {
-        List<String> types = new ArrayList<String>(method.getExceptionTypes().length);
-        for (Class<?> exceptionType : method.getExceptionTypes()) {
+    private static String[] getExceptionTypes(final Method method) {
+        final List<String> types = new ArrayList<String>(method.getExceptionTypes().length);
+        for (final Class<?> exceptionType : method.getExceptionTypes()) {
             types.add(Type.getInternalName(exceptionType));
         }
         return types.toArray(new String[types.size()]);
     }
 
-    private static void bipush(MethodVisitor mv, int i) {
+    private static void bipush(final MethodVisitor mv, final int i) {
         switch(i) {
             case -1:
                 mv.visitInsn(ICONST_M1);
@@ -1106,10 +1106,10 @@ public class Cmp2Generator implements Op
          * @param mv     The method currently being emitted.
          * @param from   The class we're converting from.
          */
-        public static void toObjectFrom(MethodVisitor mv, Class from) {
+        public static void toObjectFrom(final MethodVisitor mv, final Class from) {
             // we only handler boxing for the primitive types. 
             if (from.isPrimitive()) {
-                Convert conversion = getConversion(from);
+                final Convert conversion = getConversion(from);
                 // the only conversion that will be trouble here is void.  
                 if (conversion == null) 
                 {
@@ -1133,13 +1133,13 @@ public class Cmp2Generator implements Op
          * @param mv     The method currently being constructed.
          * @param to     The target class for the conversion.
          */
-        public static void fromObjectTo(MethodVisitor mv, Class to) {
+        public static void fromObjectTo(final MethodVisitor mv, final Class to) {
             if (to.equals(Object.class)) { //NOPMD
                 // direct assignment will work
             } else if (!to.isPrimitive()) {
                 mv.visitTypeInsn(CHECKCAST, Type.getInternalName(to));
             } else {
-                Convert conversion = getConversion(to);
+                final Convert conversion = getConversion(to);
                 {
                     if (conversion == null)
                         throw new NullPointerException("unsupported conversion for EJB select return type " + to.getName());
@@ -1150,7 +1150,7 @@ public class Cmp2Generator implements Op
 
         private static Map<Class, Convert> conversionsByPrimitive = new HashMap<Class, Convert>();
 
-        public static Convert getConversion(Class primitive) {
+        public static Convert getConversion(final Class primitive) {
             if (!primitive.isPrimitive()) {
                 throw new IllegalArgumentException(primitive.getName() + " is not a primitive class");
             }
@@ -1170,24 +1170,24 @@ public class Cmp2Generator implements Op
         private final Method toPrimitive;
         private final Method toObject;
 
-        private Convert(Class primitiveClass, Class objectClass, String toPrimitiveMethodName) {
+        private Convert(final Class primitiveClass, final Class objectClass, final String toPrimitiveMethodName) {
             objectType = Type.getType(objectClass);
 
             try {
                 toObject = objectClass.getMethod("valueOf", primitiveClass);
                 toPrimitive = objectClass.getMethod(toPrimitiveMethodName);
-            } catch (NoSuchMethodException e) {
+            } catch (final NoSuchMethodException e) {
                 throw new OpenEJBRuntimeException(e);
             }
 
             conversionsByPrimitive.put(primitiveClass, this);
         }
 
-        public void primitiveToObject(MethodVisitor mv) {
+        public void primitiveToObject(final MethodVisitor mv) {
             mv.visitMethodInsn(INVOKESTATIC, objectType.getInternalName(), toObject.getName(), Type.getMethodDescriptor(toObject));
         }
 
-        public void objectToPrimitive(MethodVisitor mv) {
+        public void objectToPrimitive(final MethodVisitor mv) {
             mv.visitTypeInsn(CHECKCAST, objectType.getInternalName());
             mv.visitMethodInsn(INVOKEVIRTUAL, objectType.getInternalName(), toPrimitive.getName(), Type.getMethodDescriptor(toPrimitive));
         }
@@ -1195,7 +1195,7 @@ public class Cmp2Generator implements Op
     }
 
     public void createEjbActivate() {
-        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "ejbActivate", "()V", null, null);
+        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "ejbActivate", "()V", null, null);
         mv.visitCode();
         mv.visitInsn(RETURN);
         mv.visitMaxs(0, 1);
@@ -1203,7 +1203,7 @@ public class Cmp2Generator implements Op
     }
 
     public void createEjbLoad() {
-        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "ejbLoad", "()V", null, null);
+        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "ejbLoad", "()V", null, null);
         mv.visitCode();
         mv.visitInsn(RETURN);
         mv.visitMaxs(0, 1);
@@ -1211,7 +1211,7 @@ public class Cmp2Generator implements Op
     }
 
     public void createEjbPassivate() {
-        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "ejbPassivate", "()V", null, null);
+        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "ejbPassivate", "()V", null, null);
         mv.visitCode();
         mv.visitInsn(RETURN);
         mv.visitMaxs(0, 1);
@@ -1219,7 +1219,7 @@ public class Cmp2Generator implements Op
     }
 
     public void createEjbRemove() {
-        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "ejbRemove", "()V", null, null);
+        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "ejbRemove", "()V", null, null);
         mv.visitCode();
         mv.visitInsn(RETURN);
         mv.visitMaxs(0, 1);
@@ -1227,7 +1227,7 @@ public class Cmp2Generator implements Op
     }
 
     public void createEjbStore() {
-        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "ejbStore", "()V", null, null);
+        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "ejbStore", "()V", null, null);
         mv.visitCode();
         mv.visitInsn(RETURN);
         mv.visitMaxs(0, 1);
@@ -1235,7 +1235,7 @@ public class Cmp2Generator implements Op
     }
 
     public void createSetEntityContext() {
-        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "setEntityContext", "(Ljavax/ejb/EntityContext;)V", null, null);
+        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "setEntityContext", "(Ljavax/ejb/EntityContext;)V", null, null);
         mv.visitCode();
         mv.visitInsn(RETURN);
         mv.visitMaxs(0, 2);
@@ -1243,7 +1243,7 @@ public class Cmp2Generator implements Op
     }
 
     public void createUnsetEntityContext() {
-        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "unsetEntityContext", "()V", null, null);
+        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "unsetEntityContext", "()V", null, null);
         mv.visitCode();
         mv.visitInsn(RETURN);
         mv.visitMaxs(0, 1);

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2KeyGenerator.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2KeyGenerator.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2KeyGenerator.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2KeyGenerator.java Wed Feb 19 15:47:58 2014
@@ -21,9 +21,9 @@ import org.apache.openejb.core.cmp.KeyGe
 import javax.ejb.EntityBean;
 
 public class Cmp2KeyGenerator implements KeyGenerator {
-    public Object getPrimaryKey(EntityBean entity) {
-        Cmp2Entity cmp2Entity = (Cmp2Entity) entity;
-        Object primaryKey = cmp2Entity.OpenEJB_getPrimaryKey();
+    public Object getPrimaryKey(final EntityBean entity) {
+        final Cmp2Entity cmp2Entity = (Cmp2Entity) entity;
+        final Object primaryKey = cmp2Entity.OpenEJB_getPrimaryKey();
         return primaryKey;
     }
 }

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Util.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Util.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Util.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Util.java Wed Feb 19 15:47:58 2014
@@ -29,66 +29,66 @@ import javax.ejb.EntityBean;
 import java.lang.reflect.Field;
 
 public class Cmp2Util {
-    public static Object getPrimaryKey(BeanContext beanContext, EntityBean entity){
+    public static Object getPrimaryKey(final BeanContext beanContext, final EntityBean entity){
         if (entity == null) return null;
 
         // build the primary key
-        KeyGenerator kg = beanContext.getKeyGenerator();
-        Object primaryKey = kg.getPrimaryKey(entity);
+        final KeyGenerator kg = beanContext.getKeyGenerator();
+        final Object primaryKey = kg.getPrimaryKey(entity);
         return primaryKey;
     }
 
-    public static <Bean extends EntityBean> Bean getEntityBean(EJBLocalObject proxy) {
+    public static <Bean extends EntityBean> Bean getEntityBean(final EJBLocalObject proxy) {
         if (proxy == null) return null;
 
-        EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(proxy);
+        final EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(proxy);
         if (handler.container == null) {
             return null;
         }
         if (!(handler.container instanceof CmpContainer)) {
             throw new IllegalArgumentException("Proxy is not connected to a CMP container but is conect to " + handler.container.getClass().getName());
         }
-        CmpContainer container = (CmpContainer) handler.container;
-        Bean entity = (Bean) container.getEjbInstance(handler.getBeanContext(), handler.primaryKey);
+        final CmpContainer container = (CmpContainer) handler.container;
+        final Bean entity = (Bean) container.getEjbInstance(handler.getBeanContext(), handler.primaryKey);
         return entity;
     }
 
-    public static <Bean extends EntityBean> Bean getEntityBean(EJBObject proxy) {
+    public static <Bean extends EntityBean> Bean getEntityBean(final EJBObject proxy) {
         if (proxy == null) return null;
 
-        EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(proxy);
+        final EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(proxy);
         if (handler.container == null) {
             return null;
         }
         if (!(handler.container instanceof CmpContainer)) {
             throw new IllegalArgumentException("Proxy is not connected to a CMP container but is conect to " + handler.container.getClass().getName());
         }
-        CmpContainer container = (CmpContainer) handler.container;
-        Bean entity = (Bean) container.getEjbInstance(handler.getBeanContext(), handler.primaryKey);
+        final CmpContainer container = (CmpContainer) handler.container;
+        final Bean entity = (Bean) container.getEjbInstance(handler.getBeanContext(), handler.primaryKey);
         return entity;
     }
 
-    public static <Proxy extends EJBLocalObject> Proxy getEjbProxy(BeanContext beanContext, EntityBean entity){
+    public static <Proxy extends EJBLocalObject> Proxy getEjbProxy(final BeanContext beanContext, final EntityBean entity){
         if (entity == null) return null;
 
         // build the primary key
-        Object primaryKey = getPrimaryKey(beanContext, entity);
+        final Object primaryKey = getPrimaryKey(beanContext, entity);
 
         // get the cmp container
         if (!(beanContext.getContainer() instanceof CmpContainer)) {
             throw new IllegalArgumentException("Proxy is not connected to a CMP container but is conect to " + beanContext.getContainer().getClass().getName());
         }
 
-        Proxy proxy = (Proxy) EjbObjectProxyHandler.createProxy(beanContext, primaryKey, InterfaceType.EJB_LOCAL_HOME, beanContext.getLocalInterface());
+        final Proxy proxy = (Proxy) EjbObjectProxyHandler.createProxy(beanContext, primaryKey, InterfaceType.EJB_LOCAL_HOME, beanContext.getLocalInterface());
         return proxy;
     }
 
-    public static BeanContext getBeanContext(Class type) {
-        BeanContext beanContext;
+    public static BeanContext getBeanContext(final Class type) {
+        final BeanContext beanContext;
         try {
-            Field deploymentInfoField = type.getField("deploymentInfo");
+            final Field deploymentInfoField = type.getField("deploymentInfo");
             beanContext = (BeanContext) deploymentInfoField.get(null);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new IllegalArgumentException("EntityBean class " + type.getName() +
                     " does not contain a deploymentInfo field.  Is this a generated CMP 2 entity implementation?", e);
         }

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmpField.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmpField.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmpField.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmpField.java Wed Feb 19 15:47:58 2014
@@ -25,7 +25,7 @@ public class CmpField {
     private final Type type;
     private final Method getter; 
 
-    public CmpField(String name, Type type, Method getter) {
+    public CmpField(final String name, final Type type, final Method getter) {
         this.name = name;
         this.type = type;
         this.getter = getter; 

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrField.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrField.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrField.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrField.java Wed Feb 19 15:47:58 2014
@@ -26,7 +26,7 @@ public class CmrField {
     private final String relatedName;
     private final boolean synthetic;
 
-    public CmrField(String fieldName, String fieldType, String cmpImplClass, String local, String relatedName, boolean synthetic) {
+    public CmrField(final String fieldName, final String fieldType, final String cmpImplClass, final String local, final String relatedName, final boolean synthetic) {
         this.synthetic = synthetic;
         this.name = fieldName;
         if (fieldType == null) {
@@ -76,7 +76,7 @@ public class CmrField {
     }
 
     public String getDescriptor() {
-        Type collectionType = cmrStyle.getCollectionType();
+        final Type collectionType = cmrStyle.getCollectionType();
         if (collectionType == null) {
             return type.getDescriptor();
         }
@@ -84,7 +84,7 @@ public class CmrField {
     }
 
     public String getGenericSignature() {
-        Type collectionType = cmrStyle.getCollectionType();
+        final Type collectionType = cmrStyle.getCollectionType();
         if (collectionType == null) {
             return null;
         }
@@ -92,7 +92,7 @@ public class CmrField {
     }
 
     public String getProxyDescriptor() {
-        Type collectionType = cmrStyle.getCollectionType();
+        final Type collectionType = cmrStyle.getCollectionType();
         if (collectionType == null) {
             return proxyType.getDescriptor();
         }
@@ -108,19 +108,19 @@ public class CmrField {
     }
 
     public String getAccessorGenericSignature() {
-        Type collectionType = cmrStyle.getCollectionType();
+        final Type collectionType = cmrStyle.getCollectionType();
         if (collectionType == null) {
             return null;
         }
         return createSignature(cmrStyle.getAccessorType(), type, proxyType);
     }
 
-    private static String createSignature(Type type, Type... genericTypes) {
-        StringBuilder builder = new StringBuilder();
+    private static String createSignature(final Type type, final Type... genericTypes) {
+        final StringBuilder builder = new StringBuilder();
         builder.append("L").append(type.getInternalName());
         if (genericTypes.length > 0) {
             builder.append("<");
-            for (Type genericType : genericTypes) {
+            for (final Type genericType : genericTypes) {
                 builder.append(genericType.getDescriptor());
             }
             builder.append(">");

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrSet.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrSet.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrSet.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrSet.java Wed Feb 19 15:47:58 2014
@@ -41,7 +41,7 @@ public class CmrSet<Bean extends EntityB
     private boolean mutable = true;
     private Collection<Bean> relatedBeans;
 
-    public CmrSet(EntityBean source, String sourceProperty, BeanContext relatedInfo, String relatedProperty, Collection<Bean> relatedBeans) {
+    public CmrSet(final EntityBean source, final String sourceProperty, final BeanContext relatedInfo, final String relatedProperty, final Collection<Bean> relatedBeans) {
         this.source = source;
         this.sourceProperty = sourceProperty;
         this.relatedInfo = relatedInfo;
@@ -49,17 +49,17 @@ public class CmrSet<Bean extends EntityB
         this.relatedBeans = relatedBeans;
 
         relatedLocal = relatedInfo.getLocalInterface();
-        TransactionSynchronizationRegistry transactionRegistry = SystemInstance.get().getComponent(TransactionSynchronizationRegistry.class);
+        final TransactionSynchronizationRegistry transactionRegistry = SystemInstance.get().getComponent(TransactionSynchronizationRegistry.class);
         try {
             transactionRegistry.registerInterposedSynchronization(new Synchronization() {
                 public void beforeCompletion() {
                 }
 
-                public void afterCompletion(int i) {
+                public void afterCompletion(final int i) {
                     mutable = false;
                 }
             });
-        } catch (IllegalStateException ignored) {
+        } catch (final IllegalStateException ignored) {
             // no tx so not mutable
             mutable = false;
         }
@@ -78,31 +78,31 @@ public class CmrSet<Bean extends EntityB
         return getRelatedBeans(false, false).size();
     }
 
-    public boolean contains(Object o) {
+    public boolean contains(final Object o) {
         if (relatedLocal.isInstance(o)) {
-            Bean entity = getEntityBean((EJBLocalObject) o);
+            final Bean entity = getEntityBean((EJBLocalObject) o);
             return entity != null && getRelatedBeans(false, false).contains(entity);
         }
         return false;
     }
 
-    public boolean addAll(Collection c) {
-        Set<Bean> entityBeans = getEntityBeans(c, relatedLocal);
+    public boolean addAll(final Collection c) {
+        final Set<Bean> entityBeans = getEntityBeans(c, relatedLocal);
         boolean changed = false;
-        for (Iterator<Bean> iterator = entityBeans.iterator(); iterator.hasNext();) {
-            Bean bean = iterator.next();
+        for (final Iterator<Bean> iterator = entityBeans.iterator(); iterator.hasNext();) {
+            final Bean bean = iterator.next();
             changed = add(bean) || changed;
         }
         return changed;
     }
 
-    public boolean add(Object proxy) {
+    public boolean add(final Object proxy) {
         if (!relatedLocal.isInstance(proxy)) {
             throw new IllegalArgumentException("Object is not an instance of " + relatedLocal.getName() +
                                 ": " + (proxy == null ? "null" : proxy.getClass().getName()));
         }
         
-        Bean newEntity = getEntityBean((EJBLocalObject) proxy);
+        final Bean newEntity = getEntityBean((EJBLocalObject) proxy);
         if (newEntity == null) {
             throw new IllegalArgumentException("Ejb has been deleted");
         }
@@ -110,12 +110,12 @@ public class CmrSet<Bean extends EntityB
         return add(newEntity);
     }
 
-    private boolean add(Bean newEntity) {
-        boolean changed = getRelatedBeans(true, true).add(newEntity);
+    private boolean add(final Bean newEntity) {
+        final boolean changed = getRelatedBeans(true, true).add(newEntity);
         if (changed && relatedProperty != null) {
             // set the back reference in the new related bean
             if (source == null) throw new IllegalStateException("source is null");
-            Object oldBackRef = toCmp2Entity(newEntity).OpenEJB_addCmr(relatedProperty, source);
+            final Object oldBackRef = toCmp2Entity(newEntity).OpenEJB_addCmr(relatedProperty, source);
 
             // if the new related beas was related to another bean, we need
             // to clear the back reference in that old bean
@@ -126,25 +126,25 @@ public class CmrSet<Bean extends EntityB
         return changed;
     }
 
-    public boolean remove(Object o) {
+    public boolean remove(final Object o) {
         if (!relatedLocal.isInstance(o)) {
             return false;
         }
 
-        Bean entity = getEntityBean((EJBLocalObject) o);
-        boolean changed = entity != null && getRelatedBeans(false, true).remove(entity);
+        final Bean entity = getEntityBean((EJBLocalObject) o);
+        final boolean changed = entity != null && getRelatedBeans(false, true).remove(entity);
         if (changed && relatedProperty != null) {
             toCmp2Entity(entity).OpenEJB_removeCmr(relatedProperty, source);
         }
         return changed;
     }
 
-    public boolean retainAll(Collection c) {
-        Set entityBeans = getEntityBeans(c, null);
+    public boolean retainAll(final Collection c) {
+        final Set entityBeans = getEntityBeans(c, null);
 
         boolean changed = false;
-        for (Iterator<Bean> iterator = getRelatedBeans(false, true).iterator(); iterator.hasNext();) {
-            Bean entity = iterator.next();
+        for (final Iterator<Bean> iterator = getRelatedBeans(false, true).iterator(); iterator.hasNext();) {
+            final Bean entity = iterator.next();
             if (!entityBeans.contains(entity)) {
                 iterator.remove();
                 if (relatedProperty != null) {
@@ -188,30 +188,30 @@ public class CmrSet<Bean extends EntityB
         };
     }
 
-    private Proxy getEjbProxy(Bean entity) throws EJBException {
+    private Proxy getEjbProxy(final Bean entity) throws EJBException {
         if (entity == null) return null;
 
-        Proxy ejbProxy = Cmp2Util.<Proxy>getEjbProxy(relatedInfo, entity);
+        final Proxy ejbProxy = Cmp2Util.<Proxy>getEjbProxy(relatedInfo, entity);
         return ejbProxy;
     }
 
-    private Bean getEntityBean(EJBLocalObject proxy) {
+    private Bean getEntityBean(final EJBLocalObject proxy) {
         if (proxy == null) return null;
 
-        Bean bean = Cmp2Util.<Bean>getEntityBean(proxy);
+        final Bean bean = Cmp2Util.<Bean>getEntityBean(proxy);
         return bean;
     }
 
-    private static <Bean extends EntityBean> Set<Bean> getEntityBeans(Collection<?> proxies, Class type) {
+    private static <Bean extends EntityBean> Set<Bean> getEntityBeans(final Collection<?> proxies, final Class type) {
         if (proxies == null) return null;
 
-        Set<Bean> entities = new HashSet<Bean>();
-        for (Object value : proxies) {
+        final Set<Bean> entities = new HashSet<Bean>();
+        for (final Object value : proxies) {
             if (type != null && !type.isInstance(value)) {
                 throw new IllegalArgumentException("Object is not an instance of " + type.getName() +
                                     ": " + (value == null ? "null" : value.getClass().getName()));
             }
-            Bean entity = Cmp2Util.<Bean>getEntityBean((EJBLocalObject) value);
+            final Bean entity = Cmp2Util.<Bean>getEntityBean((EJBLocalObject) value);
             if (entity == null) {
                 throw new IllegalArgumentException("Entity has been deleted");
             }
@@ -220,11 +220,11 @@ public class CmrSet<Bean extends EntityB
         return entities;
     }
 
-    private Cmp2Entity toCmp2Entity(Object object) {
+    private Cmp2Entity toCmp2Entity(final Object object) {
         return (Cmp2Entity) object;
     }
 
-    private Collection<Bean> getRelatedBeans(boolean mustExist, boolean mutateOpation) {
+    private Collection<Bean> getRelatedBeans(final boolean mustExist, final boolean mutateOpation) {
         if (relatedBeans == null) {
             if (mustExist) {
                 throw new IllegalStateException("Entity has been deleted therefore this cmr collection can no longer be modified");

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrStyle.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrStyle.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrStyle.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrStyle.java Wed Feb 19 15:47:58 2014
@@ -35,7 +35,7 @@ public enum CmrStyle {
     private final String setterDescriptor;
     private final String deletedDescriptor;
 
-    CmrStyle(Class accessorClass, Class collectionClass, Class initCollectionClass) {
+    CmrStyle(final Class accessorClass, final Class collectionClass, final Class initCollectionClass) {
         this.accessorType = Type.getType(accessorClass);
         if (collectionClass != null) {
             this.collectionType = Type.getType(collectionClass);
@@ -48,7 +48,7 @@ public enum CmrStyle {
         String getterDescriptor = null;
         String setterDescriptor = null;
         String deletedDescriptor = null;
-        for (Method method : accessorClass.getMethods()) {
+        for (final Method method : accessorClass.getMethods()) {
             if ("get".equals(method.getName())) {
                 getterDescriptor = Type.getMethodDescriptor(method);
             }
@@ -73,8 +73,8 @@ public enum CmrStyle {
         this.deletedDescriptor = deletedDescriptor;
     }
 
-    public String getCmrFieldDescriptor(Type relatedType) {
-        String relatedDescriptor = relatedType.getDescriptor();
+    public String getCmrFieldDescriptor(final Type relatedType) {
+        final String relatedDescriptor = relatedType.getDescriptor();
         if (collectionType != null) {
             return collectionType.getDescriptor() +
                     "<" + relatedDescriptor + ">";

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/EjbSelect.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/EjbSelect.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/EjbSelect.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/EjbSelect.java Wed Feb 19 15:47:58 2014
@@ -49,7 +49,7 @@ public class EjbSelect {
             selectMethods.put(Long.TYPE, EjbSelect.class.getMethod("execute_long", Object.class, String.class, Object[].class));
             selectMethods.put(Float.TYPE, EjbSelect.class.getMethod("execute_float", Object.class, String.class, Object[].class));
             selectMethods.put(Double.TYPE, EjbSelect.class.getMethod("execute_double", Object.class, String.class, Object[].class));
-        } catch (NoSuchMethodException e) {
+        } catch (final NoSuchMethodException e) {
             throw new OpenEJBRuntimeException(e);
         }
     }
@@ -67,11 +67,11 @@ public class EjbSelect {
      * 
      * @return The method to be used to process the method invocation. 
      */
-    public static Method getSelectMethod(Class<?> returnType) 
+    public static Method getSelectMethod(final Class<?> returnType)
     {
         // perform a lookup on the return type.  If it is not found directly in the 
         // mapping table, this is some sort of reference type.  
-        Method method = selectMethods.get(returnType); 
+        final Method method = selectMethods.get(returnType);
         if (method == null) {
             return selectMethods.get(Object.class); 
         }
@@ -95,13 +95,13 @@ public class EjbSelect {
      * 
      * @exception FinderException
      */
-    public static void execute_void(Object obj, String methodSignature, Object... args) throws FinderException {
-        BeanContext beanContext = (BeanContext) obj;
-        Container container = beanContext.getContainer();
+    public static void execute_void(final Object obj, final String methodSignature, final Object... args) throws FinderException {
+        final BeanContext beanContext = (BeanContext) obj;
+        final Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
             throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
-        CmpContainer cmpContainer = (CmpContainer) container;
+        final CmpContainer cmpContainer = (CmpContainer) container;
         
         cmpContainer.update(beanContext, methodSignature, args);
     }
@@ -123,118 +123,118 @@ public class EjbSelect {
      *         one of the collection types.
      * @exception FinderException
      */
-    public static Object execute_Object(Object obj, String methodSignature, String returnType, Object... args) throws FinderException {
-        BeanContext beanContext = (BeanContext) obj;
-        Container container = beanContext.getContainer();
+    public static Object execute_Object(final Object obj, final String methodSignature, final String returnType, final Object... args) throws FinderException {
+        final BeanContext beanContext = (BeanContext) obj;
+        final Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
             throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
-        CmpContainer cmpContainer = (CmpContainer) container;
+        final CmpContainer cmpContainer = (CmpContainer) container;
         
         return cmpContainer.select(beanContext, methodSignature, returnType, args);
     }
     
     
-    public static char execute_char(Object obj, String methodSignature, Object... args) throws FinderException {
-        BeanContext beanContext = (BeanContext) obj;
-        Container container = beanContext.getContainer();
+    public static char execute_char(final Object obj, final String methodSignature, final Object... args) throws FinderException {
+        final BeanContext beanContext = (BeanContext) obj;
+        final Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
             throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
-        CmpContainer cmpContainer = (CmpContainer) container;
+        final CmpContainer cmpContainer = (CmpContainer) container;
         
-        Character result = (Character)cmpContainer.select(beanContext, methodSignature, "char", args);
+        final Character result = (Character)cmpContainer.select(beanContext, methodSignature, "char", args);
         return result.charValue(); 
     }
     
     
-    public static byte execute_byte(Object  obj, String methodSignature, Object... args) throws FinderException {
-        BeanContext beanContext = (BeanContext) obj;
-        Container container = beanContext.getContainer();
+    public static byte execute_byte(final Object  obj, final String methodSignature, final Object... args) throws FinderException {
+        final BeanContext beanContext = (BeanContext) obj;
+        final Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
             throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
-        CmpContainer cmpContainer = (CmpContainer) container;
+        final CmpContainer cmpContainer = (CmpContainer) container;
         
-        Number result = (Number)cmpContainer.select(beanContext, methodSignature, "byte", args);
+        final Number result = (Number)cmpContainer.select(beanContext, methodSignature, "byte", args);
         return result.byteValue(); 
     }
     
     
-    public static boolean execute_boolean(Object obj, String methodSignature, Object... args) throws FinderException {
-        BeanContext beanContext = (BeanContext) obj;
-        Container container = beanContext.getContainer();
+    public static boolean execute_boolean(final Object obj, final String methodSignature, final Object... args) throws FinderException {
+        final BeanContext beanContext = (BeanContext) obj;
+        final Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
             throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
-        CmpContainer cmpContainer = (CmpContainer) container;
+        final CmpContainer cmpContainer = (CmpContainer) container;
         
-        Boolean result = (Boolean)cmpContainer.select(beanContext, methodSignature, "byte", args);
+        final Boolean result = (Boolean)cmpContainer.select(beanContext, methodSignature, "byte", args);
         return result.booleanValue(); 
     }
     
     
-    public static short execute_short(Object obj, String methodSignature, Object... args) throws FinderException {
-        BeanContext beanContext = (BeanContext) obj;
-        Container container = beanContext.getContainer();
+    public static short execute_short(final Object obj, final String methodSignature, final Object... args) throws FinderException {
+        final BeanContext beanContext = (BeanContext) obj;
+        final Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
             throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
-        CmpContainer cmpContainer = (CmpContainer) container;
+        final CmpContainer cmpContainer = (CmpContainer) container;
         
-        Number result = (Number)cmpContainer.select(beanContext, methodSignature, "short", args);
+        final Number result = (Number)cmpContainer.select(beanContext, methodSignature, "short", args);
         return result.shortValue(); 
     }
     
     
-    public static int execute_int(Object obj, String methodSignature, Object... args) throws FinderException {
-        BeanContext beanContext = (BeanContext) obj;
-        Container container = beanContext.getContainer();
+    public static int execute_int(final Object obj, final String methodSignature, final Object... args) throws FinderException {
+        final BeanContext beanContext = (BeanContext) obj;
+        final Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
             throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
-        CmpContainer cmpContainer = (CmpContainer) container;
+        final CmpContainer cmpContainer = (CmpContainer) container;
         
-        Number result = (Number)cmpContainer.select(beanContext, methodSignature, "int", args);
+        final Number result = (Number)cmpContainer.select(beanContext, methodSignature, "int", args);
         return result.intValue(); 
     }
     
     
-    public static long execute_long(Object obj, String methodSignature, Object... args) throws FinderException {
-        BeanContext beanContext = (BeanContext) obj;
-        Container container = beanContext.getContainer();
+    public static long execute_long(final Object obj, final String methodSignature, final Object... args) throws FinderException {
+        final BeanContext beanContext = (BeanContext) obj;
+        final Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
             throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
-        CmpContainer cmpContainer = (CmpContainer) container;
+        final CmpContainer cmpContainer = (CmpContainer) container;
         
-        Number result = (Number)cmpContainer.select(beanContext, methodSignature, "long", args);
+        final Number result = (Number)cmpContainer.select(beanContext, methodSignature, "long", args);
         return result.longValue(); 
     }
     
     
-    public static float execute_float(Object obj, String methodSignature, Object... args) throws FinderException {
-        BeanContext beanContext = (BeanContext) obj;
-        Container container = beanContext.getContainer();
+    public static float execute_float(final Object obj, final String methodSignature, final Object... args) throws FinderException {
+        final BeanContext beanContext = (BeanContext) obj;
+        final Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
             throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
-        CmpContainer cmpContainer = (CmpContainer) container;
+        final CmpContainer cmpContainer = (CmpContainer) container;
         
-        Number result = (Number)cmpContainer.select(beanContext, methodSignature, "float", args);
+        final Number result = (Number)cmpContainer.select(beanContext, methodSignature, "float", args);
         return result.floatValue(); 
     }
     
     
-    public static double execute_double(Object obj, String methodSignature, Object... args) throws FinderException {
-        BeanContext beanContext = (BeanContext) obj;
-        Container container = beanContext.getContainer();
+    public static double execute_double(final Object obj, final String methodSignature, final Object... args) throws FinderException {
+        final BeanContext beanContext = (BeanContext) obj;
+        final Container container = beanContext.getContainer();
         if (!(container instanceof CmpContainer)) {
             throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
         }
-        CmpContainer cmpContainer = (CmpContainer) container;
+        final CmpContainer cmpContainer = (CmpContainer) container;
         
-        Number result = (Number)cmpContainer.select(beanContext, methodSignature, "double", args);
+        final Number result = (Number)cmpContainer.select(beanContext, methodSignature, "double", args);
         return result.doubleValue(); 
     }
 }

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/PostCreateGenerator.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/PostCreateGenerator.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/PostCreateGenerator.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/PostCreateGenerator.java Wed Feb 19 15:47:58 2014
@@ -44,7 +44,7 @@ public class PostCreateGenerator {
      *                  other generation steps, we're implementing additional
      *                  stages of the process.
      */
-    public PostCreateGenerator(Class beanClass, ClassWriter cw) {
+    public PostCreateGenerator(final Class beanClass, final ClassWriter cw) {
         this.beanClass = beanClass;
         this.cw = cw;
     }
@@ -60,13 +60,13 @@ public class PostCreateGenerator {
     public void generate() {
         // ok, scan the class for the ejbCreate methods and check to see if 
         // we need to provide an ejbPostCreate implementation. 
-        for (Method ejbCreate : beanClass.getMethods()) {
+        for (final Method ejbCreate : beanClass.getMethods()) {
             if (!ejbCreate.getName().startsWith("ejbCreate")) 
             {
                 continue;
             }
 
-            StringBuilder ejbPostCreateName = new StringBuilder(ejbCreate.getName());
+            final StringBuilder ejbPostCreateName = new StringBuilder(ejbCreate.getName());
             ejbPostCreateName.replace(0, "ejbC".length(), "ejbPostC");
 
             // if there is a concrete method here, we just skip this. 
@@ -89,11 +89,11 @@ public class PostCreateGenerator {
      * @return true if the method exists and is NOT abstract.  Returns 
      *         false if the method is not found or IS abstract.
      */
-    private boolean hasMethod(Class beanClass, String name, Class... args) {
+    private boolean hasMethod(final Class beanClass, final String name, final Class... args) {
         try {
-            Method method = beanClass.getMethod(name, args);
+            final Method method = beanClass.getMethod(name, args);
             return !Modifier.isAbstract(method.getModifiers());
-        } catch (NoSuchMethodException e) {
+        } catch (final NoSuchMethodException e) {
             return false;
         }
     }
@@ -108,9 +108,9 @@ public class PostCreateGenerator {
      * @param ejbCreate The matching ejbCreate method.  The post create method
      *                  will match this one in terms of method signature.
      */
-    public void createEjbPostCreate(String ejbPostCreateName, Method ejbCreate) {
-        String methodDescriptor = Type.getMethodDescriptor(Type.VOID_TYPE, Type.getArgumentTypes(ejbCreate));
-        MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, ejbPostCreateName, methodDescriptor, null, null);
+    public void createEjbPostCreate(final String ejbPostCreateName, final Method ejbCreate) {
+        final String methodDescriptor = Type.getMethodDescriptor(Type.VOID_TYPE, Type.getArgumentTypes(ejbCreate));
+        final MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, ejbPostCreateName, methodDescriptor, null, null);
         mv.visitCode();
         mv.visitInsn(Opcodes.RETURN);
         mv.visitMaxs(0, ejbCreate.getParameterTypes().length + 1);

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SetValuedCmr.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SetValuedCmr.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SetValuedCmr.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SetValuedCmr.java Wed Feb 19 15:47:58 2014
@@ -38,7 +38,7 @@ public class SetValuedCmr<Bean extends E
     private final BeanContext relatedInfo;
     private final TransactionSynchronizationRegistry transactionRegistry;
 
-    public SetValuedCmr(EntityBean source, String sourceProperty, Class<Bean> relatedType, String relatedProperty) {
+    public SetValuedCmr(final EntityBean source, final String sourceProperty, final Class<Bean> relatedType, final String relatedProperty) {
         if (source == null) throw new NullPointerException("source is null");
         if (relatedType == null) throw new NullPointerException("relatedType is null");
 
@@ -51,7 +51,7 @@ public class SetValuedCmr<Bean extends E
         transactionRegistry = SystemInstance.get().getComponent(TransactionSynchronizationRegistry.class);
     }
 
-    public Set<Proxy> get(Set<Bean> others) {
+    public Set<Proxy> get(final Set<Bean> others) {
         if (sourceProperty == null) {
             throw new EJBException("Internal error: this container managed relationship is unidirectional and, " +
                     "this entity does not have a cmr field for the relationship");
@@ -66,7 +66,7 @@ public class SetValuedCmr<Bean extends E
         CmrSet<Bean, Proxy> cmrSet = null;
         try {
             cmrSet = (CmrSet<Bean, Proxy>) transactionRegistry.getResource(this);
-        } catch (IllegalStateException ignored) {
+        } catch (final IllegalStateException ignored) {
             // no tx, which is fine
         }
         
@@ -74,14 +74,14 @@ public class SetValuedCmr<Bean extends E
             cmrSet = new CmrSet<Bean, Proxy>(source, sourceProperty, relatedInfo, relatedProperty, others);
             try {
                 transactionRegistry.putResource(this, cmrSet);
-            } catch (IllegalStateException ignored) {
+            } catch (final IllegalStateException ignored) {
                 // we tried but there is no tx
             }
         }
         return cmrSet;
     }
 
-    public void set(Set<Bean> relatedBeans, Collection newProxies) {
+    public void set(final Set<Bean> relatedBeans, final Collection newProxies) {
         if (sourceProperty == null) {
             throw new EJBException("Internal error: this container managed relationship is unidirectional and, " +
                     "this entity does not have a cmr field for the relationship");
@@ -95,7 +95,7 @@ public class SetValuedCmr<Bean extends E
 
         // clear back reference in the old related beans
         if (relatedProperty != null) {
-            for (Bean oldBean : relatedBeans) {
+            for (final Bean oldBean : relatedBeans) {
                 if (oldBean != null) {
                     toCmp2Entity(oldBean).OpenEJB_removeCmr(relatedProperty, source);
                 }
@@ -103,9 +103,9 @@ public class SetValuedCmr<Bean extends E
         }
         relatedBeans.clear();
 
-        for (Iterator iterator = new ArrayList(newProxies).iterator(); iterator.hasNext();) {
-            Proxy newProxy = (Proxy) iterator.next();
-            Bean newBean = Cmp2Util.<Bean>getEntityBean(newProxy);
+        for (final Iterator iterator = new ArrayList(newProxies).iterator(); iterator.hasNext();) {
+            final Proxy newProxy = (Proxy) iterator.next();
+            final Bean newBean = Cmp2Util.<Bean>getEntityBean(newProxy);
 
             if (newProxy != null) {
                 // set the back reference in the new related bean
@@ -126,8 +126,8 @@ public class SetValuedCmr<Bean extends E
         }
     }
 
-    public void deleted(Set<Bean> relatedBeans) {
-        CmrSet<Bean, Proxy> cmrSet = (CmrSet<Bean, Proxy>) transactionRegistry.getResource(this);
+    public void deleted(final Set<Bean> relatedBeans) {
+        final CmrSet<Bean, Proxy> cmrSet = (CmrSet<Bean, Proxy>) transactionRegistry.getResource(this);
         if (cmrSet != null) {
             transactionRegistry.putResource(this, null);
             cmrSet.entityDeleted();
@@ -135,7 +135,7 @@ public class SetValuedCmr<Bean extends E
 
         // clear back reference in the old related beans
         if (relatedProperty != null) {
-            for (Bean oldBean : relatedBeans) {
+            for (final Bean oldBean : relatedBeans) {
                 if (oldBean != null) {
                     toCmp2Entity(oldBean).OpenEJB_removeCmr(relatedProperty, source);
                 }
@@ -143,7 +143,7 @@ public class SetValuedCmr<Bean extends E
         }
     }
 
-    private Cmp2Entity toCmp2Entity(Object object) {
+    private Cmp2Entity toCmp2Entity(final Object object) {
         return (Cmp2Entity) object;
     }
 }

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SingleValuedCmr.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SingleValuedCmr.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SingleValuedCmr.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SingleValuedCmr.java Wed Feb 19 15:47:58 2014
@@ -31,7 +31,7 @@ public class SingleValuedCmr<Bean extend
     private final String relatedProperty;
     private final BeanContext relatedInfo;
 
-    public SingleValuedCmr(EntityBean source, String sourceProperty, Class<Bean> relatedType, String relatedProperty) {
+    public SingleValuedCmr(final EntityBean source, final String sourceProperty, final Class<Bean> relatedType, final String relatedProperty) {
         if (source == null) throw new NullPointerException("source is null");
         if (relatedType == null) throw new NullPointerException("relatedType is null");
         this.source = source;
@@ -41,7 +41,7 @@ public class SingleValuedCmr<Bean extend
         this.relatedInfo = Cmp2Util.getBeanContext(relatedType);
     }
 
-    public Proxy get(Bean entity) throws EJBException {
+    public Proxy get(final Bean entity) throws EJBException {
         if (sourceProperty == null) {
             throw new EJBException("Internal error: this container managed relationship is unidirectional and, " +
                     "this entity does not have a cmr field for the relationship");
@@ -49,12 +49,12 @@ public class SingleValuedCmr<Bean extend
 
         if (entity == null) return null;
 
-        Proxy ejbProxy = Cmp2Util.<Proxy>getEjbProxy(relatedInfo, entity);
+        final Proxy ejbProxy = Cmp2Util.<Proxy>getEjbProxy(relatedInfo, entity);
         return ejbProxy;
     }
 
-    public Bean set(Bean oldBean, Proxy newValue) throws EJBException {
-        Bean newBean = Cmp2Util.<Bean>getEntityBean(newValue);
+    public Bean set(final Bean oldBean, final Proxy newValue) throws EJBException {
+        final Bean newBean = Cmp2Util.<Bean>getEntityBean(newValue);
         if (newValue != null && newBean == null) {
             // todo verify that this is the only way null can be returned
             throw new IllegalArgumentException("A deleted bean can not be assigned to a relationship");
@@ -68,7 +68,7 @@ public class SingleValuedCmr<Bean extend
 
             if (newValue != null) {
                 // set the back reference in the new related bean
-                Object oldBackRef = toCmp2Entity(newBean).OpenEJB_addCmr(relatedProperty, source);
+                final Object oldBackRef = toCmp2Entity(newBean).OpenEJB_addCmr(relatedProperty, source);
 
                 // if the new related beas was related to another bean, we need
                 // to clear the back reference in that old bean
@@ -80,11 +80,11 @@ public class SingleValuedCmr<Bean extend
         return newBean;
     }
 
-    public void deleted(Bean oldBean) throws EJBException {
+    public void deleted(final Bean oldBean) throws EJBException {
         set(oldBean, null);
     }
 
-    private Cmp2Entity toCmp2Entity(Object object) {
+    private Cmp2Entity toCmp2Entity(final Object object) {
         return (Cmp2Entity) object;
     }
 }