Skip to content

Commit

Permalink
Merge pull request #288 from itsallcode/#287-support-java-16
Browse files Browse the repository at this point in the history
Support java 16
  • Loading branch information
kaklakariada authored Aug 7, 2021
2 parents d95e0ea + ef27b5a commit dfee8e2
Show file tree
Hide file tree
Showing 129 changed files with 1,284 additions and 492 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [11]
java: [11, 16]
env:
DEFAULT_JAVA: 11

Expand Down Expand Up @@ -45,13 +45,13 @@ jobs:
restore-keys: ${{ runner.os }}-sonar

- name: Build with Maven
run: mvn --errors --batch-mode clean org.jacoco:jacoco-maven-plugin:prepare-agent install
run: mvn --threads 1C --errors --batch-mode clean org.jacoco:jacoco-maven-plugin:prepare-agent install
env:
MAVEN_OPTS: "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"

- name: Sonar analysis
if: ${{ env.DEFAULT_JAVA == matrix.java && env.SONAR_TOKEN != null }}
run: mvn --errors --batch-mode -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=itsallcode -Dsonar.login=$SONAR_TOKEN sonar:sonar
run: mvn --threads 1C --errors --batch-mode -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=itsallcode -Dsonar.login=$SONAR_TOKEN sonar:sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down
6 changes: 4 additions & 2 deletions api/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
Expand Down Expand Up @@ -53,9 +54,9 @@ org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
Expand Down Expand Up @@ -92,6 +93,7 @@ org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed=info
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,28 @@

