Skip to content

SemanticDB URISyntaxException #15860

Closed
@kierendavies

Description

@kierendavies

I have a source file whose name contains a colon, where the part before the colon is not a valid URI scheme according to RFC 2396. When I compile with SemanticDB enabled, compilation fails with a URISyntaxException.

Compiler version

3.2.0-RC3, 3.1.3

Minimized code

In a shell:

touch 1:a.scala
cs launch scalac:3.2.0-RC3 -- -Ysemanticdb 1:a.scala

Output

exception occurred while compiling 1:a.scala
java.net.URISyntaxException: Illegal character in scheme name at index 0: 1:a.scala while compiling 1:a.scala
Exception in thread "main" java.net.URISyntaxException: Illegal character in scheme name at index 0: 1:a.scala
	at java.base/java.net.URI$Parser.fail(URI.java:2973)
	at java.base/java.net.URI$Parser.checkChars(URI.java:3144)
	at java.base/java.net.URI$Parser.checkChar(URI.java:3154)
	at java.base/java.net.URI$Parser.parse(URI.java:3169)
	at java.base/java.net.URI.<init>(URI.java:708)
	at java.base/java.net.URI.<init>(URI.java:809)
	at dotty.tools.dotc.semanticdb.Tools$.$anonfun$1(Tools.scala:15)
	at scala.collection.StrictOptimizedIterableOps.map(StrictOptimizedIterableOps.scala:100)
	at scala.collection.StrictOptimizedIterableOps.map$(StrictOptimizedIterableOps.scala:87)
	at scala.collection.convert.JavaCollectionWrappers$JIterableWrapper.map(JavaCollectionWrappers.scala:58)
	at dotty.tools.dotc.semanticdb.Tools$.mkURIstring(Tools.scala:15)
	at dotty.tools.dotc.semanticdb.ExtractSemanticDB$.write(ExtractSemanticDB.scala:499)
	at dotty.tools.dotc.semanticdb.ExtractSemanticDB.run(ExtractSemanticDB.scala:50)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:311)
	at scala.collection.immutable.List.map(List.scala:246)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:312)
	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:234)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1328)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:245)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:253)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:262)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:262)
	at dotty.tools.dotc.Run.compileSources(Run.scala:186)
	at dotty.tools.dotc.Run.compile(Run.scala:170)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
	at dotty.tools.dotc.Driver.process(Driver.scala:195)
	at dotty.tools.dotc.Driver.process(Driver.scala:163)
	at dotty.tools.dotc.Driver.process(Driver.scala:175)
	at dotty.tools.dotc.Driver.main(Driver.scala:205)
	at dotty.tools.MainGenericCompiler$.run$1(MainGenericCompiler.scala:162)
	at dotty.tools.MainGenericCompiler$.main(MainGenericCompiler.scala:186)
	at dotty.tools.MainGenericCompiler.main(MainGenericCompiler.scala)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions