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 8e940a3

Browse files
committed
Review fixes: fixed formatting, removed useless overriding methods
1 parent 814ea7e commit 8e940a3

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
@@ -1242,13 +1242,8 @@ class DocPreTagStatement(content: List<DocStatement>) : DocTagStatement(content)
12421242
override fun hashCode(): Int = content.hashCode()
12431243
}
12441244

1245-
class DocCustomTagStatement(content: List<DocStatement>) : DocTagStatement(content) {
1245+
data class DocCustomTagStatement(valstatements: List<DocStatement>) : DocTagStatement(statements) {
12461246
override fun toString(): String = content.joinToString(separator = "")
1247-
1248-
override fun equals(other: Any?): Boolean =
1249-
if (other is DocCustomTagStatement) this.hashCode() == other.hashCode() else false
1250-
1251-
override fun hashCode(): Int = content.hashCode()
12521247
}
12531248

12541249
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
@@ -332,14 +332,7 @@ class CgDocPreTagStatement(content: List<CgDocStatement>) : CgDocTagStatement(co
332332
override fun hashCode(): Int = content.hashCode()
333333
}
334334

335-
class CgCustomTagStatement(content: List<CgDocStatement>) : CgDocTagStatement(content) {
336-
override fun equals(other: Any?): Boolean =
337-
if (other is CgCustomTagStatement) {
338-
this.hashCode() == other.hashCode()
339-
} else false
340-
341-
override fun hashCode(): Int = content.hashCode()
342-
}
335+
data class CgCustomTagStatement(val statements: List<CgDocStatement>) : CgDocTagStatement(statements)
343336

344337
class CgDocCodeStmt(val stmt: String) : CgDocStatement() {
345338
override fun isEmpty(): Boolean = stmt.isEmpty()
@@ -387,7 +380,7 @@ fun convertDocToCg(stmt: DocStatement): CgDocStatement {
387380
}
388381
is DocCustomTagStatement -> {
389382
val stmts = stmt.content.map { convertDocToCg(it) }
390-
CgCustomTagStatement(content = stmts)
383+
CgCustomTagStatement(statements = stmts)
391384
}
392385
is DocRegularStmt -> CgDocRegularStmt(stmt = stmt.stmt)
393386
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
@@ -315,9 +315,9 @@ internal abstract class CgAbstractRenderer(val context: CgContext, val printer:
315315
}
316316

317317
override fun visit(element: CgCustomTagStatement) {
318-
if (element.content.all { it.isEmpty() }) return
318+
if (element.statements.all { it.isEmpty() }) return
319319

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

‎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 によって変換されたページ (->オリジナル) /