Author: sebb
Date: Fri Aug 14 21:43:32 2009
New Revision: 804385
URL: http://svn.apache.org/viewvc?rev=804385&view=rev
Log:
Fix up some raw types
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterVariables.java
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/Functor.java
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterVariables.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterVariables.java?rev=804385&r1=804384&r2=804385&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterVariables.java
(original)
+++
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterVariables.java
Fri Aug 14 21:43:32 2009
@@ -23,6 +23,7 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import java.util.Map.Entry;
import org.apache.jmeter.util.JMeterUtils;
@@ -31,7 +32,7 @@
* These are similar to properties, but they are local to a single thread.
*/
public class JMeterVariables {
- private Map variables = new HashMap();
+ private final Map<String, Object> variables = new HashMap<String,
Object>();
private int iteration = 0;
@@ -87,7 +88,7 @@
variables.put(key, value);
}
- public void putAll(Map vars) {
+ public void putAll(Map<String, ?> vars) {
variables.putAll(vars);
}
@@ -107,12 +108,12 @@
return variables.get(key);
}
- public Iterator getIterator(){
+ public Iterator<Entry<String, Object>> getIterator(){
return Collections.unmodifiableMap(variables).entrySet().iterator() ;
}
// Used by DebugSampler
- public Set entrySet(){
+ public Set<Entry<String, Object>> entrySet(){
return Collections.unmodifiableMap(variables).entrySet();
}
}
\ No newline at end of file
Modified:
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java?rev=804385&r1=804384&r2=804385&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java
(original)
+++
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java
Fri Aug 14 21:43:32 2009
@@ -30,6 +30,7 @@
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;
+import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.apache.jorphan.logging.LoggingManager;
@@ -57,10 +58,10 @@
*
*
*/
- private static class FilterTreeSet extends TreeSet{
- private static final long serialVersionUID = 233L;
+ private static class FilterTreeSet extends TreeSet<String>{
+ private static final long serialVersionUID = 234L;
- private final Class[] parents; // parent classes to check
+ private final Class<?>[] parents; // parent classes to check
private final boolean inner; // are inner classes OK?
// hack to reduce the need to load every class in non-GUI mode, which
only needs functions
@@ -71,7 +72,7 @@
private final transient ClassLoader contextClassLoader
= Thread.currentThread().getContextClassLoader(); // Potentially
expensive; do it once
- FilterTreeSet(Class []parents, boolean inner, String contains, String
notContains){
+ FilterTreeSet(Class<?> []parents, boolean inner, String contains,
String notContains){
super();
this.parents=parents;
this.inner=inner;
@@ -83,17 +84,16 @@
* Override the superclass so we only add classnames that
* meet the criteria.
*
- * @param o - classname (must be a String)
+ * @param s - classname (must be a String)
* @return true if it is a new entry
*
* @see java.util.TreeSet#add(java.lang.Object)
*/
@Override
- public boolean add(Object o){
- if (contains(o)) {
+ public boolean add(String s){
+ if (contains(s)) {
return false;// No need to check it again
}
- String s = (String) o;// we only expect Strings
if (contains!=null && s.indexOf(contains) == -1){
return false; // It does not contain a required string
}
@@ -114,16 +114,16 @@
* <code>findClassesThatExtend(Class[], boolean)</code>
* with the option to include inner classes in the search set to false.
*
- * @return List containing discovered classes.
+ * @return List of Strings containing discovered class names.
*/
- public static List findClassesThatExtend(String[] paths, Class[]
superClasses)
+ public static List<String> findClassesThatExtend(String[] paths,
Class<?>[] superClasses)
throws IOException {
return findClassesThatExtend(paths, superClasses, false);
}
// For each directory in the search path, add all the jars found there
private static String[] addJarsInPath(String[] paths) {
- Set fullList = new HashSet();
+ Set<String> fullList = new HashSet<String>();
for (int i = 0; i < paths.length; i++) {
final String path = paths[i];
fullList.add(path); // Keep the unexpanded path
@@ -142,7 +142,7 @@
}
}
}
- return (String[]) fullList.toArray(new String[0]);
+ return fullList.toArray(new String[0]);
}
/**
@@ -153,8 +153,8 @@
*
* @return List containing discovered classes
*/
- public static List findClassesThatExtend(String[] strPathsOrJars,
- final Class[] superClasses, final boolean innerClasses)
+ public static List<String> findClassesThatExtend(String[] strPathsOrJars,
+ final Class<?>[] superClasses, final boolean innerClasses)
throws IOException {
return
findClassesThatExtend(strPathsOrJars,superClasses,innerClasses,null,null);
}
@@ -169,8 +169,8 @@
*
* @return List containing discovered classes
*/
- public static List findClassesThatExtend(String[] strPathsOrJars,
- final Class[] superClasses, final boolean innerClasses,
+ public static List<String> findClassesThatExtend(String[] strPathsOrJars,
+ final Class<?>[] superClasses, final boolean innerClasses,
String contains, String notContains)
throws IOException {
@@ -190,20 +190,20 @@
}
// Now eliminate any classpath entries that do not "match" the search
- List listPaths = getClasspathMatches(strPathsOrJars);
+ List<String> listPaths = getClasspathMatches(strPathsOrJars);
if (log.isDebugEnabled()) {
- Iterator tIter = listPaths.iterator();
+ Iterator<String> tIter = listPaths.iterator();
while (tIter.hasNext()) {
log.debug("listPaths : " + tIter.next());
}
}
- Set listClasses = new FilterTreeSet(superClasses, innerClasses,
contains, notContains);
+ Set<String> listClasses = new FilterTreeSet(superClasses,
innerClasses, contains, notContains);
// first get all the classes
findClassesInPaths(listPaths, listClasses);
if (log.isDebugEnabled()) {
log.debug("listClasses.size()="+listClasses.size());
- Iterator tIter = listClasses.iterator();
+ Iterator<String> tIter = listClasses.iterator();
while (tIter.hasNext()) {
log.debug("listClasses : " + tIter.next());
}
@@ -219,13 +219,13 @@
// }
// }
- return new ArrayList(listClasses);//subClassList);
+ return new ArrayList<String>(listClasses);//subClassList);
}
/*
* Returns the classpath entries that match the search list of jars and
paths
*/
- private static List getClasspathMatches(String[] strPathsOrJars) {
+ private static List<String> getClasspathMatches(String[] strPathsOrJars) {
final String javaClassPath = System.getProperty("java.class.path"); //
$NON-NLS-1$
StringTokenizer stPaths =
new StringTokenizer(javaClassPath,
@@ -238,7 +238,7 @@
}
// find all jar files or paths that end with strPathOrJar
- ArrayList listPaths = new ArrayList();
+ ArrayList<String> listPaths = new ArrayList<String>();
String strPath = null;
while (stPaths.hasMoreTokens()) {
strPath = fixPathEntry(stPaths.nextToken());
@@ -371,11 +371,11 @@
* @param contextClassLoader the classloader to use
* @return
*/
- private static boolean isChildOf(Class [] parentClasses, String
strClassName,
+ private static boolean isChildOf(Class<?> [] parentClasses, String
strClassName,
ClassLoader contextClassLoader){
// might throw an exception, assume this is ignorable
try {
- Class c = Class.forName(strClassName, false,
contextClassLoader);
+ Class<?> c = Class.forName(strClassName, false,
contextClassLoader);
if (!c.isInterface() &&
!Modifier.isAbstract(c.getModifiers())) {
for (int i=0; i< parentClasses.length; i++) {
@@ -407,7 +407,7 @@
return strClassName;
}
- private static void findClassesInOnePath(String strPath, Set listClasses)
throws IOException {
+ private static void findClassesInOnePath(String strPath, Set<String>
listClasses) throws IOException {
File file = new File(strPath);
if (file.isDirectory()) {
findClassesInPathsDir(strPath, file, listClasses);
@@ -415,7 +415,7 @@
ZipFile zipFile = null;
try {
zipFile = new ZipFile(file);
- Enumeration entries = zipFile.entries();
+ Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
String strEntry = entries.nextElement().toString();
if (strEntry.endsWith(DOT_CLASS)) {
@@ -433,14 +433,14 @@
}
}
- private static void findClassesInPaths(List listPaths, Set listClasses)
throws IOException {
- Iterator iterPaths = listPaths.iterator();
+ private static void findClassesInPaths(List<String> listPaths, Set<String>
listClasses) throws IOException {
+ Iterator<String> iterPaths = listPaths.iterator();
while (iterPaths.hasNext()) {
- findClassesInOnePath((String) iterPaths.next(), listClasses);
+ findClassesInOnePath(iterPaths.next(), listClasses);
}
}
- private static void findClassesInPathsDir(String strPathElement, File dir,
Set listClasses) throws IOException {
+ private static void findClassesInPathsDir(String strPathElement, File dir,
Set<String> listClasses) throws IOException {
String[] list = dir.list();
for (int i = 0; i < list.length; i++) {
File file = new File(dir, list[i]);
Modified:
jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/Functor.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/Functor.java?rev=804385&r1=804384&r2=804385&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/Functor.java
(original)
+++ jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/Functor.java
Fri Aug 14 21:43:32 2009
@@ -71,7 +71,7 @@
*
* Can be used instead of invokee, e.g. when using interfaces.
*/
- private final Class clazz;
+ private final Class<?> clazz;
// Methondname must always be provided.
private final String methodName;
@@ -85,7 +85,7 @@
* Argument types used to create the method.
* May be provided explicitly, or derived from the constructor argument
list.
*/
- private final Class[] types;
+ private final Class<?>[] types;
/*
* This depends on the class or invokee and either args or types;
@@ -119,7 +119,7 @@
* @param _clazz class to be used
* @param _methodName method name
*/
- public Functor(Class _clazz, String _methodName) {
+ public Functor(Class<?> _clazz, String _methodName) {
this(_clazz, null, _methodName, null, null);
}
@@ -132,7 +132,7 @@
* @param _methodName method name
* @param _types
*/
- public Functor(Object _invokee, String _methodName, Class[] _types) {
+ public Functor(Object _invokee, String _methodName, Class<?>[] _types) {
this(null, _invokee, _methodName, null, _types);
}
@@ -145,7 +145,7 @@
* @param _methodName method name
* @param _types
*/
- public Functor(Class _clazz, String _methodName, Class[] _types) {
+ public Functor(Class<?> _clazz, String _methodName, Class<?>[] _types) {
this(_clazz, null, _methodName, null, _types);
}
@@ -168,7 +168,7 @@
* @param _methodName method name
* @param _types parameter types
*/
- public Functor(String _methodName, Class[] _types) {
+ public Functor(String _methodName, Class<?>[] _types) {
this(null, null, _methodName, null, _types);
}
@@ -213,7 +213,7 @@
* - both class and invokee are specified
* - both arguments and types are specified
*/
- private Functor(Class _clazz, Object _invokee, String _methodName,
Object[] _args, Class[] _types) {
+ private Functor(Class<?> _clazz, Object _invokee, String _methodName,
Object[] _args, Class<?>[] _types) {
if (_methodName == null){
throw new IllegalArgumentException("Methodname must not be null");
}
@@ -240,8 +240,8 @@
* Should only be called after any defaults have been applied.
*
*/
- private Object doInvoke(Class _class, Object _invokee, Object[] _args) {
- Class[] argTypes = getTypes(_args);
+ private Object doInvoke(Class<?> _class, Object _invokee, Object[] _args) {
+ Class<?>[] argTypes = getTypes(_args);
try {
Method method = doCreateMethod(_class , argTypes);
if (method == null){
@@ -320,7 +320,7 @@
* Low-level (recursive) routine to define the method - if not already
defined.
* Synchronized to protect access to methodToInvoke.
*/
- private synchronized Method doCreateMethod(Class p_class, Class[] p_types)
{
+ private synchronized Method doCreateMethod(Class<?> p_class, Class<?>[]
p_types) {
if (log.isDebugEnabled()){
log.debug("doCreateMethod() using "+this.toString()
+"class="
@@ -332,21 +332,21 @@
methodToInvoke = p_class.getMethod(methodName, p_types);
} catch (Exception e) {
for (int i = 0; i < p_types.length; i++) {
- Class primitive = getPrimitive(p_types[i]);
+ Class<?> primitive = getPrimitive(p_types[i]);
if (primitive != null) {
methodToInvoke = doCreateMethod(p_class,
getNewArray(i, primitive, p_types));
if (methodToInvoke != null) {
return methodToInvoke;
}
}
- Class[] interfaces = p_types[i].getInterfaces();
+ Class<?>[] interfaces = p_types[i].getInterfaces();
for (int j = 0; j < interfaces.length; j++) {
methodToInvoke = doCreateMethod(p_class,getNewArray(i,
interfaces[j], p_types));
if (methodToInvoke != null) {
return methodToInvoke;
}
}
- Class parent = p_types[i].getSuperclass();
+ Class<?> parent = p_types[i].getSuperclass();
if (parent != null) {
methodToInvoke = doCreateMethod(p_class,getNewArray(i,
parent, p_types));
if (methodToInvoke != null) {
@@ -385,7 +385,7 @@
* @return true if method exists
*/
@Deprecated
- public boolean checkMethod(Object _invokee, Class c){
+ public boolean checkMethod(Object _invokee, Class<?> c){
Method m = null;
try {
m = doCreateMethod(_invokee.getClass(), new Class[]{c});
@@ -411,7 +411,7 @@
return sb.toString();
}
- private void typesToString(StringBuffer sb,Class[] _types) {
+ private void typesToString(StringBuffer sb,Class<?>[] _types) {
sb.append("(");
if (_types != null){
for(int i=0; i < _types.length; i++){
@@ -424,13 +424,13 @@
sb.append(")");
}
- private String typesToString(Class[] argTypes) {
+ private String typesToString(Class<?>[] argTypes) {
StringBuffer sb = new StringBuffer();
typesToString(sb,argTypes);
return sb.toString();
}
- private Class getPrimitive(Class t) {
+ private Class<?> getPrimitive(Class<?> t) {
if (t==null) {
return null;
}
@@ -454,8 +454,8 @@
return null;
}
- private Class[] getNewArray(int i, Class replacement, Class[] orig) {
- Class[] newArray = new Class[orig.length];
+ private Class<?>[] getNewArray(int i, Class<?> replacement, Class<?>[]
orig) {
+ Class<?>[] newArray = new Class[orig.length];
for (int j = 0; j < newArray.length; j++) {
if (j == i) {
newArray[j] = replacement;
@@ -466,7 +466,7 @@
return newArray;
}
- private Class[] getTypes(Object[] _args) {
+ private Class<?>[] getTypes(Object[] _args) {
if (types == null)
{
return _getTypes(_args);
@@ -474,8 +474,8 @@
return types;
}
- private static Class[] _getTypes(Object[] _args) {
- Class[] _types;
+ private static Class<?>[] _getTypes(Object[] _args) {
+ Class<?>[] _types;
if (_args != null) {
_types = new Class[_args.length];
for (int i = 0; i < _args.length; i++) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]