Package edu.hm.hafner.analysis
Class Issue
java.lang.Object
edu.hm.hafner.analysis.Issue
- All Implemented Interfaces:
Serializable
An issue reported by a static analysis tool. Use the provided
builder to create new instances.- Author:
- Ullrich Hafner
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbyCategory(String category) Returns a predicate that checks if the category of an issue is equal to the specified category.byFileName(String fileName) Returns a predicate that checks if the file name of an issue is equal to the specified file name.Returns a predicate that checks if the folder of an issue is equal to the specified folder.byModuleName(String moduleName) Returns a predicate that checks if the module name of an issue is equal to the specified module name.Returns a predicate that checks if the origin of an issue is equal to the specified origin.byPackageName(String packageName) Returns a predicate that checks if the package name of an issue is equal to the specified package name.bySeverity(Severity severity) Returns a predicate that checks if the severity of an issue is equal to the specified severity.Returns a predicate that checks if the type of an issue is equal to the specified type.booleanReturns the absolute path of the affected file.Returns additional properties for this issue.Returns the base name of the file that contains this issue (i.e. the file name without the full path).Returns the category of this issue (depends on the available categories of the static analysis tool).intReturns the last column of this issue (columns start at 1).intReturns the first column of this issue (columns start at 1, 0 indicates the whole line).Returns an additional description for this issue.Returns the name of the affected file.Returns the finger print for this issue.Returns the folder that contains the affected file of this issue.getId()Returns the unique ID of this issue.intReturns the last line of this issue (lines start at 1).Returns additional line ranges for this issue.intReturns the first line of this issue (lines start at 1; 0 indicates the whole file).Returns the detailed message for this issue.Returns the name of the module or project (or similar concept) that contains this issue.Returns the ID of the tool that did report this issue.Returns the name of the tool that did report this issue.Returns the name of the package or name space (or similar concept) that contains this issue.getPath()Returns the path of the affected file.static StringgetPropertyValueAsString(Issue issue, String propertyName) Returns the value of the property with the specified name for a given issue instance.getPropertyValueGetter(String propertyName) Returns a function that can dynamically obtain the value of the property with the specified name of an issue instance.Returns a reference to the execution of the static analysis tool (build ID, timestamp, etc.).Returns the severity of this issue.getType()Returns the type of this issue (depends on the available types of the static analysis tool).booleanReturns whether this issue has a file name set.booleanReturns whether this issue already has a fingerprint set.inthashCode()booleanReturns whether this issue has a module name set.booleanReturns whether this issue has a package name set.protected ObjectCalled after de-serialization to improve the memory usage.voidSets the ID of the tool that did report this issue.voidSets the ID and the name of the tool that did report this issue.voidsetReference(String reference) Sets a reference to the execution of the static analysis tool (build ID, timestamp, etc.).toString()
-
Method Details
-
getPropertyValueAsString
Returns the value of the property with the specified name for a given issue instance.- Parameters:
issue- the issue to get the property forpropertyName- the name of the property- Returns:
- the function that obtains the value
-
getPropertyValueGetter
Returns a function that can dynamically obtain the value of the property with the specified name of an issue instance.- Parameters:
propertyName- the name of the property- Returns:
- the function that obtains the value
-
byPackageName
Returns a predicate that checks if the package name of an issue is equal to the specified package name.- Parameters:
packageName- the package name to match- Returns:
- the predicate
-
byModuleName
Returns a predicate that checks if the module name of an issue is equal to the specified module name.- Parameters:
moduleName- the module name to match- Returns:
- the predicate
-
byFileName
Returns a predicate that checks if the file name of an issue is equal to the specified file name.- Parameters:
fileName- the file name to match- Returns:
- the predicate
-
byFolder
Returns a predicate that checks if the folder of an issue is equal to the specified folder.- Parameters:
folder- the folder to match- Returns:
- the predicate
-
bySeverity
Returns a predicate that checks if the severity of an issue is equal to the specified severity.- Parameters:
severity- the severity to match- Returns:
- the predicate
-
byCategory
Returns a predicate that checks if the category of an issue is equal to the specified category.- Parameters:
category- the category to match- Returns:
- the predicate
-
byOrigin
Returns a predicate that checks if the origin of an issue is equal to the specified origin.- Parameters:
origin- the origin to match- Returns:
- the predicate
-
byType
Returns a predicate that checks if the type of an issue is equal to the specified type.- Parameters:
type- the type to match- Returns:
- the predicate
-
readResolve
Called after de-serialization to improve the memory usage.- Returns:
- this
-
getId
Returns the unique ID of this issue.- Returns:
- the unique ID
-
getFileName
Returns the name of the affected file. This file name is a path relative to the path of the affected files (returned bygetPath()).- Returns:
- the name of the file that contains this issue
- See Also:
-
getFolder
Returns the folder that contains the affected file of this issue. Note that this path is not an absolute path, it is relative to the path of the affected files (returned bygetPath()).- Returns:
- the folder of the file that contains this issue
-
getBaseName
Returns the base name of the file that contains this issue (i.e. the file name without the full path).- Returns:
- the base name of the file that contains this issue
-
getAbsolutePath
Returns the absolute path of the affected file.- Returns:
- the base name of the file that contains this issue
-
getPath
Returns the path of the affected file. Note that this path is not the parent folder of the affected file. This path is the folder that contains all of the affected files of aReport. If this path is not defined, then the default valueUNDEFINEDis returned.- Returns:
- the base name of the file that contains this issue
-
hasFileName
public boolean hasFileName()Returns whether this issue has a file name set.- Returns:
trueif this issue has a file name set- See Also:
-
getCategory
Returns the category of this issue (depends on the available categories of the static analysis tool). Examples for categories are "Deprecation", "Design", or "JavaDoc".- Returns:
- the category
-
getType
Returns the type of this issue (depends on the available types of the static analysis tool). The type typically is the associated rule of the static analysis tool that reported this issue.- Returns:
- the type
-
getSeverity
Returns the severity of this issue.- Returns:
- the severity
-
getMessage
Returns the detailed message for this issue.- Returns:
- the message
-
getDescription
Returns an additional description for this issue. Static analysis tools might provide some additional information about this issue. This description may contain valid HTML.- Returns:
- the description
-
getLineStart
public int getLineStart()Returns the first line of this issue (lines start at 1; 0 indicates the whole file).- Returns:
- the first line
-
getLineEnd
public int getLineEnd()Returns the last line of this issue (lines start at 1).- Returns:
- the last line
-
getLineRanges
Returns additional line ranges for this issue. Not that the primary range given bylineStartandlineEndis not included.- Returns:
- the last line
-
getColumnStart
public int getColumnStart()Returns the first column of this issue (columns start at 1, 0 indicates the whole line).- Returns:
- the first column
-
getColumnEnd
public int getColumnEnd()Returns the last column of this issue (columns start at 1).- Returns:
- the last column
-
getPackageName
Returns the name of the package or name space (or similar concept) that contains this issue.- Returns:
- the package name
-
hasPackageName
public boolean hasPackageName()Returns whether this issue has a package name set.- Returns:
trueif this issue has a package name set- See Also:
-
getModuleName
Returns the name of the module or project (or similar concept) that contains this issue.- Returns:
- the module
-
hasModuleName
public boolean hasModuleName()Returns whether this issue has a module name set.- Returns:
trueif this issue has a module name set- See Also:
-
getOrigin
Returns the ID of the tool that did report this issue.- Returns:
- the ID of the origin
-
getOriginName
Returns the name of the tool that did report this issue.- Returns:
- the name of the origin
-
setOrigin
Sets the ID of the tool that did report this issue.- Parameters:
origin- the origin
-
setOrigin
Sets the ID and the name of the tool that did report this issue.- Parameters:
originId- the ID of the originname- the name of the origin
-
getReference
Returns a reference to the execution of the static analysis tool (build ID, timestamp, etc.).- Returns:
- the reference
-
setReference
Sets a reference to the execution of the static analysis tool (build ID, timestamp, etc.).- Parameters:
reference- the reference
-
getFingerprint
Returns the finger print for this issue. Used to decide if two issues are equal even if the equals method returnsfalsesince some of the properties differ due to code refactorings. The fingerprint is created by analyzing the content of the affected file.Note: the fingerprint is not part of the equals method since the fingerprint might change due to an unrelated refactoring of the source code.
- Returns:
- the fingerprint of this issue
-
hasFingerprint
public boolean hasFingerprint()Returns whether this issue already has a fingerprint set.- Returns:
trueif this issue already has a fingerprint set
-
getAdditionalProperties
Returns additional properties for this issue. A static analysis tool may store additional properties in this untyped object. This object will be serialized and is used inequalsandhashCode.- Returns:
- the additional properties
-
equals
-
hashCode
public int hashCode() -
toString
-