changeset 453:20db85cbf265

Yak shaving: ReflectiveClassInfo -> RFClassInfo.
author shade
date Sat, 01 Mar 2014 01:43:09 +0400
parents 6a621d0090e7
children e9b52c98e4c5
files jmh-core/src/main/java/org/openjdk/jmh/generators/bytecode/ASMGeneratorSource.java jmh-core/src/main/java/org/openjdk/jmh/generators/bytecode/ASMMethodInfo.java jmh-core/src/main/java/org/openjdk/jmh/generators/reflective/RFClassInfo.java jmh-core/src/main/java/org/openjdk/jmh/generators/reflective/RFConstructorInfo.java jmh-core/src/main/java/org/openjdk/jmh/generators/reflective/RFMethodInfo.java jmh-core/src/main/java/org/openjdk/jmh/generators/reflective/RFParameterInfo.java jmh-core/src/main/java/org/openjdk/jmh/generators/reflective/ReflectiveClassInfo.java
diffstat 7 files changed, 153 insertions(+), 153 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/generators/bytecode/ASMGeneratorSource.java	Sat Mar 01 01:40:55 2014 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/generators/bytecode/ASMGeneratorSource.java	Sat Mar 01 01:43:09 2014 +0400
@@ -25,7 +25,7 @@
 package org.openjdk.jmh.generators.bytecode;
 
 import org.objectweb.asm.ClassReader;
-import org.openjdk.jmh.generators.reflective.ReflectiveClassInfo;
+import org.openjdk.jmh.generators.reflective.RFClassInfo;
 import org.openjdk.jmh.generators.source.ClassInfo;
 import org.openjdk.jmh.generators.source.GeneratorSource;
 import org.openjdk.jmh.generators.source.MetadataInfo;
