[Fb-contrib-commit] SF.net SVN: fb-contrib:[1504] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2010-01-19 02:08:53
|
Revision: 1504
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1504&view=rev
Author: dbrosius
Date: 2010-01-19 02:08:47 +0000 (Tue, 19 Jan 2010)
Log Message:
-----------
java doc
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 02:01:16 UTC (rev 1503)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2010-01-19 02:08:47 UTC (rev 1504)
@@ -1,3 +1,21 @@
+/*
+ * fb-contrib - Auxiliary detectors for Java programs
+ * Copyright (C) 2005-2010 Dave Brosius
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
package com.mebigfatguy.fbcontrib.detect;
import java.util.HashMap;
@@ -45,10 +63,20 @@
private Map<Integer, String[]> localClassTypes;
private Map<String, String[]> fieldClassTypes;
+ /**
+ * constructs a ROOM detector given the reporter to report bugs on
+ * @param bugReporter the sync of bug reports
+ */
public ReflectionOnObjectMethods(BugReporter bugReporter) {
this.bugReporter = bugReporter;
}
+ /**
+ * implements the visitor to create the stack and local and field maps
+ * for Class arrays to be used for getting the reflection method
+ *
+ * @param classContext the context object of the currently parse class
+ */
@Override
public void visitClassContext(ClassContext classContext) {
try {
@@ -70,6 +98,11 @@
}
}
+ /**
+ * implements the visitor to reset the opcode stack and clear the local variable map@
+ *
+ * @param obj the context object of the currently parsed code block
+ */
@Override
public void visitCode(Code obj) {
stack.resetForMethodEntry(this);
@@ -77,6 +110,12 @@
super.visitCode(obj);
}
+ /**
+ * implements the visitor to look for calls that invoke a method through reflection
+ * where the method is defined in java.lang.Object
+ *
+ * @param seen the currently parsed opcode
+ */
@Override
public void sawOpcode(int seen) {
Integer arraySize = null;
@@ -220,6 +259,15 @@
}
}
+ /**
+ * builds a string that represents the signature of the method call that is being
+ * executed though reflection.
+ *
+ * @param methodName the method name
+ * @param parmTypes the array of parameter types of the method
+ *
+ * @return a signature string minus the return type
+ */
private String buildReflectionSignature(String methodName, String[] parmTypes) {
StringBuilder sb = new StringBuilder(64);
sb.append(methodName);
@@ -237,6 +285,13 @@
return sb.toString();
}
+ /**
+ * finds the method that is the static initializer for the class
+ *
+ * @param cls the class to find the initializer for
+ *
+ * @return the Method of the static initializer or null if this class has none
+ */
private Method findStaticInitializer(JavaClass cls) {
Method[] methods = cls.getMethods();
for (Method m : methods) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|