Skip to content

Commit 1e29a19

Browse files
committed
add parentheses to all non-arg java methods
1 parent a48a3af commit 1e29a19

20 files changed

+39
-39
lines changed

presentation-compiler/src/main/dotty/tools/pc/CompilerSearchVisitor.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class CompilerSearchVisitor(
1717
)(using ctx: Context, reports: ReportContext)
1818
extends SymbolSearchVisitor:
1919

20-
val logger: Logger = Logger.getLogger(classOf[CompilerSearchVisitor].getName.nn).nn
20+
val logger: Logger = Logger.getLogger(classOf[CompilerSearchVisitor].getName().nn).nn
2121

2222
private def isAccessible(sym: Symbol): Boolean = try
2323
sym != NoSymbol && sym.isPublic && sym.isStatic

presentation-compiler/src/main/dotty/tools/pc/CompletionItemResolver.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ object CompletionItemResolver extends ItemResolver:
6060
else ""
6161
val companion = gsym.companion
6262
if companion == NoSymbol || gsym.is(JavaDefined) then
63-
if gsymDoc.isEmpty then
63+
if gsymDoc.isEmpty() then
6464
if gsym.isAliasType then
6565
fullDocstring(gsym.info.metalsDealias.typeSymbol, search)
6666
else if gsym.is(Method) then
@@ -73,8 +73,8 @@ object CompletionItemResolver extends ItemResolver:
7373
else gsymDoc
7474
else
7575
val companionDoc = docs(companion)
76-
if companionDoc.isEmpty then gsymDoc
77-
else if gsymDoc.isEmpty then companionDoc
76+
if companionDoc.isEmpty() then gsymDoc
77+
else if gsymDoc.isEmpty() then companionDoc
7878
else
7979
List(
8080
s"""|### ${keyword(companion)} ${companion.name}

presentation-compiler/src/main/dotty/tools/pc/HoverProvider.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ object HoverProvider:
7878
)
7979
end report
8080
reportContext.unsanitized.create(report, ifVerbose = true)
81-
ju.Optional.empty.nn
81+
ju.Optional.empty().nn
8282
else
8383
val skipCheckOnName =
8484
!pos.isPoint // don't check isHoveringOnName for RangeHover
@@ -146,7 +146,7 @@ object HoverProvider:
146146
)
147147
).nn
148148
case _ =>
149-
ju.Optional.empty.nn
149+
ju.Optional.empty().nn
150150
end match
151151
end match
152152
end if
@@ -189,7 +189,7 @@ object HoverProvider:
189189

190190
refTpe.flatMap(findRefinement).asJava
191191
case _ =>
192-
ju.Optional.empty.nn
192+
ju.Optional.empty().nn
193193

194194
end HoverProvider
195195

presentation-compiler/src/main/dotty/tools/pc/InferredTypeProvider.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ final class InferredTypeProvider(
6767

6868
val sourceText = adjustOpt.map(_.text).getOrElse(params.text.nn)
6969
val source =
70-
SourceFile.virtual(filePath.toString, sourceText)
70+
SourceFile.virtual(filePath.toString(), sourceText)
7171
driver.run(uri, source)
7272
val unit = driver.currentCtx.run.nn.units.head
7373
val pos = driver.sourcePosition(params)
@@ -308,7 +308,7 @@ final class InferredTypeProvider(
308308
val end = if withBacktick then idx + 1 else idx
309309
val pos = tree.source.atSpan(Span(start, end, start))
310310
Some(pos)
311-
case None if idx < text.length =>
311+
case None if idx < text.length() =>
312312
val ch = text.charAt(idx)
313313
if ch == realName.head then
314314
lookup(idx + 1, Some((idx, realName.tail)), withBacktick)

presentation-compiler/src/main/dotty/tools/pc/MetalsDriver.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class MetalsDriver(
4848

4949
override def run(uri: URI, sourceCode: String): List[Diagnostic] =
5050
val diags =
51-
if alreadyCompiled(uri, sourceCode.toCharArray.nn) then Nil
51+
if alreadyCompiled(uri, sourceCode.toCharArray().nn) then Nil
5252
else super.run(uri, sourceCode)
5353
lastCompiledURI = uri
5454
diags

presentation-compiler/src/main/dotty/tools/pc/PcCollector.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ abstract class PcCollector[T](
3737
val filePath = Paths.get(uri).nn
3838
val sourceText = params.text.nn
3939
val source =
40-
SourceFile.virtual(filePath.toString, sourceText)
40+
SourceFile.virtual(filePath.toString(), sourceText)
4141
driver.run(uri, source)
4242
given ctx: Context = driver.currentCtx
4343

presentation-compiler/src/main/dotty/tools/pc/PcDefinitionProvider.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class PcDefinitionProvider(
5454
if findTypeDef then findTypeDefinitions(path, pos, indexedContext)
5555
else findDefinitions(path, pos, indexedContext)
5656

57-
if result.locations.nn.isEmpty then fallbackToUntyped(pos)(using ctx)
57+
if result.locations.nn.isEmpty() then fallbackToUntyped(pos)(using ctx)
5858
else result
5959
end definitions
6060

presentation-compiler/src/main/dotty/tools/pc/PcInlineValueProviderImpl.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ final class PcInlineValueProviderImpl(
2727
) extends PcCollector[Occurence](driver, params)
2828
with InlineValueProvider:
2929

30-
val text = params.text.nn.toCharArray.nn
30+
val text = params.text.nn.toCharArray().nn
3131

3232
val position: l.Position = pos.toLsp.getStart.nn
3333

presentation-compiler/src/main/dotty/tools/pc/SemanticdbTextDocumentProvider.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class SemanticdbTextDocumentProvider(
2929
val validCode = removeMagicImports(sourceCode, filePath)
3030
driver.run(
3131
uri,
32-
SourceFile.virtual(filePath.toString, validCode)
32+
SourceFile.virtual(filePath.toString(), validCode)
3333
)
3434
val tree = driver.currentCtx.run.nn.units.head.tpdTree
3535
val extractor = ExtractSemanticDB.Extractor()
@@ -42,7 +42,7 @@ class SemanticdbTextDocumentProvider(
4242
if Properties.isWin then relativeUri.toString().replace("\\", "/")
4343
else relativeUri.toString()
4444
}
45-
.getOrElse(filePath.toString)
45+
.getOrElse(filePath.toString())
4646

4747
val document = TextDocument(
4848
schema = Schema.SEMANTICDB4,
@@ -57,7 +57,7 @@ class SemanticdbTextDocumentProvider(
5757
val out = SemanticdbOutputStream.newInstance(byteStream)
5858
document.writeTo(out)
5959
out.flush()
60-
byteStream.toByteArray.nn
60+
byteStream.toByteArray().nn
6161
end textDocument
6262

6363
end SemanticdbTextDocumentProvider

presentation-compiler/src/main/dotty/tools/pc/SignatureHelpProvider.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,11 @@ object SignatureHelpProvider:
175175
info
176176

177177
private def markupContent(content: String): l.MarkupContent | Null =
178-
if content.isEmpty then null
178+
if content.isEmpty() then null
179179
else
180180
val markup = new l.MarkupContent
181181
markup.setKind("markdown")
182-
markup.setValue(content.trim)
182+
markup.setValue(content.trim())
183183
markup
184184

185185
end SignatureHelpProvider

presentation-compiler/src/main/dotty/tools/pc/TastyUtils.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ object TastyUtils:
4040
end htmlTasty
4141

4242
private def tastyHtmlPageTitle(file: URI) =
43-
val filename = Paths.get(file).nn.getFileName.toString
43+
val filename = Paths.get(file).nn.getFileName().toString
4444
s"TASTy for $filename"
4545

4646
private val standaloneHtmlStyles =

presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteFileCompletions.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,32 +63,32 @@ object AmmoniteFileCompletions:
6363
)
6464

6565
def matches(file: Path): Boolean =
66-
(Files.isDirectory(file) || file.toAbsolutePath.toString.isAmmoniteScript) &&
67-
query.exists(q => CompletionFuzzy.matches(q.nn, file.getFileName.toString))
66+
(Files.isDirectory(file) || file.toAbsolutePath().toString.isAmmoniteScript) &&
67+
query.exists(q => CompletionFuzzy.matches(q.nn, file.getFileName().toString))
6868

6969
(split, workspace) match
7070
case (_ :: script :: Nil, Some(workspace)) =>
7171
// drop / or \
7272
val current = workspace.resolve(script.drop(1))
7373
val importPath = translateImportToPath(select).drop(1)
74-
val currentPath = current.nn.getParent.nn.resolve(importPath).nn.toAbsolutePath
74+
val currentPath = current.nn.getParent().nn.resolve(importPath).nn.toAbsolutePath()
7575
val parentTextEdit =
7676
if query.exists(_.nn.isEmpty()) &&
77-
Files.exists(currentPath.nn.getParent) && Files.isDirectory(
77+
Files.exists(currentPath.nn.getParent()) && Files.isDirectory(
7878
currentPath
7979
)
8080
then List(parent)
8181
else Nil
8282
Files
8383
.list(currentPath).nn
84-
.iterator.nn
84+
.iterator().nn
8585
.asScala
8686
.toList
87-
.filter(path => !fileName.contains(path.nn.getFileName.toString.stripSuffix(".sc")))
87+
.filter(path => !fileName.contains(path.nn.getFileName().toString.stripSuffix(".sc")))
8888
.collect {
8989
case file if matches(file) =>
9090
CompletionValue.FileSystemMember(
91-
file.getFileName.toString,
91+
file.getFileName().toString,
9292
editRange,
9393
isDirectory = Files.isDirectory(file)
9494
)

presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteIvyCompletions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ object AmmoniteIvyCompletions:
2323
case None => Nil
2424
case Some(dependency) =>
2525
val isInitialCompletion =
26-
pos.lineContent.trim == "import $ivy."
26+
pos.lineContent.trim() == "import $ivy."
2727
val ivyEditRange =
2828
if isInitialCompletion then completionPos.toEditRange
2929
else

presentation-compiler/src/main/dotty/tools/pc/completions/CompletionPos.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ object CompletionPos:
5656
val prevIsDot =
5757
if start - 1 >= 0 then text.charAt(start - 1) == '.' else false
5858
val kind =
59-
if query.nn.isEmpty && !prevIsDot then CompletionKind.Empty
59+
if query.nn.isEmpty() && !prevIsDot then CompletionKind.Empty
6060
else if prevIsDot then CompletionKind.Members
6161
else CompletionKind.Scope
6262

@@ -74,7 +74,7 @@ object CompletionPos:
7474
): (Int, Boolean) =
7575
var i = 0
7676
var tabIndented = false
77-
while lineOffset + i < text.length && {
77+
while lineOffset + i < text.length() && {
7878
val char = text.charAt(lineOffset + i)
7979
if char == '\t' then
8080
tabIndented = true
@@ -126,7 +126,7 @@ object CompletionPos:
126126
*/
127127
private def inferIdentEnd(pos: SourcePosition, text: String): Int =
128128
var i = pos.point
129-
while i < text.length && Chars.isIdentifierPart(text.charAt(i)) do i += 1
129+
while i < text.length() && Chars.isIdentifierPart(text.charAt(i)) do i += 1
130130
i
131131

132132
end CompletionPos

presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class Completions(
8787
def hasSyntheticCursorSuffix: Boolean =
8888
if !sym.name.endsWith(Cursor.value) then false
8989
else
90-
val realNameLength = sym.decodedName.length - Cursor.value.length
90+
val realNameLength = sym.decodedName.length() - Cursor.value.length()
9191
sym.source == pos.source &&
9292
sym.span.start + realNameLength == pos.span.end
9393

@@ -571,7 +571,7 @@ class Completions(
571571
val nameId =
572572
if sym.isClass || sym.is(Module) then
573573
// drop #|. at the end to avoid duplication
574-
name.substring(0, name.length - 1).nn
574+
name.substring(0, name.length() - 1).nn
575575
else name
576576
val suffix =
577577
if symOnly.snippetSuffix.addLabelSnippet then "[]" else ""
@@ -693,7 +693,7 @@ class Completions(
693693
if !ov.symbol.is(Deferred) then penalty |= MemberOrdering.IsNotAbstract
694694
penalty
695695
case CompletionValue.Workspace(_, sym, _, _) =>
696-
symbolRelevance(sym) | (IsWorkspaceSymbol + sym.name.show.length)
696+
symbolRelevance(sym) | (IsWorkspaceSymbol + sym.name.show.length())
697697
case sym: CompletionValue.Symbolic =>
698698
symbolRelevance(sym.symbol)
699699
case _ =>
@@ -782,7 +782,7 @@ class Completions(
782782
def fuzzyScore(o: CompletionValue.Symbolic): Int =
783783
fuzzyCache.getOrElseUpdate(
784784
o, {
785-
val name = o.label.toLowerCase.nn
785+
val name = o.label.toLowerCase().nn
786786
if name.startsWith(queryLower) then 0
787787
else if name.contains(queryLower) then 1
788788
else 2

presentation-compiler/src/main/dotty/tools/pc/completions/InterpolatorCompletions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ object InterpolatorCompletions:
3535
config: PresentationCompilerConfig,
3636
buildTargetIdentifier: String
3737
)(using Context, ReportContext) =
38-
InterpolationSplice(pos.span.point, text.toCharArray.nn, text) match
38+
InterpolationSplice(pos.span.point, text.toCharArray().nn, text) match
3939
case Some(interpolator) =>
4040
InterpolatorCompletions.contributeScope(
4141
text,

presentation-compiler/src/main/dotty/tools/pc/completions/KeywordsCompletions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ object KeywordsCompletions:
2626
checkIfNotInComment(completionPos.cursorPos, comments)
2727

2828
path match
29-
case Nil if completionPos.query.isEmpty =>
29+
case Nil if completionPos.query.isEmpty() =>
3030
Keyword.all.collect {
3131
// topelevel definitions are allowed in Scala 3
3232
case kw if (kw.isPackage || kw.isTemplate) && notInComment =>

presentation-compiler/src/main/dotty/tools/pc/completions/OverrideCompletions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ object OverrideCompletions:
175175

176176
val uri = params.uri.nn
177177
val text = params.text.nn
178-
driver.run(uri, SourceFile.virtual(uri.toASCIIString.nn, text))
178+
driver.run(uri, SourceFile.virtual(uri.toASCIIString().nn, text))
179179

180180
val unit = driver.currentCtx.run.nn.units.headOption
181181
unit match

presentation-compiler/src/main/dotty/tools/pc/printer/ShortenedTypePrinter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ class ShortenedTypePrinter(
503503
if includeDefaultParam == ShortenedTypePrinter.IncludeDefaultParam.Include && isDefaultParam
504504
then
505505
val defaultValue = docInfo match
506-
case Some(value) if !value.defaultValue.nn.isEmpty =>
506+
case Some(value) if !value.defaultValue.nn.isEmpty() =>
507507
value.defaultValue()
508508
case _ => "..."
509509
s" = $defaultValue"

presentation-compiler/src/main/dotty/tools/pc/utils/MtagsEnrichments.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ object MtagsEnrichments extends CommonMtagsEnrichments:
101101
for
102102
uri <- InteractiveDriver.toUriOption(pos.source)
103103
range <- if pos.exists then Some(pos.toLsp) else None
104-
yield new l.Location(uri.toString, range)
104+
yield new l.Location(uri.toString(), range)
105105

106106
def encloses(other: SourcePosition): Boolean =
107107
pos.start <= other.start && pos.end >= other.end

0 commit comments

Comments
 (0)