Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 804b6ec

Browse files
committed
Review fixes: fixed formatting, removed useless overriding methods
1 parent dfcc34a commit 804b6ec

File tree

4 files changed

+28
-29
lines changed

4 files changed

+28
-29
lines changed

‎utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/Api.kt‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,13 +1276,8 @@ class DocPreTagStatement(content: List<DocStatement>) : DocTagStatement(content)
12761276
override fun hashCode(): Int = content.hashCode()
12771277
}
12781278

1279-
class DocCustomTagStatement(content: List<DocStatement>) : DocTagStatement(content) {
1279+
data class DocCustomTagStatement(valstatements: List<DocStatement>) : DocTagStatement(statements) {
12801280
override fun toString(): String = content.joinToString(separator = "")
1281-
1282-
override fun equals(other: Any?): Boolean =
1283-
if (other is DocCustomTagStatement) this.hashCode() == other.hashCode() else false
1284-
1285-
override fun hashCode(): Int = content.hashCode()
12861281
}
12871282

12881283
open class DocClassLinkStmt(val className: String) : DocStatement() {

‎utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/tree/CgElement.kt‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -337,14 +337,7 @@ class CgDocPreTagStatement(content: List<CgDocStatement>) : CgDocTagStatement(co
337337
override fun hashCode(): Int = content.hashCode()
338338
}
339339

340-
class CgCustomTagStatement(content: List<CgDocStatement>) : CgDocTagStatement(content) {
341-
override fun equals(other: Any?): Boolean =
342-
if (other is CgCustomTagStatement) {
343-
this.hashCode() == other.hashCode()
344-
} else false
345-
346-
override fun hashCode(): Int = content.hashCode()
347-
}
340+
data class CgCustomTagStatement(val statements: List<CgDocStatement>) : CgDocTagStatement(statements)
348341

349342
class CgDocCodeStmt(val stmt: String) : CgDocStatement() {
350343
override fun isEmpty(): Boolean = stmt.isEmpty()
@@ -392,7 +385,7 @@ fun convertDocToCg(stmt: DocStatement): CgDocStatement {
392385
}
393386
is DocCustomTagStatement -> {
394387
val stmts = stmt.content.map { convertDocToCg(it) }
395-
CgCustomTagStatement(content = stmts)
388+
CgCustomTagStatement(statements = stmts)
396389
}
397390
is DocRegularStmt -> CgDocRegularStmt(stmt = stmt.stmt)
398391
is DocClassLinkStmt -> CgDocClassLinkStmt(className = stmt.className)

‎utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/visitor/CgAbstractRenderer.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,9 @@ internal abstract class CgAbstractRenderer(val context: CgContext, val printer:
316316
}
317317

318318
override fun visit(element: CgCustomTagStatement) {
319-
if (element.content.all { it.isEmpty() }) return
319+
if (element.statements.all { it.isEmpty() }) return
320320

321-
for (stmt in element.content) {
321+
for (stmt in element.statements) {
322322
stmt.accept(this)
323323
}
324324
}

‎utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/javadoc/UtJavaDocInfoGenerator.kt‎

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ private const val LITERAL_TAG = "literal"
1919
private const val CODE_TAG = "code"
2020
private const val SYSTEM_PROPERTY_TAG = "systemProperty"
2121
private const val MESSAGE_SEPARATOR = ":"
22+
private const val PARAGRAPH_TAG = "<p>"
23+
private const val CODE_TAG_START = "<code>"
24+
private const val CODE_TAG_END = "</code>"
2225

2326
private val logger = KotlinLogging.logger {}
2427

@@ -53,7 +56,7 @@ class UtJavaDocInfoGenerator {
5356
utTag: UtCustomJavaDocTagProvider.UtCustomTagInfo
5457
) {
5558
val tag = comment.findTagByName(utTag.name) ?: return
56-
startHeaderSection(builder, utTag.getMessage()).append("<p>")
59+
startHeaderSection(builder, utTag.getMessage()).append(PARAGRAPH_TAG)
5760
val sectionContent = buildString {
5861
generateValue(this, tag.dataElements)
5962
trim()
@@ -120,27 +123,33 @@ class UtJavaDocInfoGenerator {
120123
}
121124

122125
private fun generateCodeValue(tag: PsiInlineDocTag, builder: StringBuilder) {
123-
builder.append("<code>")
126+
builder.append(CODE_TAG_START)
124127
val pos = builder.length
125128
generateLiteralValue(builder, tag)
126-
builder.append("</code>")
127-
if (builder[pos] == '\n') builder.insert(
128-
pos,
129-
' '
130-
) // line break immediately after opening tag is ignored by JEditorPane
129+
builder.append(CODE_TAG_END)
130+
if (builder[pos] == '\n') {
131+
builder.insert(
132+
pos,
133+
' '
134+
) // line break immediately after opening tag is ignored by JEditorPane
135+
}
131136
}
132137

133138
private fun generateLiteralValue(builder: StringBuilder, tag: PsiDocTag) {
134139
val literalValue = buildString {
135140
val children = tag.children
136141
for (i in 2 until children.size - 1) { // process all children except tag opening/closing elements
137142
val child = children[i]
138-
if (child is PsiDocToken && child.tokenType === JavaDocTokenType.DOC_COMMENT_LEADING_ASTERISKS) continue
143+
if (child is PsiDocToken && child.tokenType === JavaDocTokenType.DOC_COMMENT_LEADING_ASTERISKS) {
144+
continue
145+
}
146+
139147
var elementText = child.text
140148
if (child is PsiWhiteSpace) {
141149
val pos = elementText.lastIndexOf('\n')
142-
if (pos >= 0) elementText =
143-
elementText.substring(0, pos + 1) // skip whitespace before leading asterisk
150+
if (pos >= 0) {
151+
elementText = elementText.substring(0, pos + 1) // skip whitespace before leading asterisk
152+
}
144153
}
145154
appendPlainText(this, StringUtil.escapeXmlEntities(elementText))
146155
}
@@ -169,10 +178,12 @@ class UtJavaDocInfoGenerator {
169178
return buildString {
170179
for (i in tagElements.indices) {
171180
val tagElement = tagElements[i]
172-
if (tagElement.textOffset > offset) this.append(' ')
181+
if (tagElement.textOffset > offset) {
182+
this.append(' ')
183+
}
173184
offset = tagElement.textOffset + tagElement.text.length
174185
collectElementText(this, tagElement)
175-
if (i < tagElements.size -1) {
186+
if (i < tagElements.lastIndex) {
176187
this.append(' ')
177188
}
178189
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /