src/share/classes/java/lang/reflect/Executable.java

Print this page




  65         if (params1.length == params2.length) {
  66             for (int i = 0; i < params1.length; i++) {
  67                 if (params1[i] != params2[i])
  68                     return false;
  69             }
  70             return true;
  71         }
  72         return false;
  73     }
  74 
  75     Annotation[][] parseParameterAnnotations(byte[] parameterAnnotations) {
  76         return AnnotationParser.parseParameterAnnotations(
  77                parameterAnnotations,
  78                sun.misc.SharedSecrets.getJavaLangAccess().
  79                getConstantPool(getDeclaringClass()),
  80                getDeclaringClass());
  81     }
  82 
  83     void separateWithCommas(Class<?>[] types, StringBuilder sb) {
  84         for (int j = 0; j < types.length; j++) {
  85             sb.append(Field.getTypeName(types[j]));
  86             if (j < (types.length - 1))
  87                 sb.append(",");
  88         }
  89 
  90     }
  91 
  92     void printModifiersIfNonzero(StringBuilder sb, int mask, boolean isDefault) {
  93         int mod = getModifiers() & mask;
  94 
  95         if (mod != 0 && !isDefault) {
  96             sb.append(Modifier.toString(mod)).append(' ');
  97         } else {
  98             int access_mod = mod & Modifier.ACCESS_MODIFIERS;
  99             if (access_mod != 0)
 100                 sb.append(Modifier.toString(access_mod)).append(' ');
 101             if (isDefault)
 102                 sb.append("default ");
 103             mod = (mod & ~Modifier.ACCESS_MODIFIERS);
 104             if (mod != 0)
 105                 sb.append(Modifier.toString(mod)).append(' ');


 144             TypeVariable<?>[] typeparms = getTypeParameters();
 145             if (typeparms.length > 0) {
 146                 boolean first = true;
 147                 sb.append('<');
 148                 for(TypeVariable<?> typeparm: typeparms) {
 149                     if (!first)
 150                         sb.append(',');
 151                     // Class objects can't occur here; no need to test
 152                     // and call Class.getName().
 153                     sb.append(typeparm.toString());
 154                     first = false;
 155                 }
 156                 sb.append("> ");
 157             }
 158 
 159             specificToGenericStringHeader(sb);
 160 
 161             sb.append('(');
 162             Type[] params = getGenericParameterTypes();
 163             for (int j = 0; j < params.length; j++) {
 164                 String param = (params[j] instanceof Class)?
 165                     Field.getTypeName((Class)params[j]):
 166                     (params[j].toString());
 167                 if (isVarArgs() && (j == params.length - 1)) // replace T[] with T...
 168                     param = param.replaceFirst("\\[\\]$", "...");
 169                 sb.append(param);
 170                 if (j < (params.length - 1))
 171                     sb.append(',');
 172             }
 173             sb.append(')');
 174             Type[] exceptions = getGenericExceptionTypes();
 175             if (exceptions.length > 0) {
 176                 sb.append(" throws ");
 177                 for (int k = 0; k < exceptions.length; k++) {
 178                     sb.append((exceptions[k] instanceof Class)?
 179                               ((Class)exceptions[k]).getName():
 180                               exceptions[k].toString());
 181                     if (k < (exceptions.length - 1))
 182                         sb.append(',');
 183                 }
 184             }
 185             return sb.toString();
 186         } catch (Exception e) {




  65         if (params1.length == params2.length) {
  66             for (int i = 0; i < params1.length; i++) {
  67                 if (params1[i] != params2[i])
  68                     return false;
  69             }
  70             return true;
  71         }
  72         return false;
  73     }
  74 
  75     Annotation[][] parseParameterAnnotations(byte[] parameterAnnotations) {
  76         return AnnotationParser.parseParameterAnnotations(
  77                parameterAnnotations,
  78                sun.misc.SharedSecrets.getJavaLangAccess().
  79                getConstantPool(getDeclaringClass()),
  80                getDeclaringClass());
  81     }
  82 
  83     void separateWithCommas(Class<?>[] types, StringBuilder sb) {
  84         for (int j = 0; j < types.length; j++) {
  85             sb.append(types[j].getTypeName());
  86             if (j < (types.length - 1))
  87                 sb.append(",");
  88         }
  89 
  90     }
  91 
  92     void printModifiersIfNonzero(StringBuilder sb, int mask, boolean isDefault) {
  93         int mod = getModifiers() & mask;
  94 
  95         if (mod != 0 && !isDefault) {
  96             sb.append(Modifier.toString(mod)).append(' ');
  97         } else {
  98             int access_mod = mod & Modifier.ACCESS_MODIFIERS;
  99             if (access_mod != 0)
 100                 sb.append(Modifier.toString(access_mod)).append(' ');
 101             if (isDefault)
 102                 sb.append("default ");
 103             mod = (mod & ~Modifier.ACCESS_MODIFIERS);
 104             if (mod != 0)
 105                 sb.append(Modifier.toString(mod)).append(' ');


 144             TypeVariable<?>[] typeparms = getTypeParameters();
 145             if (typeparms.length > 0) {
 146                 boolean first = true;
 147                 sb.append('<');
 148                 for(TypeVariable<?> typeparm: typeparms) {
 149                     if (!first)
 150                         sb.append(',');
 151                     // Class objects can't occur here; no need to test
 152                     // and call Class.getName().
 153                     sb.append(typeparm.toString());
 154                     first = false;
 155                 }
 156                 sb.append("> ");
 157             }
 158 
 159             specificToGenericStringHeader(sb);
 160 
 161             sb.append('(');
 162             Type[] params = getGenericParameterTypes();
 163             for (int j = 0; j < params.length; j++) {
 164                 String param = params[j].getTypeName();


 165                 if (isVarArgs() && (j == params.length - 1)) // replace T[] with T...
 166                     param = param.replaceFirst("\\[\\]$", "...");
 167                 sb.append(param);
 168                 if (j < (params.length - 1))
 169                     sb.append(',');
 170             }
 171             sb.append(')');
 172             Type[] exceptions = getGenericExceptionTypes();
 173             if (exceptions.length > 0) {
 174                 sb.append(" throws ");
 175                 for (int k = 0; k < exceptions.length; k++) {
 176                     sb.append((exceptions[k] instanceof Class)?
 177                               ((Class)exceptions[k]).getName():
 178                               exceptions[k].toString());
 179                     if (k < (exceptions.length - 1))
 180                         sb.append(',');
 181                 }
 182             }
 183             return sb.toString();
 184         } catch (Exception e) {