/**
* This enumeration represents the different kinds of deep coverage.
*
* <ul>
* <li><code>COVERED</code> - this item and all its children are covered
* correctly</li>
* <li><code>UNCOVERED</code> - this item or at least one of its children are
* not covered correctly</li>
* <li><code>CYCLE</code> - this item is part of a link cycle, which means real
* coverage cannot be evaluated</li>
* </ul>
*/
public enum DeepCoverageStatus
{
COVERED(0), UNCOVERED(1), CYCLE(2);
/**
* This item and all its children are covered correctly.
*/
COVERED(0),
/**
* This item or at least one of its children are not covered correctly
*/
UNCOVERED(1),
/**
* This item is part of a link cycle, which means real coverage cannot be
* evaluated
*/
CYCLE(2);

private final int badness;

DeepCoverageStatus(final int badness)
private DeepCoverageStatus(final int badness)
{
this.badness = badness;

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,37 @@
* #L%
*/

/**
* This enumeration represents the different statuses of an item.
*/
public enum ItemStatus
{
APPROVED, PROPOSED, DRAFT, REJECTED;
/**
* The item is approved.
*/
APPROVED,
/**
* The item is proposed.
*/
PROPOSED,
/**
* The item is a draft.
*/
DRAFT,
/**
* The item is rejected.
*/
REJECTED;

/**
* Parses the given text and return the matching {@link ItemStatus}.
*
* @param text
* the text to parse, e.g. {@code "APPROVED"}.
* @return the matching {@link ItemStatus}.
* @throws IllegalArgumentException
* in case no matching {@link ItemStatus} is found.
*/
public static ItemStatus parseString(final String text)
{
for (final ItemStatus value : values())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,65 @@
* #L%
*/

/**
* This enumeration represents the different statuses of a coverage link between
* two items.
*/
public enum LinkStatus
{
// Outgoing coverage link status
COVERS(" ", "covers"), PREDATED(">", "predated"), OUTDATED("<", "outdated"), AMBIGUOUS("?",
"ambiguous"), UNWANTED("+", "unwanted"), ORPHANED("/", "orphaned"), //
// Incoming coverage link status
COVERED_SHALLOW(" ", "covered shallow"), COVERED_UNWANTED("+",
"unwanted coverage"), COVERED_PREDATED(">",
"predated coverage"), COVERED_OUTDATED("<", "outdated coverage"), //
// Duplicate link status
/**
* Outgoing coverage link status: item 1 covers item 2.
*/
COVERS(" ", "covers"),
/**
* Outgoing coverage link status: item 1 covers a newer revision of item 2.
*/
PREDATED(">", "predated"),
/**
* Outgoing coverage link status: item 1 covers an older revision of item 2.
*/
OUTDATED("<", "outdated"),
/**
* Outgoing coverage link status: two items with the same id are covered by
* another item.
*/
AMBIGUOUS("?", "ambiguous"),
/**
* Outgoing coverage link status: an item covers another item that does not
* require coverage.
*/
UNWANTED("+", "unwanted"),
/** Outgoing coverage link status: an item covers a non-existing item. */
ORPHANED("/", "orphaned"),

/**
* Incoming coverage link status: an item is directly covered by another
* item.
*/
COVERED_SHALLOW(" ", "covered shallow"),
/**
* Incoming coverage link status: an item is covered by another item
* although it does not require coverage.
*/
COVERED_UNWANTED("+", "unwanted coverage"),
/**
* Incoming coverage link status: an item is covered by another item that
* specifies a newer revision.
*/
COVERED_PREDATED(">", "predated coverage"),
/**
* Incoming coverage link status: an item is covered by another item that
* specifies an older revision.
*/
COVERED_OUTDATED("<", "outdated coverage"),

/** Duplicate link status: two items have the same ID. */
DUPLICATE("?", "duplicate");

private final String shortTag;
private final String text;

LinkStatus(final String shortTag, final String text)
private LinkStatus(final String shortTag, final String text)
{
this.shortTag = shortTag;
this.text = text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ public class LinkedSpecificationItem
/**
* Create a new instance of class {@link LinkedSpecificationItem}.
*
* @param item the actual specification item that is at the center of the
* links
* @param item
* the actual specification item that is at the center of the
* links
*/
public LinkedSpecificationItem(final SpecificationItem item)
{
Expand Down Expand Up @@ -148,8 +149,10 @@ public SpecificationItem getItem()
/**
* Add a link to another item with a status.
*
* @param item the item to be linked to
* @param status the link status
* @param item
* the item to be linked to
* @param status
* the link status
*/
public void addLinkToItemWithStatus(final LinkedSpecificationItem item, final LinkStatus status)
{
Expand Down Expand Up @@ -211,7 +214,8 @@ public Map<LinkStatus, List<LinkedSpecificationItem>> getLinks()
/**
* Get all links to the item by item status.
*
* @param status link status
* @param status
* link status
* @return the covered items
*/
public List<LinkedSpecificationItem> getLinksByStatus(final LinkStatus status)
Expand Down Expand Up @@ -303,7 +307,8 @@ public List<String> getUncoveredArtifactTypes()
}

/**
* Get a list of all artifact types for which required coverage is missing only considering approved items.
* Get a list of all artifact types for which required coverage is missing
* only considering approved items.
*
* @return list of uncovered artifact types.
*/
Expand All @@ -326,7 +331,8 @@ public boolean isCoveredShallow()
}

/**
* @return <code>true</code> if all needed attribute types are covered by approved items
* @return <code>true</code> if all needed attribute types are covered by
* approved items
*/
public boolean isCoveredShallowWithApprovedItems()
{
Expand All @@ -336,7 +342,7 @@ public boolean isCoveredShallowWithApprovedItems()
/**
* Check if this item and all items providing coverage for it are covered.
*
* @return covered, uncovered or ring.
* @return covered, uncovered or cycle.
*/
// [impl->dsn~tracing.deep-coverage~1]
public DeepCoverageStatus getDeepCoverageStatus()
Expand All @@ -345,6 +351,12 @@ public DeepCoverageStatus getDeepCoverageStatus()
DeepCoverageStatus.COVERED, false);
}

/**
* Check if this item and all items providing coverage for it are covered,
* only considering items with status {@link ItemStatus#APPROVED}.
*
* @return covered, uncovered or cycle.
*/
public DeepCoverageStatus getDeepCoverageStatusOnlyAcceptApprovedItems()
{
return getDeepCoverageStatusEndRecursionStartingAt(this.getId(),
Expand Down Expand Up @@ -389,9 +401,9 @@ private DeepCoverageStatus getDeepCoverageStatusEndRecursionStartingAt(
private DeepCoverageStatus adjustDeepCoverageStatusIfApprovedRequired(final boolean onlyAcceptApprovedItemStatus,
final DeepCoverageStatus deepCoveredStatus)
{
return (onlyAcceptApprovedItemStatus && deepCoveredStatus == DeepCoverageStatus.COVERED && !isApproved()) ?
DeepCoverageStatus.UNCOVERED :
deepCoveredStatus;
return (onlyAcceptApprovedItemStatus && deepCoveredStatus == DeepCoverageStatus.COVERED && !isApproved())
? DeepCoverageStatus.UNCOVERED
: deepCoveredStatus;
}

private List<LinkedSpecificationItem> getIncomingItems()
Expand Down Expand Up @@ -424,8 +436,8 @@ public boolean isDefect()
{
return hasDuplicates() //
|| (getStatus() != ItemStatus.REJECTED) //
&& (hasBadLinks()
|| (getDeepCoverageStatus() != DeepCoverageStatus.COVERED));
&& (hasBadLinks()
|| (getDeepCoverageStatus() != DeepCoverageStatus.COVERED));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@

import javax.annotation.processing.Generated;

/**
* The location of a coverage item.
*/
public final class Location
{
/** Value indicating an unknown line. */
public static final int NO_LINE = -1;
/** Value indicating an unknown column. */
public static final int NO_COLUMN = -1;
private final String path;
private final int line;
Expand Down Expand Up @@ -197,6 +202,10 @@ public static Builder builder()
return new Builder();
}

/**
* A builder for {@link Location}. Use {@link Location#builder()} to create
* a new builder and call {@link #build()} to build a {@link Location}.
*/
public static class Builder
{
private String path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,23 @@

import java.util.regex.Pattern;


/**
* This enumeration represents the different types of newline.
*/
public enum Newline
{
UNIX("\n"), WINDOWS("\r\n"), OLDMAC("\r");
/** Newline character used under Unix. */
UNIX("\n"),
/** Newline characters used under windows. */
WINDOWS("\r\n"),
/** Newline character used on old macs. */
OLDMAC("\r");

private static final String ANY_NEWLINE_REG_EX = "\\r\\n|\\r|\\n";
private static final Pattern ANY_NEWLINE_PATTERN = Pattern.compile(ANY_NEWLINE_REG_EX);
private final String representation;

Newline(final String representation)
private Newline(final String representation)
{
this.representation = representation;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

import javax.annotation.processing.Generated;

/**
* A specification item that requires coverage from other items and provides
* coverage for other items.
*/
// [impl->dsn~specification-item~3]
public class SpecificationItem
{
Expand Down Expand Up @@ -85,8 +89,8 @@ public String getArtifactType()
*
* <p>
* Not to be mixed up with the
* {@link org.itsallcode.openfasttrace.api.core.SpecificationItem#getTitle()} of
* the specification item
* {@link org.itsallcode.openfasttrace.api.core.SpecificationItem#getTitle()}
* of the specification item
* </p>
*
* @return name part of the specification item ID
Expand Down Expand Up @@ -530,6 +534,13 @@ public Builder comment(final String comment)
return this;
}

/**
* Set the status
*
* @param status
* the status
* @return this builder instance
*/
public Builder status(final ItemStatus status)
{
this.status = status;
Expand Down
Loading

0 comments on commit dfee8e2

Please sign in to comment.