aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/classfile
Commit message (Collapse)AuthorAgeFilesLines
* SI-9915 Utf8_info are modified UTF8Guillaume Martres2017-04-111-2/+6
| | | | | | | | | Adapted from scalac commit 3c5990ce5839f4bdfca8fed7f2c415a72f6a8bd8 by Som Snytt: Use DataInputStream.readUTF to read CONSTANT_Utf8_info. This fixes reading embedded null char and supplementary chars.
* SI-7455 Drop dummy param for synthetic access constructorGuillaume Martres2017-04-111-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adapted from scalac commit 050b4c951c838699c2fe30cbf01b63942c63a299 by Jason Zaugg: Java synthesizes public constructors in private classes to allow access from inner classes. The signature of that synthetic constructor (known as a "access constructor") has a dummy parameter appended to avoid overloading clashes. javac chooses the type "Enclosing$1" for the dummy parameter (called the "access constructor tag") which is either an existing anonymous class or a synthesized class for this purpose. In OpenJDK, this transformation is performed in: langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java (Incidentally, scalac would just emits a byte-code public constructor in this situation, rather than a private constructor / access constructor pair.) Scala parses the signature of the access contructor, and drops the $outer parameter, but retains the dummy parameter. This causes havoc when it tries to parse the bytecode for that anonymous class; the class file parser doesn't have the enclosing type parameters of Vector in scope and crash ensues. In any case, we shouldn't allow user code to see that constructor; it should only be called from within its own compilation unit. This commit drops the dummy parameter from access constructor signatures in class file parsing.
* SI-2464 Resiliance against missing InnerClass attributesGuillaume Martres2017-04-111-2/+6
| | | | | | | | | | | | | | | | | Adapted from scalac commit 2a19cd56258884e25f26565d7b865cc2ec931b23 by Jason Zaugg, but without the testing infrastructure added: A classfile in the wild related to Vaadin lacked the InnerClasses attribute. As such, our class file parser treated a nested enum class as top-level, which led to a crash when trying to find its linked module. More details of the investigation are available in the JIRA comments. The test introduces a new facility to rewrite classfiles. This commit turns this situation into a logged warning, rather than crashing. Code by paulp, test by yours truly.
* Fix #2186: Synchronize classpath handling with Scala 2.12Guillaume Martres2017-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This commit is a very crude port of the classpath handling as it exists in the 2.12.x branch of scalac (hash: 232d95a198c94da0c6c8393624e83e9b9ac84e81), this replaces the existing Classpath code that was adapted from scalac years ago. This code was written by Grzegorz Kossakowski, MichaƂ Pociecha, Lukas Rytz, Jason Zaugg and other scalac contributors, many thanks to them! For more information on this implementation, see the description of the PR that originally added it to scalac: https://github.com/scala/scala/pull/4060 Changes made to the copied code to get it to compile with dotty: - Rename scala.tools.nsc.util.ClassPath to dotty.tools.io.ClassPath - Rename scala.tools.nsc.classpath.* to dotty.tools.dotc.classpath.* - Replace "private[nsc]" by "private[dotty]" - Changed `isClass` methods in FileUtils to skip Scala 2.11 implementation classes (needed until we stop being retro-compatible with Scala 2.11) I also copied PlainFile.scala from scalac to get access to `PlainNioFile`.
* Simplify classfile parser "own name" checkingMartin Odersky2017-04-111-12/+5
| | | | | | | Simplifies the test that the class represented by a classfile is the class logically referenced by the file. The simplification is needed if we want to populate package scopes with unmangled classnames.
* Don't unmangle names in ClassfileParserMartin Odersky2017-04-111-13/+12
| | | | | Classfile parsing is about JVM-level names, not Scala level ones. So it is more consistent to use mangled names throughout.
* Names are no longer SeqsMartin Odersky2017-04-111-3/+7
| | | | | | | | Drop Seq implementation of name. This implementation was always problematic because it entailed potentially very costly conversions to toSimpleName. We now have better control over when we convert a name to a simple name.
* Decentralize unmangling, add new nameKindsMartin Odersky2017-04-111-2/+2
| | | | | | | Start scheme where unmangling is done by NameKinds instead of in NameOps. Also add namekinds for protected accessors.
* Rename NameExtractor -> NameKindMartin Odersky2017-04-111-1/+1
|
* Drop Config.semanticNames optionMartin Odersky2017-04-111-1/+2
| | | | | We now handle only semantic names. Also, name extractor tags and TASTY name tags are now aligned.
* Disentangle Names from SeqsMartin Odersky2017-04-111-1/+1
| | | | | | | | | Structured names are not Seqs anymmore. But the Seq behavior is required in many places that mangle names. As an intermediate step we drop the Seq basetype but add Seq behavior through a decorator. Most Seq operations only work on SimpleTermNames and their TypeName analogue, will throw an exception wehn called on structured names.
* Deug info in classfile parserMartin Odersky2017-04-111-1/+8
|
* Unmangle class names in ClassfileParserMartin Odersky2017-04-111-1/+1
|
* replace derived{Method,Poly}Type with derivedLambdaTypeMartin Odersky2017-04-061-3/+3
|
* Harmonize paramTypes and paramBoundsMartin Odersky2017-04-061-2/+2
| | | | | | MethodTypes have paramTypes whereas PolyTypes have paramBounds. We now harmonize by alling both paramInfos, and parameterizing types that will become common to both.
* Fix ClassfileParserMartin Odersky2017-03-311-1/+1
| | | | | | | #2158 has uncovered flaws in the classfile parser. Matches that used to always miss led to code that made no sense. The function naming was terrible too, that's why nobody understood what was going on. `findSourceFile` to find the class file, seriously?
* Drop mixed MethodType apply methodMartin Odersky2017-03-141-1/+1
| | | | | | The dropped method takes direct parameter types but a result type expression. Since parameter types are now in general dependent as well, that method is mostly redundant.
* Construct MethodTypes from parameter closureMartin Odersky2017-03-141-4/+4
| | | | | To allow for dependencies between method type parameters, construct MethodTypes from a closure that maps the currently constructed MethodType to its parameter types.
* ClassfileParser: avoid looking up inner class in wrong phaseGuillaume Martres2017-02-181-1/+1
| | | | | | | | | getMember needs to take an implicit `Context` parameter, otherwise the following code: val result = ctx.atPhaseNotLaterThan(ctx.typerPhase) { implicit ctx => getMember(owner, innerName.toTypeName) } will not run getMember at the typer phase.
* Drop atPhaseNotLaterThanTyperMartin Odersky2017-02-011-1/+1
| | | | | It was used only once and its body is almost as short as the name, so no need to have a separate method.
* Move compiler and compiler tests to compiler dirFelix Mulder2016-11-224-0/+1787