@Nullable
  public static ValueParameterDescriptor getAnnotationParameterByName(
      @NotNull Name name, @NotNull ClassDescriptor annotationClass) {
    Collection<ConstructorDescriptor> constructors = annotationClass.getConstructors();
    assert constructors.size() == 1 : "Annotation class descriptor must have only one constructor";

    for (ValueParameterDescriptor parameter : constructors.iterator().next().getValueParameters()) {
      if (parameter.getName().equals(name)) {
        return parameter;
      }
    }

    return null;
  }
  @NotNull
  public static Collection<JavaClass> getClassesInPackage(@NotNull JavaPackage javaPackage) {
    Collection<JavaClass> classes = javaPackage.getClasses();
    Set<FqName> addedQualifiedNames = new HashSet<FqName>(classes.size());
    List<JavaClass> result = new ArrayList<JavaClass>(classes.size());

    for (JavaClass javaClass : classes) {
      FqName fqName = javaClass.getFqName();
      if (fqName != null && addedQualifiedNames.add(fqName)) {
        result.add(javaClass);
      }
    }

    return result;
  }
 /**
  * @see
  *     com.intellij.psi.util.TypeConversionUtil#typeParameterErasure(com.intellij.psi.PsiTypeParameter)
  */
 @Nullable
 private static JavaType typeParameterErasure(
     @NotNull JavaTypeParameter typeParameter,
     @NotNull HashSet<JavaTypeParameter> visited,
     @NotNull JavaTypeSubstitutor substitutor) {
   Collection<JavaClassifierType> upperBounds = typeParameter.getUpperBounds();
   if (!upperBounds.isEmpty()) {
     JavaClassifier classifier = upperBounds.iterator().next().getClassifier();
     if (classifier instanceof JavaTypeParameter && !visited.contains(classifier)) {
       JavaTypeParameter typeParameterBound = (JavaTypeParameter) classifier;
       visited.add(typeParameterBound);
       JavaType substitutedType = substitutor.substitute(typeParameterBound);
       if (substitutedType != null) {
         return erasure(substitutedType);
       }
       return typeParameterErasure(typeParameterBound, visited, substitutor);
     } else if (classifier instanceof JavaClass) {
       return ((JavaClass) classifier).getDefaultType();
     }
   }
   return typeParameter.getTypeProvider().createJavaLangObjectType();
 }