@@ -86,7 +86,7 @@
     @Override
     public ClassInfo resolveClass(String className) {
         try {
-            return new ReflectiveClassInfo(Class.forName(className));
+            return new RFClassInfo(Class.forName(className));
         } catch (ClassNotFoundException e) {
             throw new IllegalStateException(e);
         }
--- a/jmh-core/src/main/java/org/openjdk/jmh/generators/bytecode/ASMMethodInfo.java	Sat Mar 01 01:40:55 2014 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/generators/bytecode/ASMMethodInfo.java	Sat Mar 01 01:43:09 2014 +0400
@@ -28,7 +28,7 @@
 import org.objectweb.asm.MethodVisitor;
 import org.objectweb.asm.Opcodes;
 import org.objectweb.asm.Type;
-import org.openjdk.jmh.generators.reflective.ReflectiveClassInfo;
+import org.openjdk.jmh.generators.reflective.RFClassInfo;
 import org.openjdk.jmh.generators.source.ClassInfo;
 import org.openjdk.jmh.generators.source.MethodInfo;
 import org.openjdk.jmh.generators.source.ParameterInfo;
@@ -105,7 +105,7 @@
             ClassInfo ci = repo.get(t.getClassName().replaceAll("\\.", "/"));
             if (ci == null) {
                 try {
-                    ci = new ReflectiveClassInfo(Class.forName(t.getClassName()));
+                    ci = new RFClassInfo(Class.forName(t.getClassName()));
                 } catch (ClassNotFoundException e) {
                     throw new IllegalStateException("Unresolved class: " + this + " " + t, e);
                 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core/src/main/java/org/openjdk/jmh/generators/reflective/RFClassInfo.java	Sat Mar 01 01:43:09 2014 +0400
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code 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 General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jmh.generators.reflective;
+
+import org.openjdk.jmh.generators.source.ClassInfo;
+import org.openjdk.jmh.generators.source.FieldInfo;
+import org.openjdk.jmh.generators.source.MethodInfo;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Collection;
+
+public class RFClassInfo implements ClassInfo {
+    private final Class<?> klass;
+
+    public RFClassInfo(Class<?> klass) {
+        this.klass = klass;
+    }
+
+    @Override
+    public String getPackageName() {
+        if (klass.getDeclaringClass() != null) {
+            return klass.getDeclaringClass().getPackage().getName();
+        } else {
+            return klass.getPackage().getName();
+        }
+    }
+
+    @Override
+    public String getName() {
+        String name = klass.getSimpleName();
+        if (name.contains("$")) {
+            return name.substring(name.lastIndexOf("$"));
+        } else {
+            return name;
+        }
+    }
+
+    @Override
+    public String getQualifiedName() {
+        String name = klass.getCanonicalName();
+        if (name.contains("$")) {
+            return name.replace("$", ".");
+        } else {
+            return name;
+        }
+    }
+
+    @Override
+    public Collection<FieldInfo> getFields() {
+        Collection<FieldInfo> fis = new ArrayList<FieldInfo>();
+        for (Field f : klass.getDeclaredFields()) {
+            fis.add(new RFFieldInfo(this, f));
+        }
+        return fis;
+    }
+
+    @Override
+    public Collection<MethodInfo> getConstructors() {
+        Collection<MethodInfo> mis = new ArrayList<MethodInfo>();
+        for (Constructor m : klass.getConstructors()) {
+            mis.add(new RFConstructorInfo(this, m));
+        }
+        return mis;
+    }
+
+    @Override
+    public Collection<MethodInfo> getMethods() {
+        Collection<MethodInfo> mis = new ArrayList<MethodInfo>();
+        for (Method m : klass.getMethods()) {
+            mis.add(new RFMethodInfo(this, m));
+        }
+        return mis;
+    }
+
+    @Override
+    public ClassInfo getSuperClass() {
+        if (klass.getSuperclass() != null) {
+            return new RFClassInfo(klass.getSuperclass());
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public ClassInfo getDeclaringClass() {
+        if (klass.getDeclaringClass() != null) {
+            return new RFClassInfo(klass.getDeclaringClass());
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public <T extends Annotation> T getAnnotation(Class<T> annClass) {
+        return klass.getAnnotation(annClass);
+    }
+
+    @Override
+    public boolean isAbstract() {
+        return Modifier.isAbstract(klass.getModifiers());
+    }
+
+    @Override
+    public boolean isPublic() {
+        return Modifier.isPublic(klass.getModifiers());
+    }
+
+    @Override
+    public boolean isStrictFP() {
+        return Modifier.isStrict(klass.getModifiers());
+    }
+
+    @Override
+    public String toString() {
+        return getQualifiedName();
+    }
+}
--- a/jmh-core/src/main/java/org/openjdk/jmh/generators/reflective/RFConstructorInfo.java	Sat Mar 01 01:40:55 2014 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/generators/reflective/RFConstructorInfo.java	Sat Mar 01 01:43:09 2014 +0400
@@ -36,10 +36,10 @@
 
 public class RFConstructorInfo implements MethodInfo {
 
-    private final ReflectiveClassInfo declaringClass;
+    private final RFClassInfo declaringClass;
     private final Constructor m;
 
-    public RFConstructorInfo(ReflectiveClassInfo declaringClass, Constructor m) {
+    public RFConstructorInfo(RFClassInfo declaringClass, Constructor m) {
         this.declaringClass = declaringClass;
         this.m = m;
     }
--- a/jmh-core/src/main/java/org/openjdk/jmh/generators/reflective/RFMethodInfo.java	Sat Mar 01 01:40:55 2014 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/generators/reflective/RFMethodInfo.java	Sat Mar 01 01:43:09 2014 +0400
@@ -36,10 +36,10 @@
 
 public class RFMethodInfo implements MethodInfo {
 
-    private final ReflectiveClassInfo declaringClass;
+    private final RFClassInfo declaringClass;
     private final Method m;
 
-    public RFMethodInfo(ReflectiveClassInfo declaringClass, Method m) {
+    public RFMethodInfo(RFClassInfo declaringClass, Method m) {
         this.declaringClass = declaringClass;
         this.m = m;
     }
--- a/jmh-core/src/main/java/org/openjdk/jmh/generators/reflective/RFParameterInfo.java	Sat Mar 01 01:40:55 2014 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/generators/reflective/RFParameterInfo.java	Sat Mar 01 01:43:09 2014 +0400
@@ -36,6 +36,6 @@
 
     @Override
     public ClassInfo getType() {
-        return new ReflectiveClassInfo(cl);
+        return new RFClassInfo(cl);
     }
 }
--- a/jmh-core/src/main/java/org/openjdk/jmh/generators/reflective/ReflectiveClassInfo.java	Sat Mar 01 01:40:55 2014 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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 General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.openjdk.jmh.generators.reflective;
-
-import org.openjdk.jmh.generators.source.ClassInfo;
-import org.openjdk.jmh.generators.source.FieldInfo;
-import org.openjdk.jmh.generators.source.MethodInfo;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Collection;
-
-public class ReflectiveClassInfo implements ClassInfo {
-    private final Class<?> klass;
-
-    public ReflectiveClassInfo(Class<?> klass) {
-        this.klass = klass;
-    }
-
-    @Override
-    public String getPackageName() {
-        if (klass.getDeclaringClass() != null) {
-            return klass.getDeclaringClass().getPackage().getName();
-        } else {
-            return klass.getPackage().getName();
-        }
-    }
-
-    @Override
-    public String getName() {
-        String name = klass.getSimpleName();
-        if (name.contains("$")) {
-            return name.substring(name.lastIndexOf("$"));
-        } else {
-            return name;
-        }
-    }
-
-    @Override
-    public String getQualifiedName() {
-        String name = klass.getCanonicalName();
-        if (name.contains("$")) {
-            return name.replace("$", ".");
-        } else {
-            return name;
-        }
-    }
-
-    @Override
-    public Collection<FieldInfo> getFields() {
-        Collection<FieldInfo> fis = new ArrayList<FieldInfo>();
-        for (Field f : klass.getDeclaredFields()) {
-            fis.add(new RFFieldInfo(this, f));
-        }
-        return fis;
-    }
-
-    @Override
-    public Collection<MethodInfo> getConstructors() {
-        Collection<MethodInfo> mis = new ArrayList<MethodInfo>();
-        for (Constructor m : klass.getConstructors()) {
-            mis.add(new RFConstructorInfo(this, m));
-        }
-        return mis;
-    }
-
-    @Override
-    public Collection<MethodInfo> getMethods() {
-        Collection<MethodInfo> mis = new ArrayList<MethodInfo>();
-        for (Method m : klass.getMethods()) {
-            mis.add(new RFMethodInfo(this, m));
-        }
-        return mis;
-    }
-
-    @Override
-    public ClassInfo getSuperClass() {
-        if (klass.getSuperclass() != null) {
-            return new ReflectiveClassInfo(klass.getSuperclass());
-        } else {
-            return null;
-        }
-    }
-
-    @Override
-    public ClassInfo getDeclaringClass() {
-        if (klass.getDeclaringClass() != null) {
-            return new ReflectiveClassInfo(klass.getDeclaringClass());
-        } else {
-            return null;
-        }
-    }
-
-    @Override
-    public <T extends Annotation> T getAnnotation(Class<T> annClass) {
-        return klass.getAnnotation(annClass);
-    }
-
-    @Override
-    public boolean isAbstract() {
-        return Modifier.isAbstract(klass.getModifiers());
-    }
-
-    @Override
-    public boolean isPublic() {
-        return Modifier.isPublic(klass.getModifiers());
-    }
-
-    @Override
-    public boolean isStrictFP() {
-        return Modifier.isStrict(klass.getModifiers());
-    }
-
-    @Override
-    public String toString() {
-        return getQualifiedName();
-    }
-}