1/* 2 * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 * of Java bytecode. 4 * 5 * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 * 7 * This program is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License as published by the Free 9 * Software Foundation; either version 2 of the License, or (at your option) 10 * any later version. 11 * 12 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 * more details. 16 * 17 * You should have received a copy of the GNU General Public License along 18 * with this program; if not, write to the Free Software Foundation, Inc., 19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 */ 21package proguard.classfile.attribute; 22 23import proguard.classfile.*; 24import proguard.classfile.attribute.visitor.*; 25 26/** 27 * This Attribute represents a method parameters attribute. 28 * 29 * @author Eric Lafortune 30 */ 31public class MethodParametersAttribute extends Attribute 32{ 33 public int u1parametersCount; 34 public ParameterInfo[] parameters; 35 36 37 /** 38 * Creates an uninitialized MethodParametersAttribute. 39 */ 40 public MethodParametersAttribute() 41 { 42 } 43 44 45 /** 46 * Creates an initialized MethodParametersAttribute. 47 */ 48 public MethodParametersAttribute(int u2attributeNameIndex, 49 int u1parametersCount, 50 ParameterInfo[] parameters) 51 { 52 super(u2attributeNameIndex); 53 54 this.u1parametersCount = u1parametersCount; 55 this.parameters = parameters; 56 } 57 58 59 // Implementations for Attribute. 60 61 public void accept(Clazz clazz, Method method, AttributeVisitor attributeVisitor) 62 { 63 attributeVisitor.visitMethodParametersAttribute(clazz, method, this); 64 } 65 66 67 /** 68 * Applies the given visitor to all parameters. 69 */ 70 public void parametersAccept(Clazz clazz, Method method, ParameterInfoVisitor parameterInfoVisitor) 71 { 72 // Loop over all parameters. 73 for (int index = 0; index < u1parametersCount; index++) 74 { 75 // We don't need double dispatching here, since there is only one 76 // type of ParameterInfo. 77 parameterInfoVisitor.visitParameterInfo(clazz, method, index, parameters[index]); 78 } 79 } 80} 81