11/*
2- * Copyright (c) 1996, 2015 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 1996, 2019 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
2222 * or visit www.oracle.com if you need additional information or have any
2323 * questions.
2424 */
25- package java .beans ;
2625
27- import com .sun .beans .TypeResolver ;
28- import com .sun .beans .WeakCache ;
29- import com .sun .beans .finder .ClassFinder ;
30- import com .sun .beans .introspect .ClassInfo ;
31- import com .sun .beans .introspect .EventSetInfo ;
32- import com .sun .beans .introspect .PropertyInfo ;
26+ package java .beans ;
3327
3428import java .awt .Component ;
35-
3629import java .lang .ref .Reference ;
3730import java .lang .ref .SoftReference ;
3831import java .lang .reflect .Constructor ;
3932import java .lang .reflect .InvocationTargetException ;
4033import java .lang .reflect .Method ;
4134import java .lang .reflect .Type ;
42-
43- import java .util .Map ;
4435import java .util .ArrayList ;
45- import java .util .Arrays ;
36+ import java .util .EventObject ;
4637import java .util .HashMap ;
4738import java .util .Iterator ;
48- import java .util .EventObject ;
4939import java .util .List ;
40+ import java .util .Map ;
5041import java .util .TreeMap ;
5142
43+ import com .sun .beans .TypeResolver ;
44+ import com .sun .beans .finder .ClassFinder ;
45+ import com .sun .beans .introspect .ClassInfo ;
46+ import com .sun .beans .introspect .EventSetInfo ;
47+ import com .sun .beans .introspect .PropertyInfo ;
5248import jdk .internal .misc .JavaBeansAccess ;
5349import jdk .internal .misc .SharedSecrets ;
5450import sun .reflect .misc .ReflectUtil ;
@@ -115,9 +111,6 @@ public class Introspector {
115111 */
116112 public static final int IGNORE_ALL_BEANINFO = 3 ;
117113
118- // Static Caches to speed up introspection.
119- private static final WeakCache <Class <?>, Method []> declaredMethodCache = new WeakCache <>();
120-
121114 private Class <?> beanClass ;
122115 private BeanInfo explicitBeanInfo ;
123116 private BeanInfo superBeanInfo ;
@@ -197,15 +190,10 @@ public static BeanInfo getBeanInfo(Class<?> beanClass)
197190 return (new Introspector (beanClass , null , USE_ALL_BEANINFO )).getBeanInfo ();
198191 }
199192 ThreadGroupContext context = ThreadGroupContext .getContext ();
200- BeanInfo beanInfo ;
201- synchronized (declaredMethodCache ) {
202- beanInfo = context .getBeanInfo (beanClass );
203- }
193+ BeanInfo beanInfo = context .getBeanInfo (beanClass );
204194 if (beanInfo == null ) {
205195 beanInfo = new Introspector (beanClass , null , USE_ALL_BEANINFO ).getBeanInfo ();
206- synchronized (declaredMethodCache ) {
207- context .putBeanInfo (beanClass , beanInfo );
208- }
196+ context .putBeanInfo (beanClass , beanInfo );
209197 }
210198 return beanInfo ;
211199 }
@@ -374,12 +362,8 @@ public static void setBeanInfoSearchPath(String[] path) {
374362 *
375363 * @since 1.2
376364 */
377-
378365 public static void flushCaches () {
379- synchronized (declaredMethodCache ) {
380- ThreadGroupContext .getContext ().clearBeanInfoCache ();
381- declaredMethodCache .clear ();
382- }
366+ ThreadGroupContext .getContext ().clearBeanInfoCache ();
383367 }
384368
385369 /**
@@ -402,10 +386,7 @@ public static void flushFromCaches(Class<?> clz) {
402386 if (clz == null ) {
403387 throw new NullPointerException ();
404388 }
405- synchronized (declaredMethodCache ) {
406- ThreadGroupContext .getContext ().removeBeanInfo (clz );
407- declaredMethodCache .put (clz , null );
408- }
389+ ThreadGroupContext .getContext ().removeBeanInfo (clz );
409390 }
410391
411392 //======================================================================
0 commit comments