question: public static boolean canAddClassInPackageOf ( Class < ? > cls ) { final Package beanPackage = cls . getPackage ( ) ; if ( beanPackage != null ) { if ( beanPackage . isSealed ( ) ) { return false ; } String pname = beanPackage . getName ( ) ; if ( pname . startsWith ( "java." ) || pname . startsWith ( "javax.security." ) ) { return false ; } } return true ; }
target:  Helper method called to check whether it is acceptable to create a new class in package that given class is part of. This is used to prevent certain class of failures, related to access limitations: for example, we can not add classes in sealed packages, or core Java packages (java.*).