langtools/src/share/classes/com/sun/tools/classfile/Attribute.java
changeset 22163 3651128c74eb
parent 18667 7c871925691f
child 22698 818555741cd5
equal deleted inserted replaced
22162:3b3e23e67329 22163:3651128c74eb
    88                 Class<? extends Attribute> attrClass = standardAttributes.get(name);
    88                 Class<? extends Attribute> attrClass = standardAttributes.get(name);
    89                 if (attrClass != null) {
    89                 if (attrClass != null) {
    90                     try {
    90                     try {
    91                         Class<?>[] constrArgTypes = {ClassReader.class, int.class, int.class};
    91                         Class<?>[] constrArgTypes = {ClassReader.class, int.class, int.class};
    92                         Constructor<? extends Attribute> constr = attrClass.getDeclaredConstructor(constrArgTypes);
    92                         Constructor<? extends Attribute> constr = attrClass.getDeclaredConstructor(constrArgTypes);
    93                         return constr.newInstance(new Object[] { cr, name_index, data.length });
    93                         return constr.newInstance(cr, name_index, data.length);
    94                     } catch (Throwable t) {
    94                     } catch (Throwable t) {
    95                         reasonForDefaultAttr = t.toString();
    95                         reasonForDefaultAttr = t.toString();
    96                         // fall through and use DefaultAttribute
    96                         // fall through and use DefaultAttribute
    97                         // t.printStackTrace();
    97                         // t.printStackTrace();
    98                     }
    98                     }
   105             }
   105             }
   106             return new DefaultAttribute(cr, name_index, data, reasonForDefaultAttr);
   106             return new DefaultAttribute(cr, name_index, data, reasonForDefaultAttr);
   107         }
   107         }
   108 
   108 
   109         protected void init() {
   109         protected void init() {
   110             standardAttributes = new HashMap<String,Class<? extends Attribute>>();
   110             standardAttributes = new HashMap<>();
   111             standardAttributes.put(AnnotationDefault, AnnotationDefault_attribute.class);
   111             standardAttributes.put(AnnotationDefault, AnnotationDefault_attribute.class);
   112             standardAttributes.put(BootstrapMethods, BootstrapMethods_attribute.class);
   112             standardAttributes.put(BootstrapMethods, BootstrapMethods_attribute.class);
   113             standardAttributes.put(CharacterRangeTable, CharacterRangeTable_attribute.class);
   113             standardAttributes.put(CharacterRangeTable, CharacterRangeTable_attribute.class);
   114             standardAttributes.put(Code,              Code_attribute.class);
   114             standardAttributes.put(Code,              Code_attribute.class);
   115             standardAttributes.put(ConstantValue,     ConstantValue_attribute.class);
   115             standardAttributes.put(ConstantValue,     ConstantValue_attribute.class);