diff options
author | Paul Phillips <paulp@improving.org> | 2013-04-26 13:31:48 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-04-26 15:57:17 -0700 |
commit | b2c67b328daeaf51eacdb0333db85a7287b5fe1f (patch) | |
tree | 507b4785430fe9d06b4037c7a8c2850ad6cf0511 /src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala | |
parent | fbb13630d3c1dc9b8fdc503538d4ace5873f31c9 (diff) | |
download | scala-b2c67b328daeaf51eacdb0333db85a7287b5fe1f.tar.gz scala-b2c67b328daeaf51eacdb0333db85a7287b5fe1f.tar.bz2 scala-b2c67b328daeaf51eacdb0333db85a7287b5fe1f.zip |
SI-7398 Add support for java8 default methods
In classfile parser: mark symbols which represent interface
methods yet have code attributes with new flag DEFAULTMETHOD.
These must be kept distinct from regular method bodies so that
an error can be issued when a regular concrete method is
overridden without the override keyword, but not when the
overridden method is a default.
In java source parser: mark Modifiers of interface default
methods with DEFAULTMETHOD flag.
Writing the test was everything I dreamed, and more! However,
% test/partest --debug test/files/run/t7398.scala
Skipping java8-specific test under java version 1.7.0_21
testing: [...]/files/run/t7398.scala [ OK ]
All of 1 tests were successful (elapsed time: 00:00:04)
% test/partest --debug test/files/run/t7398.scala
Attempting java8-specific test under java version 1.8.0-ea
testing: [...]/files/run/t7398.scala [ OK ]
All of 1 tests were successful (elapsed time: 00:00:13)
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index fb2301de65..0ae2b501f0 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -931,6 +931,12 @@ abstract class ClassfileParser { case pkg => pkg.fullName(File.separatorChar)+File.separator+srcfileLeaf } srcfile0 = settings.outputDirs.srcFilesFor(in.file, srcpath).find(_.exists) + case tpnme.CodeATTR => + if (sym.owner.isInterface) { + sym setFlag DEFAULTMETHOD + log(s"$sym in ${sym.owner} is a java8+ default method.") + } + in.skip(attrLen) case _ => in.skip(attrLen) } |