summaryrefslogtreecommitdiff
path: root/src/scalap/scala/tools/scalap/Main.scala
Commit message (Collapse)AuthorAgeFilesLines
* Remove abstraction layer in classpath implementationLukas Rytz2016-05-021-10/+7
|
* remove recursive classpath implementationLukas Rytz2016-04-231-13/+4
|
* SI-8679 Add support for ScalaLongSignature attribute in scalapMichaƂ Pociecha2015-05-031-0/+1
| | | | | | | | | | | | | | | | | | | | scalap didn't support really big class files. It was returning an empty String for such files. The reason was that there were only ScalaSignatures taken into account. This commit adds support for ScalaLongSignature. We try to get such an attribute when we didn't find ScalaSignature. Also there's added an additional case to the logic retrieving bytes for a signature. Since ScalaLongSignature can contain many parts, we have to merge their byte arrays. Changes are tested by a new partest-based test. These two files are really big, but it was required (t8679.scala is a reduced version of BigScalaClass - an example attached to JIRA). There are also added TODOs with a JIRA ticket: We have three places, where we process Scala signatures. In the future it would be better to reuse some common logic, if it's possible.
* Cleanup and refactoring - semicolons, unused or commented out codempociecha2014-12-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Create possibility to skip flat classpath cachingmpociecha2014-12-051-1/+4
| | | | | | There's added -YdisableFlatCpCaching option to ScalaSettings which allows user to disable caching of flat representation of classpath elements.
* Integrate flat classpath with the compilermpociecha2014-12-051-7/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit integrates with the compiler the whole flat classpath representation build next to the recursive one as an alternative. From now flat classpath really works and can be turned on. There's added flag -YclasspathImpl with two options: recursive (the default one) and flat. It was needed to make the dynamic dispatch to the particular classpath representation according to the chosen type of a classpath representation. There's added PathResolverFactory which is used instead of a concrete implementation of a path resolver. It turned out that only a small subset of path resolvers methods is used outside this class in Scala sources. Therefore, PathResolverFactory returns an instance of a base interface PathResolverResult providing only these used methods. PathResolverFactory in combination with matches in some other places ensures that in all places using classpath we create/get the proper representation. Also the classPath method in Global is modified to use the dynamic dispatch. This is very important change as a return type changed to the base ClassFileLookup providing subset of old ClassPath public methods. It can be problematic if someone was using in his project the explicit ClassPath type or public methods which are not provided via ClassFileLookup. I tested flat classpath with sbt and Scala IDE and there were no problems. Also was looking at sources of some other projects like e.g. Scala plugin for IntelliJ and there shouldn't be problems, I think, but it would be better to check these changes using the community build. Scalap's Main.scala is changed to be able to use both implementations and also to use flags related to the classpath implementation. The classpath invalidation is modified to work properly with the old (recursive) classpath representation after changes made in a Global. In the case of the attempt to use the invalidation for the flat cp it just throws exception with a message that the flat one currently doesn't support the invalidation. And also that's why the partest's test for the invalidation has been changed to use (always) the old implementation. There's added an adequate comment with TODO to this file. There's added partest test generating various dependencies (directories, zips and jars with sources and class files) and testing whether the compilation and further running an application works correctly, when there are these various types of entries specified as -classpath and -sourcepath. It should be a good approximation of real use cases.
* Refactor scalap's mainmpociecha2014-12-011-85/+84
| | | | | | | | | | | | | The structure of scalap's Main has been refactored. EmptyClasspath is deleted. It looks that it was unused since this commit: https://github.com/scala/scala/commit/e594fe58ef8116a4bd2560ad0a856ad58ae9db33 Also classpath logging is changed and now uses asClassPathString method. It was needed to modify one test because of that but it won't depend on a particular representation. There aren't changes in the way scalap works.
* Use new asClassPathString method and create FileUtils for classpathmpociecha2014-11-301-1/+1
| | | | | | | | | | | | | | 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-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | 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.
* Revert "SI-7624 Fix -feature warnings in scala/tools/scalap"Grzegorz Kossakowski2014-02-261-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit f2de2c4ec43180351ef1f306bcc5f24643ba5477 because it broke both lift-json and json4s libraries that depend on scalap's APIs. Arguably, those libraries shouldn't depend on unofficial APIs but they do because they had no better alternative at the time (no Scala reflection). The cost of breaking them is not worth minor change of the package. The f2de2c4ec43180351ef1f306bcc5f24643ba5477 mixed two things: 1. Fixing feature warnings 2. Changing package name When reverting (and resolving conflicts) I tried to keep 1. and revert just 2. However, there were also some questionable changes related to 1. that got reverted. In particular, a package object with implicit members that enable language features is an anti-pattern because members of package object are visible both _within_ and _outside_ of the package. Therefore, user could use wildcard import for importing everything from scalap package and enabled postfixOps language feature unknowingly. I went for just adding imports in just those few files where they were needed. Amended by Adriaan: To allow faster turn around, I re-enabled resolving partest from sonatype, as its version needs to be bumped and I don't want to wait for maven central synch. Conflicts: src/partest/scala/tools/partest/nest/Runner.scala src/scalap/scala/tools/scalap/scalax/rules/Memoisable.scala src/scalap/scala/tools/scalap/scalax/rules/Rule.scala src/scalap/scala/tools/scalap/scalax/rules/Rules.scala src/scalap/scala/tools/scalap/scalax/rules/scalasig/ClassFileParser.scala src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSig.scala
* SI-7624 Fix -feature warnings in scala/tools/scalapSimon Ochsenreither2013-08-151-8/+8
| | | | | | ... and move scalap.scala.tools.scalap.scalax.rules to scalap.scala.tools.scalap.rules now that all the Monad/Functor/ Applicatve/... stuff has been removed.
* SI-7624 Fix a few remaining -Xlint warnings ...Simon Ochsenreither2013-08-151-1/+1
| | | | | in various places. This includes actors, compiler (mostly some new macro parts) continuations, partest, scaladoc, scalap.
* Absolutized paths involving the scala package.Paul Phillips2013-05-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* SI-6669 Add . to the default scalap classpathJames Iry2013-01-301-1/+1
| | | | | | | The default classpath for scalap did not include '.' which made it behave differently from javap in an annoying way. This commit adds it to the default. Also included is a test to make sure it's in the default but does not corrupt a user specified classpath.
* Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013Heather Miller2012-11-021-1/+1
|
* Fix problem with names encoding in scalap.Grzegorz Kossakowski2012-09-191-3/+8
| | | | | | | | | | | | | | The refactoring performed in 020053c321 made use of naming encoding more consisted but introduced a regression in scalap. The problem is that the old encoder that scalap had didn't escape any characters that were not included in its opcode list. `NameTransformer` performs full encoding so it also encodes dots that are being used as separators for packages. Therefore, in order to retain the old behaviour we need to split the name by dots before feeding each fragment to `NameTransformer`. Review by @paulp.
* Absolutize tools.nsc => scala.tools.nsc.Paul Phillips2012-08-171-3/+3
| | | | | | Relative references to scala.tools which omit the "scala" are uncompilable by themselves if you happen to have a directory called "tools" which shadows scala/tools. As we do in trunk.
* More consistent use of Names.Paul Phillips2012-01-051-1/+2
| | | | | | | | Several large helpings of tedium later, fewer strings are being discarded like so much refuse. Some names now cache a String, but only "named Names", so it's not very many and they pay for themselves pretty quickly. Many fewer name-related implicit conversions now taking place. A number of efficiency related measures.
* Tired of ugly-printing in the repl, I sort of f...Paul Phillips2011-08-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Tired of ugly-printing in the repl, I sort of finished some old code for pretty printing token streams. It is at least a lot prettier than it once was, and I threw in some power mode helpers. Now you can do this. % scala -Dscala.repl.power Welcome to Scala version 2.10.0.r25427-b20110801144412 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_26). // .u turns a string into an URL like .r does into a regex, and .pp pretty prints the url scala> "https://raw.github.com/scalaz/scalaz/master/example/src/main/scala/scal az/example/ExampleIteratee.scala".u.pp package scalaz.example object ExampleIteratee { def main (args: Array[String]) = run import scalaz._ import Scalaz._ import IterV._ [etc it's all there in real life] } No review.
* Takes 30+% off the startup time for scala/scala...Paul Phillips2011-05-081-6/+7
| | | | | | | | | | | | | | | | | Takes 30+% off the startup time for scala/scalac with a variety of optimizations pinpointed by tracing method invocations. Frequent guest stars in the parade of slowness were: using Lists and ListBuffers when any amount of random access is needed, using Strings as if one shouldn't have to supply 80 characters of .substring noise to drop a character here and there, imagining that code can be reused in any way shape or form without a savage slowness burn being unleashed upon you and everything you have ever loved, String.format, methods which return tuples, and any method written with appealing scala features which turns out to be called a few orders of magnitude more often than the author probably supposed. This may be only the tip of the iceberg. No review.
* Deleted SourcelessComments.Paul Phillips2011-04-071-28/+2
| | | | | | | | | | | | | Nothing and Null with improved documentation of their particulars and convinced scaladoc to parse them without leaving scalac institutionalized. Now rather than seeing our hardcoded documentation strings bitrot in a shadowy flight from classes which do not exist, we are championing the cause of the innocent and powerless. Nothing and Null aren't above the law! So now any responsible party can fire up their text editor and go to town on Nothing.scala. As I'm sure they will. Review by malayeri.
* Some minor sensibility improvements to previous...Paul Phillips2011-03-311-137/+66
| | | | | | Some minor sensibility improvements to previous patch, and tearing out some obsolete pieces of scalap. No review.
* Updated copyright notices to 2011Antonio Cunei2011-01-201-1/+1
|
* Changed the behavior of -cp for scalap.Iulian Dragos2010-09-031-4/+10
|
* Generalized the scala sig "look in both attribu...Paul Phillips2010-08-031-20/+3
| | | | | | | Generalized the scala sig "look in both attribute and annotation" code so it can be reused outside of scalap main. Closes #3717, review by ilyas.
* Removed a few instances of redundant or dead co...Paul Phillips2010-05-241-15/+0
| | | | | | | Removed a few instances of redundant or dead code, most of which was marked as waiting for a new starr which has long since arrived. No review.
* Removed more than 3400 svn '$Id' keywords and r...Antonio Cunei2010-05-121-1/+0
| | | | | Removed more than 3400 svn '$Id' keywords and related junk.
* Some tweaks to classpath handling I had left ov...Paul Phillips2010-04-061-0/+1
| | | | | | Some tweaks to classpath handling I had left over from trying to figure out the continuations plugin issue. No review.
* Fix to the way Scalap decodes ScalaSignature an...Gilles Dubochet2010-03-291-2/+2
| | | | | | Fix to the way Scalap decodes ScalaSignature annotations. Contributed by ilyas. Already reviewed by dubochet, no review.
* Scala signature is generated as an annotation (...Gilles Dubochet2010-03-231-8/+30
| | | | | | | | | | | | | Scala signature is generated as an annotation (that is accessible through Java reflection). - compiler generates all pickled Scala signatures as annotations to class files. - compiler can read class files with signature as annotations or old-style signatures as attributes. - Scalap has also been updated to new signatures (contributed by Ilya Sergey: thanks a lot). - FJBG updated to allow entering constant pool strings as byte arrays. - ByteCodecs decode method returns the length of the decoded array. Review by ilyas. Already mostly reviewed by odersky.
* Some support code related to partest changes.Paul Phillips2010-03-211-6/+6
|
* The first reasonably satisfying classpath commit.Paul Phillips2010-02-181-1/+1
| | | | | there with this one. Documentation to come. Review by community.
* More work on classpaths.Paul Phillips2010-02-111-0/+1
| | | | | | | | | which we must have no test cases at all. In the short term there will probably be a few more minor disruptions since with classpaths constructed a half dozen different ways, achieving consistency requires flushing out the undocumented accidents upon which any given island might depend. Review by community.
* More work on classpaths.Paul Phillips2010-02-101-7/+3
| | | | | | | | to have command line options following source files, at the price of temporarily breaking tools/pathResolver. Working my way through all the usages of classpath in trunk zeroing in on fully consistent handling. Review by community.
* A more MSIL-aware attempt at isolating the plat...Paul Phillips2010-02-061-4/+5
| | | | | | | | A more MSIL-aware attempt at isolating the platform dependent pieces of Global and ClassPath so we don't introduce unwanted dependencies. Introduces a small interface backend.Platform which encapsulates that data. Review by rytz, odersky.
* some scalap tweaksilyas2010-02-051-1/+2
|
* Raised the level of abstraction (slightly, not ...Paul Phillips2010-02-041-3/+3
| | | | | | | | | Raised the level of abstraction (slightly, not enough) on ClassPath by defining the difference between optimized and regular classpaths in terms of an arbitrary name filter instead of in terms of settings.XO. Altered the decision logic to look at the value of -Yinline instead of -optimise. Closes #2950. Review by rytz.
* The remainder of isolating MSIL from the rest o...Paul Phillips2010-02-041-2/+1
| | | | | | | | | The remainder of isolating MSIL from the rest of the classpath code. To accomplish this I made ClassRep an inner class of ClassPath (which given the broad definition of ClassPath already in place, it conceptually is already) and as a bonus this allowed dropping its type parameter. Review by rytz.
* Removed static state from global object ClassPa...Paul Phillips2010-01-201-2/+3
| | | | | | | | Removed static state from global object ClassPath object, and some minor repositioning while in there. Closes #2928, but the intentions behind -optimise being intertwined with ClassPath could really use some source comments. Review by rytz.
* speed up ClassPath.findClass. review by communityLukas Rytz2010-01-111-3/+3
|
* REPL completion now understands type aliases de...Paul Phillips2009-12-161-2/+1
| | | | | | REPL completion now understands type aliases defined in package objects. For instance try scala.List.<tab>. review by community.
* Updated copyright notices to 2010Antonio Cunei2009-12-071-1/+1
|
* new classpaths.Lukas Rytz2009-10-261-12/+24
|
* reverted 'doArg' change made in r18738, removed...michelou2009-09-251-3/+3
| | | | | reverted 'doArg' change made in r18738, removed a few warnings
* [no content change] Fixed all SVN properties: m...Gilles Dubochet2009-09-241-1/+1
| | | | | | | | [no content change] Fixed all SVN properties: mimes, EOL, executable. Id expansion is consistently enabled for Scala/Java/C# sources in 'src/' and consistently disabled and removed from everywhere else: there should not be any dead Id tags anymore.
* scalap changed to treat named parameters and pa...ilyas2009-06-291-7/+19
| | | | | scalap changed to treat named parameters and package objects
* map page updatedilyas2009-02-101-2/+4
| | | | | scalap flags adjusted according to man page
* added build scripts for scalapLukas Rytz2009-02-091-0/+266