summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/util
Commit message (Collapse)AuthorAgeFilesLines
* Fix typos in compiler and reflectJanek Bogucki2017-02-131-1/+1
| | | | | | | | | | | | Miscellania: Miscellania is a small island off the northernmost part of the Fremennik Isles - RunScape Wiki Miscellanea: A collection of miscellaneous objects or writings - Merriam-Webster
* Merge pull request #5276 from som-snytt/issue/9750Seth Tisue2016-10-261-27/+17
|\ | | | | SI-9750 scala.util.Properties.isJavaAtLeast works with JDK9
| * SI-9750 Remove isJavaAtLeast from util.StackTracingSom Snytt2016-07-291-27/+17
| | | | | | | | | | Formatting suppressed exceptions required reflection for platform compatibility. No longer, since Java 8 is assumed. Minor tidying.
* | Reduce deprecations and warningsSimon Ochsenreither2016-08-021-6/+6
|/
* Debug flag to print a summary of the inliner's workLukas Rytz2016-05-241-1/+1
| | | | | | | | | | | | | | | | | | | Example output below. Note that inlining List.map fails because the trait forwarder uses `INVOKESPECIAL` for now, will change with pr 5177. $ cat Test.scala class C { def foo = Map(1 -> 'a', 2 -> 'b') def bar(l: List[Int]) = l.map(_ + 1) } $ qsc -Yopt-log-inline _ -Yopt:l:classpath Test.scala Inlining into C.foo (initially 36 instructions, ultimately 72): - Inlined scala/Predef$ArrowAssoc$.$minus$greater$extension (8 instructions) 2 times: the callee is annotated `@inline` Inlining into C.bar (initially 12 instructions, ultimately 12): - Failed to inline scala/collection/immutable/List.map (the callee is a higher-order method, the argument for parameter (bf: Function1) is a function literal): The callee scala/collection/immutable/List::map(Lscala/Function1;Lscala/collection/generic/CanBuildFrom;)Ljava/lang/Object; contains the instruction INVOKESPECIAL scala/collection/TraversableLike.map (Lscala/Function1;Lscala/collection/generic/CanBuildFrom;)Ljava/lang/Object; that would cause an IllegalAccessError when inlined into class C.
* Merge pull request #5112 from lrytz/dropRecursiveClasspathJason Zaugg2016-05-052-380/+65
|\ | | | | Remove legacy recursive classpath implementation
| * Remove abstraction layer in classpath implementationLukas Rytz2016-05-022-57/+55
| |
| * remove recursive classpath implementationLukas Rytz2016-04-232-332/+19
| |
* | SI-9684 Deprecate JavaConversionsSom Snytt2016-04-221-4/+3
|/ | | | | | | | | Implicit conversions are now in package convert as ImplicitConversions, ImplicitConversionsToScala and ImplicitConversionsToJava. Deprecated WrapAsJava, WrapAsScala and the values in package object. Improve documentation.
* Support :require when using the flat classpath representation.Lukas Rytz2016-03-222-8/+22
| | | | | | :require was re-incarnated in https://github.com/scala/scala/pull/4051, it seems to be used by the spark repl. This commit makes it work when using the flat classpath representation.
* Merge pull request #4727 from SethTisue/unset-stray-execute-bitsSeth Tisue2015-09-141-0/+0
|\ | | | | unset inappropriate execute bits
| * unset inappropriate execute bitsSeth Tisue2015-09-021-0/+0
| | | | | | | | | | | | | | | | | | | | I imagine these date back to old Subversion days and are probably the result of inadvertent commits from Windows users with vcs client configs. having the bit set isn't really harmful most of the time, but it's just not right, and it makes the files stand out in directory listings for no reason
* | Update Java and Sun URLs to replacement Java and Oracle URLsJanek Bogucki2015-09-021-1/+1
|/ | | | | | | For each URL - Where it redirected the target of the redirection was used - Where is no longer existed a replacement was selected
* ScalaDoc fixes for compilerJanek Bogucki2015-07-291-2/+2
|
* Fix 25 typos (g-i)Janek Bogucki2015-06-221-1/+1
|
* Fix many typos in docs and commentsmpociecha2014-12-141-1/+1
| | | | | | | | | | | | | This commit corrects many typos found in scaladocs, comments and documentation. It should reduce a bit number of PRs which fix one typo. There are no changes in the 'real' code except one corrected name of a JUnit test method and some error messages in exceptions. In the case of typos in other method or field names etc., I just skipped them. Obviously this commit doesn't fix all existing typos. I just generated in IntelliJ the list of potential typos and looked through it quickly.
* Create base classpath factory and an implementation for the flat cpmpociecha2014-11-301-26/+7
| | | | | | | | | | | | The part of the functionality of a ClassPathContext has been moved to the base trait ClassPathFactory so it can be reused by the newly created FlatClassPathFactory. This new implementation works in similar manner as the ClassPathContext with this difference that it just creates instances of flat classpath. This change doesn't modify the behaviour of the compiler as the interface and the way ClassPathContext works didn't change. Moreover FlatClassPathFactory is currently unused.
* Use new asClassPathString method and create FileUtils for classpathmpociecha2014-11-302-32/+32
| | | | | | | | | | | | | | The method asClasspathString is now deprecated. Moreover it's moved to ClassFileLookup in the case someone was using it in some project (an alternative classpath also will support it - just in the case). All its usages existing in Scala sources are changed to asClassPathString method. The only difference is the name. Some operations on files or their names are moved from ClassPath to the newly created FileUtils dedicated to classpath. It will be possible to reuse them when implementing an alternative classpath representation. Moreover such allocation-free extension methods like the one added in this commit will improve the readability.
* Abstract over ClassPath and ClassRepmpociecha2014-11-282-17/+68
| | | | | | | | | | | | | | | | | | | | | | This commit is intended to create the possibility to plug in into the compiler an alternative classpath representation which would be possibly more efficient, use less memory etc. Such an implementation - at least at the beginning - should exist next to the currently existing one and be possible to turn on using a flag. Several places in the compiler have a direct dependency on the classpath implementation. Examples include backend's icode generator and reader, SymbolLoaders, ClassfileParser. After closer inspection, one realizes that all those places depend only on a very small subset of classpath logic: they need to lookup classes from classpath. Hence there's introduced ClassFileLookup trait that encapsulates that functionality. The ClassPath extends that trait and an alternative one also must do it. There's also added ClassRepresentation - the base trait for ClassRep (the inner class of ClassPath). Thanks to that the compiler uses a type which is not directly related to the particular classpath representation as it was doing until now.
* SI-6502 Refactorings suggested by reviewHeather Miller2014-11-101-1/+18
| | | | | - Moves mergeUrlsIntoClassPath from Global into ClassPath - Revises and documents AbstractFile.getURL
* Rename ClassPath.findSourceFile to ClassPath.findClassFileGrzegorz Kossakowski2014-09-241-1/+1
| | | | | | | If you look at the implementation of that method and its usage its clear that it should have been named `findClassFile` from the beginning because that's what it does: find a class file and not a source file.
* Use Enumeration for MultiChoiceSettingSom Snytt2014-09-051-1/+1
| | | | | | | | | | | This is pretty easy, since a ValueSet is a BitSet. When the setting is updated, recompute the current set of values, which is cheap and succinct. Checking a flag is also easy and fast. Choices in MultiChoiceSettings may enable other choices.
* -Ystatistics accepts a list of phases, cleanups in MultiChoiceSettingLukas Rytz2014-09-021-3/+1
| | | | | MultiChoiceSetting and Xlint with its deprecated aliases is now a bit simpler, but there's still room for improvement, as noted in comments.
* SI-7933 REPL javax.script eval is cached resultRaphael Jolly2014-01-311-1/+12
| | | | | | | The problem is that the repl underneath the script engine evaluates input to val res0..resN, so it is a one shot operation. To allow repetition, compile(script) now returns a CompiledScript object whose eval method can be called any number of times.
* SI-8015 Count lines by EOLsSom Snytt2014-01-081-9/+17
| | | | | | | | Source lines were counted by "line break chars", including FF. Clients of `pos.line` seem to all expect the ordinary line num, so that is what they get. Unicode processing now precedes line ending processing.
* Removing deprecated code.Paul Phillips2013-11-181-32/+3
| | | | | Code which has been deprecated since 2.10.0 and which allowed for straightforward removal.
* Make parameters to implicit value classes privateJason Zaugg2013-11-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So that they aren't offered as an autocomplete suggestion: implicit class Shouty(string: String) extends AnyVal { def SHOUT_! = string.toUpperCase + "!" } "". // autocompletion offers `.string` here The original incarnation of value classes didn't allow this sort of encapsulation, so we either invented goofy names like `__thingToAdd` or just picked `x` or `self`. But SI-7859 has delivered us the freedom to keep the accessor private. Should we keep any of these accessors around in a deprecated form? The implicit classes in Predef were added in 2.11.0-M2 (c26a8db067e4f), so they are okay. I think we can make reason that these APIs were both accidental and unlikely to be interpreted as public, so we can break them immediately. scala> Left(1).x res0: scala.util.Either[Int,Int] = Left(1) scala> import concurrent.duration._ import concurrent.duration._ scala> 1.n res1: Int = 1
* move fresh name creator into scala.reflect.internal.utilDen Shabalin2013-10-181-40/+0
|
* Merge pull request #2977 from ↵Jason Zaugg2013-10-031-3/+1
|\ | | | | | | | | sjrd/topic/remove-classpath-logic-dependent-on-inline Don't avoid to load trait impl .class without inliner.
| * Don't avoid to load trait impl .class without inliner.Sébastien Doeraene2013-09-191-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the inliner is on, it is necessary to load class files containing the implementation of traits, i.e., those ending in $class.class. This is needed to be able to inline these methods. However it is useless if the inliner is disabled. The previous logic avoided to put these files on the classpath when the inliner was off. However, this complicates things, and it makes the classpath mechanism dependent on something totally unrelated. On this basis, this commit removes that logic, and instead trait impl .class files are always kept on the classpath.
* | Removing unused code.Paul Phillips2013-10-022-6/+2
| | | | | | | | | | | | | | Most of this was revealed via -Xlint with a flag which assumes closed world. I can't see how to check the assumes-closed-world code in without it being an ordeal. I'll leave it in a branch in case anyone wants to finish the long slog to the merge.
* | Move logic checking valid names from ClassPath to ClassPathContextSébastien Doeraene2013-09-231-3/+9
|/ | | | | | | | | | | | | Other methods taking the same kind of decisions were already in ClassPathContext, e.g., isValidName() or, in some sense, even toBinaryName(). This makes ClassPath itself be completely agnostic of how particular kinds of files or directories are named. It also allows to override this logic at the context level. Without it, overriding this logic required a fair amount of code duplication from ClassPath.
* SI-7781 REPL stack trunc shows causeSom Snytt2013-09-022-7/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The handy stack trace truncation in REPL doesn't show cause like a regular trace. This commit fixes that and also adds the usual indicator for truncation, viz, "... 33 more". The example from the ticket produces: ``` scala> rewrapperer java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: Point of failure at .rewrapper(<console>:9) at .rewrapperer(<console>:10) ... 32 elided Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Point of failure at .wrapper(<console>:8) ... 34 more Caused by: java.lang.RuntimeException: Point of failure at .sample(<console>:7) ... 35 more ``` Suppressed exceptions on Java 7 are handled reflectively. ``` java.lang.RuntimeException: My problem at scala.tools.nsc.util.StackTraceTest.repressed(StackTraceTest.scala:56) ... 27 elided Suppressed: java.lang.RuntimeException: Point of failure at scala.tools.nsc.util.StackTraceTest.sample(StackTraceTest.scala:29) at scala.tools.nsc.util.StackTraceTest.repressed(StackTraceTest.scala:54) ... 27 more ```
* Merge remote-tracking branch 'scala/2.10.x'Grzegorz Kossakowski2013-08-291-2/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After the merge, the test/run/t7733 started to fail on Jenkins. I tried to reproduce it locally but I couldn't so I think it's system dependent failure. Per @retronym's suggestion I moved it to pending to not block the whole merge. Conflicts: bincompat-backward.whitelist.conf bincompat-forward.whitelist.conf src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala src/compiler/scala/tools/nsc/typechecker/Macros.scala src/compiler/scala/tools/nsc/typechecker/Namers.scala src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala src/compiler/scala/tools/nsc/typechecker/RefChecks.scala src/compiler/scala/tools/nsc/util/MsilClassPath.scala src/compiler/scala/tools/reflect/ToolBoxFactory.scala src/reflect/scala/reflect/internal/ClassfileConstants.scala src/reflect/scala/reflect/internal/Importers.scala src/reflect/scala/reflect/internal/Trees.scala src/reflect/scala/reflect/runtime/JavaMirrors.scala test/files/run/macro-duplicate/Impls_Macros_1.scala test/files/run/t6392b.check test/files/run/t7331c.check
| * [nomaster] SI-7733 reflective packages now more consistent with scalacEugene Burmako2013-08-132-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously PackageScopes from scala.reflect ignored all classes that had $'s in non-rightmost positions in their names. Unfortunately this behaviour is inconsistent with how scalac does things, and I reconciled this as usual, by pulling corresponding logic into scala-reflect.jar and sharing it between runtime reflection and compiler. This change has seprate pull requests for 2.10.x and 2.11.0. The latter deprecates `scala.tools.nsc.util.ClassPath.isTraitImplementation` whereas the former (which you're looking at right now) does not, because we can't deprecated members in minor releases.
* | SI-7740 Trim stack trace before printing in REPLChristoffer Sawicki2013-08-191-0/+9
| |
* | SI-7681 Clean up scala.reflect.internal.util.TableDefSimon Ochsenreither2013-07-201-6/+0
| | | | | | | | ... now that scala.tools.nsc.Phases is gone.
* | Merge pull request #2718 from soc/SI-7592-multihashmapAdriaan Moors2013-07-121-9/+0
|\ \ | | | | | | SI-7592 Remove scala.tools.nsc.util.MultiHashMap
| * | SI-7592 Remove scala.tools.nsc.util.MultiHashMapSimon Ochsenreither2013-07-101-9/+0
| | |
* | | adds the lookahead routine to the parserDen Shabalin2013-07-081-10/+21
|/ / | | | | | | | | | | | | | | | | Introduces a scoping operator used to temporarily look into the future. Backs up scanner data before evaluating a block and restores it after. Not used anywhere, only necessary for the upcoming quasiquote patch in order to reliably detect and accordingly process holes in quasiquoted Scala syntax.
* | Merge pull request #2663 from soc/SI-7592Adriaan Moors2013-07-011-64/+0
|\ \ | | | | | | SI-7592 Replace s.t.n.u.TreeSet with s.c.m.TreeSet
| * | SI-7592 Replace s.t.n.u.TreeSet with s.c.m.TreeSetSimon Ochsenreither2013-06-191-64/+0
| | | | | | | | | | | | | | | | | | | | | This means - migrating usages from the compiler-specific implementation to the one in the standard library - removing the now unused compiler-specific implementation
* | | SI-7591 Make s.t.p.n.ConsoleRunner use s.t.c.CommandLineSimon Ochsenreither2013-07-011-98/+0
| | | | | | | | | | | | | | | | | | | | | Before this change s.t.n.u.CommandLine was used instead. Remove command-line options --ansi, --buildmanager, --show-log which don't have any effect and don't seem to be used anywhere.
* | | Remove dependency on combinators from CommandLinerParser.Adriaan Moors2013-06-251-45/+4
|/ / | | | | | | | | | | | | tools.cmd.CommandLineParser uses a small hand-rolled parser TODO: replace partest's usage of scala.tools.nsc.util.CommandLine by scala.tools.cmd.CommandLine
* | Revert "SI-6039 Harden against irrelevant filesystem details"Paul Phillips2013-05-311-2/+0
| | | | | | | | | | | | | | | | This reverts commit b0758f5cb9d966b940933d48bdbb45d17a80de66. This commit sent startup time through the roof, at least in some circumstances (it is presumably related to one's current working directory.)
* | Make all numeric coercions explicit.Paul Phillips2013-05-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Optimistically, this is preparation for a day when we don't let numeric types drift with the winds. Even without the optimism it's a good idea. It flushed out an undocumented change in the math package object relative to the methods being forwarded (a type is widened from what is returned in java) so I documented the intentionality of it. Managing type coercions manually is a bit tedious, no doubt, but it's not tedious enough to warrant abandoning type safety just because java did it.
* | Moves AbstractFileClassLoader to scala-reflect.jarEugene Burmako2013-05-203-246/+9
| | | | | | | | | | | | | | | | | | Its string name was used in ReflectionUtils and became broken after repl got factored out. This hints that that classloader belongs to where it is used, i.e. to scala-reflect.jar. Moreover AbstractFile is defined in scala-reflect.jar, so it's only logical to also define a derived classloader in scala-reflect.jar.
* | SI-6039 Harden against irrelevant filesystem detailsPaul Phillips2013-05-081-0/+2
| | | | | | | | | | | | | | The symbol loader need not create and populate package symbols merely because there is a directory somewhere. Every package created based on the existence of a directory should contain a classfile, either directly or indirectly.
* | Absolutized paths involving the scala package.Paul Phillips2013-05-033-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #2335 from retronym/topic/opt-file-accessJames Iry2013-04-101-5/+18
|\ \ | | | | | | Optimize file metadata access