felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r425313 - in /incubator/felix/trunk: org.apache.felix.ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/PreprocessClassAdapter.java org.apache.felix.ipojo/src/main/java/org/apache/felix/ipojo/ComponentManager.java
Date Tue, 25 Jul 2006 07:15:40 GMT
Author: rickhall
Date: Tue Jul 25 00:15:40 2006
New Revision: 425313

URL: http://svn.apache.org/viewvc?rev=425313&view=rev
Log:
Patch to make injected methods private instead of public (FELIX-96).

Modified:
    incubator/felix/trunk/org.apache.felix.ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/PreprocessClassAdapter.java
    incubator/felix/trunk/org.apache.felix.ipojo/src/main/java/org/apache/felix/ipojo/ComponentManager.java

Modified: incubator/felix/trunk/org.apache.felix.ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/PreprocessClassAdapter.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/PreprocessClassAdapter.java?rev=425313&r1=425312&r2=425313&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/PreprocessClassAdapter.java
(original)
+++ incubator/felix/trunk/org.apache.felix.ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/PreprocessClassAdapter.java
Tue Jul 25 00:15:40 2006
@@ -89,7 +89,7 @@
             m_owner = name;
 
             // Insert _cm field
-            super.visitField(ACC_PUBLIC + ACC_STATIC, "_cm", ManipulationProperty.IPOJO_INTERNAL_DESCRIPTOR
+ "ComponentManager;", null, null);
+            super.visitField(ACC_PRIVATE + ACC_STATIC, "_cm", ManipulationProperty.IPOJO_INTERNAL_DESCRIPTOR
+ "ComponentManager;", null, null);
 
             // Create the _cmSetter(ComponentManager cm) method
             createComponentManagerSetter();
@@ -131,7 +131,7 @@
          * The generated method must be called only one time.
          */
         private void createComponentManagerSetter() {
-            MethodVisitor mv = super.visitMethod(ACC_PUBLIC + ACC_STATIC, "setComponentManager",
"(" + ManipulationProperty.IPOJO_INTERNAL_DESCRIPTOR + "ComponentManager;)V", null, null);
+            MethodVisitor mv = super.visitMethod(ACC_PRIVATE + ACC_STATIC, "setComponentManager",
"(" + ManipulationProperty.IPOJO_INTERNAL_DESCRIPTOR + "ComponentManager;)V", null, null);
 
             mv.visitVarInsn(ALOAD, 0);
             mv.visitFieldInsn(PUTSTATIC, m_owner, "_cm", ManipulationProperty.IPOJO_INTERNAL_DESCRIPTOR
+ "ComponentManager;");
@@ -203,7 +203,7 @@
         }
 
         private void createArraySetter(String name, String desc, Type type) {
-        	MethodVisitor mv = cv.visitMethod(ACC_PUBLIC, "_set" + name, desc, null, null);
+        	MethodVisitor mv = cv.visitMethod(ACC_PRIVATE, "_set" + name, desc, null, null);
 
         	String internalType = desc.substring(1);
         	internalType = internalType.substring(0, internalType.length() - 2);
@@ -236,7 +236,7 @@
 //
 
 			String methodName = "_get" + name;
-            MethodVisitor mv = cv.visitMethod(ACC_PUBLIC, methodName, desc, null, null);
+            MethodVisitor mv = cv.visitMethod(ACC_PRIVATE, methodName, desc, null, null);
 
             String internalType = desc.substring(2);
 
@@ -292,7 +292,7 @@
         private void createSimpleGetter(String name, String desc, Type type) {
 
             String methodName = "_get" + name;
-            MethodVisitor mv = cv.visitMethod(ACC_PUBLIC, methodName, desc, null, null);
+            MethodVisitor mv = cv.visitMethod(ACC_PRIVATE, methodName, desc, null, null);
 
             switch (type.getSort()) {
             	case Type.BOOLEAN :
@@ -408,7 +408,7 @@
          * @param type : type of the property
          */
         private void createSimpleSetter(String name, String desc, Type type) {
-            MethodVisitor mv = cv.visitMethod(ACC_PUBLIC, "_set" + name, desc, null, null);
+            MethodVisitor mv = cv.visitMethod(ACC_PRIVATE, "_set" + name, desc, null, null);
 
             switch(type.getSort()) {
         		case Type.BOOLEAN :

Modified: incubator/felix/trunk/org.apache.felix.ipojo/src/main/java/org/apache/felix/ipojo/ComponentManager.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.ipojo/src/main/java/org/apache/felix/ipojo/ComponentManager.java?rev=425313&r1=425312&r2=425313&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.ipojo/src/main/java/org/apache/felix/ipojo/ComponentManager.java
(original)
+++ incubator/felix/trunk/org.apache.felix.ipojo/src/main/java/org/apache/felix/ipojo/ComponentManager.java
Tue Jul 25 00:15:40 2006
@@ -311,7 +311,8 @@
 
 			Activator.getLogger().log(Level.INFO, "[" + m_metadata.getClassName() + "] createInstance
-> call setComponentManager");
 			// Invoke the static method setComponentManager on the manipulated class
-			Method method = m_clazz.getMethod("setComponentManager", new Class[] {this.getClass()});
+			Method method = m_clazz.getDeclaredMethod("setComponentManager", new Class[] {this.getClass()});
+			method.setAccessible(true);
 			method.invoke(null, new Object[] {this});
 
 			Activator.getLogger().log(Level.INFO, "[" + m_metadata.getClassName() + "] createInstance
-> Try to find the constructor");



Mime
View raw message