diff options
-rw-r--r-- | java/com/google/turbine/binder/CompUnitPreprocessor.java | 2 | ||||
-rw-r--r-- | javatests/com/google/turbine/lower/LowerIntegrationTest.java | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/java/com/google/turbine/binder/CompUnitPreprocessor.java b/java/com/google/turbine/binder/CompUnitPreprocessor.java index 970dc4b..25ba48a 100644 --- a/java/com/google/turbine/binder/CompUnitPreprocessor.java +++ b/java/com/google/turbine/binder/CompUnitPreprocessor.java @@ -105,7 +105,7 @@ public final class CompUnitPreprocessor { // "While the file could technically contain the source code // for one or more package-private (default-access) classes, // it would be very bad form." -- JLS 7.4.1 - if (!unit.pkg().get().annos().isEmpty()) { + if (!unit.pkg().get().annos().isEmpty() || unit.decls().isEmpty()) { decls = Iterables.concat(decls, ImmutableList.of(packageInfoTree(unit.pkg().get()))); } } else { diff --git a/javatests/com/google/turbine/lower/LowerIntegrationTest.java b/javatests/com/google/turbine/lower/LowerIntegrationTest.java index 9026725..6c95d44 100644 --- a/javatests/com/google/turbine/lower/LowerIntegrationTest.java +++ b/javatests/com/google/turbine/lower/LowerIntegrationTest.java @@ -391,7 +391,12 @@ public class LowerIntegrationTest { int version = SOURCE_VERSION.getOrDefault(test, 8); assumeTrue(version <= Runtime.version().feature()); ImmutableList<String> javacopts = - ImmutableList.of("-source", String.valueOf(version), "-target", String.valueOf(version)); + ImmutableList.of( + "-source", + String.valueOf(version), + "-target", + String.valueOf(version), + "-Xpkginfo:always"); Map<String, byte[]> expected = IntegrationTestSupport.runJavac(input.sources, classpathJar, javacopts); |