You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running scalac or scaladoc on an object or a class named "Con" (case insensitive),
the program will not be able to produce the corresponding output file (Con.class or Con.html),
but rather throw an error or crash:
X:>scalac ReservedFilename.scala
error: The system cannot find the file specified
one error found
X:>scaladoc ReservedFilename.scala
Exception in thread "main" java.io.FileNotFoundException: .\Con.html (The system cannot find the file specified)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:179)
at java.io.FileOutputStream.(FileOutputStream.java:70)
at scala.tools.nsc.doc.html.HtmlPage.writeFor(HtmlPage.scala:57)
at scala.tools.nsc.doc.html.HtmlFactory$$anonfun$generate$1.apply(HtmlFactory.scala:101)
at scala.tools.nsc.doc.html.HtmlFactory$$anonfun$generate$1.apply(HtmlFactory.scala:101)
at scala.tools.nsc.doc.html.HtmlFactory.writeTemplate$1(HtmlFactory.scala:113)
at scala.tools.nsc.doc.html.HtmlFactory$$anonfun$writeTemplate$1$1.apply(HtmlFactory.scala:115)
at scala.tools.nsc.doc.html.HtmlFactory$$anonfun$writeTemplate$1$1.apply(HtmlFactory.scala:115)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:194)
at scala.collection.immutable.List.map(List.scala:45)
at scala.tools.nsc.doc.html.HtmlFactory.writeTemplate$1(HtmlFactory.scala:115)
at scala.tools.nsc.doc.html.HtmlFactory.writeTemplates(HtmlFactory.scala:118)
at scala.tools.nsc.doc.html.HtmlFactory.generate(HtmlFactory.scala:101)
at scala.tools.nsc.doc.html.Doclet.generateImpl(Doclet.scala:10)
at scala.tools.nsc.doc.doclet.Generator.generate(Generator.scala:24)
at scala.tools.nsc.doc.DocFactory.generate$1(DocFactory.scala:117)
at scala.tools.nsc.doc.DocFactory.document(DocFactory.scala:120)
at scala.tools.nsc.ScalaDoc.process(ScalaDoc.scala:48)
at scala.tools.nsc.ScalaDoc$.main(ScalaDoc.scala:74)
at scala.tools.nsc.ScalaDoc.main(ScalaDoc.scala)
This is due to the "con" filename being a reserved one on Windows OS family (regardless of extension).
An improvement would be to detect when the filename "con" is about to be created and suggest an appropriate course of action instead of crashing. This could be anything ranging from a simple explanation (why the file cannot be created), a suggestion of renaming the object/class if possible or for instance, compiling on another OS and then packaging as a jar which would allow using the precompiled binaries on Windows.
The text was updated successfully, but these errors were encountered:
Do not use the following reserved device names for the name of a file:
CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed immediately by an extension; for example, NUL.txt is not recommended.
At least it is a finite list that could be used for better error reporting.
When running scalac or scaladoc on an object or a class named "Con" (case insensitive),
the program will not be able to produce the corresponding output file (Con.class or Con.html),
but rather throw an error or crash:
X:>scalac ReservedFilename.scala
error: The system cannot find the file specified
one error found
X:>scaladoc ReservedFilename.scala
Exception in thread "main" java.io.FileNotFoundException: .\Con.html (The system cannot find the file specified)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:179)
at java.io.FileOutputStream.(FileOutputStream.java:70)
at scala.tools.nsc.doc.html.HtmlPage.writeFor(HtmlPage.scala:57)
at scala.tools.nsc.doc.html.HtmlFactory$$anonfun$generate$1.apply(HtmlFactory.scala:101)
at scala.tools.nsc.doc.html.HtmlFactory$$anonfun$generate$1.apply(HtmlFactory.scala:101)
at scala.tools.nsc.doc.html.HtmlFactory.writeTemplate$1(HtmlFactory.scala:113)
at scala.tools.nsc.doc.html.HtmlFactory$$anonfun$writeTemplate$1$1.apply(HtmlFactory.scala:115)
at scala.tools.nsc.doc.html.HtmlFactory$$anonfun$writeTemplate$1$1.apply(HtmlFactory.scala:115)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:194)
at scala.collection.immutable.List.map(List.scala:45)
at scala.tools.nsc.doc.html.HtmlFactory.writeTemplate$1(HtmlFactory.scala:115)
at scala.tools.nsc.doc.html.HtmlFactory.writeTemplates(HtmlFactory.scala:118)
at scala.tools.nsc.doc.html.HtmlFactory.generate(HtmlFactory.scala:101)
at scala.tools.nsc.doc.html.Doclet.generateImpl(Doclet.scala:10)
at scala.tools.nsc.doc.doclet.Generator.generate(Generator.scala:24)
at scala.tools.nsc.doc.DocFactory.generate$1(DocFactory.scala:117)
at scala.tools.nsc.doc.DocFactory.document(DocFactory.scala:120)
at scala.tools.nsc.ScalaDoc.process(ScalaDoc.scala:48)
at scala.tools.nsc.ScalaDoc$.main(ScalaDoc.scala:74)
at scala.tools.nsc.ScalaDoc.main(ScalaDoc.scala)
This is due to the "con" filename being a reserved one on Windows OS family (regardless of extension).
An improvement would be to detect when the filename "con" is about to be created and suggest an appropriate course of action instead of crashing. This could be anything ranging from a simple explanation (why the file cannot be created), a suggestion of renaming the object/class if possible or for instance, compiling on another OS and then packaging as a jar which would allow using the precompiled binaries on Windows.
The text was updated successfully, but these errors were encountered: