8146625: OverloadedDynamicMethod has unused ClassLoader field that can be removed
authorsundar
Thu, 07 Jan 2016 21:47:21 +0530
changeset 34901 bba3b9d1c9ea
parent 34900 96c0c150eb21
child 34902 e101f200cb31
8146625: OverloadedDynamicMethod has unused ClassLoader field that can be removed Reviewed-by: attila, hannesw
nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/OverloadedDynamicMethod.java
--- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/OverloadedDynamicMethod.java	Wed Jan 06 20:19:02 2016 +0530
+++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/OverloadedDynamicMethod.java	Thu Jan 07 21:47:21 2016 +0530
@@ -112,8 +112,7 @@
     /**
      * Holds a list of all methods.
      */
-    private final LinkedList<SingleDynamicMethod> methods;
-    private final ClassLoader classLoader;
+    private final LinkedList<SingleDynamicMethod> methods = new LinkedList<>();
 
     /**
      * Creates a new overloaded dynamic method.
@@ -122,13 +121,7 @@
      * @param name the name of the method
      */
     OverloadedDynamicMethod(final Class<?> clazz, final String name) {
-        this(new LinkedList<SingleDynamicMethod>(), clazz.getClassLoader(), getClassAndMethodName(clazz, name));
-    }
-
-    private OverloadedDynamicMethod(final LinkedList<SingleDynamicMethod> methods, final ClassLoader classLoader, final String name) {
-        super(name);
-        this.methods = methods;
-        this.classLoader = classLoader;
+        super(getClassAndMethodName(clazz, name));
     }
 
     @Override
@@ -288,10 +281,6 @@
         return b.toString();
     };
 
-    ClassLoader getClassLoader() {
-        return classLoader;
-    }
-
     private static boolean isApplicableDynamically(final LinkerServices linkerServices, final MethodType callSiteType,
             final SingleDynamicMethod m) {
         final MethodType methodType = m.getMethodType();