diff --git a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala index 7909413e36fb..55b2f2ae4c8f 100644 --- a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala +++ b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala @@ -161,7 +161,7 @@ class ClassfileParser( for (i <- 0 until in.nextChar) parseMember(method = false) for (i <- 0 until in.nextChar) parseMember(method = true) - classInfo = cook.apply(parseAttributes(classRoot.symbol, classInfo)) + classInfo = parseAttributes(classRoot.symbol, classInfo) if (isAnnotation) addAnnotationConstructor(classInfo) val companionClassMethod = ctx.synthesizeCompanionMethod(nme.COMPANION_CLASS_METHOD, classRoot, moduleRoot) @@ -261,7 +261,7 @@ class ClassfileParser( addConstructorTypeParams(denot) } - denot.info = cook.apply(pool.getType(in.nextChar)) + denot.info = pool.getType(in.nextChar) if (isEnum) denot.info = ConstantType(Constant(sym)) if (isConstructor) normalizeConstructorParams() setPrivateWithin(denot, jflags) @@ -625,7 +625,8 @@ class ClassfileParser( for (i <- 0 until in.nextChar) { parseAttribute() } - newType + + cook.apply(newType) } /** Add synthetic constructor(s) and potentially also default getters which diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index e79121c7fe6e..f382d89f3946 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -69,7 +69,6 @@ class CompilationTests extends ParallelTesting { ), scala2Mode ) + - compileFilesInDir("../tests/pos-special/i3273", defaultOptions) + compileFilesInDir("../tests/pos-special/spec-t5545", defaultOptions) + compileFilesInDir("../tests/pos-special/strawman-collections", defaultOptions) + compileFile("../scala2-library/src/library/scala/collection/immutable/IndexedSeq.scala", defaultOptions) + @@ -110,6 +109,7 @@ class CompilationTests extends ParallelTesting { implicit val testGroup: TestGroup = TestGroup("posTwice") compileFile("../tests/pos/Labels.scala", defaultOptions) + compileFilesInDir("../tests/pos-java-interop", defaultOptions) + + compileFilesInDir("../tests/pos-java-interop-separate", defaultOptions) + compileFile("../tests/pos/t2168.scala", defaultOptions) + compileFile("../tests/pos/erasure.scala", defaultOptions) + compileFile("../tests/pos/Coder.scala", defaultOptions) + diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala index 48dcd42a96eb..062eb929e3e8 100644 --- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala +++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala @@ -376,7 +376,10 @@ trait ParallelTesting extends RunnerOrchestration { self => // Compile with a try to catch any StackTrace generated by the compiler: try { - driver.process(allArgs ++ files.map(_.getAbsolutePath), reporter = reporter) + // If a test contains a Java file that cannot be parsed by Dotty's Java source parser, its + // name must contain the string "JAVA_ONLY". + val dottyFiles = files.filterNot(_.getName.contains("JAVA_ONLY")).map(_.getAbsolutePath) + driver.process(allArgs ++ dottyFiles, reporter = reporter) val javaFiles = files.filter(_.getName.endsWith(".java")).map(_.getAbsolutePath) val javaErrors = compileWithJavac(javaFiles) diff --git a/tests/pos-special/i3273/test/Bar_1.java b/tests/pos-java-interop-separate/i3273/Bar_1.java similarity index 100% rename from tests/pos-special/i3273/test/Bar_1.java rename to tests/pos-java-interop-separate/i3273/Bar_1.java diff --git a/tests/pos-special/i3273/test/client_2.scala b/tests/pos-java-interop-separate/i3273/client_2.scala similarity index 100% rename from tests/pos-special/i3273/test/client_2.scala rename to tests/pos-java-interop-separate/i3273/client_2.scala diff --git a/tests/pos-java-interop-separate/i3533/Test_2.scala b/tests/pos-java-interop-separate/i3533/Test_2.scala new file mode 100644 index 000000000000..02819f8aac2a --- /dev/null +++ b/tests/pos-java-interop-separate/i3533/Test_2.scala @@ -0,0 +1,3 @@ +object Test { + TryMe_JAVA_ONLY_1.ifYouCan(list => list.size()) +} diff --git a/tests/pos-java-interop-separate/i3533/TryMe_JAVA_ONLY_1.java b/tests/pos-java-interop-separate/i3533/TryMe_JAVA_ONLY_1.java new file mode 100644 index 000000000000..14fbbd32e777 --- /dev/null +++ b/tests/pos-java-interop-separate/i3533/TryMe_JAVA_ONLY_1.java @@ -0,0 +1,6 @@ +import java.util.function.Function; + +public class TryMe_JAVA_ONLY_1 { + public static void ifYouCan(Function f) { + } +}