[Fb-contrib-commit] SF.net SVN: fb-contrib:[1500] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2010-01-19 01:27:43
|
Revision: 1500
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1500&view=rev
Author: dbrosius
Date: 2010-01-19 01:27:35 +0000 (Tue, 19 Jan 2010)
Log Message:
-----------
support the Class array being setup in clinit
Modified Paths:
--------------
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2010-01-19 00:20:13 UTC (rev 1499)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2010-01-19 01:27:35 UTC (rev 1500)
@@ -6,6 +6,8 @@
import java.util.Set;
import org.apache.bcel.classfile.Code;
+import org.apache.bcel.classfile.JavaClass;
+import org.apache.bcel.classfile.Method;
import com.mebigfatguy.fbcontrib.utils.RegisterUtils;
@@ -53,6 +55,13 @@
stack = new OpcodeStack();
localClassTypes = new HashMap<Integer, String[]>();
fieldClassTypes = new HashMap<String, String[]>();
+ JavaClass cls = classContext.getJavaClass();
+ Method staticInit = findStaticInitializer(cls);
+ if (staticInit != null) {
+ setupVisitorForClass(cls);
+ doVisitMethod(staticInit);
+ }
+
super.visitClassContext(classContext);
} finally {
stack = null;
@@ -228,4 +237,14 @@
return sb.toString();
}
+ private Method findStaticInitializer(JavaClass cls) {
+ Method[] methods = cls.getMethods();
+ for (Method m : methods) {
+ if ("<clinit>".equals(m.getName())) {
+ return m;
+ }
+ }
+
+ return null;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|