jdk/src/java.desktop/share/classes/java/beans/MethodDescriptor.java
author serb
Sat, 18 Jul 2015 15:09:28 +0300
changeset 32109 b89c59200379
parent 25859 3317bb8137f4
child 35667 ed476aba94de
permissions -rw-r--r--
8130937: Several methods in BeanProperty return null instead of boolean value Reviewed-by: alexsch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 21278
diff changeset
     2
 * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4960
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4960
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4960
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4960
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4960
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.beans;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.lang.ref.Reference;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.lang.ref.WeakReference;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.lang.reflect.Method;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.util.List;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.util.ArrayList;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * A MethodDescriptor describes a particular method that a Java Bean
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * supports for external access from other components.
25130
adfaa02ea516 8044855: Add missing @since tag under java.beans.*
henryjen
parents: 24526
diff changeset
    37
 *
adfaa02ea516 8044855: Add missing @since tag under java.beans.*
henryjen
parents: 24526
diff changeset
    38
 * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
public class MethodDescriptor extends FeatureDescriptor {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
20110
85b98c3054f6 7172865: PropertyDescriptor fails to work with setter method name if setter is non-void
malenkov
parents: 14887
diff changeset
    43
    private final MethodRef methodRef = new MethodRef();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    private String[] paramNames;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
11120
f8576c769572 7116954: Misc warnings in java.beans/java.beans.context
mcimadamore
parents: 6657
diff changeset
    47
    private List<WeakReference<Class<?>>> params;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    private ParameterDescriptor parameterDescriptors[];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     * Constructs a <code>MethodDescriptor</code> from a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     * <code>Method</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * @param method    The low-level method information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    public MethodDescriptor(Method method) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
        this(method, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * Constructs a <code>MethodDescriptor</code> from a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * <code>Method</code> providing descriptive information for each
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * of the method's parameters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * @param method    The low-level method information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * @param parameterDescriptors  Descriptive information for each of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     *                          method's parameters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    public MethodDescriptor(Method method,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
                ParameterDescriptor parameterDescriptors[]) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        setName(method.getName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        setMethod(method);
14887
226dd1cda199 8005065: [findbugs] reference to mutable array in JavaBeans
malenkov
parents: 11120
diff changeset
    75
        this.parameterDescriptors = (parameterDescriptors != null)
226dd1cda199 8005065: [findbugs] reference to mutable array in JavaBeans
malenkov
parents: 11120
diff changeset
    76
                ? parameterDescriptors.clone()
226dd1cda199 8005065: [findbugs] reference to mutable array in JavaBeans
malenkov
parents: 11120
diff changeset
    77
                : null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    /**
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20110
diff changeset
    81
     * Gets the method that this MethodDescriptor encapsulates.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * @return The low-level description of the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    public synchronized Method getMethod() {
20110
85b98c3054f6 7172865: PropertyDescriptor fails to work with setter method name if setter is non-void
malenkov
parents: 14887
diff changeset
    86
        Method method = this.methodRef.get();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        if (method == null) {
11120
f8576c769572 7116954: Misc warnings in java.beans/java.beans.context
mcimadamore
parents: 6657
diff changeset
    88
            Class<?> cls = getClass0();
5947
0e6f2837eeca 6707234: Method returned by Introspector.internalFindMethod not necessarily most specific
malenkov
parents: 5506
diff changeset
    89
            String name = getName();
0e6f2837eeca 6707234: Method returned by Introspector.internalFindMethod not necessarily most specific
malenkov
parents: 5506
diff changeset
    90
            if ((cls != null) && (name != null)) {
11120
f8576c769572 7116954: Misc warnings in java.beans/java.beans.context
mcimadamore
parents: 6657
diff changeset
    91
                Class<?>[] params = getParams();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
                if (params == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                    for (int i = 0; i < 3; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                        // Find methods for up to 2 params. We are guessing here.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                        // This block should never execute unless the classloader
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
                        // that loaded the argument classes disappears.
6657
15dbb366c6a3 6976577: JCK7 api/java_beans/EventSetDescriptor/descriptions.html#Ctor1 fails since jdk7 b102
malenkov
parents: 5947
diff changeset
    97
                        method = Introspector.findMethod(cls, name, i, null);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
                        if (method != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
                            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                } else {
6657
15dbb366c6a3 6976577: JCK7 api/java_beans/EventSetDescriptor/descriptions.html#Ctor1 fails since jdk7 b102
malenkov
parents: 5947
diff changeset
   103
                    method = Introspector.findMethod(cls, name, params.length, params);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
                setMethod(method);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        return method;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    private synchronized void setMethod(Method method) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        if (method == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        if (getClass0() == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            setClass0(method.getDeclaringClass());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        setParams(getParameterTypes(getClass0(), method));
20110
85b98c3054f6 7172865: PropertyDescriptor fails to work with setter method name if setter is non-void
malenkov
parents: 14887
diff changeset
   119
        this.methodRef.set(method);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
11120
f8576c769572 7116954: Misc warnings in java.beans/java.beans.context
mcimadamore
parents: 6657
diff changeset
   122
    private synchronized void setParams(Class<?>[] param) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        if (param == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        paramNames = new String[param.length];
11120
f8576c769572 7116954: Misc warnings in java.beans/java.beans.context
mcimadamore
parents: 6657
diff changeset
   127
        params = new ArrayList<>(param.length);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        for (int i = 0; i < param.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
            paramNames[i] = param[i].getName();
11120
f8576c769572 7116954: Misc warnings in java.beans/java.beans.context
mcimadamore
parents: 6657
diff changeset
   130
            params.add(new WeakReference<Class<?>>(param[i]));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    // pp getParamNames used as an optimization to avoid method.getParameterTypes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    String[] getParamNames() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        return paramNames;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
11120
f8576c769572 7116954: Misc warnings in java.beans/java.beans.context
mcimadamore
parents: 6657
diff changeset
   139
    private synchronized Class<?>[] getParams() {
f8576c769572 7116954: Misc warnings in java.beans/java.beans.context
mcimadamore
parents: 6657
diff changeset
   140
        Class<?>[] clss = new Class<?>[params.size()];
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        for (int i = 0; i < params.size(); i++) {
11120
f8576c769572 7116954: Misc warnings in java.beans/java.beans.context
mcimadamore
parents: 6657
diff changeset
   143
            Reference<? extends Class<?>> ref = (Reference<? extends Class<?>>)params.get(i);
f8576c769572 7116954: Misc warnings in java.beans/java.beans.context
mcimadamore
parents: 6657
diff changeset
   144
            Class<?> cls = ref.get();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            if (cls == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                clss[i] = cls;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        return clss;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * Gets the ParameterDescriptor for each of this MethodDescriptor's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * method's parameters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * @return The locale-independent names of the parameters.  May return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     *          a null array if the parameter names aren't known.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    public ParameterDescriptor[] getParameterDescriptors() {
14887
226dd1cda199 8005065: [findbugs] reference to mutable array in JavaBeans
malenkov
parents: 11120
diff changeset
   162
        return (this.parameterDescriptors != null)
226dd1cda199 8005065: [findbugs] reference to mutable array in JavaBeans
malenkov
parents: 11120
diff changeset
   163
                ? this.parameterDescriptors.clone()
226dd1cda199 8005065: [findbugs] reference to mutable array in JavaBeans
malenkov
parents: 11120
diff changeset
   164
                : null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
24526
ebdd0909c381 8040656: Classes with overriden methods with covariant returns return random read methods
malenkov
parents: 23010
diff changeset
   167
    private static Method resolve(Method oldMethod, Method newMethod) {
ebdd0909c381 8040656: Classes with overriden methods with covariant returns return random read methods
malenkov
parents: 23010
diff changeset
   168
        if (oldMethod == null) {
ebdd0909c381 8040656: Classes with overriden methods with covariant returns return random read methods
malenkov
parents: 23010
diff changeset
   169
            return newMethod;
ebdd0909c381 8040656: Classes with overriden methods with covariant returns return random read methods
malenkov
parents: 23010
diff changeset
   170
        }
ebdd0909c381 8040656: Classes with overriden methods with covariant returns return random read methods
malenkov
parents: 23010
diff changeset
   171
        if (newMethod == null) {
ebdd0909c381 8040656: Classes with overriden methods with covariant returns return random read methods
malenkov
parents: 23010
diff changeset
   172
            return oldMethod;
ebdd0909c381 8040656: Classes with overriden methods with covariant returns return random read methods
malenkov
parents: 23010
diff changeset
   173
        }
ebdd0909c381 8040656: Classes with overriden methods with covariant returns return random read methods
malenkov
parents: 23010
diff changeset
   174
        return !oldMethod.isSynthetic() && newMethod.isSynthetic() ? oldMethod : newMethod;
ebdd0909c381 8040656: Classes with overriden methods with covariant returns return random read methods
malenkov
parents: 23010
diff changeset
   175
    }
ebdd0909c381 8040656: Classes with overriden methods with covariant returns return random read methods
malenkov
parents: 23010
diff changeset
   176
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * Package-private constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * Merge two method descriptors.  Where they conflict, give the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * second argument (y) priority over the first argument (x).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * @param x  The first (lower priority) MethodDescriptor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * @param y  The second (higher priority) MethodDescriptor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    MethodDescriptor(MethodDescriptor x, MethodDescriptor y) {
20110
85b98c3054f6 7172865: PropertyDescriptor fails to work with setter method name if setter is non-void
malenkov
parents: 14887
diff changeset
   186
        super(x, y);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
24526
ebdd0909c381 8040656: Classes with overriden methods with covariant returns return random read methods
malenkov
parents: 23010
diff changeset
   188
        this.methodRef.set(resolve(x.methodRef.get(), y.methodRef.get()));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        params = x.params;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        if (y.params != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
            params = y.params;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        paramNames = x.paramNames;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        if (y.paramNames != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
            paramNames = y.paramNames;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        parameterDescriptors = x.parameterDescriptors;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        if (y.parameterDescriptors != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            parameterDescriptors = y.parameterDescriptors;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * Package-private dup constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * This must isolate the new object from any changes to the old object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    MethodDescriptor(MethodDescriptor old) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        super(old);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
20110
85b98c3054f6 7172865: PropertyDescriptor fails to work with setter method name if setter is non-void
malenkov
parents: 14887
diff changeset
   211
        this.methodRef.set(old.getMethod());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        params = old.params;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        paramNames = old.paramNames;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        if (old.parameterDescriptors != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
            int len = old.parameterDescriptors.length;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
            parameterDescriptors = new ParameterDescriptor[len];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            for (int i = 0; i < len ; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                parameterDescriptors[i] = new ParameterDescriptor(old.parameterDescriptors[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
4960
99ac74ca2f2f 4498236: RFE: Provide a toString method for PropertyChangeEvent and other classes
malenkov
parents: 2
diff changeset
   224
    void appendTo(StringBuilder sb) {
20110
85b98c3054f6 7172865: PropertyDescriptor fails to work with setter method name if setter is non-void
malenkov
parents: 14887
diff changeset
   225
        appendTo(sb, "method", this.methodRef.get());
4960
99ac74ca2f2f 4498236: RFE: Provide a toString method for PropertyChangeEvent and other classes
malenkov
parents: 2
diff changeset
   226
        if (this.parameterDescriptors != null) {
99ac74ca2f2f 4498236: RFE: Provide a toString method for PropertyChangeEvent and other classes
malenkov
parents: 2
diff changeset
   227
            sb.append("; parameterDescriptors={");
99ac74ca2f2f 4498236: RFE: Provide a toString method for PropertyChangeEvent and other classes
malenkov
parents: 2
diff changeset
   228
            for (ParameterDescriptor pd : this.parameterDescriptors) {
99ac74ca2f2f 4498236: RFE: Provide a toString method for PropertyChangeEvent and other classes
malenkov
parents: 2
diff changeset
   229
                sb.append(pd).append(", ");
99ac74ca2f2f 4498236: RFE: Provide a toString method for PropertyChangeEvent and other classes
malenkov
parents: 2
diff changeset
   230
            }
99ac74ca2f2f 4498236: RFE: Provide a toString method for PropertyChangeEvent and other classes
malenkov
parents: 2
diff changeset
   231
            sb.setLength(sb.length() - 2);
99ac74ca2f2f 4498236: RFE: Provide a toString method for PropertyChangeEvent and other classes
malenkov
parents: 2
diff changeset
   232
            sb.append("}");
99ac74ca2f2f 4498236: RFE: Provide a toString method for PropertyChangeEvent and other classes
malenkov
parents: 2
diff changeset
   233
        }
99ac74ca2f2f 4498236: RFE: Provide a toString method for PropertyChangeEvent and other classes
malenkov
parents: 2
diff changeset
   234
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
}