summaryrefslogtreecommitdiff
path: root/test/files/jvm
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #4574 from janekdb/2.11.x-typos-g-iJason Zaugg2015-06-232-2/+2
|\ | | | | Fix 25 typos (g-i)
| * Fix 25 typos (g-i)Janek Bogucki2015-06-222-2/+2
| |
* | Merge pull request #4564 from som-snytt/issue/promptv2.11.7Adriaan Moors2015-06-221-9/+9
|\ \ | |/ |/| SI-9206 Fix REPL code indentation
| * SI-9206 Fix REPL code indentationSom Snytt2015-06-191-9/+9
| | | | | | | | | | | | | | | | | | | | To make code in error messages line up with the original line of code, templated code is indented by the width of the prompt. Use the raw prompt (without ANSI escapes or newlines) to determine the indentation. Also, indent only once per line.
* | Fix 36 typos (d-f)Janek Bogucki2015-06-211-1/+1
|/
* Fix some typos (a-c)Janek Bogucki2015-06-182-2/+2
|
* Make two tests work under -Ydelambdafy:methodJason Zaugg2015-05-264-61/+66
| | | | | | | | | | | | | | | | | | Recently, in 029cce7, I changed uncurry to selectively fallback to the old method of emitting lambdas when we detect that `-Ydelambdafy:method`. The change in classfile names breaks the expectations of the test `innerClassAttribute`. This commit changes that test to avoid using specialized functions, so that under -Ydelambdafy:method all functions are uniform. This changes a few fresh suffixes for anonymous class names under both `-Ydelambdafy:{inline,method}`, so the expectations have been duly updated. Similarly, I have changed `javaReflection` in the same manner. Its checkfiles remained unchanged.
* Fix several tests under GenBCodeLukas Rytz2015-05-265-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | - private-inline, t8601-closure-elim, inline-in-constructors - test closure inlining / elimination, which is not yet implemented in GenBCode. noted in https://github.com/scala-opt/scala/issues/14. - constant-optimization, t7006 - no constant folding in GenBCode yet. noted in https://github.com/scala-opt/scala/issues/29. - patmat_opt_ignore_underscore, patmat_opt_no_nullcheck, patmat_opt_primitive_typetest - not all optimizations in GenBCode yet. noted in https://github.com/scala-opt/scala/issues/30. - t3234 - tests a warning of trait inlining - trait inlining works in GenBCode - synchronized - ignore inliner warnings (they changed a bit) - t6102 - account for the changed outputo of -Ydebug has under GenBCode
* Fix many typosMichał Pociecha2015-04-212-3/+3
| | | | | This commit corrects many typos found in scaladocs and comments. There's also fixed the name of a private method in ICodeCheckers.
* SI-8689 Make a Future test case determisticJason Zaugg2015-03-311-2/+7
| | | | | | | | | As discussed: https://groups.google.com/forum/#!topic/scala-internals/m8I_3GQR4vQ We need to ensure a happens-before relationship between the callback that prints "success" and the end of the main method.
* Merge commit 'ad845ff' into merge/2.10.x-to-2.11.x-20150224Jason Zaugg2015-02-243-8/+81
|\ | | | | | | | | | | Conflicts: src/library/scala/concurrent/Promise.scala test/files/jvm/future-spec/PromiseTests.scala
| * SI-8689 Avoid internal error in Promise after sequence of completionsViktor Klang2015-02-043-9/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling `completeWith` when the `DefaultPromise` is already completed, leads to callbacks not being properly executed. This happened because `Future.InternalCallbackExecutor` extends `BatchingExecutor`[1] which assumes `unbatchedExecute` to be async, when in this case it is sync, and if there is an exception thrown by executing the batch, it creates a new batch with the remaining items from the current batch and submits that to `unbatchedExecute` and then rethrows, but if you have a sync `unbatchedExecute`, it will fail since it is not reentrant, as witnessed by the failed `require` as reported in this issue. This commit avoids problem by delegating `completeWith` to `tryComplete`, which has the effect of using `onComplete` + `tryComplete` i.s.o. `complete`, which means that when it fails (because of a benign race condition between completers) it won't throw an exception. It has been tested by the minimized reproducer. [1] Actually, in the 2.10.x branch where this patch is starting out, "The BatchingExecutor trait had to be inlined into InternalCallbackExecutor for binary compatibility.". This comment will be more literally correct in the context of 2.11.x and beyond
* | Test java reflection on scala library / reflect / compiler jarsLukas Rytz2015-02-071-0/+65
| | | | | | | | | | | | | | Run a number of Java reflection operations on all classes in scala library / reflect / compiler. The test is based on a draft by Jason.
* | Fix InnerClass / EnclosingMethod for closures nested in value classesLukas Rytz2015-02-074-13/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Members of value classes are moved over to the companion object early. This change ensures that closure classes nested in value classes appear that way to Java reflection. This commit also changes the EnclosingMethod attribute for classes (and anonymous functions) nested in anonymous function bodies. Before, the enclosing method was in some cases the function's apply method. Not always though: () => { class C ... val a = { class D ...} } The class C used to be nested in the function's apply method, but not D, because the value definition for a was lifted out of the apply. After this commit, we uniformly set the enclosing method of classes nested in function bodies to `null`. This is consistent with the source-level view of the code. Note that under delambdafy:method, closures never appear as enclosing classes (this didn't change in this commit).
* | Fix InnerClass/EnclosingMethod for trait impl and specialized classesLukas Rytz2015-02-072-2/+124
| | | | | | | | | | | | | | | | | | | | Trait implementation classes and specialized classes are always considered top-level in terms of the InnerClass / EnclosingMethod attributes. These attributes describe source-level properties, and such classes are a compilation artifact. Note that the same is true for delambdafy:method closure classes (they are always top-level).
* | SI-9124 fix EnclosingMethod of classes nested in implOnly trait defsLukas Rytz2015-02-072-0/+48
| | | | | | | | | | | | | | | | | | | | Private trait methods are not added to the generated interface, they end up only in the implementation class. For classes nested in such methods, the EnclosingMethod attribute was incorrect. Since the EnclosingMethod attribute expresses a source-level property, but the actual enclosing method does not exist in the bytecode, we set the enclosing method to null.
* | SI-9105 Fix EnclosingMethod for classes defined in lambdasLukas Rytz2015-02-075-19/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixes both GenASM and GenBCode, except for the change to renaming in LamdaLift mentioned below. The reason for an inconsistent EnclosingMethod attribute was the symbol owner chain. Initially, closure class symbols don't exist, they are only created in UnCurry (delambdafy:inline). So walking the originalOwner of a definition does not yield closure classes. The commit also fixes uses of isAnonymousClass, isAnonymousFunction and isDelambdafyFunction in two ways: 1. by phase-travelling to an early phase. after flatten, the name includes the name of outer classes, so the properties may become accidentally true (they check for a substring in the name) 2. by ensuring that the (destructive) renames during LambdaLift don't make the above properties accidentally true. This was in fact the cause for SI-8900.
* | Merge pull request #4233 from kanielc/SI-7770Lukas Rytz2015-02-032-2/+2
|\ \ | | | | | | SI-7770 mutable.BitSet.toImmutable isn't immutable
| * | SI-7770 mutable.BitSet.toImmutable isn't immutableDenton Cockburn2015-01-072-2/+2
| | | | | | | | | | | | | | | Mark method as deprecated due to it not providing the expected result, while fixing it will break existing code.
* | | Construct ClassBTypes from parsed classfilesLukas Rytz2015-01-163-20/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This infrastructure is required for the inliner: when inlining code from a classfile, the corresponding ClassBType is needed for various things (eg access checks, InnerClass attribute). The test creates two ClassBTypes for the same class: once using the (unpickled) Symbol, once using the parsed ASM ClassNode, and verifies that the two are the same. There's a cleanup to the InnerClass attribute: object T { class Member; def foo = { class Local } } class T For Java compatibility the InnerClass entry for Member says the class is nested in T (not in the module class T$). We now make sure to add that entry only to T, not to T$ (unless Member is actually referenced in the classfile T$, in that case it will be added, as required).
* | | SI-9044 Fix order of interfaces in classfilesLukas Rytz2014-12-181-0/+6
|/ / | | | | | | | | | | | | | | | | | | It was reversed since ced3ca8ae1. The reason is that the backend used `mixinClasses` to obtain the parents of a class, which returns them in linearization order. `mixinClasses` als returns all ancestors (not only direct parents), which means more work for `minimizeInterfaces`. This was introduced in cd62f52 for unclear reasons. So we switch back to using `parents`.
* | Fix lambda names under delambdafy:method in innerClassAttribute testLukas Rytz2014-10-101-3/+3
| | | | | | | | This should have been done in 63207e1
* | Update check files for -Ydelambdafy:methodLukas Rytz2014-10-101-2/+2
| | | | | | | | Should have been done in 63207e1.
* | SI-8568 unreachable test now passes in GenBCodeLukas Rytz2014-09-101-1/+0
| |
* | JUnit tests for dead code elimination.Lukas Rytz2014-09-102-5/+5
| | | | | | | | JUnit tests may use tools from partest-extras (ASMConverters)
* | SI-8786 disable part of test that's failing the jdk8 buildLukas Rytz2014-09-041-1/+3
| |
* | Fix InnerClass / EnclosingMethod attributesLukas Rytz2014-09-017-39/+815
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit seems bigger than it is. Most of it is tests, and moving some code around. The actual changes are small, but a bit subtle. The InnerClass and EnclosingMethod attributes should now be close to the JVM spec (which is summarized in BTypes.scala). New tests make sure that changes to these attributes, and changes to the way Java reflection sees Scala classfiles, don't go unnoticed. A new file, BCodeAsmCommon, holds code that's shared between the two backend (it could hold more, future work). In general, the difficulty with emitting InnerClass / EnclosingMethod is that we need to find out source-level properties. We need to make sure to do enough phase-travelling, and work around destructive changes to the ownerchain in lambdalift (we use originalOwner a lot). The change to JavaMirrors is prompted by the change to the EnclosingMethod attribute, which changes Java reflection's answer to getEnclosingMethod and getEnclosingConstructor. Classes defined in field initializers no longer have an enclosing method, just an enclosing class, which broke an assumption in JavaMirrors. There's one change in erasure. Before this change, when an object declaration implements / overrides a method, and a bridge is required, then the bridge method was actually a ModuleSymbol (it would get the lateMETHOD flag and be emitted as a method anyway). This is confusing, when iterating through the members of a class, you can find two modules with the same name, and one of them doesn't have a module class. Now, such bridge methods will be MethodSymbols. Removed Symbol.originalEnclosingMethod, that is a backend thing and doesn't need to live in the symbol API.
* | Merge pull request #3927 from lrytz/innerClassesTestLukas Rytz2014-08-123-0/+310
|\ \ | | | | | | test for InnerClass and EnclosingMethod attributes
| * | test for InnerClass and EnclosingMethod attributesLukas Rytz2014-08-123-0/+310
| | | | | | | | | | | | | | | | | | Some parts of the test assert (current) buggy behavior. This is marked in the test file with TODO. It will be fixed in later work on the backend.
* | | SI-4563 friendlier behavior for Ctrl+D in the REPLAntoine Gourlay2014-07-293-3/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | | | Closing the REPL with Ctrl+D does not issue a newline, so the user's prompt displays on the same line as the `scala>` prompt. This is bad. We now force a newline before closing the interpreter, and display `:quit` while we're at it so that people know how to exit the REPL (since `exit` doesn't exist anymore). The tricky part was to only add a newline when the console is interrupted, and *not* when it is closed by a command (like `:quit`), since commands are processed after their text (including newline) has been sent to the console.
* | SI-8743 Fix crasher with poly-methods annotated with @varargsJason Zaugg2014-07-233-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | The code that generated the Java varargs forwarder was basing things on the `ValDef-s` of the parameters of the source method. But, their types refer to a type parameter skolems of the enclosing method, which led to a type mismatch when typechecking the forwarder. Instead, I've reworked the code to simply use the `DefDef`-s symbol's info, which *doesn't* refer to skolems. This actually simplifies the surrounding code somewhat; rather than repeated symbols in a map we can just time travel the pre-uncurry method signatures to figure out which params are releated.
* | Merge pull request #3866 from Blaisorblade/issue/8677-backportLukas Rytz2014-07-091-0/+5
|\ \ | | | | | | SI-8677 Duration: Zero - Inf should be MinusInf
| * | [backport] SI-8677 Duration: Zero - Inf should be MinusInfPaolo G. Giarrusso2014-07-041-0/+5
| | | | | | | | | | | | | | | Fixes #8677. Add basic tests. This is a backport from 2.12.x of dead39dc5f21c6eac41788e93426c50ddd398c24.
* | | Use countElementsAsString for summarized warnings.Adriaan Moors2014-07-043-3/+3
|/ /
* | SI-8185 Correct grammar for single-warning compilation runFrançois Garillot2014-05-145-6/+6
| |
* | Move t8582 to test/files/jvmLukas Rytz2014-05-132-0/+125
| |
* | Fix BeanInfo generation for GenBCodeLukas Rytz2014-05-133-0/+32
| |
* | Disable 'unreachable' test for GenBCodeLukas Rytz2014-05-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | GenICode has some logic to eliminate some dead code directly at code gen (introduced in b50a0d811f for SI-7006). This has not been ported over to GenBCode. GenBCode with the new optimizer (in Miguel's branch) also eliminates such dead code. Before adding such functionality to GenBCode I'd like to investigate the cost of running DCE. Maybe we can keep the code generator simple. I created SI-8568 to keep track of this.
* | PR #3233 cleanupPavel Pavlov2014-02-051-1/+1
| | | | | | | | | | - `::.head` became a `val`; excessive accessor removed - SerializationProxy moved to `object List`
* | Merge pull request #3316 from Ichoran/topic/big-decimal-correctnessAdriaan Moors2014-01-151-1/+0
|\ \ | | | | | | Quasi-comprehensive BigDecimal soundness/correctness fix.
| * | Quasi-comprehensive BigDecimal soundness/correctness fix.Rex Kerr2014-01-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes issues SI-6153, SI-6173, SI-6456, SI-6699, and SI-8116, along with a number of other similar possible issues. Relevant changes include * Changes to avoid heap explosion when working with BigInt - to isWhole - to hashCode - to equals - to BigInt's equals * Changes to enable equality matching hashCode - Only for sufficiently small BigInt - For identical values with different precision * Changes to isValidDouble - Takes precision into account now - New methods added to test whether even if the Double is not represented exactly, it's a representation of a certain type - New companion methods added to allow intended expansion of Double (binary/decimal difference) * Changes to constructor - Null arguments are not allowed (these can throw NPEs later at awkward/unexpected times) * New JUnit test to test all these things * Fixed existing tests to expect new behavior * Modified scaladocs to explain the issues * Deprecated problematic methods * Made application of MathContext more consistent (it is where you expect it and not where you don't) These changes are coordinated, for the most part, hence the monolithic commit.
* | | SI-8035 Deprecate automatic () insertion in argument listsSimon Ochsenreither2014-01-095-142/+137
|/ / | | | | | | | | | | | | | | | | | | | | | | | | This promotes the () insertion warning from -Ywarn-adapted-args to a deprecation warning. -Xfuture tunrs it into a compiler error. Auto tupling remains unchanged for now. The tests have been fixed the following way: - Warnings caused by general sloppiness (Try(), Future(), ...) have been fixed. - Warnings which raise interesting questions (x == (), ...) received an updated checkfile for now.
* | Use t- prefix instead of si- prefix for test filesDen Shabalin2013-12-162-0/+0
| |
* | Merge commit '7d74884' into merge-2.10.x-to-masterJason Zaugg2013-12-062-4/+4
|\| | | | | | | | | Conflicts: test/files/jvm/scala-concurrent-tck.scala
| * SI-6913 Fixing semantics of Future fallbackTo to be according to docsHeather Miller2013-12-052-4/+4
| | | | | | | | Origin: viktorklang@1bbe854
* | SI-7999 s.u.c.NonFatal: StackOverflowError is fatalSimon Ochsenreither2013-11-221-2/+2
| | | | | | | | | | | | | | | | | | As demonstrated in https://groups.google.com/d/topic/scala-language/eC9dqTTBYHg, SOEs should be considered fatal, because all popular JVM implementations seem to run into inconsistent state (ignoring finally blocks leading to not running monitorExit, leading to locks not being unlocked, ...) if one just pushes them enough.
* | deprecate Pair and TripleDen Shabalin2013-11-201-1/+1
| |
* | SI-7958 Deprecate methods `future` and `promise` in the `scala.concurrent` ↵Philipp Haller2013-11-122-81/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | package object - The corresponding `apply` methods in the `Future` and `Promise` objects should be used instead. - Adjusted tests to use non-deprecated versions - Fixed doc comments not to use deprecated methods - Added comment about planned removal in 2.13.0
* | Collections library tidying and deprecation. Separate parts are listed below.Rex Kerr2013-11-073-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Collections library tidying, part one: scripting. Everything in scala.collection.scripting is deprecated now, along with the << method that is implemented in a few other classes. Scripting does not seem used at all, and anyone who did can easily write a wrapper that does the same thing. Deprecated *Proxy collections. The only place proxies were used in the library was in swing.ListView, and that was easy to change to a lazy val. Proxy itself is used in ScalaNumberProxy and such, so it was left undeprecated. Deprecated Synchronized* traits from collections. Synchronizability does not compose well, and it requires careful examination of every method (which has not actually been done). Places where the Scala codebase needs to be fixed (eventually) include: scala.reflect.internal.util.Statistics$QuantMap scala.tools.nsc.interactive.Global (several places) Deprecated LinkedList (including Double- and -Like variants). Interface is idiosyncratic and dangerously low-level. Although some low-level functionality of this sort would be useful, this doesn't seem to be the ideal implementation. Also deprecated the extractFirst method in Queue as it exposes LinkedList. Cannot shift internal representations away from LinkedList at this time because of that method. Deprecated non-finality of several toX collection methods. Improved documentation of most toX collection methods to describe what the expectation is for their behavior. Additionally deprecated overriding of - toIterator in IterableLike (should always forward to iterator) - toTraversable in TraversableLike (should always return self) - toIndexedSeq in immutable.IndexedSeq (should always return self) - toMap in immutable.Map (should always return self) - toSet in immutable.Set (should always return self) Did not do anything with IterableLike.toIterable or Seq/SeqLike.toSeq since for some odd reason immutable.Range overrides those. Deprecated Forwarders from collections. Forwarding, without an automatic mechanism to keep up to date with changes in the forwarded class, is inherently unreliable. Absent a mechanism to keep current, they're deprecated. ListBuffer is the only class in the collections library that uses forwarders, and that functionality can be rolled into ListBuffer itself. Deprecating immutable set/map adaptors. They're a bad idea (barring compiler support) for the same reason that all the other adaptors are a bad idea: they get out of date and probably have a variety of performance bugs. Deprecated inheritance from leaf classes in immutable collections. Inheriting from leaf-classes in immutable collections is rarely a good idea since whenever you use any interesting collections method you'll revert to the original class. Also, the methods are often designed to work with only particular behavior, and an override would be difficult (at best) to make work. Fortunately, people seem to have realized this and there are few to no cases of people extending PagedSeq and TreeSet and the like. Note that in many cases the classes will become sealed not final. Deprecated overriding of methods and inheritance from various mutable collections. Some mutable collections seem unsuited for overriding since to override anything interesting you would need vast knowledge of internal data structures and/or access to private methods. These include - ArrayBuilder.ofX classes. - ArrayOps - Some methods of BitSet (moved others from private to protected final) - Some methods of HashTable and FlatHashTable - Some methods of HashMap and HashSet (esp += and -= which just forward) - Some methods of other maps and sets (LinkedHashX, ListMap, TreeSet) - PriorityQueue - UnrolledBuffer This is a somewhat aggressive deprecation, the theory being better to try it out now and back off if it's too much than not attempt the change and be stuck with collections that can neither be safely inherited nor have implementation details changed. Note that I have made no changes--in this commit--which would cause deprecation warnings in any of the Scala projects available on Maven (at least as gathered by Adriaan). There are deprecation warnings induced within the library (esp. for classes/traits that should become static) and the compiler. I have not attempted to fix all the deprecations in the compiler as some of them touch the IDE API (but these mostly involved Synchronized which is inherently unsafe, so this should be fixed eventually in coordination with the IDE code base(s)). Updated test checks to include new deprecations. Used a higher level implementation for messages in JavapClass.
* | Add a skeletal Delambdafy phase.James Iry2013-11-011-0/+1
| | | | | | | | | | | | This commit adds a do-nothing phase called "Delambdafy" that will eventually be responsible for doing the final translation of lambdas into classes.