src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java
changeset 47436 389695e5e8db
parent 47216 71c04702a3d5
child 52220 9c260a6b6471
equal deleted inserted replaced
47435:80fd2dab3805 47436:389695e5e8db
    55         this.memberValues = memberValues;
    55         this.memberValues = memberValues;
    56     }
    56     }
    57 
    57 
    58     public Object invoke(Object proxy, Method method, Object[] args) {
    58     public Object invoke(Object proxy, Method method, Object[] args) {
    59         String member = method.getName();
    59         String member = method.getName();
    60         Class<?>[] paramTypes = method.getParameterTypes();
    60         int parameterCount = method.getParameterCount();
    61 
    61 
    62         // Handle Object and Annotation methods
    62         // Handle Object and Annotation methods
    63         if (member.equals("equals") && paramTypes.length == 1 &&
    63         if (parameterCount == 1 && member == "equals" &&
    64             paramTypes[0] == Object.class)
    64                 method.getParameterTypes()[0] == Object.class) {
    65             return equalsImpl(proxy, args[0]);
    65             return equalsImpl(proxy, args[0]);
    66         if (paramTypes.length != 0)
    66         }
       
    67         if (parameterCount != 0) {
    67             throw new AssertionError("Too many parameters for an annotation method");
    68             throw new AssertionError("Too many parameters for an annotation method");
    68 
    69         }
    69         switch(member) {
    70 
    70         case "toString":
    71         if (member == "toString") {
    71             return toStringImpl();
    72             return toStringImpl();
    72         case "hashCode":
    73         } else if (member == "hashCode") {
    73             return hashCodeImpl();
    74             return hashCodeImpl();
    74         case "annotationType":
    75         } else if (member == "annotationType") {
    75             return type;
    76             return type;
    76         }
    77         }
    77 
    78 
    78         // Handle annotation member accessors
    79         // Handle annotation member accessors
    79         Object result = memberValues.get(member);
    80         Object result = memberValues.get(member);