static String packageNameOf(TypeElement type) {
        while (true) {
            Element enclosing = type.getEnclosingElement();
            if (enclosing instanceof PackageElement) {
                return ((PackageElement) enclosing).getQualifiedName().toString();
            }
            type = (TypeElement) enclosing;
        }
    }
Returns the name of the package that the given type is in. If the type is in the default
(unnamed) package then the name is the empty string.

@param type given type
@return package name
android/annotation_processors/permission-requester-compiler/src/main/java/github/tornaco/permission/compiler/CompilerUtil.java