summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/Global.scala
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #5724 from jvican/stub-errors-2.12.xAdriaan Moors2017-03-271-0/+13
|\ | | | | SCP-009: Improve direct dependency experience
| * Improve stub error messages (SCP-009 proposal)jvican2017-03-241-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following commit message is a squash of several commit messages. - This is the 1st commit message: Add position to stub error messages Stub errors happen when we've started the initialization of a symbol but key information of this symbol is missing (the information cannot be found in any entry of the classpath not sources). When this error happens, we better have a good error message with a position to the place where the stub error came from. This commit goes into this direction by adding a `pos` value to `StubSymbol` and filling it in in all the use sites (especifically `UnPickler`). This commit also changes some tests that test stub errors-related issues. Concretely, `t6440` is using special Partest infrastructure and doens't pretty print the position, while `t5148` which uses the conventional infrastructure does. Hence the difference in the changes for both tests. - This is the commit message #2: Add partest infrastructure to test stub errors `StubErrorMessageTest` is the friend I introduce in this commit to help state stub errors. The strategy to test them is easy and builds upon previous concepts: we reuse `StoreReporterDirectTest` and add some methods that will compile the code and simulate a missing classpath entry by removing the class files from the class directory (the folder where Scalac compiles to). This first iteration allow us to programmatically check that stub errors are emitted under certain conditions. - This is the commit message #3: Improve contents of stub error message This commit does three things: * Keep track of completing symbol while unpickling First, it removes the previous `symbolOnCompletion` definition to be more restrictive/clear and use only positions, since only positions are used to report the error (the rest of the information comes from the context of the `UnPickler`). Second, it adds a new variable called `lazyCompletingSymbol` that is responsible for keeping a reference to the symbol that produces the stub error. This symbol will usually (always?) come from the classpath entries and therefore we don't have its position (that's why we keep track of `symbolOnCompletion` as well). This is the one that we have to explicitly use in the stub error message, the culprit so to speak. Aside from these two changes, this commit modifies the existing tests that are affected by the change in the error message, which is more precise now, and adds new tests for stub errors that happen in complex inner cases and in return type of `MethodType`. * Check that order of initialization is correct With the changes introduced previously to keep track of position of symbols coming from source files, we may ask ourselves: is this going to work always? What happens if two symbols the initialization of two symbols is intermingled and the stub error message gets the wrong position? This commit adds a test case and modifications to the test infrastructure to double check empirically that this does not happen. Usually, this interaction in symbol initialization won't happen because the `UnPickler` will lazily load all the buckets necessary for a symbol to be truly initialized, with the pertinent addresses from which this information has to be deserialized. This ensures that this operation is atomic and no other symbol initialization can happen in the meantime. Even though the previous paragraph is the feeling I got from reading the sources, this commit creates a test to double-check it. My attempt to be better safe than sorry. * Improve contents of the stub error message This commit modifies the format of the previous stub error message by being more precise in its formulation. It follows the structured format: ``` s"""|Symbol '${name.nameKind} ${owner.fullName}.$name' is missing from the classpath. |This symbol is required by '${lazyCompletingSymbol.kindString} ${lazyCompletingSymbol.fullName}'. ``` This format has the advantage that is more readable and explicit on what's happening. First, we report what is missing. Then, why it was required. Hopefully, people working on direct dependencies will find the new message friendlier. Having a good test suite to check the previously added code is important. This commit checks that stub errors happen in presence of well-known and widely used Scala features. These include: * Higher kinded types. * Type definitions. * Inheritance and subclasses. * Typeclasses and implicits. - This is the commit message #4: Use `lastTreeToTyper` to get better positions The previous strategy to get the last user-defined position for knowing what was the root cause (the trigger) of stub errors relied on instrumenting `def info`. This instrumentation, while easy to implement, is inefficient since we register the positions for symbols that are already completed. However, we cannot do it only for uncompleted symbols (!hasCompleteInfo) because the positions won't be correct anymore -- definitions using stub symbols (val b = new B) are for the compiler completed, but their use throws stub errors. This means that if we initialize symbols between a definition and its use, we'll use their positions instead of the position of `b`. To work around this we use `lastTreeToTyper`. We assume that stub errors will be thrown by Typer at soonest. The benefit of this approach is better error messages. The positions used in them are now as concrete as possible since they point to the exact tree that **uses** a symbol, instead of the one that **defines** it. Have a look at `StubErrorComplexInnerClass` for an example. This commit removes the previous infrastructure and replaces it by the new one. It also removes the fields positions from the subclasses of `StubSymbol`s. - This is the commit message #5: Keep track of completing symbols Make sure that cycles don't happen by keeping track of all the symbols that are being completed by `completeInternal`. Stub errors only need the last completing symbols, but the whole stack of symbols may be useful to reporting other error like cyclic initialization issues. I've added this per Jason's suggestion. I've implemented with a list because `remove` in an array buffer is linear. Array was not an option because I would need to resize it myself. I think that even though list is not as efficient memory-wise, it probably doesn't matter since the stack will usually be small. - This is the commit message #6: Remove `isPackage` from `newStubSymbol` Remove `isPackage` since in 2.12.x its value is not used.
* | Avoid forcing info transforms of primitive methodsJason Zaugg2017-02-191-2/+3
|/ | | | | | | | | Although this is cheap, when debugging log output of info transformer activity this was a major source of noise. This commit avoids the info lookup for methods other than `+`, and then for `+` uses the typer phase info to distinguish concatentation from addition.
* 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
* SI-10173 Crash output shows true line numberSom Snytt2017-02-051-3/+4
| | | | Where true means 1-based, for whatever tree was last to typer.
* remove deprecated compiler flag "-Yeta-expand-keeps-star"Lars Hupel2016-12-011-6/+0
| | | | This was slated for removal in 2.12.
* Merge pull request #5284 from milessabin/topic/si-7046Adriaan Moors2016-11-301-0/+13
|\ | | | | | | | | | | | | | | | | | | SI-7046 reflection doesn't see all knownDirectSubclasses This appears to do the right thing in the most typical scenarios in which `knownDirectSubclasses` would be used. The missing 5% is that subclasses defined in local scopes might not be seen by `knownDirectSubclasses` (see `Local` and `Riddle` in the test below). In mitigation, though, it is almost certain that a local subclass would represent an error in any scenario where `knownDirectSubclasses` might be used. Errors for such situations are reported by recording (via a symbol attachment) that `knownDirectSubclasses` has been called and reporting an error if any additional children are added subsequently. Despite these limitations and caveats, I believe that this represents a huge improvement over the status quo, and would eliminate 100% of the failures that I've seen in practice with people using shapeless for type class derivation.
| * Partial fix for SI-7046Miles Sabin2016-11-281-0/+13
| |
* | Merge pull request #5376 from milessabin/topic/clean-experimentalAdriaan Moors2016-11-301-2/+0
|\ \ | | | | | | Clean up of code guarded by bare -Xexperimental
| * | Typevar experimentals now default; t5729 pos -> neg.Miles Sabin2016-11-281-2/+0
| |/
* / SI-8779 Enable inlining of code within a REPL sessionJason Zaugg2016-11-281-0/+3
|/ | | | | | | | | | | | | | | | | | | | | The REPL has a long running instance of Global which outputs classfiles by default to a VirtualDirectory. The inliner did not find any of these class files when compiling calls to methods defined in previous runs (ie, previous lines of input.) This commit: - Adds a hook to augment the classpath that the optimizer searches, and uses this in the REPL to add the output directory - Fixes the implementation of `findClassFile` in VirtualDirectory, which doesn't seem to have been used in anger before. I've factored out some common code into a new method on `AbstractFile`. - Fixes a similar problem getSubDir reported by Li Haoyi - Adds missing unit test coverage. This also fixes a bug in REPL autocompletion for types defined in packages >= 2 level deep (with the `:paste -raw` command). I've added a test for this case.
* Typo and spelling correctionsJanek Bogucki2016-11-111-1/+1
|
* Don't clip descrip when -YdebugSom Snytt2016-09-301-6/+6
| | | | | | -Ydebug is supposed to show everything about the phases, including full description (if otherwise clipped) and any phases that are not "enabled" by options.
* Shorten fields phase descriptionSom Snytt2016-09-301-1/+1
| | | | | | | | | | | | | | | | | | | Makes fields fit the field width, which is fitting. `s/including/add` seems sufficient. Possibly, "synthesize" is an extravagance for "add", but "add" is used previously in that column. Resolve, load, translate, add, synthesize, replace, erase, move, eliminate, remove, generate. Would love to learn a word that says what typer does, if the word "type" is too redundant or overloaded, besides the food metaphor. Also "meat-and-potatoes" implies basic, simple, not fussy or fancy. There are many devices, like the heart or a Ferrari engine, that are fundamental without being unfussy.
* Fields does bitmaps & synch for lazy vals & modulesAdriaan Moors2016-08-291-10/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Essentially, we fuse mixin and lazyvals into the fields phase. With fields mixing in trait members into subclasses, we have all info needed to compute bitmaps, and thus we can synthesize the synchronisation logic as well. By doing this before erasure we get better signatures, and before specialized means specialized lazy vals work now. Mixins is now almost reduced to its essence: implementing super accessors and forwarders. It still synthesizes accessors for param accessors and early init trait vals. Concretely, trait lazy vals are mixed into subclasses with the needed synchronization logic in place, as do lazy vals in classes and methods. Similarly, modules are initialized using double checked locking. Since the code to initialize a module is short, we do not emit compute methods for modules (anymore). For simplicity, local lazy vals do not get a compute method either. The strange corner case of constant-typed final lazy vals is resolved in favor of laziness, by no longer assigning a constant type to a lazy val (see widenIfNecessary in namers). If you explicitly ask for something lazy, you get laziness; with the constant-typedness implicit, it yields to the conflicting `lazy` modifier because it is explicit. Co-Authored-By: Lukas Rytz <lukas@lightbend.com> Fixes scala/scala-dev#133 Inspired by dotc, desugar a local `lazy val x = rhs` into ``` val x$lzy = new scala.runtime.LazyInt() def x(): Int = { x$lzy.synchronized { if (!x$lzy.initialized) { x$lzy.initialized = true x$lzy.value = rhs } x$lzy.value } } ``` Note that the 2.11 decoding (into a local variable and a bitmap) also creates boxes for local lazy vals, in fact two for each lazy val: ``` def f = { lazy val x = 0 x } ``` desugars to ``` public int f() { IntRef x$lzy = IntRef.zero(); VolatileByteRef bitmap$0 = VolatileByteRef.create((byte)0); return this.x$1(x$lzy, bitmap$0); } private final int x$lzycompute$1(IntRef x$lzy$1, VolatileByteRef bitmap$0$1) { C c = this; synchronized (c) { if ((byte)(bitmap$0$1.elem & 1) == 0) { x$lzy$1.elem = 0; bitmap$0$1.elem = (byte)(bitmap$0$1.elem | 1); } return x$lzy$1.elem; } } private final int x$1(IntRef x$lzy$1, VolatileByteRef bitmap$0$1) { return (byte)(bitmap$0$1.elem & 1) == 0 ? this.x$lzycompute$1(x$lzy$1, bitmap$0$1) : x$lzy$1.elem; } ``` An additional problem with the above encoding is that the `lzycompute` method synchronizes on `this`. In connection with the new lambda encoding that no longer generates anonymous classes, captured lazy vals no longer synchronize on the lambda object. The new encoding solves this problem (scala/scala-dev#133) by synchronizing on the lazy holder. Currently, we don't exploit the fact that the initialized field is `@volatile`, because it's not clear the performance is needed for local lazy vals (as they are not contended, and as soon as the VM warms up, biased locking should deal with that) Note, be very very careful when moving to double-checked locking, as this needs a different variation than the one we use for class-member lazy vals. A read of a volatile field of a class does not necessarily impart any knowledge about a "subsequent" read of another non-volatile field of the same object. A pair of volatile reads and write can be used to implement a lock, but it's not clear if the complexity is worth an unproven performance gain. (Once the performance gain is proven, let's change the encoding.) - don't explicitly init bitmap in bytecode - must apply method to () explicitly after uncurry
* Uncurry's info transform: non-static module --> methodAdriaan Moors2016-08-111-1/+1
| | | | | | | We do this during uncurry so we can insert the necessary applications to the empty argument list. Fields is too late. Refchecks is no longer an info transform.
* Fields phaseAdriaan Moors2016-08-111-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One step towards teasing apart the mixin phase, making each phase that adds members to traits responsible for mixing in those members into subclasses of said traits. Another design tenet is to not emit symbols or trees only to later remove them. Therefore, we model a val in a trait as its accessor. The underlying field is an implementation detail. It must be mixed into subclasses, but has no business in a trait (an interface). Also trying to reduce tree creation by changing less in subtrees during tree transforms. A lot of nice fixes fall out from this rework: - Correct bridges and more precise generic signatures for mixed in accessors, since they are now created before erasure. - Correct enclosing method attribute for classes nested in trait fields. Trait fields are now created as MethodSymbol (no longer TermSymbol). This symbol shows up in the `originalOwner` chain of a class declared within the field initializer. This promoted the field getter to being the enclosing method of the nested class, which it is not (the EnclosingMethod attribute is a source-level property). - Signature inference is now more similar between vals and defs - No more field for constant-typed vals, or mixed in accessors for subclasses. A constant val can be fully implemented in a trait. TODO: - give same treatment to trait lazy vals (only accessors, no fields) - remove support for presuper vals in traits (they don't have the right init semantics in traits anyway) - lambdalift should emit accessors for captured vals in traits, not a field Assorted notes from the full git history before squashing below. Unit-typed vals: don't suppress field it affects the memory model -- even a write of unit to a field is relevant... unit-typed lazy vals should never receive a field this need was unmasked by test/files/run/t7843-jsr223-service.scala, which no longer printed the output expected from the `0 to 10 foreach` Use getter.referenced to track traitsetter reify's toolbox compiler changes the name of the trait that owns the accessor between fields and constructors (`$` suffix), so that the trait setter cannot be found when doing mkAssign in constructors this could be solved by creating the mkAssign tree immediately during fields anyway, first experiment: use `referenced` now that fields runs closer to the constructors phase (I tried this before and something broke) Infer result type for `val`s, like we do for `def`s The lack of result type inference caused pos/t6780 to fail in the new field encoding for traits, as there is no separate accessor, and method synthesis computes the type signature based on the ValDef tree. This caused a cyclic error in implicit search, because now the implicit val's result type was not inferred from the super member, and inferring it from the RHS would cause implicit search to consider the member in question, so that a cycle is detected and type checking fails... Regardless of the new encoding, we should consistently infer result types for `def`s and `val`s. Removed test/files/run/t4287inferredMethodTypes.scala and test/files/presentation/t4287c, since they were relying on inferring argument types from "overridden" constructors in a test for range positions of default arguments. Constructors don't override, so that was a mis-feature of -Yinfer-argument-types. Had to slightly refactor test/files/presentation/doc, as it was relying on scalac inferring a big intersection type to approximate the anonymous class that's instantiated for `override lazy val analyzer`. Now that we infer `Global` as the expected type based on the overridden val, we make `getComment` private in navigating between good old Skylla and Charybdis. I'm not sure why we need this restriction for anonymous classes though; only structural calls are restricted in the way that we're trying to avoid. The old behavior is maintained nder -Xsource:2.11. Tests: - test/files/{pos,neg}/val_infer.scala - test/files/neg/val_sig_infer_match.scala - test/files/neg/val_sig_infer_struct.scala need NMT when inferring sig for accessor Q: why are we calling valDefSig and not methodSig? A: traits use defs for vals, but still use valDefSig... keep accessor and field info in synch
* Retain javadoc comments in scaladocJakob Odersky2016-07-151-1/+3
| | | | | * Hook into java parser to generate doc comments * Generate empty trees for java implementation bodies
* Add since arg to deprecationWarning and use itSimon Ochsenreither2016-05-291-4/+4
|
* Merge pull request #5112 from lrytz/dropRecursiveClasspathJason Zaugg2016-05-051-117/+27
|\ | | | | Remove legacy recursive classpath implementation
| * Remove abstraction layer in classpath implementationLukas Rytz2016-05-021-30/+26
| |
| * remove recursive classpath implementationLukas Rytz2016-04-231-103/+17
| |
* | SD-142 Avoid noisy log output in backend (#5134)Jason Zaugg2016-05-021-5/+8
|/ | | | | | | | | | | | | | | | | | | | | | `withCurrentUnit` is designed to be called once per compilation unit as it side effects by logging and updating progress counters. `GenBCode` was calling it more frequently (once per `ClassDef`.) This is due to the somewhat convoluted internal architecture of that phase, which is designed to support paralellism in the future. This commit factors out the internal part of `withCompilationUnit` that modifies `currentUnit`, and calls that instead in the loop over classes. After this change: ``` % qscala -Ydebug ... [running phase jvm on <console>] // only once ```
* General cleanups and less warnings during a Scala buildsoc2016-04-041-3/+3
|
* Support :require when using the flat classpath representation.Lukas Rytz2016-03-221-64/+141
| | | | | | :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.
* Update some phase listsSimon Ochsenreither2015-11-251-1/+1
|
* Merge commit '8eb1d4c' into merge-2.11-to-2.12-nov-24Lukas Rytz2015-11-241-1/+1
|\
| * it's Scaladoc, not "ScalaDoc" or "Scala doc"Seth Tisue2015-11-121-1/+1
| | | | | | | | | | renaming the existing ScalaDoc and ScalaDocReporter classes might break stuff, sadly, but at least we can fix the rest
* | Sbt-compatible implementation of `isPastXXXPhase`Adriaan Moors2015-11-121-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | sbt's [API extraction phase](https://github.com/sbt/sbt/blob/0.13/compile/interface/src/main/scala/xsbt/API.scala#L25) extends `scala.reflect.internal.Phase`, which implements a bunch of methods, such as `erasedTypes` as `false`, which are then overridden by scalac in `GlobalPhase` (nested in scala.tools.nsc.Global). (`erasedTypes` in particular is again overridden in the back-end -- for performance?) However, since sbt's compiler phases extend `reflect.internal.Phase`, the logic for detecting the current phase does not work, as the default implementation is called (simply returning `false`), when chasing the `prev` pointers hits an sbt-injected phase, as its implementation is `reflect.internal`'s constant `false`.
* | Minor cleanupsLukas Rytz2015-11-061-4/+3
| |
* | Remove the rest of ICodesLukas Rytz2015-11-061-5/+4
| | | | | | | | | | | | | | The only pieces of ICodes that were still used - An enum representing bytecode comparisons, re-implemented - The `icodes.IClass` class, which remains for sbt compatibility (https://github.com/scala/scala/pull/4588)
* | Remove ICodeSimon Ochsenreither2015-10-311-122/+11
| |
* | Remove GenASM, merge remaining common code snippetsSimon Ochsenreither2015-10-271-8/+0
| | | | | | | | | | | | | | | | With GenBCode being the default and only supported backend for Java 8, we can get rid of GenASM. This commit also fixes/migrates/moves to pending/deletes tests which depended on GenASM before.
* | Merge commit 'bb3ded3' into merge-2.11-to-2.12-oct-5Lukas Rytz2015-10-051-1/+4
|\|
| * fix bug where -Xprint-icode leaked an InputStream and a file handleSeth Tisue2015-09-251-1/+4
| | | | | | | | | | | | | | | | usually it hardly matters, but it's still a bug, and on Windows we can't delete an open file, so this can cause trouble for someone writing a test that relies on being able to generate icode files and then clean them up afterwards. (and in fact, two IcodeComparison-based tests were failing.)
* | Warn when combining settings for the old optimizer with -YGenBCodeLukas Rytz2015-07-031-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove some unnecessary flags files - neg/t4425.flags - run/blame_eye_triple_eee-double.flags - run/blame_eye_triple_eee-float.flags Force tests that use -optimize to GenASM - neg/sealed-final-neg.flags - pos/inline-access-levels.flags - pos/inliner2.flags - pos/sealed-final.flags - pos/t3420.flags - pos/t8410.flags - run/constant-optimization.flags - run/dead-code-elimination.flags - run/elidable-opt.flags - run/finalvar.flags - run/icode-reader-dead-code.scala - run/optimizer-array-load.flags - run/synchronized.flags - run/t3509.flags - run/t3569.flags - run/t4285.flags - run/t4935.flags - run/t5789.scala - run/t6188.flags - run/t7459b-optimize.flags - run/t7582.flags - run/t7582b.flags - run/t8601.flags - run/t8601b.flags - run/t8601c.flags - run/t8601d.flags - run/t8601e.flags - run/t9003.flags Move some tests to the new optimizer - run/classfile-format-51.scala - run/classfile-format-52.scala - run/run-bug4840.flags - run/t2106.flags - run/t6102.flags
* | SI-9350 Command option -XreporterSom Snytt2015-06-291-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a setting to take a custom Reporter. Example of reporter that discounts deprecations for purposes of (not) failing the build: ``` import scala.tools.nsc.Settings import scala.tools.nsc.reporters.ConsoleReporter import scala.reflect.internal.util._ class MyReporter(ss: Settings) extends ConsoleReporter(ss) { var deprecationCount = 0 override def warning(pos: Position, msg: String): Unit = { if (msg contains "is deprecated") deprecationCount += 1 super.warning(pos, msg) } override def hasWarnings: Boolean = count(WARNING) - deprecationCount > 0 override def reset() = { deprecationCount = 0 ; super.reset() } } ``` Invoked as: ``` $ scalac -toolcp . -Xreporter myrep.MyReporter -Xfatal-warnings -deprecation test.scala test.scala:8: warning: class C in package tester is deprecated: Don't use me Console println s"${new C}" ^ one warning found ``` where the reporter class is in the current directory, placed on the tool class path. Also flush on early-reported errors.
* | Merge branch '2.11.x' into merge/2.11.x-to-2.12.x-20150624Jason Zaugg2015-06-241-11/+14
|\|
| * SI-7773 Restore phase id to icode filenameSom Snytt2015-06-071-10/+12
| | | | | | | | | | | | | | | | | | | | Having icode output files of the form `X-24.icode` went in and out of style using the long-form phase name because it broke the windows nightly build somehow. Here's hoping using just the phase id works on this year's infrastructure. As previously, the long name is still available under `-Ydebug`, because why not debug.
| * SI-9322 Elapsed times in compiler calculated withSean Riggin2015-05-261-1/+2
| | | | | | | | | | | | | | | | System.currentTimeMillis and System.nanoTime Reverted elapsedTime calculation in compiler to use System.currentTimeMillis, consistent with the start time.
* | Require and target Java 8Jason Zaugg2015-05-261-2/+5
|/ | | | | | | | | | | | | | | - Require Java 8 in ant build - use -source 1.8 and -target 1.8 for javac - Default scalac's -target to `jvm-1.8`, ignore and deprecate attempts to use `jvm-1.{6.7}` - Remove fragile javap-app test. The feature itself is slated for removal. - Remove obsolete Java6 checkfile - Adapt DCE tests - Remove deprecated/redundant -target:jvm-1.6 from flags where the intent was to trigger generation of stack map frames. - Remove tests with -target:jvm-1.5 that tested without stack map frames - Ignore OpenJDK JVM warnings (via test/[files|scaladoc]/filters).
* SI-9170 More flexible SessionTestSom Snytt2015-03-031-1/+2
| | | | | | | | SessionTest session text can include line continuations and pasted text. Pasted script (which looks like a double prompt) probably doesn't work. This commit includes @retronym's SI-9170 one-liner.
* Fix many typos in docs and commentsmpociecha2014-12-141-2/+2
| | | | | | | | | | | | | 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.
* Merge pull request #4176 from mpociecha/flat-classpath2Grzegorz Kossakowski2014-12-051-15/+34
|\ | | | | The alternative, flat representation of classpath elements
| * Cleanup and refactoring - semicolons, unused or commented out codempociecha2014-12-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * Integrate flat classpath with the compilermpociecha2014-12-051-8/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * Use new asClassPathString method and create FileUtils for classpathmpociecha2014-11-301-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | SI-7683 Enable -Ystop-before:typerSom Snytt2014-12-011-3/+2
|/ | | | | | | | Allows a plugin to run before typer without incurring typechecking. The test is that a plugin doesn't run when stopping after parser, and that the truncated compilation run also succeeds, since updating check files for the output of -Xshow-phases is tedious.
* SI-6502 Refactorings suggested by reviewHeather Miller2014-11-101-25/+1
| | | | | - Moves mergeUrlsIntoClassPath from Global into ClassPath - Revises and documents AbstractFile.getURL
* SI-6502 Moving methods concerned with the state of Global from IMain to GlobalHeather Miller2014-11-051-0/+35
|