Skip to content

Commit

Permalink
Introduce PropertyOwner to commonise handling of PropertyBag values
Browse files Browse the repository at this point in the history
  • Loading branch information
jckoenen authored and tiulpin committed Apr 16, 2024
1 parent 7fcea34 commit 1422f0b
Show file tree
Hide file tree
Showing 54 changed files with 176 additions and 53 deletions.
5 changes: 5 additions & 0 deletions sarif/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ tasks {
}
}

kotlin {
compilerOptions {
freeCompilerArgs.add("-Xjvm-default=all")
}
}
withType<AbstractPublishToMaven> {
dependsOn(test)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* A physical or virtual address, or a range of addresses, in an 'addressable region' (memory or a binary file).
*/
@SuppressWarnings({"DuplicatedCode", "unused"})
public class Address {
public class Address implements PropertyOwner {

/**
* The address expressed as a byte offset from the start of the addressable region.
Expand Down Expand Up @@ -273,6 +273,7 @@ public Address withParentIndex(Integer parentIndex) {
* Key/value pairs that provide additional information about the object.
*/
@SuppressWarnings("unused")
@Override
public PropertyBag getProperties() {
return properties;
}
Expand All @@ -281,6 +282,7 @@ public PropertyBag getProperties() {
* Key/value pairs that provide additional information about the object.
*/
@SuppressWarnings("unused")
@Override
public void setProperties(PropertyBag properties) {
this.properties = properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* A single artifact. In some cases, this artifact might be nested within another artifact.
*/
@SuppressWarnings("DuplicatedCode")
public class Artifact {
public class Artifact implements PropertyOwner {

/**
* Encapsulates a message intended to be read by the end user.
Expand Down Expand Up @@ -323,13 +323,15 @@ public Artifact withLastModifiedTimeUtc(Instant lastModifiedTimeUtc) {
/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public PropertyBag getProperties() {
return properties;
}

/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public void setProperties(PropertyBag properties) {
this.properties = properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* A change to a single artifact.
*/
@SuppressWarnings("DuplicatedCode")
public class ArtifactChange {
public class ArtifactChange implements PropertyOwner {

/**
* Specifies the location of an artifact.
Expand Down Expand Up @@ -94,13 +94,15 @@ public ArtifactChange withReplacements(List<Replacement> replacements) {
/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public PropertyBag getProperties() {
return properties;
}

/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public void setProperties(PropertyBag properties) {
this.properties = properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Represents the contents of an artifact.
*/
@SuppressWarnings("DuplicatedCode")
public class ArtifactContent {
public class ArtifactContent implements PropertyOwner {

/**
* UTF-8-encoded content from a text artifact.
Expand Down Expand Up @@ -95,13 +95,15 @@ public ArtifactContent withRendered(MultiformatMessageString rendered) {
/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public PropertyBag getProperties() {
return properties;
}

/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public void setProperties(PropertyBag properties) {
this.properties = properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Specifies the location of an artifact.
*/
@SuppressWarnings("DuplicatedCode")
public class ArtifactLocation {
public class ArtifactLocation implements PropertyOwner {

/**
* A string containing a valid relative or absolute URI.
Expand Down Expand Up @@ -120,13 +120,15 @@ public ArtifactLocation withDescription(Message description) {
/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public PropertyBag getProperties() {
return properties;
}

/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public void setProperties(PropertyBag properties) {
this.properties = properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* An artifact relevant to a result.
*/
@SuppressWarnings("DuplicatedCode")
public class Attachment {
public class Attachment implements PropertyOwner {

/**
* Encapsulates a message intended to be read by the end user.
Expand Down Expand Up @@ -139,13 +139,15 @@ public Attachment withRectangles(Set<Rectangle> rectangles) {
/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public PropertyBag getProperties() {
return properties;
}

/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public void setProperties(PropertyBag properties) {
this.properties = properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* A set of threadFlows which together describe a pattern of code execution relevant to detecting a result.
*/
@SuppressWarnings("DuplicatedCode")
public class CodeFlow {
public class CodeFlow implements PropertyOwner {

/**
* Encapsulates a message intended to be read by the end user.
Expand Down Expand Up @@ -90,13 +90,15 @@ public CodeFlow withThreadFlows(List<ThreadFlow> threadFlows) {
/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public PropertyBag getProperties() {
return properties;
}

/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public void setProperties(PropertyBag properties) {
this.properties = properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Information about how a specific rule or notification was reconfigured at runtime.
*/
@SuppressWarnings("DuplicatedCode")
public class ConfigurationOverride {
public class ConfigurationOverride implements PropertyOwner {

/**
* Information about a rule or notification that can be configured at runtime.
Expand Down Expand Up @@ -92,13 +92,15 @@ public ConfigurationOverride withDescriptor(ReportingDescriptorReference descrip
/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public PropertyBag getProperties() {
return properties;
}

/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public void setProperties(PropertyBag properties) {
this.properties = properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Describes how a converter transformed the output of a static analysis tool from the analysis tool's native output format into the SARIF format.
*/
@SuppressWarnings("DuplicatedCode")
public class Conversion {
public class Conversion implements PropertyOwner {

/**
* The analysis tool that was run.
Expand Down Expand Up @@ -114,13 +114,15 @@ public Conversion withAnalysisToolLogFiles(Set<ArtifactLocation> analysisToolLog
/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public PropertyBag getProperties() {
return properties;
}

/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public void setProperties(PropertyBag properties) {
this.properties = properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Represents a directed edge in a graph.
*/
@SuppressWarnings("DuplicatedCode")
public class Edge {
public class Edge implements PropertyOwner {

/**
* A string that uniquely identifies the edge within its graph.
Expand Down Expand Up @@ -147,13 +147,15 @@ public Edge withTargetNodeId(String targetNodeId) {
/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public PropertyBag getProperties() {
return properties;
}

/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public void setProperties(PropertyBag properties) {
this.properties = properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Represents the traversal of a single edge during a graph traversal.
*/
@SuppressWarnings("DuplicatedCode")
public class EdgeTraversal {
public class EdgeTraversal implements PropertyOwner {

/**
* Identifies the edge being traversed.
Expand Down Expand Up @@ -137,13 +137,15 @@ public EdgeTraversal withStepOverEdgeCount(Integer stepOverEdgeCount) {
/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public PropertyBag getProperties() {
return properties;
}

/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public void setProperties(PropertyBag properties) {
this.properties = properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Describes a runtime exception encountered during the execution of an analysis tool.
*/
@SuppressWarnings("DuplicatedCode")
public class Exception {
public class Exception implements PropertyOwner {

/**
* A string that identifies the kind of exception, for example, the fully qualified type name of an object that was thrown, or the symbolic name of a signal.
Expand Down Expand Up @@ -122,13 +122,15 @@ public Exception withInnerExceptions(List<Exception> innerExceptions) {
/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public PropertyBag getProperties() {
return properties;
}

/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public void setProperties(PropertyBag properties) {
this.properties = properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* The top-level element of an external property file.
*/
public class ExternalProperties {
public class ExternalProperties implements PropertyOwner {

/**
* The URI of the JSON schema corresponding to the version of the external property file format.
Expand Down Expand Up @@ -525,13 +525,15 @@ public ExternalProperties withWebResponses(Set<WebResponse> webResponses) {
/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public PropertyBag getProperties() {
return properties;
}

/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public void setProperties(PropertyBag properties) {
this.properties = properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contains information that enables a SARIF consumer to locate the external property file that contains the value of an externalized property associated with the run.
*/
@SuppressWarnings("DuplicatedCode")
public class ExternalPropertyFileReference {
public class ExternalPropertyFileReference implements PropertyOwner {

/**
* Specifies the location of an artifact.
Expand Down Expand Up @@ -95,13 +95,15 @@ public ExternalPropertyFileReference withItemCount(Integer itemCount) {
/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public PropertyBag getProperties() {
return properties;
}

/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public void setProperties(PropertyBag properties) {
this.properties = properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* References to external property files that should be inlined with the content of a root log file.
*/
@SuppressWarnings("DuplicatedCode")
public class ExternalPropertyFileReferences {
public class ExternalPropertyFileReferences implements PropertyOwner {

/**
* Contains information that enables a SARIF consumer to locate the external property file that contains the value of an externalized property associated with the run.
Expand Down Expand Up @@ -422,13 +422,15 @@ public ExternalPropertyFileReferences withWebResponses(Set<ExternalPropertyFileR
/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public PropertyBag getProperties() {
return properties;
}

/**
* Key/value pairs that provide additional information about the object.
*/
@Override
public void setProperties(PropertyBag properties) {
this.properties = properties;
}
Expand Down
Loading

0 comments on commit 1422f0b

Please sign in to comment.