summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/io
Commit message (Collapse)AuthorAgeFilesLines
* SI-9632 don't keep JarFile open in ZipArchiveSam Halliday2017-02-221-18/+58
|
* fix doc for walkfilter and walkMartijn Hoekstra2017-01-051-6/+7
|
* Support Java 9 modular runtime imagesJason Zaugg2016-12-021-1/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | http://openjdk.java.net/jeps/220 changes the layout of the JDK to encapsulate the provided libraries with the new module system. This commit modifies the compiler's classpath implementation to scan the new location of these, the `jrt://` virtual filesystem. This might need to be adjusted once we provide a means for users to specify the subset of modules that they want to depend on, but for now reclaims the ground we lost. ``` ⚡ (java_use 9-ea; qscala) Welcome to Scala 2.12.0-20160908-223617-7e4ebda (Java HotSpot(TM) 64-Bit Server VM, Java 9-ea). Type in expressions for evaluation. Or try :help. scala> import StackWalker._, java.util.stream._, scala.collection.JavaConverters._ import StackWalker._ import java.util.stream._ import scala.collection.JavaConverters._ scala> (() => StackWalker.getInstance(java.util.EnumSet.of(Option.RETAIN_CLASS_REFERENCE)).walk[Seq[String]]((s: java.util.stream.Stream[StackFrame]) => s.iterator.asScala.take(3).map(_.toString).toList)).apply().mkString("\n") res0: String = .$anonfun$res0$1(<console>:21) .<init>(<console>:21) .<clinit>(<console>) scala> ``` I've marked the new class, `NioFile` as `private[scala]` to justify the forward compatibility whitelist entry. In principle we could use NioFile more widely rather than `PlainFile` I tried this out in https://github.com/retronym/scala/commit/b2d0a17a which passed CI. But to be conservative, I'm not submitting that change at this point.
* SI-9684 Deprecate JavaConversionsSom Snytt2016-04-221-2/+2
| | | | | | | | | Implicit conversions are now in package convert as ImplicitConversions, ImplicitConversionsToScala and ImplicitConversionsToJava. Deprecated WrapAsJava, WrapAsScala and the values in package object. Improve documentation.
* Remove unused imports and other minor cleanupsSimon Ochsenreither2015-12-186-17/+9
| | | | | | | | | | - Language imports are preceding other imports - Deleted empty file: InlineErasure - Removed some unused private[parallel] methods in scala/collection/parallel/package.scala This removes hundreds of warnings when compiling with "-Xlint -Ywarn-dead-code -Ywarn-unused -Ywarn-unused-import".
* add comments warning of InputStream leaks in scala.io.reflectSeth Tisue2015-09-251-0/+8
|
* Cleanup and refactoring - semicolons, unused or commented out codempociecha2014-12-052-16/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit contains some minor changes made by the way when implementing flat classpath. Sample JUnit test that shows that all pieces of JUnit infrastructure work correctly now uses assert method form JUnit as it should do from the beginning. I removed commented out lines which were obvious to me. In the case of less obvious commented out lines I added TODOs as someone should look at such places some day and clean them up. I removed also some unnecessary semicolons and unused imports. Many string concatenations using + have been changed to string interpolation. There's removed unused, private walkIterator method from ZipArchive. It seems that it was unused since this commit: https://github.com/scala/scala/commit/9d4994b96c77d914687433586eb6d1f9e49c520f However, I had to add an exception for the compatibility checker because it was complaining about this change. I made some trivial corrections/optimisations like use 'findClassFile' method instead of 'findClass' in combination with 'binary' to find the class file.
* Add flat classpath implementation for zip and jar filesmpociecha2014-11-301-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds an implementation of flat classpath which can handle both jar and vanilla zip files. In fact there are two versions - for a class- and a sourcepath. Both extend ZipArchiveFileLookup which provides common logic. They use FileZipArchive. @gkossakowski made a comparison of different ways of handling zips and jars (e.g. using javac's ZipFileIndex). He stated that general efficiency of FileZipArchive, taking into account various parameters, is the best. FileZipArchive is slightly changed. From now it allows to find the entry for directory in all directory entries without iterating all entries regardless of a type. Thanks to that we can simply find a directory for a package - like in the case of DirectoryFileLookup. There's also added possibility to cache classpath representation of classpath elements from jar and zip files across compiler instances. The cache is just a map AbstractFile -> FlatClassPath. It should reduce the number of created classpath and file instances e.g. in the case of many ScalaPresentationCompilers in Scala IDE. To prevent the possibility to avoid a cache, caches are created as a part of factories responsible for the creation of these types of the flat classpath.
* SI-6502 Refactorings suggested by reviewHeather Miller2014-11-101-7/+9
| | | | | - Moves mergeUrlsIntoClassPath from Global into ClassPath - Revises and documents AbstractFile.getURL
* SI-7044 deprecates Symbol.associatedFileEugene Burmako2014-02-151-0/+1
| | | | | | | | | | | | | | | | | | | | Before this commit, Symbol.associatedFile used to be broken in two ways. Firstly, it was never autoloaded (just like we used to have flags, privateWithin and annotations). Secondly, it was never filled in by runtime reflection. My first attempt at fixing those problems was, well, just fixing them. However, its runtime implementation was based on a hacky function that we were not very much excited about supported (see comments), whereas its compile-time usefulness was somewhat questionable. Therefore the second attempt at fixing this bug is deprecating the API altogether, replacing it with `Symbol.pos.source`. Since `Symbol.pos` isn't retained for runtime consumption, `Symbol.pos.source` is still going to return `NoAbstractFile` as before this commit, but that's left for future work, and suggested approach is documented in SI-8259.
* A better diagnostic error for corrupt or missing JARs.Jason Zaugg2013-08-271-1/+5
| | | | | | | | | | | | | Augment the IOException with the name of the file we're trying to open. Motivated by a troubleshooting session with partial downloads of JARs from Maven central breaking the Scala build on Martin's laptop. The test case only tests our part of the error message, so as not to be platform / JDK specific. Otherwise, it would check that the correct cause exception was present and accounted for.
* Merge pull request #2399 from rjolly/scripting8Jason Zaugg2013-05-151-1/+1
|\ | | | | AbstractFile.getDirectory does not return null when outDir is "."
| * AbstractFile.getDirectory does not return null when outDir is "."Raphael Jolly2013-04-221-1/+1
| |
* | Absolutized paths involving the scala package.Paul Phillips2013-05-0312-23/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Confusing, now-it-happens now-it-doesn't mysteries lurk in the darkness. When scala packages are declared like this: package scala.collection.mutable Then paths relative to scala can easily be broken via the unlucky presence of an empty (or nonempty) directory. Example: // a.scala package scala.foo class Bar { new util.Random } % scalac ./a.scala % mkdir util % scalac ./a.scala ./a.scala:4: error: type Random is not a member of package util new util.Random ^ one error found There are two ways to play defense against this: - don't use relative paths; okay sometimes, less so others - don't "opt out" of the scala package This commit mostly pursues the latter, with occasional doses of the former. I created a scratch directory containing these empty directories: actors annotation ant api asm beans cmd collection compat concurrent control convert docutil dtd duration event factory forkjoin generic hashing immutable impl include internal io logging macros man1 matching math meta model mutable nsc parallel parsing partest persistent process pull ref reflect reify remote runtime scalap scheduler script swing sys text threadpool tools transform unchecked util xml I stopped when I could compile the main src directories even with all those empties on my classpath.
* | Eliminate a pile of -Xlint warnings.Paul Phillips2013-04-232-3/+7
|/ | | | | | Some unused private code, unused imports, and points where an extra pair of parentheses is necessary for scalac to have confidence in our intentions.
* Optimization: avoid call to exists in PlainFile#iteratorJason Zaugg2013-03-291-1/+7
| | | | | | | | | | | | | | | | | If we just established that the given path is a File or a Directory, we can assume it continues to exist. Before ---------------------------------- File.isFile calls : 7620 File.isDirectory calls : 2319 File.exists calls : 5770 After ---------------------------------- File.isFile calls : 7620 File.isDirectory calls : 2319 File.exists calls : 345
* Add counters to File#{exists, isFile, isDirectory}.Jason Zaugg2013-03-293-6/+61
| | | | | | | | | | | | | | | | | | | | | | | Due to limitations in the Statistics machinery, these are only reported if this patch is applied. --- a/src/reflect/scala/reflect/internal/util/Statistics.scala +++ b/src/reflect/scala/reflect/internal/util/Statistics.scala @@ -109,7 +109,7 @@ quant) * Quantities with non-empty prefix are printed in the statistics info. */ trait Quantity { - if (enabled && prefix.nonEmpty) { + if (prefix.nonEmpty) { val key = s"${if (underlying != this) underlying.prefix else ""}/$prefix" qs(key) = this } @@ -243,7 +243,7 @@ quant) * * to remove all Statistics code from build */ - final val canEnable = _enabled + final val canEnable = true // _enabled
* Bypass determination of protection domain when resource is not in a jarRaphael Jolly2013-03-221-1/+5
|
* Merge pull request #2238 from adriaanm/pr-2206-rebasedAdriaan Moors2013-03-123-15/+90
|\ | | | | [rebase of #2206] l JSR-223 compliance for the interpreter
| * SI-874 reflect.io improvementsRaphael Jolly2013-03-113-15/+90
| |
* | Close after slurping (fixes SI-7244)Som Snytt2013-03-111-1/+4
|/ | | | | | | | Since slurp by definition is the noise made by the straw when the cup is empty and all milk shake is consumed, we can safely close after slurping. Use case was deleting a test artifact on Windows.
* Name boolean arguments in src/reflect.Jason Zaugg2013-03-054-7/+7
|
* Don't wrap an array just to get its length.Jason Zaugg2013-02-251-1/+1
| | | | Use .length directly, avoiding the allocation of the WrappedArray.
* More explicit empty paren lists in method calls.Jason Zaugg2013-02-245-16/+18
|
* Banish needless semicolons.Jason Zaugg2013-02-242-2/+2
|
* adds c.introduceTopLevelEugene Burmako2013-01-054-1/+9
| | | | | | | | | | | | | | | | | | | The first in the family of mutators for the global symbol table, `introduceTopLevel` is capable of creating synthetic top-level classes and modules. The addition of nme.EMPTY_PACKAGE_NAME is necessary to let programmers insert definitions into the empty package. That's explicitly discouraged in the docs, but at times might come in handy. This patch introduce workarounds to avoid incompatibilities with SBT. First of all SBT doesn't like VirtualFiles having JFile set to null. Secondly SBT gets confused when someone depends on synthetic files added by c.introduceTopLevel. Strictly speaking these problems require changes to SBT, and that will be done later. However the main target of the patch is paradise/macros, which needs to be useful immediately, therefore we apply workarounds.
* Members removed from scala.reflect.io.Paul Phillips2012-11-199-189/+20
| | | | | Mostly hailing from a long-ago day when I imagined I was writing a general purpose library. We dodged that bullet.
* Removing ancient comments and pointless comments.Paul Phillips2012-11-192-26/+9
| | | | | | | | | | Translating <code></code> into backticks. Removed the "@param tree ..." blocks which have been taunting me for half a decade now. Removed commented-out blocks of code which had been sitting there for two years or more.
* Revert "Commenting out unused members."Paul Phillips2012-11-199-104/+104
| | | | This reverts commit 951fc3a486.
* Commenting out unused members.Paul Phillips2012-11-199-104/+104
| | | | | | | | | | | | | | | | | | I want to get this commit into the history because the tests pass here, which demonstrates that every commented out method is not only unnecessary internally but has zero test coverage. Since I know (based on the occasional source code comment, or more often based on knowing something about other source bases) that some of these can't be removed without breaking other things, I want to at least record a snapshot of the identities of all these unused and untested methods. This commit will be reverted; then there will be another commit which removes the subset of these methods which I believe to be removable. The remainder are in great need of tests which exercise the interfaces upon which other repositories depend.
* Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013Heather Miller2012-11-0211-11/+11
|
* Fixes SI-6305 scala.tools.nsc.io split between jars.Josh Suereth2012-09-1811-0/+1515
* migrates scala.tools.nsc.io portions into scala.reflect.io * marks all classes in scala.reflect.io experimental/internal * rewires src/reflect to use new io locations * creates forwarders in scala.tools.nsci.io package object.