private static boolean implementsMap ( ClassDescriptor d ) { while ( d != null ) { try { // Do not report this warning for EnumMap: EnumMap.keySet()/get() iteration is as fast as entrySet() iteration if ( "java.util.EnumMap" . equals ( d . getDottedClassName ( ) ) ) { return false ; } // True if variable is itself declared as a Map if ( "java.util.Map" . equals ( d . getDottedClassName ( ) ) ) { return true ; } XClass classNameAndInfo = Global . getAnalysisCache ( ) . getClassAnalysis ( XClass . class , d ) ; ClassDescriptor is [ ] = classNameAndInfo . getInterfaceDescriptorList ( ) ; d = classNameAndInfo . getSuperclassDescriptor ( ) ; for ( ClassDescriptor i : is ) { if ( "java.util.Map" . equals ( i . getDottedClassName ( ) ) ) { return true ; } } } catch ( CheckedAnalysisException e ) { d = null ; } } return false ; }
Determine from the class descriptor for a variable whether that variable implements java . util . Map .