MutableAnnotationTypeDeclaration extends MutablePluginDeclaration<MutableAnnotationTypeDeclaration> implements BareAnnotationTypeDeclaration { public static MutableAnnotationTypeDeclaration fromClass(Class<? extends Annotation> original, CopyOption... copyOptions) { return new MutableAnnotationTypeDeclaration(original, copyOptions); } MutableAnnotationTypeDeclaration(); private  MutableAnnotationTypeDeclaration(Class<? extends Annotation> original, CopyOption[] copyOptions); private  MutableAnnotationTypeDeclaration(BareAnnotationTypeDeclaration original, CopyOption[] copyOptions); static MutableAnnotationTypeDeclaration fromClass(Class<? extends Annotation> original,
            CopyOption... copyOptions); @Nullable static MutableAnnotationTypeDeclaration copyOfAnnotationTypeDeclaration(
            @Nullable BareAnnotationTypeDeclaration original, CopyOption... copyOptions); @Override boolean equals(@Nullable Object otherObject); @Override int hashCode(); @Override String toString(); @Override @Nullable T accept(BarePluginDeclarationVisitor<T, P> visitor, @Nullable P parameter); @XmlElementWrapper @XmlElement(name = "element") @Override List<MutableAnnotationTypeElement> getElements(); MutableAnnotationTypeDeclaration setElements(List<MutableAnnotationTypeElement> elements);  }
@Test public void fromClass() { MutableAnnotationTypeDeclaration actual = MutableAnnotationTypeDeclaration.fromClass(MemoryRequirements.class, CopyOptions.INSTANCE); Collections.sort(actual.getDeclaredAnnotations(), (first, second) -> { @Nullable MutableQualifiedNamable firstDeclaration = first.getDeclaration(); @Nullable MutableQualifiedNamable secondDeclaration = second.getDeclaration(); assert firstDeclaration != null && secondDeclaration != null; @Nullable Name firstName = firstDeclaration.getQualifiedName(); @Nullable Name secondName = secondDeclaration.getQualifiedName(); assert firstName != null && secondName != null; return firstName.compareTo(secondName); }); Collections.sort(actual.getElements(), (first, second) -> { @Nullable Name firstName = first.getSimpleName(); @Nullable Name secondName = second.getSimpleName(); assert firstName != null && secondName != null; return firstName.compareTo(secondName); }); MutableAnnotationTypeDeclaration expected = new MutableAnnotationTypeDeclaration() .setSimpleName(MemoryRequirements.class.getSimpleName()) .setDeclaredAnnotations(Arrays.asList( new MutableAnnotation() .setDeclaration(BarAnnotation.class.getCanonicalName()), new MutableAnnotation() .setDeclaration(FooAnnotation.class.getCanonicalName()) .setEntries(Collections.singletonList( new MutableAnnotationEntry() .setKey("value") .setValue(new byte[]{(byte) 2, (byte) 3}) )) )) .setElements(Arrays.asList( new MutableAnnotationTypeElement() .setSimpleName("unit") .setReturnType(new MutableDeclaredType().setDeclaration(String.class.getName())) .setDefaultValue("MB"), new MutableAnnotationTypeElement() .setSimpleName("value") .setReturnType(new MutablePrimitiveType().setPrimitiveKind(BarePrimitiveType.Kind.INT)) .setDefaultValue(1024) )); Assert.assertEquals(actual, expected); }