1
1
/*
2
- * Copyright (c) 2003, 2019 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2003, 2021 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -370,6 +370,8 @@ private Boolean equalsImpl(Object proxy, Object o) {
370
370
if (!type .isInstance (o ))
371
371
return false ;
372
372
for (Method memberMethod : getMemberMethods ()) {
373
+ if (memberMethod .isSynthetic ())
374
+ continue ;
373
375
String member = memberMethod .getName ();
374
376
Object ourValue = memberValues .get (member );
375
377
Object hisValue = null ;
@@ -491,6 +493,17 @@ private void validateAnnotationMethods(Method[] memberMethods) {
491
493
*/
492
494
boolean valid = true ;
493
495
for (Method method : memberMethods ) {
496
+ int modifiers = method .getModifiers ();
497
+ // Skip over methods that may be a static initializer or
498
+ // similar construct. A static initializer may be used for
499
+ // purposes such as initializing a lambda stored in an
500
+ // interface field.
501
+ if (method .isSynthetic () &&
502
+ (modifiers & (Modifier .STATIC | Modifier .PRIVATE )) != 0 &&
503
+ method .getParameterCount () == 0 ) {
504
+ continue ;
505
+ }
506
+
494
507
/*
495
508
* "By virtue of the AnnotationTypeElementDeclaration
496
509
* production, a method declaration in an annotation type
@@ -501,7 +514,7 @@ private void validateAnnotationMethods(Method[] memberMethods) {
501
514
* production, a method declaration in an annotation type
502
515
* declaration cannot be default or static."
503
516
*/
504
- if (method . getModifiers () != (Modifier .PUBLIC | Modifier .ABSTRACT ) ||
517
+ if (modifiers != (Modifier .PUBLIC | Modifier .ABSTRACT ) ||
505
518
method .isDefault () ||
506
519
method .getParameterCount () != 0 ||
507
520
method .getExceptionTypes ().length != 0 ) {
0 commit comments