Skip to content

Commit

Permalink
JApiCompatibilityChangeType can generate Markdown of compatibility ch…
Browse files Browse the repository at this point in the history
…anges
  • Loading branch information
siom79 committed Jul 11, 2024
1 parent 01fd3aa commit 7c75cbd
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlEnum;
import java.util.Arrays;
import java.util.Comparator;

@XmlEnum
public enum JApiCompatibilityChangeType {
Expand Down Expand Up @@ -68,9 +70,9 @@ public enum JApiCompatibilityChangeType {
CONSTRUCTOR_REMOVED(false, false, JApiSemanticVersionLevel.MAJOR),
CONSTRUCTOR_LESS_ACCESSIBLE(false, false, JApiSemanticVersionLevel.MAJOR);

private boolean binaryCompatible;
private boolean sourceCompatible;
private JApiSemanticVersionLevel semanticVersionLevel;
private final boolean binaryCompatible;
private final boolean sourceCompatible;
private final JApiSemanticVersionLevel semanticVersionLevel;
private Boolean binaryCompatibleOverridden = null;
private Boolean sourceCompatibleOverridden = null;
private JApiSemanticVersionLevel semanticVersionLevelOverridden = null;
Expand Down Expand Up @@ -122,4 +124,20 @@ public void resetOverrides() {
this.sourceCompatibleOverridden = null;
this.semanticVersionLevelOverridden = null;
}

public static void main(String[] args) {
StringBuilder sb = new StringBuilder();
sb.append("| Check | Default binary compatible | Default source compatible | Default semantic version level |\n");
sb.append("|-------|---------------------------|---------------------------|--------------------------------|\n");
JApiCompatibilityChangeType[] values = Arrays.copyOf(JApiCompatibilityChangeType.values(), JApiCompatibilityChangeType.values().length);
Arrays.sort(values, Comparator.comparing(Enum::name));
for (JApiCompatibilityChangeType type : values) {
sb.append("| ").append(type.name())
.append(" | ").append(type.binaryCompatible)
.append(" | ").append(type.sourceCompatible)
.append(" | ").append(type.semanticVersionLevel.name())
.append(" |\n");
}
System.out.println(sb);
}
}
124 changes: 64 additions & 60 deletions src/site/markdown/MavenPlugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,66 +260,70 @@ the <dependency> element. Through the <parameter> element you can pr
The parameter overrideCompatibilityChangeParameters allows you to override the default values for binary and source compatibility as well as the semantic version level
for each check. This allows you to customize the following verifications:

| Check | Default binary compatible | Default source compatible | Default semantic version level
|-------|---------------------------|---------------------------|--------------------------------|
| ANNOTATION_ADDED | true | true | PATCH |
| ANNOTATION_DEPRECATED_ADDED | true | true | MINOR |
| ANNOTATION_MODIFIED | true | true | PATCH |
| ANNOTATION_REMOVED | true | true | PATCH |
| CLASS_REMOVED | false | false | MAJOR |
| CLASS_NOW_ABSTRACT | false | false | MAJOR |
| CLASS_NOW_FINAL | false | false | MAJOR |
| CLASS_NO_LONGER_PUBLIC | false | false | MAJOR |
| CLASS_TYPE_CHANGED | false | false | MAJOR |
| CLASS_NOW_CHECKED_EXCEPTION | true | false | MINOR |
| CLASS_LESS_ACCESSIBLE | false | false | MAJOR |
| CLASS_GENERIC_TEMPLATE_CHANGED | true | false | MINOR |
| CLASS_GENERIC_TEMPLATE_GENERICS_CHANGED | true | false | MINOR |
| SUPERCLASS_REMOVED | false | false | MAJOR |
| SUPERCLASS_ADDED | true | true | MINOR |
| SUPERCLASS_MODIFIED_INCOMPATIBLE | false | false | MAJOR |
| INTERFACE_ADDED | true | true | MINOR |
| INTERFACE_REMOVED | false | false | MAJOR |
| METHOD_REMOVED | false | false | MAJOR |
| METHOD_REMOVED_IN_SUPERCLASS | false | false | MAJOR |
| METHOD_LESS_ACCESSIBLE | false | false | MAJOR |
| METHOD_LESS_ACCESSIBLE_THAN_IN_SUPERCLASS | false | false | MAJOR |
| METHOD_IS_STATIC_AND_OVERRIDES_NOT_STATIC | false | false | MAJOR |
| METHOD_RETURN_TYPE_CHANGED | false | false | MAJOR |
| METHOD_RETURN_TYPE_GENERICS_CHANGED | true | false | MINOR |
| METHOD_PARAMETER_GENERICS_CHANGED | true | false | MINOR |
| METHOD_NOW_ABSTRACT | false | false | MAJOR |
| METHOD_NOW_FINAL | false | false | MAJOR |
| METHOD_NOW_STATIC | false | false | MAJOR |
| METHOD_NO_LONGER_STATIC | false | false | MAJOR |
| METHOD_NOW_VARARGS | true | true | MINOR |
| METHOD_NO_LONGER_VARARGS | true | false | MINOR |
| METHOD_ADDED_TO_INTERFACE | true | false | MINOR |
| METHOD_ADDED_TO_PUBLIC_CLASS | true | true | PATCH |
| METHOD_NOW_THROWS_CHECKED_EXCEPTION | true | false | MINOR |
| METHOD_NO_LONGER_THROWS_CHECKED_EXCEPTION | true | false | MINOR |
| METHOD_ABSTRACT_ADDED_TO_CLASS | true | false | MINOR |
| METHOD_ABSTRACT_ADDED_IN_SUPERCLASS | true | false | MINOR |
| METHOD_ABSTRACT_ADDED_IN_IMPLEMENTED_INTERFACE | true | false | MINOR |
| METHOD_DEFAULT_ADDED_IN_IMPLEMENTED_INTERFACE | true | true | MINOR |
| METHOD_NEW_DEFAULT | true | true | MINOR |
| METHOD_NEW_STATIC_ADDED_TO_INTERFACE | true | true | MINOR |
| METHOD_ABSTRACT_NOW_DEFAULT | false | false | MAJOR |
| METHOD_MOVED_TO_SUPERCLASS | true | true | PATCH |
| METHOD_NON_STATIC_IN_INTERFACE_NOW_STATIC | true | true | MINOR |
| METHOD_STATIC_IN_INTERFACE_NO_LONGER_STATIC | false | false | MAJOR |
| FIELD_STATIC_AND_OVERRIDES_STATIC | false | false | MAJOR |
| FIELD_LESS_ACCESSIBLE_THAN_IN_SUPERCLASS | false | false | MAJOR |
| FIELD_NOW_FINAL | false | false | MAJOR |
| FIELD_NOW_STATIC | false | false | MAJOR |
| FIELD_NO_LONGER_STATIC | false | false | MAJOR |
| FIELD_TYPE_CHANGED | false | false | MAJOR |
| FIELD_REMOVED | false | false | MAJOR |
| FIELD_REMOVED_IN_SUPERCLASS | false | false | MAJOR |
| FIELD_LESS_ACCESSIBLE | false | false | MAJOR |
| FIELD_GENERICS_CHANGED | true | false | MINOR |
| CONSTRUCTOR_REMOVED | false | false | MAJOR |
| CONSTRUCTOR_LESS_ACCESSIBLE | false | false | MAJOR |
| Check | Default binary compatible | Default source compatible | Default semantic version level |
|------------------------------------------------|---------------------------|---------------------------|--------------------------------|
| ANNOTATION_ADDED | true | true | PATCH |
| ANNOTATION_DEPRECATED_ADDED | true | true | MINOR |
| ANNOTATION_MODIFIED | true | true | PATCH |
| ANNOTATION_REMOVED | true | true | PATCH |
| CLASS_GENERIC_TEMPLATE_CHANGED | true | false | MINOR |
| CLASS_GENERIC_TEMPLATE_GENERICS_CHANGED | true | false | MINOR |
| CLASS_LESS_ACCESSIBLE | false | false | MAJOR |
| CLASS_NOW_ABSTRACT | false | false | MAJOR |
| CLASS_NOW_CHECKED_EXCEPTION | true | false | MINOR |
| CLASS_NOW_FINAL | false | false | MAJOR |
| CLASS_NO_LONGER_PUBLIC | false | false | MAJOR |
| CLASS_REMOVED | false | false | MAJOR |
| CLASS_TYPE_CHANGED | false | false | MAJOR |
| CONSTRUCTOR_LESS_ACCESSIBLE | false | false | MAJOR |
| CONSTRUCTOR_REMOVED | false | false | MAJOR |
| FIELD_GENERICS_CHANGED | true | false | MINOR |
| FIELD_LESS_ACCESSIBLE | false | false | MAJOR |
| FIELD_LESS_ACCESSIBLE_THAN_IN_SUPERCLASS | false | false | MAJOR |
| FIELD_NOW_FINAL | false | false | MAJOR |
| FIELD_NOW_STATIC | false | false | MAJOR |
| FIELD_NOW_TRANSIENT | true | true | PATCH |
| FIELD_NOW_VOLATILE | true | true | PATCH |
| FIELD_NO_LONGER_STATIC | false | false | MAJOR |
| FIELD_NO_LONGER_TRANSIENT | true | true | PATCH |
| FIELD_NO_LONGER_VOLATILE | true | true | PATCH |
| FIELD_REMOVED | false | false | MAJOR |
| FIELD_REMOVED_IN_SUPERCLASS | false | false | MAJOR |
| FIELD_STATIC_AND_OVERRIDES_STATIC | false | false | MAJOR |
| FIELD_TYPE_CHANGED | false | false | MAJOR |
| INTERFACE_ADDED | true | true | MINOR |
| INTERFACE_REMOVED | false | false | MAJOR |
| METHOD_ABSTRACT_ADDED_IN_IMPLEMENTED_INTERFACE | true | false | MINOR |
| METHOD_ABSTRACT_ADDED_IN_SUPERCLASS | true | false | MINOR |
| METHOD_ABSTRACT_ADDED_TO_CLASS | true | false | MINOR |
| METHOD_ABSTRACT_NOW_DEFAULT | false | false | MAJOR |
| METHOD_ADDED_TO_INTERFACE | true | false | MINOR |
| METHOD_ADDED_TO_PUBLIC_CLASS | true | true | PATCH |
| METHOD_DEFAULT_ADDED_IN_IMPLEMENTED_INTERFACE | true | true | MINOR |
| METHOD_IS_STATIC_AND_OVERRIDES_NOT_STATIC | false | false | MAJOR |
| METHOD_LESS_ACCESSIBLE | false | false | MAJOR |
| METHOD_LESS_ACCESSIBLE_THAN_IN_SUPERCLASS | false | false | MAJOR |
| METHOD_MOVED_TO_SUPERCLASS | true | true | PATCH |
| METHOD_NEW_DEFAULT | true | true | MINOR |
| METHOD_NEW_STATIC_ADDED_TO_INTERFACE | true | true | MINOR |
| METHOD_NON_STATIC_IN_INTERFACE_NOW_STATIC | false | false | MAJOR |
| METHOD_NOW_ABSTRACT | false | false | MAJOR |
| METHOD_NOW_FINAL | false | false | MAJOR |
| METHOD_NOW_STATIC | false | false | MAJOR |
| METHOD_NOW_THROWS_CHECKED_EXCEPTION | true | false | MINOR |
| METHOD_NOW_VARARGS | true | true | MINOR |
| METHOD_NO_LONGER_STATIC | false | false | MAJOR |
| METHOD_NO_LONGER_THROWS_CHECKED_EXCEPTION | true | false | MINOR |
| METHOD_NO_LONGER_VARARGS | true | false | MINOR |
| METHOD_PARAMETER_GENERICS_CHANGED | true | false | MINOR |
| METHOD_REMOVED | false | false | MAJOR |
| METHOD_REMOVED_IN_SUPERCLASS | false | false | MAJOR |
| METHOD_RETURN_TYPE_CHANGED | false | false | MAJOR |
| METHOD_RETURN_TYPE_GENERICS_CHANGED | true | false | MINOR |
| METHOD_STATIC_IN_INTERFACE_NO_LONGER_STATIC | false | false | MAJOR |
| SUPERCLASS_ADDED | true | true | MINOR |
| SUPERCLASS_MODIFIED_INCOMPATIBLE | false | false | MAJOR |
| SUPERCLASS_REMOVED | false | false | MAJOR |

If your library implements interfaces or extends classes from other libraries than the JDK, you can add these dependencies by using the
<dependencies> element:
Expand Down

0 comments on commit 7c75cbd

Please sign in to comment.