Mercurial > hg > openjdk > jdk9 > langtools
changeset 3823:cd0a8a7a0199
Merge
author | alanb |
---|---|
date | Fri, 16 Dec 2016 08:17:55 +0000 |
parents | 9c8da4d340c8 (current diff) d8766c39123a (diff) |
children | 376ee1fd40c3 |
files | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleVersion_attribute.java test/jdk/javadoc/doclet/testModules/TestModules.java test/jdk/javadoc/doclet/testModules/module1/module-info.java test/jdk/javadoc/doclet/testModules/module1/testpkgmdl1/TestClassInModule1.java test/jdk/javadoc/doclet/testModules/module2/module-info.java test/jdk/javadoc/doclet/testModules/module2/testpkg2mdl2/TestInterfaceInModule2.java test/jdk/javadoc/doclet/testModules/module2/testpkgmdl2/AnnotationType.java test/jdk/javadoc/doclet/testModules/module2/testpkgmdl2/AnnotationTypeUndocumented.java test/jdk/javadoc/doclet/testModules/module2/testpkgmdl2/TestClassInModule2.java test/jdk/javadoc/doclet/testModules/moduleA/module-info.java test/tools/javac/diags/examples/CyclicRequires/modulesourcepath/m1/module-info.java test/tools/javac/diags/examples/CyclicRequires/modulesourcepath/m2/module-info.java test/tools/javac/diags/examples/DuplicateModule/modulesourcepath/m1/module-info.java test/tools/javac/diags/examples/DuplicateModule/modulesourcepath/m2/module-info.java test/tools/javac/diags/examples/HasBeenDeprecatedModule/modulesourcepath/m1/module-info.java test/tools/javac/diags/examples/HasBeenDeprecatedModule/modulesourcepath/m2/module-info.java test/tools/javac/diags/examples/HasBeenDeprecatedRemovalModule/modulesourcepath/m1/module-info.java test/tools/javac/diags/examples/HasBeenDeprecatedRemovalModule/modulesourcepath/m2/module-info.java test/tools/javac/diags/examples/LeaksNotAccessible/modulesourcepath/m1/api/Api.java test/tools/javac/diags/examples/LeaksNotAccessible/modulesourcepath/m1/module-info.java test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m1/api1/Api1.java test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m1/module-info.java test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m2/api2/Api2.java test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m2/module-info.java test/tools/javac/diags/examples/LeaksNotAccessibleUnexported/modulesourcepath/m1/api/Api.java test/tools/javac/diags/examples/LeaksNotAccessibleUnexported/modulesourcepath/m1/impl/Impl.java test/tools/javac/diags/examples/LeaksNotAccessibleUnexported/modulesourcepath/m1/module-info.java test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m1/api/Api.java test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m1/module-info.java test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m1/qapi/QApi.java test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m2/module-info.java test/tools/javac/diags/examples/ModuleInfoWithoutModule/modulesourcepath/m1/module-info.java test/tools/javac/diags/examples/MultiModuleOutputCannotBeExplodedModule/additional/m1/module-info.java test/tools/javac/diags/examples/MultiModuleOutputCannotBeExplodedModule/modulesourcepath/m2/module-info.java test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m1/module-info.java test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m1/p1/C1.java test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m2/module-info.java test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m2/p2/C2.java test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib1/exported/Api1.java test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib1/module-info.java test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib2/exported/Api2.java test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib2/module-info.java test/tools/javac/diags/examples/PackageEmptyOrNotFound/modulesourcepath/m1/module-info.java test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m1/exported/Service.java test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m1/exported/ServiceImplementation.java test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m1/module-info.java test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m2/module-info.java test/tools/javac/diags/examples/UnnamedPackageInNamedModule/modulesourcepath/m1/UnnamedPackageInNamedModule.java test/tools/javac/diags/examples/UnnamedPackageInNamedModule/modulesourcepath/m1/module-info.java test/tools/javac/modules/AnnotationProcessing.java test/tools/jdeps/modules/src/m4/module-info.java test/tools/jdeps/modules/src/m4/p4/Lib.java test/tools/jdeps/modules/src/m4/p4/internal/Impl.java test/tools/jdeps/modules/src/m5/module-info.java test/tools/jdeps/modules/src/m5/p5/Main.java test/tools/jdeps/modules/src/m5/p5/internal/T.java test/tools/jdeps/modules/src/m8/module-info.java test/tools/jdeps/modules/src/m8/p8/Main.java |
diffstat | 200 files changed, 3985 insertions(+), 3075 deletions(-) [+] |
line wrap: on
line diff
--- a/make/tools/crules/MutableFieldsAnalyzer.java Thu Dec 15 11:47:25 2016 -0800 +++ b/make/tools/crules/MutableFieldsAnalyzer.java Fri Dec 16 08:17:55 2016 +0000 @@ -107,6 +107,8 @@ "layerClass", "bootMethod", "defineModulesWithOneLoaderMethod", "configurationMethod"); ignoreFields("com.sun.tools.javac.util.JDK9Wrappers$Module", "addExportsMethod", "addUsesMethod", "getModuleMethod", "getUnnamedModuleMethod"); + ignoreFields("com.sun.tools.javac.util.JDK9Wrappers$ModuleDescriptor$Version", + "versionClass", "parseMethod"); ignoreFields("com.sun.tools.javac.util.JDK9Wrappers$ServiceLoaderHelper", "loadMethod"); ignoreFields("com.sun.tools.javac.util.JDK9Wrappers$VMHelper",
--- a/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java Fri Dec 16 08:17:55 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,6 +36,7 @@ import javax.lang.model.element.ModuleElement.Directive; import javax.lang.model.element.ModuleElement.DirectiveKind; import javax.lang.model.element.ModuleElement.ExportsDirective; +import javax.lang.model.element.ModuleElement.OpensDirective; import javax.lang.model.element.ModuleElement.ProvidesDirective; import javax.lang.model.element.ModuleElement.RequiresDirective; import javax.lang.model.element.ModuleElement.UsesDirective; @@ -239,11 +240,9 @@ return set; } - - /** - * Returns a list of export directives in {@code directives}. - * @return a list of export directives in {@code directives} + * Returns a list of {@code exports} directives in {@code directives}. + * @return a list of {@code exports} directives in {@code directives} * @param directives the directives to filter * @since 9 */ @@ -253,8 +252,19 @@ } /** - * Returns a list of provides directives in {@code directives}. - * @return a list of provides directives in {@code directives} + * Returns a list of {@code opens} directives in {@code directives}. + * @return a list of {@code opens} directives in {@code directives} + * @param directives the directives to filter + * @since 9 + */ + public static List<OpensDirective> + opensIn(Iterable<? extends Directive> directives) { + return listFilter(directives, DirectiveKind.OPENS, OpensDirective.class); + } + + /** + * Returns a list of {@code provides} directives in {@code directives}. + * @return a list of {@code provides} directives in {@code directives} * @param directives the directives to filter * @since 9 */ @@ -264,8 +274,8 @@ } /** - * Returns a list of requires directives in {@code directives}. - * @return a list of requires directives in {@code directives} + * Returns a list of {@code requires} directives in {@code directives}. + * @return a list of {@code requires} directives in {@code directives} * @param directives the directives to filter * @since 9 */ @@ -275,8 +285,8 @@ } /** - * Returns a list of uses directives in {@code directives}. - * @return a list of uses directives in {@code directives} + * Returns a list of {@code uses} directives in {@code directives}. + * @return a list of {@code uses} directives in {@code directives} * @param directives the directives to filter * @since 9 */
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java Fri Dec 16 08:17:55 2016 +0000 @@ -118,6 +118,7 @@ if (source.compareTo(Source.JDK1_9) >= 0) { values.add(LintCategory.DEP_ANN); } + values.add(LintCategory.MODULE); values.add(LintCategory.REMOVAL); } @@ -205,6 +206,11 @@ FINALLY("finally"), /** + * Warn about module system related issues. + */ + MODULE("module"), + + /** * Warn about issues relating to use of command line options */ OPTIONS("options"),
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java Fri Dec 16 08:17:55 2016 +0000 @@ -925,6 +925,7 @@ public Completer usesProvidesCompleter = Completer.NULL_COMPLETER; public final Set<ModuleFlags> flags = EnumSet.noneOf(ModuleFlags.class); + public final Set<ModuleResolutionFlags> resolutionFlags = EnumSet.noneOf(ModuleResolutionFlags.class); /** * Create a ModuleSymbol with an associated module-info ClassSymbol. @@ -1037,7 +1038,26 @@ } public final int value; + } + public enum ModuleResolutionFlags { + DO_NOT_RESOLVE_BY_DEFAULT(0x0001), + WARN_DEPRECATED(0x0002), + WARN_DEPRECATED_REMOVAL(0x0004), + WARN_INCUBATOR(0x0008); + + public static int value(Set<ModuleResolutionFlags> s) { + int v = 0; + for (ModuleResolutionFlags f: s) + v |= f.value; + return v; + } + + private ModuleResolutionFlags(int value) { + this.value = value; + } + + public final int value; } /** A class for package symbols
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Fri Dec 16 08:17:55 2016 +0000 @@ -4444,7 +4444,7 @@ ModuleSymbol msym = tree.sym; Lint lint = env.outer.info.lint = env.outer.info.lint.augment(msym); Lint prevLint = chk.setLint(lint); - + chk.checkModuleName(tree); chk.checkDeprecatedAnnotation(tree, msym); try {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Fri Dec 16 08:17:55 2016 +0000 @@ -2116,6 +2116,18 @@ } } + public void checkModuleName (JCModuleDecl tree) { + Name moduleName = tree.sym.name; + Assert.checkNonNull(moduleName); + if (lint.isEnabled(LintCategory.MODULE)) { + String moduleNameString = moduleName.toString(); + int nameLength = moduleNameString.length(); + if (nameLength > 0 && Character.isDigit(moduleNameString.charAt(nameLength - 1))) { + log.warning(Lint.LintCategory.MODULE, tree.qualId.pos(), Warnings.PoorChoiceForModuleName(moduleName)); + } + } + } + private boolean checkNameClash(ClassSymbol origin, Symbol s1, Symbol s2) { ClashFilter cf = new ClashFilter(origin.type); return (cf.accepts(s1) && @@ -3877,4 +3889,17 @@ log.warning(LintCategory.EXPORTS, pos, Warnings.LeaksNotAccessibleNotRequiredTransitive(kindName(what), what, what.packge().modle)); } } + + void checkModuleExists(final DiagnosticPosition pos, ModuleSymbol msym) { + if (msym.kind != MDL) { + deferredLintHandler.report(new DeferredLintHandler.LintLogger() { + @Override + public void report() { + if (lint.isEnabled(Lint.LintCategory.MODULE)) + log.warning(LintCategory.MODULE, pos, Warnings.ModuleNotFound(msym)); + } + }); + } + } + }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java Fri Dec 16 08:17:55 2016 +0000 @@ -158,6 +158,7 @@ private final Set<String> extraAddMods = new HashSet<>(); private final String limitModsOpt; private final Set<String> extraLimitMods = new HashSet<>(); + private final String moduleVersionOpt; private final boolean lintOptions; @@ -203,6 +204,7 @@ addReadsOpt = options.get(Option.ADD_READS); addModsOpt = options.get(Option.ADD_MODULES); limitModsOpt = options.get(Option.LIMIT_MODULES); + moduleVersionOpt = options.get(Option.MODULE_VERSION); } int depth = -1; @@ -605,13 +607,16 @@ msym.flags_field |= UNATTRIBUTED; ModuleVisitor v = new ModuleVisitor(); JavaFileObject prev = log.useSource(tree.sourcefile); + JCModuleDecl moduleDecl = tree.getModuleDecl(); + DiagnosticPosition prevLintPos = deferredLintHandler.setPos(moduleDecl.pos()); + try { - JCModuleDecl moduleDecl = tree.getModuleDecl(); moduleDecl.accept(v); completeModule(msym); checkCyclicDependencies(moduleDecl); } finally { log.useSource(prev); + deferredLintHandler.setPos(prevLintPos); msym.flags_field &= ~UNATTRIBUTED; } } @@ -693,15 +698,12 @@ Set<ModuleSymbol> to = new LinkedHashSet<>(); for (JCExpression n: tree.moduleNames) { ModuleSymbol msym = lookupModule(n); - if (msym.kind != MDL) { - log.error(n.pos(), Errors.ModuleNotFound(msym)); - } else { - for (ExportsDirective d : exportsForPackage) { - checkDuplicateExportsToModule(n, msym, d); - } - if (!to.add(msym)) { - reportExportsConflictToModule(n, msym); - } + chk.checkModuleExists(n.pos(), msym); + for (ExportsDirective d : exportsForPackage) { + checkDuplicateExportsToModule(n, msym, d); + } + if (!to.add(msym)) { + reportExportsConflictToModule(n, msym); } } toModules = List.from(to); @@ -755,15 +757,12 @@ Set<ModuleSymbol> to = new LinkedHashSet<>(); for (JCExpression n: tree.moduleNames) { ModuleSymbol msym = lookupModule(n); - if (msym.kind != MDL) { - log.error(n.pos(), Errors.ModuleNotFound(msym)); - } else { - for (OpensDirective d : opensForPackage) { - checkDuplicateOpensToModule(n, msym, d); - } - if (!to.add(msym)) { - reportOpensConflictToModule(n, msym); - } + chk.checkModuleExists(n.pos(), msym); + for (OpensDirective d : opensForPackage) { + checkDuplicateOpensToModule(n, msym, d); + } + if (!to.add(msym)) { + reportOpensConflictToModule(n, msym); } } toModules = List.from(to); @@ -1148,6 +1147,12 @@ result.add(syms.unnamedModule); allModules = result; + + //add module versions from options, if any: + if (moduleVersionOpt != null) { + Name version = names.fromString(moduleVersionOpt); + rootModules.forEach(m -> m.version = version); + } } public boolean isInModuleGraph(ModuleSymbol msym) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java Fri Dec 16 08:17:55 2016 +0000 @@ -85,6 +85,8 @@ public final static int CONSTANT_MethodHandle = 15; public final static int CONSTANT_MethodType = 16; public final static int CONSTANT_InvokeDynamic = 18; + public final static int CONSTANT_Module = 19; + public final static int CONSTANT_Package = 20; public final static int REF_getField = 1; public final static int REF_getStatic = 2;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java Fri Dec 16 08:17:55 2016 +0000 @@ -161,9 +161,6 @@ */ protected ModuleSymbol currentModule = null; - // FIXME: temporary compatibility code - private boolean readNewModuleAttribute; - /** The buffer containing the currently read class file. */ byte[] buf = new byte[INITIAL_BUFFER_SIZE]; @@ -392,6 +389,8 @@ case CONSTANT_Class: case CONSTANT_String: case CONSTANT_MethodType: + case CONSTANT_Module: + case CONSTANT_Package: bp = bp + 2; break; case CONSTANT_MethodHandle: @@ -481,6 +480,11 @@ case CONSTANT_InvokeDynamic: skipBytes(5); break; + case CONSTANT_Module: + case CONSTANT_Package: + // this is temporary for now: treat as a simple reference to the underlying Utf8. + poolObj[i] = readName(getChar(index + 1)); + break; default: throw badClassFile("bad.const.pool.tag", Byte.toString(tag)); } @@ -567,40 +571,12 @@ return (NameAndType)obj; } - /** Read the class name of a module-info.class file. - * The name is stored in a CONSTANT_Class entry, where the - * class name is of the form module-name.module-info. - */ - Name readModuleInfoName(int i) { - if (majorVersion < Version.V53.major) { - throw badClassFile("anachronistic.module.info", - Integer.toString(majorVersion), - Integer.toString(minorVersion)); - } - int classIndex = poolIdx[i]; - if (buf[classIndex] == CONSTANT_Class) { - int utf8Index = poolIdx[getChar(classIndex + 1)]; - if (buf[utf8Index] == CONSTANT_Utf8) { - int len = getChar(utf8Index + 1); - int start = utf8Index + 3; - return names.fromUtf(internalize(buf, start, len)); - } - } - throw badClassFile("bad.module-info.name"); - } - /** Read the name of a module. - * The name is stored in a CONSTANT_Utf8 entry, in - * JVMS 4.2 internal form (with '/' instead of '.') + * The name is stored in a CONSTANT_Module entry, in + * JVMS 4.2 binary form (using ".", not "/") */ Name readModuleName(int i) { - Name name = readName(i); - // FIXME: temporary compatibility code - if (readNewModuleAttribute) { - return names.fromUtf(internalize(name)); - } else { - return name; - } + return readName(i); } /** Read module_flags. @@ -614,6 +590,17 @@ return set; } + /** Read resolution_flags. + */ + Set<ModuleResolutionFlags> readModuleResolutionFlags(int flags) { + Set<ModuleResolutionFlags> set = EnumSet.noneOf(ModuleResolutionFlags.class); + for (ModuleResolutionFlags f : ModuleResolutionFlags.values()) { + if ((flags & f.value) != 0) + set.add(f); + } + return set; + } + /** Read exports_flags. */ Set<ExportsFlag> readExportsFlags(int flags) { @@ -1282,21 +1269,20 @@ ModuleSymbol msym = (ModuleSymbol) sym.owner; ListBuffer<Directive> directives = new ListBuffer<>(); - // FIXME: temporary compatibility code - if (readNewModuleAttribute) { - Name moduleName = readModuleName(nextChar()); - if (currentModule.name != moduleName) { - throw badClassFile("module.name.mismatch", moduleName, currentModule.name); - } + Name moduleName = readModuleName(nextChar()); + if (currentModule.name != moduleName) { + throw badClassFile("module.name.mismatch", moduleName, currentModule.name); } msym.flags.addAll(readModuleFlags(nextChar())); + msym.version = readName(nextChar()); ListBuffer<RequiresDirective> requires = new ListBuffer<>(); int nrequires = nextChar(); for (int i = 0; i < nrequires; i++) { ModuleSymbol rsym = syms.enterModule(readModuleName(nextChar())); Set<RequiresFlag> flags = readRequiresFlags(nextChar()); + nextChar(); // skip compiled version requires.add(new RequiresDirective(rsym, flags)); } msym.requires = requires.toList(); @@ -1372,7 +1358,7 @@ } }, - new AttributeReader(names.ModuleVersion, V53, CLASS_ATTRIBUTE) { + new AttributeReader(names.ModuleResolution, V53, CLASS_ATTRIBUTE) { @Override protected boolean accepts(AttributeKind kind) { return super.accepts(kind) && allowModules; @@ -1380,7 +1366,7 @@ protected void read(Symbol sym, int attrLen) { if (sym.kind == TYP && sym.owner.kind == MDL) { ModuleSymbol msym = (ModuleSymbol) sym.owner; - msym.version = readName(nextChar()); + msym.resolutionFlags.addAll(readModuleResolutionFlags(nextChar())); } } }, @@ -2564,24 +2550,15 @@ self.flatname); } } else { + if (majorVersion < Version.V53.major) { + throw badClassFile("anachronistic.module.info", + Integer.toString(majorVersion), + Integer.toString(minorVersion)); + } c.flags_field = flags; currentModule = (ModuleSymbol) c.owner; int this_class = nextChar(); - // FIXME: temporary compatibility code - if (this_class == 0) { - readNewModuleAttribute = true; - } else { - Name modInfoName = readModuleInfoName(this_class); - if (currentModule.name.append('.', names.module_info) != modInfoName) { - //strip trailing .module-info, if exists: - int modInfoStart = modInfoName.length() - names.module_info.length(); - modInfoName = modInfoName.subName(modInfoStart, modInfoName.length()) == names.module_info && - modInfoName.charAt(modInfoStart - 1) == '.' ? - modInfoName.subName(0, modInfoStart - 1) : modInfoName; - throw badClassFile("module.name.mismatch", modInfoName, currentModule.name); - } - readNewModuleAttribute = false; - } + // temp, no check on this_class } // class attributes must be read before class
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Fri Dec 16 08:17:55 2016 +0000 @@ -474,6 +474,14 @@ poolbuf.appendByte(CONSTANT_MethodHandle); poolbuf.appendByte(ref.refKind); poolbuf.appendChar(pool.put(ref.refSym)); + } else if (value instanceof ModuleSymbol) { + ModuleSymbol m = (ModuleSymbol)value; + poolbuf.appendByte(CONSTANT_Module); + poolbuf.appendChar(pool.put(m.name)); + } else if (value instanceof PackageSymbol) { + PackageSymbol m = (PackageSymbol)value; + poolbuf.appendByte(CONSTANT_Package); + poolbuf.appendChar(pool.put(names.fromUtf(externalize(m.fullname)))); } else { Assert.error("writePool " + value); } @@ -954,8 +962,9 @@ int alenIdx = writeAttr(names.Module); - databuf.appendChar(pool.put(names.fromUtf(externalize(m.name)))); + databuf.appendChar(pool.put(m)); databuf.appendChar(ModuleFlags.value(m.flags)); // module_flags + databuf.appendChar(m.version != null ? pool.put(m.version) : 0); ListBuffer<RequiresDirective> requires = new ListBuffer<>(); for (RequiresDirective r: m.requires) { @@ -964,21 +973,22 @@ } databuf.appendChar(requires.size()); for (RequiresDirective r: requires) { - databuf.appendChar(pool.put(names.fromUtf(externalize(r.module.name)))); + databuf.appendChar(pool.put(r.module)); databuf.appendChar(RequiresFlag.value(r.flags)); + databuf.appendChar(r.module.version != null ? pool.put(r.module.version) : 0); } List<ExportsDirective> exports = m.exports; databuf.appendChar(exports.size()); for (ExportsDirective e: exports) { - databuf.appendChar(pool.put(names.fromUtf(externalize(e.packge.flatName())))); + databuf.appendChar(pool.put(e.packge)); databuf.appendChar(ExportsFlag.value(e.flags)); if (e.modules == null) { databuf.appendChar(0); } else { databuf.appendChar(e.modules.size()); for (ModuleSymbol msym: e.modules) { - databuf.appendChar(pool.put(names.fromUtf(externalize(msym.name)))); + databuf.appendChar(pool.put(msym)); } } } @@ -986,14 +996,14 @@ List<OpensDirective> opens = m.opens; databuf.appendChar(opens.size()); for (OpensDirective o: opens) { - databuf.appendChar(pool.put(names.fromUtf(externalize(o.packge.flatName())))); + databuf.appendChar(pool.put(o.packge)); databuf.appendChar(OpensFlag.value(o.flags)); if (o.modules == null) { databuf.appendChar(0); } else { databuf.appendChar(o.modules.size()); for (ModuleSymbol msym: o.modules) { - databuf.appendChar(pool.put(names.fromUtf(externalize(msym.name)))); + databuf.appendChar(pool.put(msym)); } } } @@ -1718,7 +1728,8 @@ databuf.appendChar(flags); if (c.owner.kind == MDL) { - databuf.appendChar(0); + PackageSymbol unnamed = ((ModuleSymbol) c.owner).unnamedPackage; + databuf.appendChar(pool.put(new ClassSymbol(0, names.module_info, unnamed))); } else { databuf.appendChar(pool.put(c)); }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ModuleNameReader.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ModuleNameReader.java Fri Dec 16 08:17:55 2016 +0000 @@ -100,30 +100,24 @@ if (access_flags != 0x8000) throw new BadClassFile("invalid access flags for module: 0x" + Integer.toHexString(access_flags)); - // FIXME: temporary compatibility code int this_class = nextChar(); - if (this_class == 0) { - // new form - checkZero(nextChar(), "super_class"); - checkZero(nextChar(), "interface_count"); - checkZero(nextChar(), "fields_count"); - checkZero(nextChar(), "methods_count"); - int attributes_count = nextChar(); - for (int i = 0; i < attributes_count; i++) { - int attr_name = nextChar(); - int attr_length = nextInt(); - if (getUtf8Value(attr_name, false).equals("Module") && attr_length > 2) { - return getUtf8Value(nextChar(), true); - } else { - // skip over unknown attributes - bp += attr_length; - } + // could, should, check this_class == CONSTANT_Class("mdoule-info") + checkZero(nextChar(), "super_class"); + checkZero(nextChar(), "interface_count"); + checkZero(nextChar(), "fields_count"); + checkZero(nextChar(), "methods_count"); + int attributes_count = nextChar(); + for (int i = 0; i < attributes_count; i++) { + int attr_name = nextChar(); + int attr_length = nextInt(); + if (getUtf8Value(attr_name, false).equals("Module") && attr_length > 2) { + return getModuleName(nextChar()); + } else { + // skip over unknown attributes + bp += attr_length; } - throw new BadClassFile("no Module attribute"); - } else { - // old form - return readModuleInfoName(this_class); } + throw new BadClassFile("no Module attribute"); } void checkZero(int count, String name) throws BadClassFile { @@ -172,6 +166,8 @@ case CONSTANT_Class: case CONSTANT_String: case CONSTANT_MethodType: + case CONSTANT_Module: + case CONSTANT_Package: bp = bp + 2; break; case CONSTANT_MethodHandle: @@ -211,33 +207,13 @@ throw new BadClassFile("bad name at index " + index); } - /** Read the class name of a module-info.class file. - * The name is stored in a CONSTANT_Class entry, where the - * class name is of the form module-name/module-info. - */ - String readModuleInfoName(int i) throws BadClassFile { - int classIndex = poolIdx[i]; - if (buf[classIndex] == CONSTANT_Class) { - int utf8Index = poolIdx[getChar(classIndex + 1)]; - if (buf[utf8Index] == CONSTANT_Utf8) { - int len = getChar(utf8Index + 1); - int start = utf8Index + 3; - String suffix = "/module-info"; - if (endsWith(buf, start, len, suffix)) - return new String(ClassFile.internalize(buf, start, len - suffix.length())); - } + String getModuleName(int index) throws BadClassFile { + int infoIndex = poolIdx[index]; + if (buf[infoIndex] == CONSTANT_Module) { + return getUtf8Value(getChar(infoIndex + 1), true); + } else { + throw new BadClassFile("bad module name at index " + index); } - throw new BadClassFile("bad module-info name"); - } - - private boolean endsWith(byte[] buf, int start, int len, String suffix) { - if (len <= suffix.length()) - return false; - for (int i = 0; i < suffix.length(); i++) { - if (buf[start + len - suffix.length() + i] != suffix.charAt(i)) - return false; - } - return true; } private static byte[] readInputStream(byte[] buf, InputStream s) throws IOException {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java Fri Dec 16 08:17:55 2016 +0000 @@ -582,7 +582,8 @@ Option.BOOT_CLASS_PATH, Option.XBOOTCLASSPATH_PREPEND, Option.XBOOTCLASSPATH, Option.XBOOTCLASSPATH_APPEND, Option.ENDORSEDDIRS, Option.DJAVA_ENDORSED_DIRS, - Option.EXTDIRS, Option.DJAVA_EXT_DIRS); + Option.EXTDIRS, Option.DJAVA_EXT_DIRS, + Option.PROFILE); checkOptionAllowed(t.compareTo(Target.JDK1_9) >= 0, option -> error("err.option.not.allowed.with.target", option.getPrimaryName(), t.name),
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java Fri Dec 16 08:17:55 2016 +0000 @@ -35,16 +35,12 @@ import java.util.Collections; import java.util.Comparator; import java.util.EnumSet; -import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Locale; -import java.util.Map; import java.util.ServiceLoader; import java.util.Set; import java.util.TreeSet; -import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.StreamSupport; @@ -60,7 +56,6 @@ import com.sun.tools.javac.jvm.Target; import com.sun.tools.javac.platform.PlatformProvider; import com.sun.tools.javac.processing.JavacProcessingEnvironment; -import com.sun.tools.javac.resources.CompilerProperties.Errors; import com.sun.tools.javac.util.Assert; import com.sun.tools.javac.util.JDK9Wrappers; import com.sun.tools.javac.util.Log; @@ -634,6 +629,33 @@ } }, + MODULE_VERSION("--module-version", "opt.arg.module.version", "opt.module.version", STANDARD, BASIC) { + @Override + public void process(OptionHelper helper, String option, String arg) throws InvalidValueException { + if (arg.isEmpty()) { + throw helper.newInvalidValueException("err.no.value.for.option", option); + } else { + try { + Class.forName(JDK9Wrappers.ModuleDescriptor.Version.CLASSNAME); + // use official parser if available + try { + JDK9Wrappers.ModuleDescriptor.Version.parse(arg); + } catch (IllegalArgumentException e) { + throw helper.newInvalidValueException("err.bad.value.for.option", option, arg); + } + } catch (ClassNotFoundException ex) { + // fall-back to simplistic rules when running on older platform + if (!(arg.charAt(0) >= '0' && arg.charAt(0) <= '9') || + arg.endsWith("-") || + arg.endsWith("+")) { + throw helper.newInvalidValueException("err.bad.value.for.option", option, arg); + } + } + } + super.process(helper, option, arg); + } + }, + // This option exists only for the purpose of documenting itself. // It's actually implemented by the CommandLine class. AT("@", "opt.arg.file", "opt.AT", STANDARD, INFO, ArgKind.ADJACENT) { @@ -681,7 +703,7 @@ @Override public void process(OptionHelper helper, String option) throws InvalidValueException { try { - Class.forName(JDK9Wrappers.VMHelper.VM_CLASSNAME); + Class.forName(JDK9Wrappers.VMHelper.CLASSNAME); String[] runtimeArgs = JDK9Wrappers.VMHelper.getRuntimeArguments(); for (String arg : runtimeArgs) { // Handle any supported runtime options; ignore all others. @@ -1035,7 +1057,7 @@ * @param helper a helper to provide access to the environment * @param arg the arg string that identified this option * @param rest the remaining strings to be analysed - * @return true if the operation was successful, and false otherwise + * @throws InvalidValueException if the value of the option was invalid * @implNote The return value is the opposite of that used by {@link #process}. */ public void handleOption(OptionHelper helper, String arg, Iterator<String> rest) throws InvalidValueException { @@ -1084,6 +1106,7 @@ * @param option the option to be processed * @param arg the value to associate with the option, or a default value * to be used if the option does not otherwise take an argument. + * @throws InvalidValueException if an error occurred */ public void process(OptionHelper helper, String option, String arg) throws InvalidValueException { if (choices != null) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties Fri Dec 16 08:17:55 2016 +0000 @@ -1457,6 +1457,10 @@ compiler.warn.finally.cannot.complete=\ finally clause cannot complete normally +# 0: name +compiler.warn.poor.choice.for.module.name=\ + module name {0} should avoid terminal digits + # 0: symbol, 1: symbol compiler.warn.has.been.deprecated=\ {0} in {1} has been deprecated @@ -2749,6 +2753,10 @@ compiler.err.module.not.found=\ module not found: {0} +# 0: symbol +compiler.warn.module.not.found=\ + module not found: {0} + compiler.err.too.many.modules=\ too many module declarations found
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties Fri Dec 16 08:17:55 2016 +0000 @@ -201,6 +201,9 @@ javac.opt.Xlint.desc.finally=\ Warn about finally clauses that do not terminate normally. +javac.opt.Xlint.desc.module=\ + Warn about module system related issues. + javac.opt.Xlint.desc.options=\ Warn about issues relating to use of command line options. @@ -308,6 +311,10 @@ Limit the universe of observable modules javac.opt.arg.limitmods=\ <module>(,<module>)* +javac.opt.module.version=\ + Specify version of modules that are being compiled +javac.opt.arg.module.version=\ + <version> javac.opt.inherit_runtime_environment=\ Inherit module system configuration options from the runtime environment.
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java Fri Dec 16 08:17:55 2016 +0000 @@ -462,11 +462,22 @@ @Override public void visitExports(JCExports tree) { try { - if (tree.hasTag(EXPORTS)) { - print("exports "); - } else { - print("opens "); + print("exports "); + printExpr(tree.qualid); + if (tree.moduleNames != null) { + print(" to "); + printExprs(tree.moduleNames); } + print(";"); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + @Override + public void visitOpens(JCOpens tree) { + try { + print("opens "); printExpr(tree.qualid); if (tree.moduleNames != null) { print(" to "); @@ -1493,7 +1504,7 @@ public void visitTree(JCTree tree) { try { - print("(UNKNOWN: " + tree + ")"); + print("(UNKNOWN: " + tree.getTag() + ")"); println(); } catch (IOException e) { throw new UncheckedIOException(e);
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java Fri Dec 16 08:17:55 2016 +0000 @@ -86,6 +86,58 @@ } /** + * Wrapper class for java.lang.module.ModuleDescriptor and ModuleDescriptor.Version. + */ + public static class ModuleDescriptor { + public static class Version { + public static final String CLASSNAME = "java.lang.module.ModuleDescriptor$Version"; + private final Object theRealVersion; + + private Version(Object version) { + this.theRealVersion = version; + } + + public static Version parse(String v) { + try { + init(); + Object result = parseMethod.invoke(null, v); + Version version = new Version(result); + return version; + } catch (InvocationTargetException ex) { + if (ex.getCause() instanceof IllegalArgumentException) { + throw (IllegalArgumentException) ex.getCause(); + } else { + throw new Abort(ex); + } + } catch (IllegalAccessException | IllegalArgumentException | SecurityException ex) { + throw new Abort(ex); + } + } + + @Override + public String toString() { + return theRealVersion.toString(); + } + + // ----------------------------------------------------------------------------------------- + + private static Class<?> versionClass = null; + private static Method parseMethod = null; + + private static void init() { + if (versionClass == null) { + try { + versionClass = Class.forName(CLASSNAME, false, null); + parseMethod = versionClass.getDeclaredMethod("parse", String.class); + } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) { + throw new Abort(ex); + } + } + } + } + } + + /** * Wrapper class for java.lang.module.ModuleFinder. */ public static class ModuleFinder { @@ -338,7 +390,7 @@ * Helper class for new method in jdk.internal.misc.VM. */ public static final class VMHelper { - public static final String VM_CLASSNAME = "jdk.internal.misc.VM"; + public static final String CLASSNAME = "jdk.internal.misc.VM"; @SuppressWarnings("unchecked") public static String[] getRuntimeArguments() { @@ -360,7 +412,7 @@ private static void init() { if (vmClass == null) { try { - vmClass = Class.forName(VM_CLASSNAME, false, null); + vmClass = Class.forName(CLASSNAME, false, null); getRuntimeArgumentsMethod = vmClass.getDeclaredMethod("getRuntimeArguments"); } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) { throw new Abort(ex);
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java Fri Dec 16 08:17:55 2016 +0000 @@ -150,7 +150,7 @@ public final Name LocalVariableTypeTable; public final Name MethodParameters; public final Name Module; - public final Name ModuleVersion; + public final Name ModuleResolution; public final Name RuntimeInvisibleAnnotations; public final Name RuntimeInvisibleParameterAnnotations; public final Name RuntimeInvisibleTypeAnnotations; @@ -312,7 +312,7 @@ LocalVariableTypeTable = fromString("LocalVariableTypeTable"); MethodParameters = fromString("MethodParameters"); Module = fromString("Module"); - ModuleVersion = fromString("ModuleVersion"); + ModuleResolution = fromString("ModuleResolution"); RuntimeInvisibleAnnotations = fromString("RuntimeInvisibleAnnotations"); RuntimeInvisibleParameterAnnotations = fromString("RuntimeInvisibleParameterAnnotations"); RuntimeInvisibleTypeAnnotations = fromString("RuntimeInvisibleTypeAnnotations");
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Attribute.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Attribute.java Fri Dec 16 08:17:55 2016 +0000 @@ -56,8 +56,8 @@ public static final String ModuleHashes = "ModuleHashes"; public static final String ModuleMainClass = "ModuleMainClass"; public static final String ModulePackages = "ModulePackages"; + public static final String ModuleResolution = "ModuleResolution"; public static final String ModuleTarget = "ModuleTarget"; - public static final String ModuleVersion = "ModuleVersion"; public static final String RuntimeVisibleAnnotations = "RuntimeVisibleAnnotations"; public static final String RuntimeInvisibleAnnotations = "RuntimeInvisibleAnnotations"; public static final String RuntimeVisibleParameterAnnotations = "RuntimeVisibleParameterAnnotations"; @@ -128,8 +128,8 @@ standardAttributes.put(ModuleHashes, ModuleHashes_attribute.class); standardAttributes.put(ModuleMainClass, ModuleMainClass_attribute.class); standardAttributes.put(ModulePackages, ModulePackages_attribute.class); + standardAttributes.put(ModuleResolution, ModuleResolution_attribute.class); standardAttributes.put(ModuleTarget, ModuleTarget_attribute.class); - standardAttributes.put(ModuleVersion, ModuleVersion_attribute.class); standardAttributes.put(RuntimeInvisibleAnnotations, RuntimeInvisibleAnnotations_attribute.class); standardAttributes.put(RuntimeInvisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations_attribute.class); standardAttributes.put(RuntimeVisibleAnnotations, RuntimeVisibleAnnotations_attribute.class); @@ -191,8 +191,8 @@ R visitModuleHashes(ModuleHashes_attribute attr, P p); R visitModuleMainClass(ModuleMainClass_attribute attr, P p); R visitModulePackages(ModulePackages_attribute attr, P p); + R visitModuleResolution(ModuleResolution_attribute attr, P p); R visitModuleTarget(ModuleTarget_attribute attr, P p); - R visitModuleVersion(ModuleVersion_attribute attr, P p); R visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, P p); R visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, P p); R visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, P p);
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassTranslator.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassTranslator.java Fri Dec 16 08:17:55 2016 +0000 @@ -38,7 +38,9 @@ import com.sun.tools.classfile.ConstantPool.CONSTANT_MethodHandle_info; import com.sun.tools.classfile.ConstantPool.CONSTANT_MethodType_info; import com.sun.tools.classfile.ConstantPool.CONSTANT_Methodref_info; +import com.sun.tools.classfile.ConstantPool.CONSTANT_Module_info; import com.sun.tools.classfile.ConstantPool.CONSTANT_NameAndType_info; +import com.sun.tools.classfile.ConstantPool.CONSTANT_Package_info; import com.sun.tools.classfile.ConstantPool.CONSTANT_String_info; import com.sun.tools.classfile.ConstantPool.CONSTANT_Utf8_info; import com.sun.tools.classfile.ConstantPool.CPInfo; @@ -242,6 +244,7 @@ return true; } + @Override public CPInfo visitClass(CONSTANT_Class_info info, Map<Object, Object> translations) { CONSTANT_Class_info info2 = (CONSTANT_Class_info) translations.get(info); if (info2 == null) { @@ -255,6 +258,7 @@ return info; } + @Override public CPInfo visitDouble(CONSTANT_Double_info info, Map<Object, Object> translations) { CONSTANT_Double_info info2 = (CONSTANT_Double_info) translations.get(info); if (info2 == null) { @@ -264,6 +268,7 @@ return info; } + @Override public CPInfo visitFieldref(CONSTANT_Fieldref_info info, Map<Object, Object> translations) { CONSTANT_Fieldref_info info2 = (CONSTANT_Fieldref_info) translations.get(info); if (info2 == null) { @@ -277,6 +282,7 @@ return info; } + @Override public CPInfo visitFloat(CONSTANT_Float_info info, Map<Object, Object> translations) { CONSTANT_Float_info info2 = (CONSTANT_Float_info) translations.get(info); if (info2 == null) { @@ -286,6 +292,7 @@ return info; } + @Override public CPInfo visitInteger(CONSTANT_Integer_info info, Map<Object, Object> translations) { CONSTANT_Integer_info info2 = (CONSTANT_Integer_info) translations.get(info); if (info2 == null) { @@ -295,6 +302,7 @@ return info; } + @Override public CPInfo visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Map<Object, Object> translations) { CONSTANT_InterfaceMethodref_info info2 = (CONSTANT_InterfaceMethodref_info) translations.get(info); if (info2 == null) { @@ -308,6 +316,7 @@ return info; } + @Override public CPInfo visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Map<Object, Object> translations) { CONSTANT_InvokeDynamic_info info2 = (CONSTANT_InvokeDynamic_info) translations.get(info); if (info2 == null) { @@ -322,6 +331,7 @@ return info; } + @Override public CPInfo visitLong(CONSTANT_Long_info info, Map<Object, Object> translations) { CONSTANT_Long_info info2 = (CONSTANT_Long_info) translations.get(info); if (info2 == null) { @@ -331,19 +341,7 @@ return info; } - public CPInfo visitNameAndType(CONSTANT_NameAndType_info info, Map<Object, Object> translations) { - CONSTANT_NameAndType_info info2 = (CONSTANT_NameAndType_info) translations.get(info); - if (info2 == null) { - ConstantPool cp2 = translate(info.cp, translations); - if (cp2 == info.cp) - info2 = info; - else - info2 = new CONSTANT_NameAndType_info(cp2, info.name_index, info.type_index); - translations.put(info, info2); - } - return info; - } - + @Override public CPInfo visitMethodref(CONSTANT_Methodref_info info, Map<Object, Object> translations) { CONSTANT_Methodref_info info2 = (CONSTANT_Methodref_info) translations.get(info); if (info2 == null) { @@ -357,6 +355,7 @@ return info; } + @Override public CPInfo visitMethodHandle(CONSTANT_MethodHandle_info info, Map<Object, Object> translations) { CONSTANT_MethodHandle_info info2 = (CONSTANT_MethodHandle_info) translations.get(info); if (info2 == null) { @@ -371,6 +370,7 @@ return info; } + @Override public CPInfo visitMethodType(CONSTANT_MethodType_info info, Map<Object, Object> translations) { CONSTANT_MethodType_info info2 = (CONSTANT_MethodType_info) translations.get(info); if (info2 == null) { @@ -385,6 +385,49 @@ return info; } + @Override + public CPInfo visitModule(CONSTANT_Module_info info, Map<Object, Object> translations) { + CONSTANT_Module_info info2 = (CONSTANT_Module_info) translations.get(info); + if (info2 == null) { + ConstantPool cp2 = translate(info.cp, translations); + if (cp2 == info.cp) + info2 = info; + else + info2 = new CONSTANT_Module_info(cp2, info.name_index); + translations.put(info, info2); + } + return info; + } + + @Override + public CPInfo visitNameAndType(CONSTANT_NameAndType_info info, Map<Object, Object> translations) { + CONSTANT_NameAndType_info info2 = (CONSTANT_NameAndType_info) translations.get(info); + if (info2 == null) { + ConstantPool cp2 = translate(info.cp, translations); + if (cp2 == info.cp) + info2 = info; + else + info2 = new CONSTANT_NameAndType_info(cp2, info.name_index, info.type_index); + translations.put(info, info2); + } + return info; + } + + @Override + public CPInfo visitPackage(CONSTANT_Package_info info, Map<Object, Object> translations) { + CONSTANT_Package_info info2 = (CONSTANT_Package_info) translations.get(info); + if (info2 == null) { + ConstantPool cp2 = translate(info.cp, translations); + if (cp2 == info.cp) + info2 = info; + else + info2 = new CONSTANT_Package_info(cp2, info.name_index); + translations.put(info, info2); + } + return info; + } + + @Override public CPInfo visitString(CONSTANT_String_info info, Map<Object, Object> translations) { CONSTANT_String_info info2 = (CONSTANT_String_info) translations.get(info); if (info2 == null) { @@ -398,6 +441,7 @@ return info; } + @Override public CPInfo visitUtf8(CONSTANT_Utf8_info info, Map<Object, Object> translations) { CONSTANT_Utf8_info info2 = (CONSTANT_Utf8_info) translations.get(info); if (info2 == null) {
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java Fri Dec 16 08:17:55 2016 +0000 @@ -290,13 +290,6 @@ } @Override - public Integer visitNameAndType(CONSTANT_NameAndType_info info, ClassOutputStream out) { - out.writeShort(info.name_index); - out.writeShort(info.type_index); - return 1; - } - - @Override public Integer visitMethodHandle(CONSTANT_MethodHandle_info info, ClassOutputStream out) { out.writeByte(info.reference_kind.tag); out.writeShort(info.reference_index); @@ -315,6 +308,25 @@ } @Override + public Integer visitModule(CONSTANT_Module_info info, ClassOutputStream out) { + out.writeShort(info.name_index); + return 1; + } + + @Override + public Integer visitNameAndType(CONSTANT_NameAndType_info info, ClassOutputStream out) { + out.writeShort(info.name_index); + out.writeShort(info.type_index); + return 1; + } + + @Override + public Integer visitPackage(CONSTANT_Package_info info, ClassOutputStream out) { + out.writeShort(info.name_index); + return 1; + } + + @Override public Integer visitString(CONSTANT_String_info info, ClassOutputStream out) { out.writeShort(info.string_index); return 1; @@ -425,14 +437,6 @@ } @Override - public Void visitModulePackages(ModulePackages_attribute attr, ClassOutputStream out) { - out.writeShort(attr.packages_count); - for (int i: attr.packages_index) - out.writeShort(i); - return null; - } - - @Override public Void visitConstantValue(ConstantValue_attribute attr, ClassOutputStream out) { out.writeShort(attr.constantvalue_index); return null; @@ -466,20 +470,6 @@ return null; } - @Override - public Void visitModuleHashes(ModuleHashes_attribute attr, ClassOutputStream out) { - out.writeShort(attr.algorithm_index); - out.writeShort(attr.hashes_table.length); - for (ModuleHashes_attribute.Entry e: attr.hashes_table) { - out.writeShort(e.module_name_index); - out.writeShort(e.hash.length); - for (byte b: e.hash) { - out.writeByte(b); - } - } - return null; - } - protected void writeInnerClassesInfo(InnerClasses_attribute.Info info, ClassOutputStream out) { out.writeShort(info.inner_class_info_index); out.writeShort(info.outer_class_info_index); @@ -543,20 +533,16 @@ } @Override - public Void visitModuleMainClass(ModuleMainClass_attribute attr, ClassOutputStream out) { - out.writeShort(attr.main_class_index); - return null; - } - - @Override public Void visitModule(Module_attribute attr, ClassOutputStream out) { out.writeShort(attr.module_name); out.writeShort(attr.module_flags); + out.writeShort(attr.module_version_index); out.writeShort(attr.requires.length); for (Module_attribute.RequiresEntry e: attr.requires) { out.writeShort(e.requires_index); out.writeShort(e.requires_flags); + out.writeShort(e.requires_version_index); } out.writeShort(attr.exports.length); @@ -595,8 +581,44 @@ } @Override - public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, ClassOutputStream out) { - annotationWriter.write(attr.annotations, out); + public Void visitModuleHashes(ModuleHashes_attribute attr, ClassOutputStream out) { + out.writeShort(attr.algorithm_index); + out.writeShort(attr.hashes_table.length); + for (ModuleHashes_attribute.Entry e: attr.hashes_table) { + out.writeShort(e.module_name_index); + out.writeShort(e.hash.length); + for (byte b: e.hash) { + out.writeByte(b); + } + } + return null; + } + + @Override + public Void visitModuleMainClass(ModuleMainClass_attribute attr, ClassOutputStream out) { + out.writeShort(attr.main_class_index); + return null; + } + + @Override + public Void visitModulePackages(ModulePackages_attribute attr, ClassOutputStream out) { + out.writeShort(attr.packages_count); + for (int i: attr.packages_index) + out.writeShort(i); + return null; + } + + @Override + public Void visitModuleResolution(ModuleResolution_attribute attr, ClassOutputStream out) { + out.writeShort(attr.resolution_flags); + return null; + } + + @Override + public Void visitModuleTarget(ModuleTarget_attribute attr, ClassOutputStream out) { + out.writeShort(attr.os_name_index); + out.writeShort(attr.os_arch_index); + out.writeShort(attr.os_version_index); return null; } @@ -607,13 +629,21 @@ } @Override - public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, ClassOutputStream out) { + public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, ClassOutputStream out) { + out.writeByte(attr.parameter_annotations.length); + for (Annotation[] annos: attr.parameter_annotations) + annotationWriter.write(annos, out); + return null; + } + + @Override + public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, ClassOutputStream out) { annotationWriter.write(attr.annotations, out); return null; } @Override - public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, ClassOutputStream out) { + public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, ClassOutputStream out) { annotationWriter.write(attr.annotations, out); return null; } @@ -627,10 +657,8 @@ } @Override - public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, ClassOutputStream out) { - out.writeByte(attr.parameter_annotations.length); - for (Annotation[] annos: attr.parameter_annotations) - annotationWriter.write(annos, out); + public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, ClassOutputStream out) { + annotationWriter.write(attr.annotations, out); return null; } @@ -685,24 +713,10 @@ return null; } - @Override - public Void visitModuleTarget(ModuleTarget_attribute attr, ClassOutputStream out) { - out.writeShort(attr.os_name_index); - out.writeShort(attr.os_arch_index); - out.writeShort(attr.os_version_index); - return null; - } - protected void writeAccessFlags(AccessFlags flags, ClassOutputStream p) { sharedOut.writeShort(flags.flags); } - @Override - public Void visitModuleVersion(ModuleVersion_attribute attr, ClassOutputStream out) { - out.writeShort(attr.version_index); - return null; - } - protected StackMapTableWriter stackMapWriter; }
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ConstantPool.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ConstantPool.java Fri Dec 16 08:17:55 2016 +0000 @@ -117,6 +117,8 @@ public static final int CONSTANT_MethodHandle = 15; public static final int CONSTANT_MethodType = 16; public static final int CONSTANT_InvokeDynamic = 18; + public static final int CONSTANT_Module = 19; + public static final int CONSTANT_Package = 20; public static enum RefKind { REF_getField(1), @@ -213,10 +215,18 @@ pool[i] = new CONSTANT_Methodref_info(this, cr); break; + case CONSTANT_Module: + pool[i] = new CONSTANT_Module_info(this, cr); + break; + case CONSTANT_NameAndType: pool[i] = new CONSTANT_NameAndType_info(this, cr); break; + case CONSTANT_Package: + pool[i] = new CONSTANT_Package_info(this, cr); + break; + case CONSTANT_String: pool[i] = new CONSTANT_String_info(this, cr); break; @@ -276,10 +286,18 @@ return ((CONSTANT_Class_info) get(index, CONSTANT_Class)); } + public CONSTANT_Module_info getModuleInfo(int index) throws InvalidIndex, UnexpectedEntry { + return ((CONSTANT_Module_info) get(index, CONSTANT_Module)); + } + public CONSTANT_NameAndType_info getNameAndTypeInfo(int index) throws InvalidIndex, UnexpectedEntry { return ((CONSTANT_NameAndType_info) get(index, CONSTANT_NameAndType)); } + public CONSTANT_Package_info getPackageInfo(int index) throws InvalidIndex, UnexpectedEntry { + return ((CONSTANT_Package_info) get(index, CONSTANT_Package)); + } + public String getUTF8Value(int index) throws InvalidIndex, UnexpectedEntry { return getUTF8Info(index).value; } @@ -339,10 +357,12 @@ R visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, P p); R visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, P p); R visitLong(CONSTANT_Long_info info, P p); - R visitNameAndType(CONSTANT_NameAndType_info info, P p); R visitMethodref(CONSTANT_Methodref_info info, P p); R visitMethodHandle(CONSTANT_MethodHandle_info info, P p); R visitMethodType(CONSTANT_MethodType_info info, P p); + R visitModule(CONSTANT_Module_info info, P p); + R visitNameAndType(CONSTANT_NameAndType_info info, P p); + R visitPackage(CONSTANT_Package_info info, P p); R visitString(CONSTANT_String_info info, P p); R visitUtf8(CONSTANT_Utf8_info info, P p); } @@ -781,6 +801,46 @@ } } + public static class CONSTANT_Module_info extends CPInfo { + CONSTANT_Module_info(ConstantPool cp, ClassReader cr) throws IOException { + super(cp); + name_index = cr.readUnsignedShort(); + } + + public CONSTANT_Module_info(ConstantPool cp, int name_index) { + super(cp); + this.name_index = name_index; + } + + public int getTag() { + return CONSTANT_Module; + } + + public int byteLength() { + return 3; + } + + /** + * Get the raw value of the module name referenced by this constant pool entry. + * This will be the name of the module. + * @return the raw value of the module name + */ + public String getName() throws ConstantPoolException { + return cp.getUTF8Value(name_index); + } + + @Override + public String toString() { + return "CONSTANT_Module_info[name_index: " + name_index + "]"; + } + + public <R, D> R accept(Visitor<R, D> visitor, D data) { + return visitor.visitModule(this, data); + } + + public final int name_index; + } + public static class CONSTANT_NameAndType_info extends CPInfo { CONSTANT_NameAndType_info(ConstantPool cp, ClassReader cr) throws IOException { super(cp); @@ -823,6 +883,46 @@ public final int type_index; } + public static class CONSTANT_Package_info extends CPInfo { + CONSTANT_Package_info(ConstantPool cp, ClassReader cr) throws IOException { + super(cp); + name_index = cr.readUnsignedShort(); + } + + public CONSTANT_Package_info(ConstantPool cp, int name_index) { + super(cp); + this.name_index = name_index; + } + + public int getTag() { + return CONSTANT_Package; + } + + public int byteLength() { + return 3; + } + + /** + * Get the raw value of the package name referenced by this constant pool entry. + * This will be the name of the package, in internal form. + * @return the raw value of the module name + */ + public String getName() throws ConstantPoolException { + return cp.getUTF8Value(name_index); + } + + @Override + public String toString() { + return "CONSTANT_Package_info[name_index: " + name_index + "]"; + } + + public <R, D> R accept(Visitor<R, D> visitor, D data) { + return visitor.visitPackage(this, data); + } + + public final int name_index; + } + public static class CONSTANT_String_info extends CPInfo { CONSTANT_String_info(ConstantPool cp, ClassReader cr) throws IOException { super(cp);
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Dependencies.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Dependencies.java Fri Dec 16 08:17:55 2016 +0000 @@ -708,6 +708,10 @@ return visitRef(info, p); } + public Void visitModule(CONSTANT_Module_info info, Void p) { + return null; + } + public Void visitNameAndType(CONSTANT_NameAndType_info info, Void p) { try { new Signature(info.type_index).getType(constant_pool).accept(this, null); @@ -717,6 +721,10 @@ } } + public Void visitPackage(CONSTANT_Package_info info, Void p) { + return null; + } + public Void visitString(CONSTANT_String_info info, Void p) { return null; }
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModulePackages_attribute.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModulePackages_attribute.java Fri Dec 16 08:17:55 2016 +0000 @@ -27,6 +27,8 @@ import java.io.IOException; +import com.sun.tools.classfile.ConstantPool.CONSTANT_Package_info; + /** * See JVMS, section 4.8.15. * @@ -61,7 +63,8 @@ public String getPackage(int index, ConstantPool constant_pool) throws ConstantPoolException { int package_index = packages_index[index]; - return constant_pool.getUTF8Value(package_index); + CONSTANT_Package_info info = constant_pool.getPackageInfo(package_index); + return info.getName(); } @Override
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleResolution_attribute.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.tools.classfile; + +import java.io.IOException; + +/** + * See JVMS, section 4.8.15. + * + * <p><b>This is NOT part of any supported API. + * If you write code that depends on this, you do so at your own risk. + * This code and its internal interfaces are subject to change or + * deletion without notice.</b> + */ +public class ModuleResolution_attribute extends Attribute { + public static final int DO_NOT_RESOLVE_BY_DEFAULT = 0x0001; + public static final int WARN_DEPRECATED = 0x0002; + public static final int WARN_DEPRECATED_FOR_REMOVAL = 0x0004; + public static final int WARN_INCUBATING = 0x0008; + + ModuleResolution_attribute(ClassReader cr, int name_index, int length) + throws IOException { + super(name_index, length); + resolution_flags = cr.readUnsignedShort(); + } + + public ModuleResolution_attribute(ConstantPool constant_pool, + int resolution_flags) + throws ConstantPoolException { + this(constant_pool.getUTF8Index(Attribute.ModulePackages), + resolution_flags); + } + + public ModuleResolution_attribute(int name_index, + int resolution_flags) { + super(name_index, 2); + this.resolution_flags = resolution_flags; + } + + @Override + public <R, D> R accept(Visitor<R, D> visitor, D data) { + return visitor.visitModuleResolution(this, data); + } + + public final int resolution_flags; +}
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ModuleVersion_attribute.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.classfile; - -import java.io.IOException; - -/** - * See JVMS, section 4.8.15. - * - * <p><b>This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice.</b> - */ -public class ModuleVersion_attribute extends Attribute { - ModuleVersion_attribute(ClassReader cr, int name_index, int length) throws IOException { - super(name_index, length); - version_index = cr.readUnsignedShort(); - } - - public ModuleVersion_attribute(ConstantPool constant_pool, int version_index) - throws ConstantPoolException { - this(constant_pool.getUTF8Index(Attribute.ModuleVersion), version_index); - } - - public ModuleVersion_attribute(int name_index, int version_index) { - super(name_index, 2); - this.version_index = version_index; - } - - @Override - public <R, D> R accept(Visitor<R, D> visitor, D data) { - return visitor.visitModuleVersion(this, data); - } - - public final int version_index; -}
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Module_attribute.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Module_attribute.java Fri Dec 16 08:17:55 2016 +0000 @@ -27,6 +27,8 @@ import java.io.IOException; +import com.sun.tools.classfile.ConstantPool.CONSTANT_Module_info; + /** * See Jigsaw. * @@ -48,6 +50,8 @@ module_name = cr.readUnsignedShort(); module_flags = cr.readUnsignedShort(); + module_version_index = cr.readUnsignedShort(); + requires_count = cr.readUnsignedShort(); requires = new RequiresEntry[requires_count]; for (int i = 0; i < requires_count; i++) @@ -77,6 +81,7 @@ public Module_attribute(int name_index, int module_name, int module_flags, + int module_version_index, RequiresEntry[] requires, ExportsEntry[] exports, OpensEntry[] opens, @@ -85,6 +90,7 @@ super(name_index, 2); this.module_name = module_name; this.module_flags = module_flags; + this.module_version_index = module_version_index; requires_count = requires.length; this.requires = requires; exports_count = exports.length; @@ -109,6 +115,7 @@ public final int module_name; public final int module_flags; + public final int module_version_index; public final int requires_count; public final RequiresEntry[] requires; public final int exports_count; @@ -124,21 +131,25 @@ RequiresEntry(ClassReader cr) throws IOException { requires_index = cr.readUnsignedShort(); requires_flags = cr.readUnsignedShort(); + requires_version_index = cr.readUnsignedShort(); } - public RequiresEntry(int index, int flags) { + public RequiresEntry(int index, int flags, int version_index) { this.requires_index = index; this.requires_flags = flags; + this.requires_version_index = version_index; } public String getRequires(ConstantPool constant_pool) throws ConstantPoolException { - return constant_pool.getUTF8Value(requires_index); + CONSTANT_Module_info info = constant_pool.getModuleInfo(requires_index); + return info.getName(); } public static final int length = 4; public final int requires_index; public final int requires_flags; + public final int requires_version_index; } public static class ExportsEntry {
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ReferenceFinder.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ReferenceFinder.java Fri Dec 16 08:17:55 2016 +0000 @@ -136,14 +136,6 @@ return false; } - public Boolean visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, ConstantPool cpool) { - return filter.accept(cpool, info); - } - - public Boolean visitMethodref(CONSTANT_Methodref_info info, ConstantPool cpool) { - return filter.accept(cpool, info); - } - public Boolean visitFieldref(CONSTANT_Fieldref_info info, ConstantPool cpool) { return filter.accept(cpool, info); } @@ -160,6 +152,10 @@ return false; } + public Boolean visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, ConstantPool cpool) { + return filter.accept(cpool, info); + } + public Boolean visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, ConstantPool cpool) { return false; } @@ -168,15 +164,27 @@ return false; } + public Boolean visitMethodHandle(CONSTANT_MethodHandle_info info, ConstantPool cpool) { + return false; + } + + public Boolean visitMethodref(CONSTANT_Methodref_info info, ConstantPool cpool) { + return filter.accept(cpool, info); + } + + public Boolean visitMethodType(CONSTANT_MethodType_info info, ConstantPool cpool) { + return false; + } + + public Boolean visitModule(CONSTANT_Module_info info, ConstantPool cpool) { + return false; + } + public Boolean visitNameAndType(CONSTANT_NameAndType_info info, ConstantPool cpool) { return false; } - public Boolean visitMethodHandle(CONSTANT_MethodHandle_info info, ConstantPool cpool) { - return false; - } - - public Boolean visitMethodType(CONSTANT_MethodType_info info, ConstantPool cpool) { + public Boolean visitPackage(CONSTANT_Package_info info, ConstantPool cpool) { return false; }
--- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java Fri Dec 16 08:17:55 2016 +0000 @@ -51,8 +51,8 @@ import com.sun.tools.classfile.ModuleHashes_attribute; import com.sun.tools.classfile.ModuleMainClass_attribute; import com.sun.tools.classfile.ModulePackages_attribute; +import com.sun.tools.classfile.ModuleResolution_attribute; import com.sun.tools.classfile.ModuleTarget_attribute; -import com.sun.tools.classfile.ModuleVersion_attribute; import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute; import com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute; import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute; @@ -237,27 +237,6 @@ return null; } - private String getJavaPackage(ModulePackages_attribute attr, int index) { - try { - return getJavaName(attr.getPackage(index, constant_pool)); - } catch (ConstantPoolException e) { - return report(e); - } - } - - @Override - public Void visitModulePackages(ModulePackages_attribute attr, Void ignore) { - println("ModulePackages: "); - indent(+1); - for (int i = 0; i < attr.packages_count; i++) { - print("#" + attr.packages_index[i]); - tab(); - println("// " + getJavaPackage(attr, i)); - } - indent(-1); - return null; - } - @Override public Void visitConstantValue(ConstantValue_attribute attr, Void ignore) { print("ConstantValue: "); @@ -322,39 +301,6 @@ } } - @Override - public Void visitModuleHashes(ModuleHashes_attribute attr, Void ignore) { - println("ModuleHashes:"); - indent(+1); - print("algorithm #" + attr.algorithm_index); - tab(); - println("// " + getAlgorithm(attr)); - for (ModuleHashes_attribute.Entry e : attr.hashes_table) { - print("#" + e.module_name_index); - tab(); - println("// " + getModuleName(e)); - println("hash_length: " + e.hash.length); - println("hash: [" + toHex(e.hash) + "]"); - } - indent(-1); - return null; - } - - private String getAlgorithm(ModuleHashes_attribute attr) { - try { - return constant_pool.getUTF8Value(attr.algorithm_index); - } catch (ConstantPoolException e) { - return report(e); - } - } - - private String getModuleName(ModuleHashes_attribute.Entry entry) { - try { - return constant_pool.getUTF8Value(entry.module_name_index); - } catch (ConstantPoolException e) { - return report(e); - } - } @Override public Void visitInnerClasses(InnerClasses_attribute attr, Void ignore) { @@ -449,15 +395,6 @@ return null; } - @Override - public Void visitModuleMainClass(ModuleMainClass_attribute attr, Void ignore) { - print("ModuleMainClass: #" + attr.main_class_index); - tab(); - print("// " + getJavaClassName(attr)); - println(); - return null; - } - private String getJavaClassName(ModuleMainClass_attribute a) { try { return getJavaName(a.getMainClassName(constant_pool)); @@ -495,13 +432,11 @@ println("Module:"); indent(+1); - print(attr.module_name); - tab(); - println("// " + constantWriter.stringValue(attr.module_name)); - + print("#" + attr.module_name); + print(","); print(String.format("%x", attr.module_flags)); tab(); - print("// "); + print("// " + constantWriter.stringValue(attr.module_name)); if ((attr.module_flags & Module_attribute.ACC_OPEN) != 0) print(" ACC_OPEN"); if ((attr.module_flags & Module_attribute.ACC_MANDATED) != 0) @@ -509,6 +444,12 @@ if ((attr.module_flags & Module_attribute.ACC_SYNTHETIC) != 0) print(" ACC_SYNTHETIC"); println(); + print("#" + attr.module_version_index); + if (attr.module_version_index != 0) { + tab(); + print("// " + constantWriter.stringValue(attr.module_version_index)); + } + println(); printRequiresTable(attr); printExportsTable(attr); @@ -538,6 +479,12 @@ if ((e.requires_flags & Module_attribute.ACC_MANDATED) != 0) print(" ACC_MANDATED"); println(); + print("#" + e.requires_version_index); + if (e.requires_version_index != 0) { + tab(); + print("// " + constantWriter.stringValue(e.requires_version_index)); + } + println(); } indent(-1); } @@ -627,6 +574,145 @@ } @Override + public Void visitModuleHashes(ModuleHashes_attribute attr, Void ignore) { + println("ModuleHashes:"); + indent(+1); + print("algorithm: #" + attr.algorithm_index); + tab(); + println("// " + getAlgorithm(attr)); + print(attr.hashes_table_length); + tab(); + println("// hashes"); + for (ModuleHashes_attribute.Entry e : attr.hashes_table) { + print("#" + e.module_name_index); + tab(); + println("// " + getModuleName(e)); + println("hash_length: " + e.hash.length); + println("hash: [" + toHex(e.hash) + "]"); + } + indent(-1); + return null; + } + + private String getAlgorithm(ModuleHashes_attribute attr) { + try { + return constant_pool.getUTF8Value(attr.algorithm_index); + } catch (ConstantPoolException e) { + return report(e); + } + } + + private String getModuleName(ModuleHashes_attribute.Entry entry) { + try { + int utf8Index = constant_pool.getModuleInfo(entry.module_name_index).name_index; + return constant_pool.getUTF8Value(utf8Index); + } catch (ConstantPoolException e) { + return report(e); + } + } + + @Override + public Void visitModuleMainClass(ModuleMainClass_attribute attr, Void ignore) { + print("ModuleMainClass: #" + attr.main_class_index); + tab(); + print("// " + getJavaClassName(attr)); + println(); + return null; + } + + @Override + public Void visitModulePackages(ModulePackages_attribute attr, Void ignore) { + println("ModulePackages: "); + indent(+1); + for (int i = 0; i < attr.packages_count; i++) { + print("#" + attr.packages_index[i]); + tab(); + println("// " + getJavaPackage(attr, i)); + } + indent(-1); + return null; + } + + private String getJavaPackage(ModulePackages_attribute attr, int index) { + try { + return getJavaName(attr.getPackage(index, constant_pool)); + } catch (ConstantPoolException e) { + return report(e); + } + } + + @Override + public Void visitModuleResolution(ModuleResolution_attribute attr, Void ignore) { + println("ModuleResolution:"); + indent(+1); + print(String.format("%x", attr.resolution_flags)); + tab(); + print("// "); + int flags = attr.resolution_flags; + if ((flags & ModuleResolution_attribute.DO_NOT_RESOLVE_BY_DEFAULT) != 0) + print(" DO_NOT_RESOLVE_BY_DEFAULT"); + if ((flags & ModuleResolution_attribute.WARN_DEPRECATED) != 0) + print(" WARN_DEPRECATED"); + if ((flags & ModuleResolution_attribute.WARN_DEPRECATED_FOR_REMOVAL) != 0) + print(" WARN_DEPRECATED_FOR_REMOVAL"); + if ((flags & ModuleResolution_attribute.WARN_INCUBATING) != 0) + print(" WARN_INCUBATING"); + println(); + indent(-1); + return null; + } + + @Override + public Void visitModuleTarget(ModuleTarget_attribute attr, Void ignore) { + println("ModuleTarget:"); + indent(+1); + print("os_name: #" + attr.os_name_index); + if (attr.os_name_index != 0) { + tab(); + print("// " + getOSName(attr)); + } + println(); + print("os_arch: #" + attr.os_arch_index); + if (attr.os_arch_index != 0) { + tab(); + print("// " + getOSArch(attr)); + } + println(); + print("os_version: #" + attr.os_version_index); + if (attr.os_version_index != 0) { + tab(); + print("// " + getOSVersion(attr)); + } + println(); + indent(-1); + return null; + } + + private String getOSName(ModuleTarget_attribute attr) { + try { + return constant_pool.getUTF8Value(attr.os_name_index); + } catch (ConstantPoolException e) { + return report(e); + } + } + + private String getOSArch(ModuleTarget_attribute attr) { + try { + return constant_pool.getUTF8Value(attr.os_arch_index); + } catch (ConstantPoolException e) { + return report(e); + } + } + + private String getOSVersion(ModuleTarget_attribute attr) { + try { + return constant_pool.getUTF8Value(attr.os_version_index); + } catch (ConstantPoolException e) { + return report(e); + } + } + + @Override public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, Void ignore) { println("RuntimeVisibleAnnotations:"); indent(+1); @@ -929,74 +1015,6 @@ return null; } - @Override - public Void visitModuleTarget(ModuleTarget_attribute attr, Void ignore) { - println("ModuleTarget:"); - indent(+1); - print("os_name: #" + attr.os_name_index); - if (attr.os_name_index != 0) { - tab(); - print("// " + getOSName(attr)); - } - println(); - print("os_arch: #" + attr.os_arch_index); - if (attr.os_arch_index != 0) { - tab(); - print("// " + getOSArch(attr)); - } - println(); - print("os_version: #" + attr.os_version_index); - if (attr.os_version_index != 0) { - tab(); - print("// " + getOSVersion(attr)); - } - println(); - indent(-1); - return null; - } - - private String getOSName(ModuleTarget_attribute attr) { - try { - return constant_pool.getUTF8Value(attr.os_name_index); - } catch (ConstantPoolException e) { - return report(e); - } - } - - private String getOSArch(ModuleTarget_attribute attr) { - try { - return constant_pool.getUTF8Value(attr.os_arch_index); - } catch (ConstantPoolException e) { - return report(e); - } - } - - private String getOSVersion(ModuleTarget_attribute attr) { - try { - return constant_pool.getUTF8Value(attr.os_version_index); - } catch (ConstantPoolException e) { - return report(e); - } - } - - @Override - public Void visitModuleVersion(ModuleVersion_attribute attr, Void ignore) { - print("ModuleVersion: #" + attr.version_index); - indent(+1); - tab(); - println("// " + getVersion(attr)); - indent(-1); - return null; - } - - private String getVersion(ModuleVersion_attribute attr) { - try { - return constant_pool.getUTF8Value(attr.version_index); - } catch (ConstantPoolException e) { - return report(e); - } - } - static String getJavaName(String name) { return name.replace('/', '.'); }
--- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/ClassWriter.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/ClassWriter.java Fri Dec 16 08:17:55 2016 +0000 @@ -58,6 +58,8 @@ import com.sun.tools.classfile.Type.WildcardType; import static com.sun.tools.classfile.AccessFlags.*; +import static com.sun.tools.classfile.ConstantPool.CONSTANT_Module; +import static com.sun.tools.classfile.ConstantPool.CONSTANT_Package; /* * The main javap class to write the contents of a class file as text. @@ -166,7 +168,12 @@ Module_attribute modAttr = (Module_attribute) attr; String name; try { - name = getJavaName(constant_pool.getUTF8Value(modAttr.module_name)); + // FIXME: compatibility code + if (constant_pool.get(modAttr.module_name).getTag() == CONSTANT_Module) { + name = getJavaName(constant_pool.getModuleInfo(modAttr.module_name).getName()); + } else { + name = getJavaName(constant_pool.getUTF8Value(modAttr.module_name)); + } } catch (ConstantPoolException e) { name = report(e); } @@ -175,6 +182,10 @@ } print("module "); print(name); + if (modAttr.module_version_index != 0) { + print("@"); + print(getUTF8Value(modAttr.module_version_index)); + } } else { // fallback for malformed class files print("class "); @@ -602,19 +613,31 @@ if ((entry.requires_flags & Module_attribute.ACC_TRANSITIVE) != 0) print(" transitive"); print(" "); - print(getUTF8Value(entry.requires_index).replace('/', '.')); + String mname; + try { + mname = getModuleName(entry.requires_index); + } catch (ConstantPoolException e) { + mname = report(e); + } + print(mname); println(";"); } for (Module_attribute.ExportsEntry entry: m.exports) { print("exports"); print(" "); - print(getUTF8Value(entry.exports_index).replace('/', '.')); + String pname; + try { + pname = getPackageName(entry.exports_index).replace('/', '.'); + } catch (ConstantPoolException e) { + pname = report(e); + } + print(pname); boolean first = true; for (int i: entry.exports_to_index) { String mname; try { - mname = classFile.constant_pool.getUTF8Value(i).replace('/', '.'); + mname = getModuleName(i); } catch (ConstantPoolException e) { mname = report(e); } @@ -635,12 +658,18 @@ for (Module_attribute.OpensEntry entry: m.opens) { print("opens"); print(" "); - print(getUTF8Value(entry.opens_index).replace('/', '.')); + String pname; + try { + pname = getPackageName(entry.opens_index).replace('/', '.'); + } catch (ConstantPoolException e) { + pname = report(e); + } + print(pname); boolean first = true; for (int i: entry.opens_to_index) { String mname; try { - mname = classFile.constant_pool.getUTF8Value(i).replace('/', '.'); + mname = getModuleName(i); } catch (ConstantPoolException e) { mname = report(e); } @@ -684,6 +713,22 @@ } } + String getModuleName(int index) throws ConstantPoolException { + if (constant_pool.get(index).getTag() == CONSTANT_Module) { + return constant_pool.getModuleInfo(index).getName(); + } else { + return constant_pool.getUTF8Value(index); + } + } + + String getPackageName(int index) throws ConstantPoolException { + if (constant_pool.get(index).getTag() == CONSTANT_Package) { + return constant_pool.getPackageInfo(index).getName(); + } else { + return constant_pool.getUTF8Value(index); + } + } + String getUTF8Value(int index) { try { return classFile.constant_pool.getUTF8Value(index);
--- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/ConstantWriter.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/ConstantWriter.java Fri Dec 16 08:17:55 2016 +0000 @@ -109,13 +109,6 @@ return 2; } - public Integer visitNameAndType(CONSTANT_NameAndType_info info, Void p) { - print("#" + info.name_index + ":#" + info.type_index); - tab(); - println("// " + stringValue(info)); - return 1; - } - public Integer visitMethodref(CONSTANT_Methodref_info info, Void p) { print("#" + info.class_index + ".#" + info.name_and_type_index); tab(); @@ -137,6 +130,27 @@ return 1; } + public Integer visitModule(CONSTANT_Module_info info, Void p) { + print("#" + info.name_index); + tab(); + println("// " + stringValue(info)); + return 1; + } + + public Integer visitNameAndType(CONSTANT_NameAndType_info info, Void p) { + print("#" + info.name_index + ":#" + info.type_index); + tab(); + println("// " + stringValue(info)); + return 1; + } + + public Integer visitPackage(CONSTANT_Package_info info, Void p) { + print("#" + info.name_index); + tab(); + println("// " + stringValue(info)); + return 1; + } + public Integer visitString(CONSTANT_String_info info, Void p) { print("#" + info.string_index); tab(); @@ -304,6 +318,14 @@ return info.value + "l"; } + public String visitModule(CONSTANT_Module_info info, Void p) { + try { + return checkName(info.getName()); + } catch (ConstantPoolException e) { + return report(e); + } + } + public String visitNameAndType(CONSTANT_NameAndType_info info, Void p) { return getCheckedName(info) + ":" + getType(info); } @@ -316,6 +338,14 @@ } } + public String visitPackage(CONSTANT_Package_info info, Void p) { + try { + return checkName(info.getName()); + } catch (ConstantPoolException e) { + return report(e); + } + } + String getType(CONSTANT_NameAndType_info info) { try { return info.getType();
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/CPSelector.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/CPSelector.java Fri Dec 16 08:17:55 2016 +0000 @@ -76,11 +76,6 @@ } @Override - public Void visitNameAndType(ConstantPool.CONSTANT_NameAndType_info info, CPEntries p) { - return null; - } - - @Override public Void visitMethodref(ConstantPool.CONSTANT_Methodref_info info, CPEntries p) { p.methodRefs.add(info); return null; @@ -97,6 +92,21 @@ } @Override + public Void visitModule(ConstantPool.CONSTANT_Module_info info, CPEntries p) { + return null; + } + + @Override + public Void visitNameAndType(ConstantPool.CONSTANT_NameAndType_info info, CPEntries p) { + return null; + } + + @Override + public Void visitPackage(ConstantPool.CONSTANT_Package_info info, CPEntries p) { + return null; + } + + @Override public Void visitString(ConstantPool.CONSTANT_String_info info, CPEntries p) { return null; }
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java Thu Dec 15 11:47:25 2016 -0800 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java Fri Dec 16 08:17:55 2016 +0000 @@ -416,7 +416,12 @@ } }; - return new ModuleReference(descriptor, uri, readerSupplier); + return new ModuleReference(descriptor, uri) { + @Override + public ModuleReader open() { + return readerSupplier.get(); + } + }; } catch (IOException e) { throw new UncheckedIOException(e); }
--- a/test/jdk/javadoc/doclet/testModules/TestModules.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/jdk/javadoc/doclet/testModules/TestModules.java Fri Dec 16 08:17:55 2016 +0000 @@ -45,8 +45,8 @@ void testHtml4() { javadoc("-d", "out", "-use", "--module-source-path", testSrc, - "--add-modules", "module1,module2", - "testpkgmdl1", "testpkgmdl2"); + "--add-modules", "moduleA,moduleB", + "testpkgmdlA", "testpkgmdlB"); checkExit(Exit.OK); checkDescription(true); checkNoDescription(false); @@ -66,8 +66,8 @@ void testHtml5() { javadoc("-d", "out-html5", "-html5", "-use", "--module-source-path", testSrc, - "--add-modules", "module1,module2", - "testpkgmdl1", "testpkgmdl2"); + "--add-modules", "moduleA,moduleB", + "testpkgmdlA", "testpkgmdlB"); checkExit(Exit.OK); checkHtml5Description(true); checkHtml5NoDescription(false); @@ -87,8 +87,8 @@ void testHtml4NoComment() { javadoc("-d", "out-nocomment", "-nocomment", "-use", "--module-source-path", testSrc, - "--add-modules", "module1,module2", - "testpkgmdl1", "testpkgmdl2"); + "--add-modules", "moduleA,moduleB", + "testpkgmdlA", "testpkgmdlB"); checkExit(Exit.OK); checkDescription(false); checkNoDescription(true); @@ -104,8 +104,8 @@ void testHtml5NoComment() { javadoc("-d", "out-html5-nocomment", "-nocomment", "-html5", "-use", "--module-source-path", testSrc, - "--add-modules", "module1,module2", - "testpkgmdl1", "testpkgmdl2"); + "--add-modules", "moduleA,moduleB", + "testpkgmdlA", "testpkgmdlB"); checkExit(Exit.OK); checkHtml5Description(false); checkHtml5NoDescription(true); @@ -154,8 +154,8 @@ "-tag", "regular:a:Regular Tag:", "-tag", "moduletag:s:Module Tag:", "--module-source-path", testSrc, - "--add-modules", "moduletags,module2", - "testpkgmdltags", "testpkgmdl2"); + "--add-modules", "moduletags,moduleB", + "testpkgmdltags", "testpkgmdlB"); checkExit(Exit.OK); checkModuleTags(); } @@ -167,8 +167,8 @@ void testModuleSummary() { javadoc("-d", "out-moduleSummary", "-use", "--module-source-path", testSrc, - "--add-modules", "module1,module2", - "testpkgmdl1", "testpkgmdl2", "module2/testpkg2mdl2"); + "--add-modules", "moduleA,moduleB", + "testpkgmdlA", "testpkgmdlB", "moduleB/testpkg2mdlB"); checkExit(Exit.OK); checkModuleSummary(); checkNegatedModuleSummary(); @@ -181,8 +181,8 @@ void testModuleFilesAndLinks() { javadoc("-d", "out-modulelinks", "--module-source-path", testSrc, - "--add-modules", "module1", - "testpkgmdl1"); + "--add-modules", "moduleA", + "testpkgmdlA"); checkExit(Exit.OK); checkModuleFilesAndLinks(true); checkNegatedOverviewFrame(); @@ -197,8 +197,8 @@ "-tag", "regular:a:Regular Tag:", "-tag", "moduletag:s:Module Tag:", "--module-source-path", testSrc, - "--module", "module1,module2,moduletags", - "testpkgmdl1", "testpkgmdl2", "testpkgmdltags"); + "--module", "moduleA,moduleB,moduletags", + "testpkgmdlA", "testpkgmdlB", "testpkgmdltags"); checkExit(Exit.OK); checkModuleDeprecation(true); } @@ -210,38 +210,38 @@ void testModuleAnnotation() { javadoc("-d", "out-moduleanno", "--module-source-path", testSrc, - "--module", "module1,module2", - "testpkgmdl1", "testpkgmdl2"); + "--module", "moduleA,moduleB", + "testpkgmdlA", "testpkgmdlB"); checkExit(Exit.OK); checkModuleAnnotation(); } void checkDescription(boolean found) { - checkOutput("module1-summary.html", found, + checkOutput("moduleA-summary.html", found, "<!-- ============ MODULE DESCRIPTION =========== -->\n" + "<a name=\"module.description\">\n" + "<!-- -->\n" + "</a>\n" - + "<div class=\"block\">This is a test description for the module1 module. Search " + + "<div class=\"block\">This is a test description for the moduleA module. Search " + "phrase <a id=\"searchphrase\">search phrase</a>.</div>"); - checkOutput("module2-summary.html", found, + checkOutput("moduleB-summary.html", found, "<!-- ============ MODULE DESCRIPTION =========== -->\n" + "<a name=\"module.description\">\n" + "<!-- -->\n" + "</a>\n" - + "<div class=\"block\">This is a test description for the module2 module. Search " + + "<div class=\"block\">This is a test description for the moduleB module. Search " + "word <a id=\"search_word\">search_word</a> with no description.</div>"); } void checkNoDescription(boolean found) { - checkOutput("module1-summary.html", found, + checkOutput("moduleA-summary.html", found, "<div class=\"contentContainer\">\n" + "<ul class=\"blockList\">\n" + "<li class=\"blockList\">\n" + "<ul class=\"blockList\">\n" + "<li class=\"blockList\">\n" + "<!-- ============ MODULES SUMMARY =========== -->"); - checkOutput("module2-summary.html", found, + checkOutput("moduleB-summary.html", found, "<div class=\"contentContainer\">\n" + "<ul class=\"blockList\">\n" + "<li class=\"blockList\">\n" @@ -251,7 +251,7 @@ } void checkHtml5Description(boolean found) { - checkOutput("module1-summary.html", found, + checkOutput("moduleA-summary.html", found, "<section role=\"region\">\n" + "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated, for removal:" + " This API element is subject to removal in a future version. </span>\n" @@ -261,27 +261,27 @@ + "<a id=\"module.description\">\n" + "<!-- -->\n" + "</a>\n" - + "<div class=\"block\">This is a test description for the module1 module. Search " + + "<div class=\"block\">This is a test description for the moduleA module. Search " + "phrase <a id=\"searchphrase\">search phrase</a>.</div>"); - checkOutput("module2-summary.html", found, + checkOutput("moduleB-summary.html", found, "<section role=\"region\">\n" + "<!-- ============ MODULE DESCRIPTION =========== -->\n" + "<a id=\"module.description\">\n" + "<!-- -->\n" + "</a>\n" - + "<div class=\"block\">This is a test description for the module2 module. Search " + + "<div class=\"block\">This is a test description for the moduleB module. Search " + "word <a id=\"search_word\">search_word</a> with no description.</div>"); } void checkHtml5NoDescription(boolean found) { - checkOutput("module1-summary.html", found, + checkOutput("moduleA-summary.html", found, "<div class=\"contentContainer\">\n" + "<ul class=\"blockList\">\n" + "<li class=\"blockList\">\n" + "<ul class=\"blockList\">\n" + "<li class=\"blockList\">\n" + "<!-- ============ MODULES SUMMARY =========== -->"); - checkOutput("module2-summary.html", found, + checkOutput("moduleB-summary.html", found, "<div class=\"contentContainer\">\n" + "<ul class=\"blockList\">\n" + "<li class=\"blockList\">\n" @@ -293,18 +293,18 @@ void checkModuleLink() { checkOutput("overview-summary.html", true, "<li>Module</li>"); - checkOutput("module1-summary.html", true, + checkOutput("moduleA-summary.html", true, "<li class=\"navBarCell1Rev\">Module</li>"); - checkOutput("module2-summary.html", true, + checkOutput("moduleB-summary.html", true, "<li class=\"navBarCell1Rev\">Module</li>"); - checkOutput("testpkgmdl1/class-use/TestClassInModule1.html", true, - "<li><a href=\"../../module1-summary.html\">Module</a></li>"); - checkOutput("testpkgmdl2/package-summary.html", true, - "<li><a href=\"../module2-summary.html\">Module</a></li>"); - checkOutput("testpkgmdl2/TestClassInModule2.html", true, - "<li><a href=\"../module2-summary.html\">Module</a></li>"); - checkOutput("testpkgmdl2/class-use/TestClassInModule2.html", true, - "<li><a href=\"../../module2-summary.html\">Module</a></li>"); + checkOutput("testpkgmdlA/class-use/TestClassInModuleA.html", true, + "<li><a href=\"../../moduleA-summary.html\">Module</a></li>"); + checkOutput("testpkgmdlB/package-summary.html", true, + "<li><a href=\"../moduleB-summary.html\">Module</a></li>"); + checkOutput("testpkgmdlB/TestClassInModuleB.html", true, + "<li><a href=\"../moduleB-summary.html\">Module</a></li>"); + checkOutput("testpkgmdlB/class-use/TestClassInModuleB.html", true, + "<li><a href=\"../../moduleB-summary.html\">Module</a></li>"); } void checkNoModuleLink() { @@ -422,102 +422,102 @@ } void checkModuleSummary() { - checkOutput("module1-summary.html", true, + checkOutput("moduleA-summary.html", true, "<ul class=\"subNavList\">\n" + "<li>Module: </li>\n" + "<li><a href=\"#module.description\">Description</a> | <a " + "href=\"#modules.summary\">Modules</a> | <a href=\"#packages.summary\">" + "Packages</a> | Services</li>\n" + "</ul>"); - checkOutput("module1-summary.html", true, + checkOutput("moduleA-summary.html", true, "<!-- ============ MODULES SUMMARY =========== -->\n" + "<a name=\"modules.summary\">\n" + "<!-- -->\n" + "</a>"); - checkOutput("module1-summary.html", true, + checkOutput("moduleA-summary.html", true, "<tr class=\"altColor\">\n" - + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdl1/package-summary.html\">testpkgmdl1</a></th>\n" + + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlA/package-summary.html\">testpkgmdlA</a></th>\n" + "<td class=\"colSecond\">All Modules</td>\n" + "<td class=\"colLast\"> </td>\n" + "</tr>"); - checkOutput("module1-summary.html", true, + checkOutput("moduleA-summary.html", true, "<!-- ============ PACKAGES SUMMARY =========== -->\n" + "<a name=\"packages.summary\">\n" + "<!-- -->\n" + "</a>"); - checkOutput("module1-summary.html", true, + checkOutput("moduleA-summary.html", true, "<tr class=\"rowColor\">\n" - + "<th class=\"colFirst\" scope=\"row\"><a href=\"module2-summary.html\">module2</a></th>\n" + + "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n" + "<td class=\"colLast\">\n" - + "<div class=\"block\">This is a test description for the module2 module.</div>\n" + + "<div class=\"block\">This is a test description for the moduleB module.</div>\n" + "</td>\n" + "</tr>"); - checkOutput("module2-summary.html", true, + checkOutput("moduleB-summary.html", true, "<li><a href=\"#module.description\">Description</a> | <a " + "href=\"#modules.summary\">Modules</a> | <a href=\"#packages.summary\">" + "Packages</a> | <a href=\"#services.summary\">Services</a></li>"); - checkOutput("module2-summary.html", true, + checkOutput("moduleB-summary.html", true, "<!-- ============ MODULES SUMMARY =========== -->\n" + "<a name=\"modules.summary\">\n" + "<!-- -->\n" + "</a>"); - checkOutput("module2-summary.html", true, + checkOutput("moduleB-summary.html", true, "<tr class=\"rowColor\">\n" - + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkg2mdl2/package-summary.html\">" - + "testpkg2mdl2</a></th>\n" - + "<td class=\"colSecond\">module1</td>\n" + + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkg2mdlB/package-summary.html\">" + + "testpkg2mdlB</a></th>\n" + + "<td class=\"colSecond\">moduleA</td>\n" + "<td class=\"colLast\"> </td>\n" + "</tr>"); - checkOutput("module2-summary.html", true, + checkOutput("moduleB-summary.html", true, "<!-- ============ PACKAGES SUMMARY =========== -->\n" + "<a name=\"packages.summary\">\n" + "<!-- -->\n" + "</a>"); - checkOutput("module2-summary.html", true, + checkOutput("moduleB-summary.html", true, "<tr class=\"altColor\">\n" + "<th class=\"colFirst\" scope=\"row\"><a href=\"java.base-summary.html\">java.base</a></th>\n" + "<td class=\"colLast\"> </td>\n" + "</tr>"); - checkOutput("module2-summary.html", true, + checkOutput("moduleB-summary.html", true, "<!-- ============ SERVICES SUMMARY =========== -->\n" + "<a name=\"services.summary\">\n" + "<!-- -->\n" + "</a>"); - checkOutput("module2-summary.html", true, + checkOutput("moduleB-summary.html", true, "<tr class=\"altColor\">\n" - + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdl2/TestClassInModule2.html\" " - + "title=\"class in testpkgmdl2\">TestClassInModule2</a></th>\n" + + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/TestClassInModuleB.html\" " + + "title=\"class in testpkgmdlB\">TestClassInModuleB</a></th>\n" + "<td class=\"colLast\"> </td>\n" + "</tr>"); - checkOutput("module2-summary.html", true, + checkOutput("moduleB-summary.html", true, "<tr class=\"altColor\">\n" - + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkg2mdl2/TestInterfaceInModule2.html\" " - + "title=\"interface in testpkg2mdl2\">TestInterfaceInModule2</a><br>" + + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkg2mdlB/TestInterfaceInModuleB.html\" " + + "title=\"interface in testpkg2mdlB\">TestInterfaceInModuleB</a><br>" + "(<span class=\"implementationLabel\">Implementation:</span> " - + "<a href=\"testpkgmdl2/TestClassInModule2.html\" title=\"class in testpkgmdl2\">" - + "TestClassInModule2</a>)</th>\n" + + "<a href=\"testpkgmdlB/TestClassInModuleB.html\" title=\"class in testpkgmdlB\">" + + "TestClassInModuleB</a>)</th>\n" + "<td class=\"colLast\"> </td>\n" + "</tr"); - checkOutput("module2-summary.html", true, + checkOutput("moduleB-summary.html", true, "<caption><span>Exported Packages</span><span class=\"tabEnd\"> </span></caption>\n" + "<tr>\n" + "<th class=\"colFirst\" scope=\"col\">Package</th>\n" + "<th class=\"colSecond\" scope=\"col\">Module</th>\n" + "<th class=\"colLast\" scope=\"col\">Description</th>\n" + "</tr>"); - checkOutput("module2-summary.html", true, + checkOutput("moduleB-summary.html", true, "<caption><span>Requires</span><span class=\"tabEnd\"> </span></caption>\n" + "<tr>\n" + "<th class=\"colFirst\" scope=\"col\">Module</th>\n" + "<th class=\"colLast\" scope=\"col\">Description</th>\n" + "</tr>"); - checkOutput("module2-summary.html", true, + checkOutput("moduleB-summary.html", true, "<caption><span>Uses</span><span class=\"tabEnd\"> </span></caption>\n" + "<tr>\n" + "<th class=\"colFirst\" scope=\"col\">Type</th>\n" + "<th class=\"colLast\" scope=\"col\">Description</th>\n" + "</tr>"); - checkOutput("module2-summary.html", true, + checkOutput("moduleB-summary.html", true, "<caption><span>Provides</span><span class=\"tabEnd\"> </span></caption>\n" + "<tr>\n" + "<th class=\"colFirst\" scope=\"col\">Type</th>\n" @@ -526,7 +526,7 @@ } void checkNegatedModuleSummary() { - checkOutput("module1-summary.html", false, + checkOutput("moduleA-summary.html", false, "<!-- ============ SERVICES SUMMARY =========== -->\n" + "<a name=\"services.summary\">\n" + "<!-- -->\n" @@ -535,13 +535,13 @@ void checkModuleClickThroughLinks() { checkOutput("module-overview-frame.html", true, - "<li><a href=\"module1-frame.html\" target=\"packageListFrame\" " - + "onclick=\"updateModuleFrame('module1-type-frame.html','module1-summary.html');" - + "\">module1</a></li>"); + "<li><a href=\"moduleA-frame.html\" target=\"packageListFrame\" " + + "onclick=\"updateModuleFrame('moduleA-type-frame.html','moduleA-summary.html');" + + "\">moduleA</a></li>"); checkOutput("module-overview-frame.html", true, - "<li><a href=\"module2-frame.html\" target=\"packageListFrame\" " - + "onclick=\"updateModuleFrame('module2-type-frame.html','module2-summary.html');" - + "\">module2</a></li>"); + "<li><a href=\"moduleB-frame.html\" target=\"packageListFrame\" " + + "onclick=\"updateModuleFrame('moduleB-type-frame.html','moduleB-summary.html');" + + "\">moduleB</a></li>"); checkOutput("script.js", true, "function updateModuleFrame(pFrame, cFrame)\n" + "{\n" @@ -552,52 +552,52 @@ void checkModuleClickThrough(boolean found) { checkFiles(found, - "module1-type-frame.html", - "module2-type-frame.html"); + "moduleA-type-frame.html", + "moduleB-type-frame.html"); } void checkModuleFilesAndLinks(boolean found) { - checkOutput("testpkgmdl1/package-summary.html", found, - "<li><a href=\"../module1-summary.html\">Module</a></li>"); - checkOutput("testpkgmdl1/package-summary.html", found, + checkOutput("testpkgmdlA/package-summary.html", found, + "<li><a href=\"../moduleA-summary.html\">Module</a></li>"); + checkOutput("testpkgmdlA/package-summary.html", found, "<div class=\"subTitle\"><span class=\"moduleLabelInClass\">Module</span> " - + "<a href=\"../module1-summary.html\">module1</a></div>"); - checkOutput("testpkgmdl1/TestClassInModule1.html", found, - "<li><a href=\"../module1-summary.html\">Module</a></li>"); - checkOutput("testpkgmdl1/TestClassInModule1.html", found, + + "<a href=\"../moduleA-summary.html\">moduleA</a></div>"); + checkOutput("testpkgmdlA/TestClassInModuleA.html", found, + "<li><a href=\"../moduleA-summary.html\">Module</a></li>"); + checkOutput("testpkgmdlA/TestClassInModuleA.html", found, "<div class=\"subTitle\"><span class=\"moduleLabelInClass\">Module</span> " - + "<a href=\"../module1-summary.html\">module1</a></div>"); + + "<a href=\"../moduleA-summary.html\">moduleA</a></div>"); checkFiles(found, - "module1-frame.html", - "module1-summary.html", + "moduleA-frame.html", + "moduleA-summary.html", "module-overview-frame.html"); } void checkModulesInSearch(boolean found) { checkOutput("index-all.html", found, "<dl>\n" - + "<dt><a href=\"module1-summary.html\">module1</a> - module module1</dt>\n" + + "<dt><a href=\"moduleA-summary.html\">moduleA</a> - module moduleA</dt>\n" + "<dd>\n" - + "<div class=\"block\">This is a test description for the module1 module.</div>\n" + + "<div class=\"block\">This is a test description for the moduleA module.</div>\n" + "</dd>\n" - + "<dt><a href=\"module2-summary.html\">module2</a> - module module2</dt>\n" + + "<dt><a href=\"moduleB-summary.html\">moduleB</a> - module moduleB</dt>\n" + "<dd>\n" - + "<div class=\"block\">This is a test description for the module2 module.</div>\n" + + "<div class=\"block\">This is a test description for the moduleB module.</div>\n" + "</dd>\n" + "</dl>"); checkOutput("index-all.html", found, "<dl>\n" - + "<dt><span class=\"searchTagLink\"><a href=\"module1-summary.html#searchphrase\">" - + "search phrase</a></span> - Search tag in module1</dt>\n" + + "<dt><span class=\"searchTagLink\"><a href=\"moduleA-summary.html#searchphrase\">" + + "search phrase</a></span> - Search tag in moduleA</dt>\n" + "<dd>with description</dd>\n" - + "<dt><span class=\"searchTagLink\"><a href=\"module2-summary.html#search_word\">" - + "search_word</a></span> - Search tag in module2</dt>\n" + + "<dt><span class=\"searchTagLink\"><a href=\"moduleB-summary.html#search_word\">" + + "search_word</a></span> - Search tag in moduleB</dt>\n" + "<dd> </dd>\n" + "</dl>"); } void checkModuleDeprecation(boolean found) { - checkOutput("module1-summary.html", found, + checkOutput("moduleA-summary.html", found, "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated, for removal:" + " This API element is subject to removal in a future version. </span>\n" + "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated.</span></div>\n" @@ -608,12 +608,12 @@ + "<li><a href=\"#module\">Deprecated Modules</a></li>\n" + "</ul>", "<tr class=\"altColor\">\n" - + "<th class=\"colFirst\" scope=\"row\"><a href=\"module1-summary.html\">module1</a></th>\n" + + "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleA-summary.html\">moduleA</a></th>\n" + "<td class=\"colLast\">\n" + "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated.</span></div>\n" + "</td>\n" + "</tr>"); - checkOutput("module2-summary.html", !found, + checkOutput("moduleB-summary.html", !found, "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>\n" + "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated using just the javadoc tag.</span></div>"); checkOutput("moduletags-summary.html", found, @@ -623,11 +623,11 @@ } void checkModuleAnnotation() { - checkOutput("module2-summary.html", true, - "<p><a href=\"testpkgmdl2/AnnotationType.html\" title=\"annotation in testpkgmdl2\">@AnnotationType</a>(<a href=\"testpkgmdl2/AnnotationType.html#optional--\">optional</a>=\"Module Annotation\",\n" - + " <a href=\"testpkgmdl2/AnnotationType.html#required--\">required</a>=2016)\n" + checkOutput("moduleB-summary.html", true, + "<p><a href=\"testpkgmdlB/AnnotationType.html\" title=\"annotation in testpkgmdlB\">@AnnotationType</a>(<a href=\"testpkgmdlB/AnnotationType.html#optional--\">optional</a>=\"Module Annotation\",\n" + + " <a href=\"testpkgmdlB/AnnotationType.html#required--\">required</a>=2016)\n" + "</p>"); - checkOutput("module2-summary.html", false, + checkOutput("moduleB-summary.html", false, "@AnnotationTypeUndocumented"); }
--- a/test/jdk/javadoc/doclet/testModules/module1/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * This is a test description for the module1 module. Search phrase {@index "search phrase" with description}. - * - * @deprecated This module is deprecated. - */ -@Deprecated(forRemoval=true) -module module1 { - requires module2; - - exports testpkgmdl1; -}
--- a/test/jdk/javadoc/doclet/testModules/module1/testpkgmdl1/TestClassInModule1.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package testpkgmdl1; - -public class TestClassInModule1 { -}
--- a/test/jdk/javadoc/doclet/testModules/module2/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * This is a test description for the module2 module. Search word {@index search_word} with no description. - * - * @deprecated This module is deprecated using just the javadoc tag. - */ -@testpkgmdl2.AnnotationType(optional="Module Annotation", required=2016) -@testpkgmdl2.AnnotationTypeUndocumented(optional="Module Annotation", required=2016) -module module2 { - exports testpkgmdl2; - - exports testpkg2mdl2 to module1; - - uses testpkgmdl2.TestClassInModule2; - - provides testpkg2mdl2.TestInterfaceInModule2 with testpkgmdl2.TestClassInModule2; -}
--- a/test/jdk/javadoc/doclet/testModules/module2/testpkg2mdl2/TestInterfaceInModule2.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package testpkg2mdl2; - -public interface TestInterfaceInModule2 { - void testMethod(); -}
--- a/test/jdk/javadoc/doclet/testModules/module2/testpkgmdl2/AnnotationType.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package testpkgmdl2; - -import java.lang.annotation.*; - -/** - * This is a test annotation type. - */ -@Documented public @interface AnnotationType { - - /** - * The copyright holder. - * - * @return a string. - */ - String optional() default "unknown"; - - /** - * The year of the copyright. - * - * @return an int. - */ - int required(); -}
--- a/test/jdk/javadoc/doclet/testModules/module2/testpkgmdl2/AnnotationTypeUndocumented.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package testpkgmdl2; - -import java.lang.annotation.*; - -/** - * This is a test annotation type this is not documented because it - * is missing the @Documented tag. - */ -public @interface AnnotationTypeUndocumented { - - /** - * The copyright holder. - * - * @return a string. - */ - String optional() default "unknown"; - - /** - * The year of the copyright. - * - * @return an int. - */ - int required(); -}
--- a/test/jdk/javadoc/doclet/testModules/module2/testpkgmdl2/TestClassInModule2.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package testpkgmdl2; - -import testpkg2mdl2.TestInterfaceInModule2; - -public class TestClassInModule2 implements TestInterfaceInModule2 { - void testMethod() {} -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/javadoc/doclet/testModules/moduleA/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * This is a test description for the moduleA module. Search phrase {@index "search phrase" with description}. + * + * @deprecated This module is deprecated. + */ +@Deprecated(forRemoval=true) +module moduleA { + requires moduleB; + + exports testpkgmdlA; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/javadoc/doclet/testModules/moduleA/testpkgmdlA/TestClassInModuleA.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package testpkgmdlA; + +public class TestClassInModuleA { +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/javadoc/doclet/testModules/moduleB/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * This is a test description for the moduleB module. Search word {@index search_word} with no description. + * + * @deprecated This module is deprecated using just the javadoc tag. + */ +@testpkgmdlB.AnnotationType(optional="Module Annotation", required=2016) +@testpkgmdlB.AnnotationTypeUndocumented(optional="Module Annotation", required=2016) +module moduleB { + exports testpkgmdlB; + + exports testpkg2mdlB to moduleA; + + uses testpkgmdlB.TestClassInModuleB; + + provides testpkg2mdlB.TestInterfaceInModuleB with testpkgmdlB.TestClassInModuleB; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/javadoc/doclet/testModules/moduleB/testpkg2mdlB/TestInterfaceInModuleB.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package testpkg2mdlB; + +public interface TestInterfaceInModuleB { + void testMethod(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/javadoc/doclet/testModules/moduleB/testpkgmdlB/AnnotationType.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package testpkgmdlB; + +import java.lang.annotation.*; + +/** + * This is a test annotation type. + */ +@Documented public @interface AnnotationType { + + /** + * The copyright holder. + * + * @return a string. + */ + String optional() default "unknown"; + + /** + * The year of the copyright. + * + * @return an int. + */ + int required(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/javadoc/doclet/testModules/moduleB/testpkgmdlB/AnnotationTypeUndocumented.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package testpkgmdlB; + +import java.lang.annotation.*; + +/** + * This is a test annotation type this is not documented because it + * is missing the @Documented tag. + */ +public @interface AnnotationTypeUndocumented { + + /** + * The copyright holder. + * + * @return a string. + */ + String optional() default "unknown"; + + /** + * The year of the copyright. + * + * @return an int. + */ + int required(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/javadoc/doclet/testModules/moduleB/testpkgmdlB/TestClassInModuleB.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package testpkgmdlB; + +import testpkg2mdlB.TestInterfaceInModuleB; + +public class TestClassInModuleB implements TestInterfaceInModuleB { + void testMethod() {} +}
--- a/test/jdk/javadoc/doclet/testModules/moduletags/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/jdk/javadoc/doclet/testModules/moduletags/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -24,7 +24,7 @@ */ /** - * This is a test description for the module1 module.<br> + * This is a test description for the moduleA module.<br> * Type Link: {@link testpkgmdltags.TestClassInModuleTags}.<br> * Member Link: {@link testpkgmdltags.TestClassInModuleTags#testMethod(String)}.<br> * Package Link: {@link testpkgmdltags}.<br> @@ -39,7 +39,7 @@ */ @Deprecated module moduletags { - requires module2; + requires moduleB; exports testpkgmdltags; }
--- a/test/lib/annotations/annotations/classfile/ClassfileInspector.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/lib/annotations/annotations/classfile/ClassfileInspector.java Fri Dec 16 08:17:55 2016 +0000 @@ -1183,16 +1183,6 @@ private static class AbstractAttributeVisitor<T> implements Attribute.Visitor<Void, T> { @Override - public Void visitBootstrapMethods(BootstrapMethods_attribute attr, T p) { - return null; - } - - @Override - public Void visitModulePackages(ModulePackages_attribute attr, T p) { - return null; - } - - @Override public Void visitDefault(DefaultAttribute attr, T p) { return null; } @@ -1203,6 +1193,11 @@ } @Override + public Void visitBootstrapMethods(BootstrapMethods_attribute attr, T p) { + return null; + } + + @Override public Void visitCharacterRangeTable(CharacterRangeTable_attribute attr, T p) { return null; } @@ -1238,11 +1233,6 @@ } @Override - public Void visitModuleHashes(ModuleHashes_attribute attr, T p) { - return null; - } - - @Override public Void visitInnerClasses(InnerClasses_attribute attr, T p) { return null; } @@ -1263,11 +1253,6 @@ } @Override - public Void visitModuleMainClass(ModuleMainClass_attribute attr, T p) { - return null; - } - - @Override public Void visitMethodParameters(MethodParameters_attribute attr, T p) { return null; } @@ -1278,7 +1263,27 @@ } @Override - public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, T p) { + public Void visitModuleHashes(ModuleHashes_attribute attr, T p) { + return null; + } + + @Override + public Void visitModuleMainClass(ModuleMainClass_attribute attr, T p) { + return null; + } + + @Override + public Void visitModulePackages(ModulePackages_attribute attr, T p) { + return null; + } + + @Override + public Void visitModuleResolution(ModuleResolution_attribute attr, T p) { + return null; + } + + @Override + public Void visitModuleTarget(ModuleTarget_attribute attr, T p) { return null; } @@ -1288,26 +1293,31 @@ } @Override + public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, T p) { + return null; + } + + @Override + public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, T p) { + return null; + } + + @Override + public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, T p) { + return null; + } + + @Override public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, T p) { return null; } @Override - public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, T p) { - return null; - } - - @Override public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, T p) { return null; } @Override - public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, T p) { - return null; - } - - @Override public Void visitSignature(Signature_attribute attr, T p) { return null; } @@ -1341,17 +1351,6 @@ public Void visitSynthetic(Synthetic_attribute attr, T p) { return null; } - - @Override - public Void visitModuleTarget(ModuleTarget_attribute attr, T p) { - return null; - } - - @Override - public Void visitModuleVersion(ModuleVersion_attribute attr, T p) { - return null; - } - } private static final Attribute.Visitor<Void, ExpectedTypeAnnotation> typeAnnoMatcher
--- a/test/tools/javac/MethodParameters/AttributeVisitor.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/MethodParameters/AttributeVisitor.java Fri Dec 16 08:17:55 2016 +0000 @@ -47,8 +47,8 @@ public R visitModuleHashes(ModuleHashes_attribute attr, P p) { return null; } public R visitModuleMainClass(ModuleMainClass_attribute attr, P p) { return null; } public R visitModulePackages(ModulePackages_attribute attr, P p) { return null; } + public R visitModuleResolution(ModuleResolution_attribute attr, P p) { return null; } public R visitModuleTarget(ModuleTarget_attribute attr, P p) { return null; } - public R visitModuleVersion(ModuleVersion_attribute attr, P p) { return null; } public R visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, P p) { return null; } public R visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, P p) { return null; } public R visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, P p) { return null; }
--- a/test/tools/javac/T8003967/DetectMutableStaticFields.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/T8003967/DetectMutableStaticFields.java Fri Dec 16 08:17:55 2016 +0000 @@ -112,6 +112,8 @@ "bootMethod", "defineModulesWithOneLoaderMethod", "configurationMethod", "layerClass"); ignore("com/sun/tools/javac/util/JDK9Wrappers$Module", "addExportsMethod", "addUsesMethod", "getModuleMethod", "getUnnamedModuleMethod"); + ignore("com/sun/tools/javac/util/JDK9Wrappers$ModuleDescriptor$Version", + "versionClass", "parseMethod"); ignore("com/sun/tools/javac/util/JDK9Wrappers$ModuleFinder", "moduleFinderClass", "ofMethod"); ignore("com/sun/tools/javac/util/JDK9Wrappers$ServiceLoaderHelper",
--- a/test/tools/javac/classfiles/attributes/Module/ModuleTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/classfiles/attributes/Module/ModuleTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -46,7 +46,7 @@ @Test public void testEmptyModule(Path base) throws Exception { - ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1") + ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m") .write(base); compile(base); testModuleAttribute(base, moduleDescriptor); @@ -54,7 +54,7 @@ @Test public void testExports(Path base) throws Exception { - ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1") + ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m") .exports("pack") .write(base); tb.writeJavaFiles(base, "package pack; public class C extends java.util.ArrayList{ }"); @@ -64,7 +64,7 @@ @Test public void testSeveralExports(Path base) throws Exception { - ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1") + ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m") .exports("pack") .exports("pack2") .exports("pack3") @@ -83,7 +83,7 @@ @Test public void testQualifiedExports(Path base) throws Exception { - ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1") + ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m") .exportsTo("pack", "jdk.compiler") .write(base); tb.writeJavaFiles(base, "package pack; public class A { }"); @@ -93,7 +93,7 @@ @Test public void testQualifiedDynamicExports(Path base) throws Exception { - ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1") + ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m") .exportsTo("pack", "jdk.compiler") .write(base); tb.writeJavaFiles(base, "package pack; public class A { }"); @@ -103,7 +103,7 @@ @Test public void testSeveralQualifiedExports(Path base) throws Exception { - ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1") + ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m") .exportsTo("pack", "jdk.compiler, jdk.jdeps") .exportsTo("pack2", "jdk.jdeps") .exportsTo("pack3", "jdk.compiler") @@ -122,7 +122,7 @@ @Test public void testRequires(Path base) throws Exception { - ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1") + ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m") .requires("jdk.compiler") .write(base); compile(base); @@ -131,7 +131,7 @@ @Test public void testRequiresTransitive(Path base) throws Exception { - ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1") + ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m") .requires("jdk.jdeps", RequiresFlag.TRANSITIVE) .write(base); compile(base); @@ -140,7 +140,7 @@ @Test public void testRequiresStatic(Path base) throws Exception { - ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1") + ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m") .requires("jdk.jdeps", RequiresFlag.STATIC) .write(base); compile(base); @@ -149,26 +149,26 @@ @Test public void testSeveralRequires(Path base) throws Exception { - ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1") + ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1x") .requires("jdk.jdeps", RequiresFlag.TRANSITIVE) .requires("jdk.compiler") - .requires("m2", RequiresFlag.STATIC) - .requires("m3") - .requires("m4", RequiresFlag.TRANSITIVE) - .requires("m5", RequiresFlag.STATIC, RequiresFlag.TRANSITIVE) - .write(base.resolve("m1")); - tb.writeJavaFiles(base.resolve("m2"), "module m2 { }"); - tb.writeJavaFiles(base.resolve("m3"), "module m3 { }"); - tb.writeJavaFiles(base.resolve("m4"), "module m4 { }"); - tb.writeJavaFiles(base.resolve("m5"), "module m5 { }"); + .requires("m2x", RequiresFlag.STATIC) + .requires("m3x") + .requires("m4x", RequiresFlag.TRANSITIVE) + .requires("m5x", RequiresFlag.STATIC, RequiresFlag.TRANSITIVE) + .write(base.resolve("m1x")); + tb.writeJavaFiles(base.resolve("m2x"), "module m2x { }"); + tb.writeJavaFiles(base.resolve("m3x"), "module m3x { }"); + tb.writeJavaFiles(base.resolve("m4x"), "module m4x { }"); + tb.writeJavaFiles(base.resolve("m5x"), "module m5x { }"); compile(base, "--module-source-path", base.toString(), "-d", base.toString()); - testModuleAttribute(base.resolve("m1"), moduleDescriptor); + testModuleAttribute(base.resolve("m1x"), moduleDescriptor); } @Test public void testProvides(Path base) throws Exception { - ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1") + ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m") .provides("java.util.Collection", "pack2.D") .write(base); tb.writeJavaFiles(base, "package pack2; public class D extends java.util.ArrayList{ }"); @@ -178,7 +178,7 @@ @Test public void testSeveralProvides(Path base) throws Exception { - ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1") + ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m") .provides("java.util.Collection", "pack2.D") .provides("java.util.List", "pack2.D") .requires("jdk.compiler") @@ -192,7 +192,7 @@ @Test public void testUses(Path base) throws Exception { - ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1") + ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m") .uses("java.util.List") .write(base); compile(base); @@ -201,7 +201,7 @@ @Test public void testSeveralUses(Path base) throws Exception { - ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1") + ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m") .uses("java.util.List") .uses("java.util.Collection") .requires("jdk.compiler") @@ -213,22 +213,22 @@ @Test public void testComplex(Path base) throws Exception { - Path m1 = base.resolve("m1"); - ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1") + Path m1 = base.resolve("m1x"); + ModuleDescriptor moduleDescriptor = new ModuleDescriptor("m1x") .exports("pack1") .exports("pack3") - .exportsTo("packTo1", "m2") - .exportsTo("packTo3", "m3") + .exportsTo("packTo1", "m2x") + .exportsTo("packTo3", "m3x") .requires("jdk.compiler") - .requires("m2", RequiresFlag.TRANSITIVE) - .requires("m3", RequiresFlag.STATIC) - .requires("m4", RequiresFlag.TRANSITIVE, RequiresFlag.STATIC) + .requires("m2x", RequiresFlag.TRANSITIVE) + .requires("m3x", RequiresFlag.STATIC) + .requires("m4x", RequiresFlag.TRANSITIVE, RequiresFlag.STATIC) .provides("java.util.List", "pack1.C", "pack2.D") .uses("java.util.List") .uses("java.nio.file.Path") .requires("jdk.jdeps", RequiresFlag.STATIC, RequiresFlag.TRANSITIVE) - .requires("m5", RequiresFlag.STATIC) - .requires("m6", RequiresFlag.TRANSITIVE) + .requires("m5x", RequiresFlag.STATIC) + .requires("m6x", RequiresFlag.TRANSITIVE) .requires("java.compiler") .exportsTo("packTo4", "java.compiler") .exportsTo("packTo2", "java.compiler") @@ -244,11 +244,11 @@ "package packTo2; public class T2 {}", "package packTo3; public class T3 {}", "package packTo4; public class T4 {}"); - tb.writeJavaFiles(base.resolve("m2"), "module m2 { }"); - tb.writeJavaFiles(base.resolve("m3"), "module m3 { }"); - tb.writeJavaFiles(base.resolve("m4"), "module m4 { }"); - tb.writeJavaFiles(base.resolve("m5"), "module m5 { }"); - tb.writeJavaFiles(base.resolve("m6"), "module m6 { }"); + tb.writeJavaFiles(base.resolve("m2x"), "module m2x { }"); + tb.writeJavaFiles(base.resolve("m3x"), "module m3x { }"); + tb.writeJavaFiles(base.resolve("m4x"), "module m4x { }"); + tb.writeJavaFiles(base.resolve("m5x"), "module m5x { }"); + tb.writeJavaFiles(base.resolve("m6x"), "module m6x { }"); compile(base, "--module-source-path", base.toString(), "-d", base.toString()); testModuleAttribute(m1, moduleDescriptor);
--- a/test/tools/javac/classfiles/attributes/Module/ModuleTestBase.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/classfiles/attributes/Module/ModuleTestBase.java Fri Dec 16 08:17:55 2016 +0000 @@ -93,10 +93,10 @@ tr.checkContains(actualRequires, moduleDescriptor.requires, "Lists of requires don't match"); } - private void testExports(ModuleDescriptor moduleDescriptor, Module_attribute module, ConstantPool constantPool) throws ConstantPool.InvalidIndex, ConstantPool.UnexpectedEntry { + private void testExports(ModuleDescriptor moduleDescriptor, Module_attribute module, ConstantPool constantPool) throws ConstantPoolException { tr.checkEquals(module.exports_count, moduleDescriptor.exports.size(), "Wrong amount of exports."); for (Module_attribute.ExportsEntry export : module.exports) { - String pkg = constantPool.getUTF8Value(export.exports_index); + String pkg = constantPool.getPackageInfo(export.exports_index).getName(); if (tr.checkTrue(moduleDescriptor.exports.containsKey(pkg), "Unexpected export " + pkg)) { Export expectedExport = moduleDescriptor.exports.get(pkg); tr.checkEquals(expectedExport.mask, export.exports_flags, "Wrong export flags"); @@ -104,7 +104,7 @@ tr.checkEquals(export.exports_to_count, expectedTo.size(), "Wrong amount of exports to"); List<String> actualTo = new ArrayList<>(); for (int toIdx : export.exports_to_index) { - actualTo.add(constantPool.getUTF8Value(toIdx).replace('/', '.')); + actualTo.add(constantPool.getModuleInfo(toIdx).getName().replace('/', '.')); } tr.checkContains(actualTo, expectedTo, "Lists of \"exports to\" don't match."); }
--- a/test/tools/javac/diags/examples/CyclicRequires/modulesourcepath/m1/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m1 { - requires m2; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/CyclicRequires/modulesourcepath/m1x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m1x { + requires m2x; +}
--- a/test/tools/javac/diags/examples/CyclicRequires/modulesourcepath/m2/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m2 { - requires m1; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/CyclicRequires/modulesourcepath/m2x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m2x { + requires m1x; +}
--- a/test/tools/javac/diags/examples/DuplicateModule/modulesourcepath/m1/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module blah {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/DuplicateModule/modulesourcepath/m1x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module blah {}
--- a/test/tools/javac/diags/examples/DuplicateModule/modulesourcepath/m2/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module blah {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/DuplicateModule/modulesourcepath/m2x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module blah {}
--- a/test/tools/javac/diags/examples/HasBeenDeprecatedModule/modulesourcepath/m1/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -@Deprecated -module m1 {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/HasBeenDeprecatedModule/modulesourcepath/m1x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +@Deprecated +module m1x {}
--- a/test/tools/javac/diags/examples/HasBeenDeprecatedModule/modulesourcepath/m2/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m2 { - requires m1; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/HasBeenDeprecatedModule/modulesourcepath/m2x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m2x { + requires m1x; +}
--- a/test/tools/javac/diags/examples/HasBeenDeprecatedRemovalModule/modulesourcepath/m1/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -@Deprecated(forRemoval=true) -module m1 {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/HasBeenDeprecatedRemovalModule/modulesourcepath/m1x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +@Deprecated(forRemoval=true) +module m1x {}
--- a/test/tools/javac/diags/examples/HasBeenDeprecatedRemovalModule/modulesourcepath/m2/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m2 { - requires m1; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/HasBeenDeprecatedRemovalModule/modulesourcepath/m2x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m2x { + requires m1x; +}
--- a/test/tools/javac/diags/examples/LeaksNotAccessible/modulesourcepath/m1/api/Api.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package api; - -public class Api { - public Impl getImpl() { - return null; - } -} - -class Impl {}
--- a/test/tools/javac/diags/examples/LeaksNotAccessible/modulesourcepath/m1/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m1 { - exports api; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/LeaksNotAccessible/modulesourcepath/m1x/api/Api.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package api; + +public class Api { + public Impl getImpl() { + return null; + } +} + +class Impl {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/LeaksNotAccessible/modulesourcepath/m1x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m1x { + exports api; +}
--- a/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m1/api1/Api1.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package api1; - -public class Api1 { -}
--- a/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m1/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m1 { - exports api1; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m1x/api1/Api1.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package api1; + +public class Api1 { +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m1x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m1x { + exports api1; +}
--- a/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m2/api2/Api2.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package api2; - -public class Api2 { - public api1.Api1 getApi1() { - return null; - } -}
--- a/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m2/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m2 { - requires m1; - exports api2; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m2x/api2/Api2.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package api2; + +public class Api2 { + public api1.Api1 getApi1() { + return null; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/LeaksNotAccessibleNotRequiredTransitive/modulesourcepath/m2x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m2x { + requires m1x; + exports api2; +}
--- a/test/tools/javac/diags/examples/LeaksNotAccessibleUnexported/modulesourcepath/m1/api/Api.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package api; - -public class Api { - public impl.Impl getImpl() { - return null; - } -}
--- a/test/tools/javac/diags/examples/LeaksNotAccessibleUnexported/modulesourcepath/m1/impl/Impl.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package impl; - -public class Impl { -}
--- a/test/tools/javac/diags/examples/LeaksNotAccessibleUnexported/modulesourcepath/m1/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m1 { - exports api; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/LeaksNotAccessibleUnexported/modulesourcepath/m1x/api/Api.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package api; + +public class Api { + public impl.Impl getImpl() { + return null; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/LeaksNotAccessibleUnexported/modulesourcepath/m1x/impl/Impl.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package impl; + +public class Impl { +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/LeaksNotAccessibleUnexported/modulesourcepath/m1x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m1x { + exports api; +}
--- a/test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m1/api/Api.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package api; - -public class Api { - public qapi.QApi get() { - return null; - } -}
--- a/test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m1/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m1 { - exports api; - exports qapi to m2; -}
--- a/test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m1/qapi/QApi.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package qapi; - -public class QApi { -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m1x/api/Api.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package api; + +public class Api { + public qapi.QApi get() { + return null; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m1x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m1x { + exports api; + exports qapi to m2x; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m1x/qapi/QApi.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package qapi; + +public class QApi { +}
--- a/test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m2/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m2 { - requires m1; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/LeaksNotAccessibleUnexportedQualified/modulesourcepath/m2x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m2x { + requires m1x; +}
--- a/test/tools/javac/diags/examples/ModuleInfoWithoutModule/modulesourcepath/m1/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -// No module description here
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/ModuleInfoWithoutModule/modulesourcepath/m1x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// No module description here
--- a/test/tools/javac/diags/examples/MultiModuleOutputCannotBeExplodedModule/additional/m1/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m1 { -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/MultiModuleOutputCannotBeExplodedModule/additional/m1x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m1x { +}
--- a/test/tools/javac/diags/examples/MultiModuleOutputCannotBeExplodedModule/modulesourcepath/m2/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m2 { -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/MultiModuleOutputCannotBeExplodedModule/modulesourcepath/m2x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m2x { +}
--- a/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m1/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m1 {}
--- a/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m1/p1/C1.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package p1; - -public class C1 {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m1x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m1x {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m1x/p1/C1.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package p1; + +public class C1 {}
--- a/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m2/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m2 {}
--- a/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m2/p2/C2.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package p2; - -public class C2 { - p1.C1 c1; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m2x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m2x {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m2x/p2/C2.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package p2; + +public class C2 { + p1.C1 c1; +}
--- a/test/tools/javac/diags/examples/NotInProfile.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/diags/examples/NotInProfile.java Fri Dec 16 08:17:55 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ // key: compiler.err.not.in.profile -// options: -profile compact1 +// options: --release 8 -profile compact1 class NotInProfile { Class<?> c = java.awt.Frame.class;
--- a/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib1/exported/Api1.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package exported; - -public class Api1 { -}
--- a/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib1/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module lib1 { - exports exported; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib1x/exported/Api1.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package exported; + +public class Api1 { +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib1x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module lib1x { + exports exported; +}
--- a/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib2/exported/Api2.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package exported; - -public class Api2 { -}
--- a/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib2/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module lib2 { - exports exported; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib2x/exported/Api2.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package exported; + +public class Api2 { +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/lib2x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module lib2x { + exports exported; +}
--- a/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/use/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/diags/examples/PackageClashFromRequires/modulesourcepath/use/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -22,6 +22,6 @@ */ module use { - requires lib1; - requires lib2; + requires lib1x; + requires lib2x; }
--- a/test/tools/javac/diags/examples/PackageEmptyOrNotFound/modulesourcepath/m1/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m1 { - exports p1; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/PackageEmptyOrNotFound/modulesourcepath/m1x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m1x { + exports p1; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/PoorChoiceForModuleName/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.warn.poor.choice.for.module.name +// options: -Xlint:module + +module mango19 {}
--- a/test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m1/exported/Service.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package exported; - -public interface Service { -}
--- a/test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m1/exported/ServiceImplementation.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package exported; - -public class ServiceImplementation implements Service { -}
--- a/test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m1/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m1 { - exports exported; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m1x/exported/Service.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package exported; + +public interface Service { +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m1x/exported/ServiceImplementation.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package exported; + +public class ServiceImplementation implements Service { +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m1x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m1x { + exports exported; +}
--- a/test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m2/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m2 { - requires m1; - provides exported.Service with exported.ServiceImplementation; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/ServiceImplementationNotInRightModule/modulesourcepath/m2x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m2x { + requires m1x; + provides exported.Service with exported.ServiceImplementation; +}
--- a/test/tools/javac/diags/examples/TooManyModules/p1/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/diags/examples/TooManyModules/p1/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -21,4 +21,4 @@ * questions. */ -module m1 {} +module m1x {}
--- a/test/tools/javac/diags/examples/TooManyModules/p2/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/diags/examples/TooManyModules/p2/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -21,4 +21,4 @@ * questions. */ -module m2 {} +module m2x {}
--- a/test/tools/javac/diags/examples/UnnamedPackageInNamedModule/modulesourcepath/m1/UnnamedPackageInNamedModule.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -class UnnamedPackageInNamedModule {}
--- a/test/tools/javac/diags/examples/UnnamedPackageInNamedModule/modulesourcepath/m1/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m1 {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/UnnamedPackageInNamedModule/modulesourcepath/m1x/UnnamedPackageInNamedModule.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +class UnnamedPackageInNamedModule {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/UnnamedPackageInNamedModule/modulesourcepath/m1x/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m1x {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/WarnModuleNotFound/WarnModuleNotFound.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.warn.module.not.found +// options: -Xlint:module
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/WarnModuleNotFound/modulesourcepath/m/api/Api.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package api; + +public class Api { +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/WarnModuleNotFound/modulesourcepath/m/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m { + exports api to does.not.exist; +}
--- a/test/tools/javac/lambda/ByteCodeTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/lambda/ByteCodeTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -619,6 +619,36 @@ } @Override + public String visitModule(CONSTANT_Module_info c, Integer p) { + + String value = slist.get(p); + if (value == null) { + try { + value = visit(cfpool.get(c.name_index), c.name_index); + slist.set(p, value); + } catch (ConstantPoolException ex) { + ex.printStackTrace(); + } + } + return value; + } + + @Override + public String visitPackage(CONSTANT_Package_info c, Integer p) { + + String value = slist.get(p); + if (value == null) { + try { + value = visit(cfpool.get(c.name_index), c.name_index); + slist.set(p, value); + } catch (ConstantPoolException ex) { + ex.printStackTrace(); + } + } + return value; + } + + @Override public String visitString(CONSTANT_String_info c, Integer p) { try {
--- a/test/tools/javac/modules/AddExportsTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/AddExportsTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -31,13 +31,10 @@ * @run main AddExportsTest */ -import java.nio.file.Files; import java.nio.file.Path; -import java.util.Set; import toolbox.JavacTask; import toolbox.Task; -import toolbox.ToolBox; public class AddExportsTest extends ModuleTestBase { @@ -71,24 +68,24 @@ @Test public void testEmptyItem(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { }", + "module m1x { }", "package p1; public class C1 { }"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { }", + "module m2x { }", "package p2; class C2 { p1.C1 c1; }"); - Path src_m3 = src.resolve("m3"); + Path src_m3 = src.resolve("m3x"); tb.writeJavaFiles(src_m3, - "module m3 { }", + "module m3x { }", "package p3; class C3 { p1.C1 c1; }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); - testEmptyItem(src, classes, "m1/p1=,m2,m3"); - testEmptyItem(src, classes, "m1/p1=m2,,m3"); - testEmptyItem(src, classes, "m1/p1=m2,m3,"); + testEmptyItem(src, classes, "m1x/p1=,m2x,m3x"); + testEmptyItem(src, classes, "m1x/p1=m2x,,m3x"); + testEmptyItem(src, classes, "m1x/p1=m2x,m3x,"); } void testEmptyItem(Path src, Path classes, String option) throws Exception { @@ -104,15 +101,15 @@ @Test public void testEmptyList(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports p1; }", + "module m1x { exports p1; }", "package p1; public class C1 { }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); - testEmptyList(src, classes, "m1/p1="); - testEmptyList(src, classes, "m1/p1=,"); + testEmptyList(src, classes, "m1x/p1="); + testEmptyList(src, classes, "m1x/p1=,"); } void testEmptyList(Path src, Path classes, String option) throws Exception { @@ -132,22 +129,22 @@ @Test public void testMissingSourceParts(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports p1; }", + "module m1x { exports p1; }", "package p1; public class C1 { }"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { }", + "module m2x { }", "package p2; class C2 { p1.C1 c1; }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); - testMissingSourcePart(src, classes, "=m2"); - testMissingSourcePart(src, classes, "/=m2"); - testMissingSourcePart(src, classes, "m1/=m2"); - testMissingSourcePart(src, classes, "/p1=m2"); - testMissingSourcePart(src, classes, "m1p1=m2"); + testMissingSourcePart(src, classes, "=m2x"); + testMissingSourcePart(src, classes, "/=m2x"); + testMissingSourcePart(src, classes, "m1x/=m2x"); + testMissingSourcePart(src, classes, "/p1=m2x"); + testMissingSourcePart(src, classes, "m1xp1=m2x"); } private void testMissingSourcePart(Path src, Path classes, String option) throws Exception { @@ -167,19 +164,19 @@ @Test public void testBadSourceParts(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports p1; }", + "module m1x { exports p1; }", "package p1; public class C1 { }"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { }", + "module m2x { }", "package p2; class C2 { p1.C1 c1; }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); - testBadSourcePart(src, classes, "m!/p1=m2", "m!"); - testBadSourcePart(src, classes, "m1/p!=m2", "p!"); + testBadSourcePart(src, classes, "m!/p1=m2x", "m!"); + testBadSourcePart(src, classes, "m1x/p!=m2x", "p!"); } private void testBadSourcePart(Path src, Path classes, String option, String badName) @@ -201,9 +198,9 @@ @Test public void testBadTarget(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports p1; }", + "module m1x { exports p1; }", "package p1; public class C1 { }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); @@ -211,7 +208,7 @@ String log = new JavacTask(tb, Task.Mode.CMDLINE) .options("-XDrawDiagnostics", "--module-source-path", src.toString(), - "--add-exports", "m1/p1=m!") + "--add-exports", "m1x/p1=m!") .outdir(classes) .files(findJavaFiles(src)) .run() @@ -225,16 +222,16 @@ @Test public void testSourceNotFound(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { }"); + "module m1x { }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); String log = new JavacTask(tb, Task.Mode.CMDLINE) .options("-XDrawDiagnostics", "--module-source-path", src.toString(), - "--add-exports", "DoesNotExist/p=m1") + "--add-exports", "DoesNotExist/p=m1x") .outdir(classes) .files(findJavaFiles(src)) .run() @@ -248,9 +245,9 @@ @Test public void testTargetNotFound(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { }", + "module m1x { }", "package p1; class C1 { }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); @@ -258,7 +255,7 @@ String log = new JavacTask(tb, Task.Mode.CMDLINE) .options("-XDrawDiagnostics", "--module-source-path", src.toString(), - "--add-exports", "m1/p1=DoesNotExist") + "--add-exports", "m1x/p1=DoesNotExist") .outdir(classes) .files(findJavaFiles(src)) .run() @@ -272,20 +269,20 @@ @Test public void testDuplicate(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { }", + "module m1x { }", "package p1; public class C1 { }"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { }", + "module m2x { }", "package p2; class C2 { p1.C1 c1; }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); new JavacTask(tb) .options("--module-source-path", src.toString(), - "--add-exports", "m1/p1=m2,m2") + "--add-exports", "m1x/p1=m2x,m2x") .outdir(classes) .files(findJavaFiles(src)) .run() @@ -295,21 +292,21 @@ @Test public void testRepeated_SameTarget(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { }", + "module m1x { }", "package p1; public class C1 { }"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { }", + "module m2x { }", "package p2; class C2 { p1.C1 c1; }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); new JavacTask(tb) .options("--module-source-path", src.toString(), - "--add-exports", "m1/p1=m2", - "--add-exports", "m1/p1=m2") + "--add-exports", "m1x/p1=m2x", + "--add-exports", "m1x/p1=m2x") .outdir(classes) .files(findJavaFiles(src)) .run() @@ -319,25 +316,25 @@ @Test public void testRepeated_DifferentTarget(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { }", + "module m1x { }", "package p1; public class C1 { }"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { }", + "module m2x { }", "package p2; class C2 { p1.C1 c1; }"); - Path src_m3 = src.resolve("m3"); + Path src_m3 = src.resolve("m3x"); tb.writeJavaFiles(src_m3, - "module m3 { }", + "module m3x { }", "package p3; class C3 { p1.C1 c1; }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); new JavacTask(tb) .options("--module-source-path", src.toString(), - "--add-exports", "m1/p1=m2", - "--add-exports", "m1/p1=m3") + "--add-exports", "m1x/p1=m2x", + "--add-exports", "m1x/p1=m3x") .outdir(classes) .files(findJavaFiles(src)) .run()
--- a/test/tools/javac/modules/AddLimitMods.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/AddLimitMods.java Fri Dec 16 08:17:55 2016 +0000 @@ -81,22 +81,22 @@ @Test public void testManual(Path base) throws Exception { Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m1x"); tb.writeJavaFiles(m1, - "module m1 { requires m2; requires m3; }"); + "module m1x { requires m2x; requires m3x; }"); - Path m2 = moduleSrc.resolve("m2"); + Path m2 = moduleSrc.resolve("m2x"); tb.writeJavaFiles(m2, - "module m2 { requires m3; exports m2; }", - "package m2; public class M2 {}"); + "module m2x { requires m3x; exports m2x; }", + "package m2x; public class M2 {}"); - Path m3 = moduleSrc.resolve("m3"); + Path m3 = moduleSrc.resolve("m3x"); tb.writeJavaFiles(m3, - "module m3 { exports m3; }", - "package m3; public class M3 {}"); + "module m3x { exports m3x; }", + "package m3x; public class M3 {}"); Path modulePath = base.resolve("module-path"); @@ -130,7 +130,7 @@ .options("--module-path", modulePath.toString(), "--should-stop:ifNoError=FLOW", "--limit-modules", "java.base", - "--add-modules", "m2") + "--add-modules", "m2x") .outdir(modulePath) .files(findJavaFiles(m1)) .run(Task.Expect.FAIL) @@ -140,7 +140,7 @@ .options("--module-path", modulePath.toString(), "--should-stop:ifNoError=FLOW", "--limit-modules", "java.base", - "--add-modules", "m2,m3") + "--add-modules", "m2x,m3x") .outdir(modulePath) .files(findJavaFiles(m1)) .run() @@ -149,7 +149,7 @@ new JavacTask(tb) .options("--module-path", modulePath.toString(), "--should-stop:ifNoError=FLOW", - "--limit-modules", "m2") + "--limit-modules", "m2x") .outdir(modulePath) .files(findJavaFiles(m1)) .run() @@ -158,7 +158,7 @@ new JavacTask(tb) .options("--module-path", modulePath.toString(), "--should-stop:ifNoError=FLOW", - "--limit-modules", "m3") + "--limit-modules", "m3x") .outdir(modulePath) .files(findJavaFiles(m1)) .run(Task.Expect.FAIL) @@ -167,8 +167,8 @@ new JavacTask(tb) .options("--module-path", modulePath.toString(), "--should-stop:ifNoError=FLOW", - "--limit-modules", "m3", - "--add-modules", "m2") + "--limit-modules", "m3x", + "--add-modules", "m2x") .outdir(modulePath) .files(findJavaFiles(m1)) .run() @@ -233,10 +233,10 @@ tb.cleanDirectory(base); Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m1x"); tb.writeJavaFiles(m1, - "module m1 { exports api; }", + "module m1x { exports api; }", "package api; public class Api { }"); Path modulePath = base.resolve("module-path"); @@ -319,7 +319,7 @@ throw new IllegalStateException("incorrect errors; actual=" + actual); } - tb.writeJavaFiles(cpSrc, "module m1 {}"); + tb.writeJavaFiles(cpSrc, "module m1x {}"); actual = new JavacTask(tb) .options("-XDrawDiagnostics", @@ -382,10 +382,10 @@ .run(); Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m1x"); tb.writeJavaFiles(m1, - "module m1 { exports api; }", + "module m1x { exports api; }", "package api; public class Api { public void test() { } }"); System.err.println("Compiling module-src files:"); @@ -405,8 +405,8 @@ System.err.println("Running check: " + moduleInfo + "; " + Arrays.asList(options)); - Path m2Runtime = base.resolve(index + "-runtime").resolve("m2"); - Path out = base.resolve(index + "-runtime").resolve("out").resolve("m2"); + Path m2Runtime = base.resolve(index + "-runtime").resolve("m2x"); + Path out = base.resolve(index + "-runtime").resolve("out").resolve("m2x"); Files.createDirectories(out); @@ -443,14 +443,14 @@ String output; try { - System.err.println("Running m2/test.Test:"); + System.err.println("Running m2x/test.Test:"); output = new JavaTask(tb) .vmOptions(augmentOptions(options, Collections.emptyList(), "--module-path", modulePath.toString() + File.pathSeparator + out.getParent().toString(), "--class-path", classpathOut.toString(), - "--add-reads", "m2=ALL-UNNAMED,automatic", - "-m", "m2/test.Test")) + "--add-reads", "m2x=ALL-UNNAMED,automatic", + "-m", "m2x/test.Test")) .run() .writeAll() .getOutput(Task.OutputKind.STDERR); @@ -461,7 +461,7 @@ output = ""; } - Path m2 = base.resolve(String.valueOf(index)).resolve("m2"); + Path m2 = base.resolve(String.valueOf(index)).resolve("m2x"); tb.writeJavaFiles(m2, moduleInfo, @@ -475,7 +475,7 @@ "-XDaccessInternalAPI=true" ) : Collections.emptyList(); - System.err.println("Compiling/processing m2 files:"); + System.err.println("Compiling/processing m2x files:"); new JavacTask(tb) .options(augmentOptions(options, auxOptions, @@ -515,8 +515,8 @@ private static final Map<String, String> MODULES_TO_CHECK_TO_SAMPLE_CLASS = new LinkedHashMap<>(); static { - MODULES_TO_CHECK_TO_SAMPLE_CLASS.put("m1", "api.Api"); - MODULES_TO_CHECK_TO_SAMPLE_CLASS.put("m2", "test.Test"); + MODULES_TO_CHECK_TO_SAMPLE_CLASS.put("m1x", "api.Api"); + MODULES_TO_CHECK_TO_SAMPLE_CLASS.put("m2x", "test.Test"); MODULES_TO_CHECK_TO_SAMPLE_CLASS.put("java.base", "java.lang.Object"); }; @@ -578,19 +578,19 @@ } private static final String[] MODULE_INFO_VARIANTS = { - "module m2 { exports test; }", - "module m2 { requires m1; exports test; }" + "module m2x { exports test; }", + "module m2x { requires m1x; exports test; }" }; private static final String[][] OPTIONS_VARIANTS = { {"--add-modules", "automatic"}, - {"--add-modules", "m1,automatic"}, + {"--add-modules", "m1x,automatic"}, {"--add-modules", "jdk.compiler,automatic"}, - {"--add-modules", "m1,jdk.compiler,automatic"}, + {"--add-modules", "m1x,jdk.compiler,automatic"}, {"--add-modules", "ALL-SYSTEM,automatic"}, {"--limit-modules", "java.base", "--add-modules", "automatic"}, {"--limit-modules", "java.base", "--add-modules", "ALL-SYSTEM,automatic"}, - {"--limit-modules", "m2", "--add-modules", "automatic"}, + {"--limit-modules", "m2x", "--add-modules", "automatic"}, {"--limit-modules", "jdk.compiler", "--add-modules", "automatic"}, }; }
--- a/test/tools/javac/modules/AddModulesTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/AddModulesTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -36,7 +36,6 @@ import toolbox.JavacTask; import toolbox.Task; -import toolbox.ToolBox; public class AddModulesTest extends ModuleTestBase { public static void main(String... args) throws Exception { @@ -70,18 +69,18 @@ @Test public void testEmptyItem(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { }"); - Path src_m2 = src.resolve("m2"); + "module m1x { }"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { }"); + "module m2x { }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); - testEmptyItem(src, classes, ",m1"); - testEmptyItem(src, classes, "m1,,m2"); - testEmptyItem(src, classes, "m1,"); + testEmptyItem(src, classes, ",m1x"); + testEmptyItem(src, classes, "m1x,,m2x"); + testEmptyItem(src, classes, "m1x,"); } private void testEmptyItem(Path src, Path classes, String option) throws Exception { @@ -159,9 +158,9 @@ Path src = base.resolve("src"); // setup a utility module - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports p1; }", + "module m1x { exports p1; }", "package p1; public class C1 { }"); Path modules = base.resolve("modules"); tb.createDirectories(modules); @@ -182,7 +181,7 @@ new JavacTask(tb) .options("--module-path", modules.toString(), - "--add-modules", "m1,m1") + "--add-modules", "m1x,m1x") .outdir(classes) .files(findJavaFiles(src2)) .run() @@ -194,13 +193,13 @@ Path src = base.resolve("src"); // setup some utility modules - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports p1; }", + "module m1x { exports p1; }", "package p1; public class C1 { }"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { exports p2; }", + "module m2x { exports p2; }", "package p2; public class C2 { }"); Path modules = base.resolve("modules"); tb.createDirectories(modules); @@ -221,8 +220,8 @@ new JavacTask(tb) .options("--module-path", modules.toString(), - "--add-modules", "m1", - "--add-modules", "m2") + "--add-modules", "m1x", + "--add-modules", "m2x") .outdir(classes) .files(findJavaFiles(src2)) .run()
--- a/test/tools/javac/modules/AddReadsTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/AddReadsTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -60,13 +60,13 @@ @Test public void testAddReads(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports api; }", + "module m1x { exports api; }", "package api; public class Api { }"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { }", + "module m2x { }", "package test; public class Test extends api.Api { }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); @@ -85,7 +85,7 @@ //test add dependencies: new JavacTask(tb) - .options("--add-reads", "m2=m1", + .options("--add-reads", "m2x=m1x", "--module-source-path", src.toString(), "-processor", VerifyRequires.class.getName()) .outdir(classes) @@ -94,18 +94,19 @@ .writeAll(); String decompiled = new JavapTask(tb) - .options("-verbose", classes.resolve("m2").resolve("module-info.class").toString()) + .options("-verbose", + classes.resolve("m2x").resolve("module-info.class").toString()) .run() .getOutput(Task.OutputKind.DIRECT); - if (decompiled.contains("m1")) { - throw new Exception("Incorrectly refers to m1 module."); + if (decompiled.contains("m1x")) { + throw new Exception("Incorrectly refers to m1x module."); } //cyclic dependencies OK when created through addReads: new JavacTask(tb) - .options("--add-reads", "m2=m1", - "--add-reads", "m1=m2", + .options("--add-reads", "m2x=m1x", + "--add-reads", "m1x=m2x", "--module-source-path", src.toString()) .outdir(classes) .files(findJavaFiles(src)) @@ -113,10 +114,10 @@ .writeAll(); tb.writeJavaFiles(src_m2, - "module m2 { requires m1; }"); + "module m2x { requires m1x; }"); new JavacTask(tb) - .options("--add-reads", "m1=m2", + .options("--add-reads", "m1x=m2x", "--module-source-path", src.toString()) .outdir(classes) .files(findJavaFiles(src)) @@ -129,16 +130,16 @@ @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { - ModuleElement m2Module = processingEnv.getElementUtils().getModuleElement("m2"); + ModuleElement m2Module = processingEnv.getElementUtils().getModuleElement("m2x"); if (m2Module == null) { - throw new AssertionError("Cannot find the m2 module!"); + throw new AssertionError("Cannot find the m2x module!"); } boolean foundM1 = false; for (RequiresDirective rd : ElementFilter.requiresIn(m2Module.getDirectives())) { - foundM1 |= rd.getDependency().getSimpleName().contentEquals("m1"); + foundM1 |= rd.getDependency().getSimpleName().contentEquals("m1x"); } if (!foundM1) { - throw new AssertionError("Cannot find the dependency on m1 module!"); + throw new AssertionError("Cannot find the dependency on m1x module!"); } return false; } @@ -155,19 +156,19 @@ Path jar = prepareTestJar(base); Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m1x"); Path classes = base.resolve("classes"); Files.createDirectories(classes); tb.writeJavaFiles(m1, - "module m1 { }", + "module m1x { }", "package impl; public class Impl { api.Api api; }"); new JavacTask(tb) .options("--class-path", jar.toString(), - "--add-reads", "m1=ALL-UNNAMED", + "--add-reads", "m1x=ALL-UNNAMED", "-XDrawDiagnostics") .outdir(classes) .files(findJavaFiles(moduleSrc)) @@ -180,21 +181,21 @@ Path jar = prepareTestJar(base); Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m1x"); Path classes = base.resolve("classes"); Files.createDirectories(classes); tb.writeJavaFiles(m1, - "module m1 { }", + "module m1x { }", "package api; public class Api { public static void test() { } }", "package impl; public class Impl { { api.Api.test(); } }"); new JavacTask(tb) .options("--class-path", jar.toString(), "--module-source-path", moduleSrc.toString(), - "--add-reads", "m1=ALL-UNNAMED", + "--add-reads", "m1x=ALL-UNNAMED", "-XDrawDiagnostics") .outdir(classes) .files(m1.resolve("impl").resolve("Impl.java")) @@ -279,9 +280,9 @@ @Test public void testX(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { provides java.lang.Runnable with impl.Impl; }", + "module m1x { provides java.lang.Runnable with impl.Impl; }", "package impl; public class Impl implements Runnable { public void run() { } }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); @@ -302,8 +303,8 @@ "package impl; public class Impl { }"); new JavacTask(tb) - .options("--add-reads", "m1=ALL-UNNAMED", - "-Xmodule:m1", + .options("--add-reads", "m1x=ALL-UNNAMED", + "-Xmodule:m1x", "--module-path", classes.toString()) .outdir(unnamedClasses) .files(findJavaFiles(unnamedSrc)) @@ -314,16 +315,16 @@ @Test public void testAddSelf(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports p1; }", + "module m1x { exports p1; }", "package p1; public class C1 { }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); new JavacTask(tb) .options("--module-source-path", src.toString(), - "--add-reads", "m1=m1") + "--add-reads", "m1x=m1x") .outdir(classes) .files(findJavaFiles(src)) .run() @@ -357,24 +358,24 @@ @Test public void testEmptyItem(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports p1; }", + "module m1x { exports p1; }", "package p1; public class C1 { }"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { }", + "module m2x { }", "package p2; class C2 { }"); - Path src_m3 = src.resolve("m3"); + Path src_m3 = src.resolve("m3x"); tb.writeJavaFiles(src_m3, - "module m3 { }", + "module m3x { }", "package p3; class C3 { p1.C1 c1; }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); - testEmptyItem(src, classes, "m3=,m1"); - testEmptyItem(src, classes, "m3=m1,,m2"); - testEmptyItem(src, classes, "m3=m1,"); + testEmptyItem(src, classes, "m3x=,m1x"); + testEmptyItem(src, classes, "m3x=m1x,,m2x"); + testEmptyItem(src, classes, "m3x=m1x,"); } private void testEmptyItem(Path src, Path classes, String option) throws Exception { @@ -390,23 +391,23 @@ @Test public void testEmptyList(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports p1; }", + "module m1x { exports p1; }", "package p1; public class C1 { }"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { }", + "module m2x { }", "package p2; class C2 { }"); - Path src_m3 = src.resolve("m3"); + Path src_m3 = src.resolve("m3x"); tb.writeJavaFiles(src_m3, - "module m3 { }", + "module m3x { }", "package p3; class C3 { p1.C1 c1; }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); - testEmptyList(src, classes, "m3="); - testEmptyList(src, classes, "m3=,"); + testEmptyList(src, classes, "m3x="); + testEmptyList(src, classes, "m3x=,"); } private void testEmptyList(Path src, Path classes, String option) throws Exception { @@ -426,25 +427,25 @@ @Test public void testMultipleAddReads_DifferentModules(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports p1; }", + "module m1x { exports p1; }", "package p1; public class C1 { }"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { }", + "module m2x { }", "package p2; class C2 { p1.C1 c1; }"); - Path src_m3 = src.resolve("m3"); + Path src_m3 = src.resolve("m3x"); tb.writeJavaFiles(src_m3, - "module m3 { }", + "module m3x { }", "package p3; class C3 { p1.C1 c1; }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); new JavacTask(tb) .options("--module-source-path", src.toString(), - "--add-reads", "m2=m1", - "--add-reads", "m3=m1") + "--add-reads", "m2x=m1x", + "--add-reads", "m3x=m1x") .outdir(classes) .files(findJavaFiles(src)) .run() @@ -454,25 +455,25 @@ @Test public void testMultipleAddReads_SameModule(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports p1; }", + "module m1x { exports p1; }", "package p1; public class C1 { }"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { exports p2; }", + "module m2x { exports p2; }", "package p2; public class C2 { }"); - Path src_m3 = src.resolve("m3"); + Path src_m3 = src.resolve("m3x"); tb.writeJavaFiles(src_m3, - "module m3 { }", + "module m3x { }", "package p3; class C3 { p1.C1 c1; p2.C2 c2; }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); new JavacTask(tb) .options("--module-source-path", src.toString(), - "--add-reads", "m3=m1", - "--add-reads", "m3=m2") + "--add-reads", "m3x=m1x", + "--add-reads", "m3x=m2x") .outdir(classes) .files(findJavaFiles(src)) .run() @@ -482,20 +483,20 @@ @Test public void testDuplicateAddReads_SameOption(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports p1; }", + "module m1x { exports p1; }", "package p1; public class C1 { }"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { exports p2; }", + "module m2x { exports p2; }", "package p2; class C2 { p1.C1 c1; }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); new JavacTask(tb) .options("--module-source-path", src.toString(), - "--add-reads", "m2=m1,m1") + "--add-reads", "m2x=m1x,m1x") .outdir(classes) .files(findJavaFiles(src)) .run() @@ -505,21 +506,21 @@ @Test public void testDuplicateAddReads_MultipleOptions(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports p1; }", + "module m1x { exports p1; }", "package p1; public class C1 { }"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { }", + "module m2x { }", "package p2; class C2 { p1.C1 c1; }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); new JavacTask(tb) .options("--module-source-path", src.toString(), - "--add-reads", "m2=m1", - "--add-reads", "m2=m1") + "--add-reads", "m2x=m1x", + "--add-reads", "m2x=m1x") .outdir(classes) .files(findJavaFiles(src)) .run() @@ -529,25 +530,25 @@ @Test public void testRepeatedAddReads(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports p1; }", + "module m1x { exports p1; }", "package p1; public class C1 { }"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { exports p2; }", + "module m2x { exports p2; }", "package p2; public class C2 { }"); - Path src_m3 = src.resolve("m3"); + Path src_m3 = src.resolve("m3x"); tb.writeJavaFiles(src_m3, - "module m3 { }", + "module m3x { }", "package p3; class C3 { p1.C1 c1; p2.C2 c2; }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); new JavacTask(tb) .options("--module-source-path", src.toString(), - "--add-reads", "m3=m1", - "--add-reads", "m3=m2") + "--add-reads", "m3x=m1x", + "--add-reads", "m3x=m2x") .outdir(classes) .files(findJavaFiles(src)) .run() @@ -563,7 +564,7 @@ String log = new JavacTask(tb, Task.Mode.CMDLINE) .options("-XDrawDiagnostics", - "--add-reads", "m1:m2") + "--add-reads", "m1x:m2x") .outdir(classes) .files(findJavaFiles(src)) .run(Task.Expect.FAIL) @@ -571,7 +572,7 @@ .getOutput(Task.OutputKind.DIRECT); checkOutputContains(log, - "javac: bad value for --add-reads option: 'm1:m2'"); + "javac: bad value for --add-reads option: 'm1x:m2x'"); } @Test @@ -583,7 +584,7 @@ String log = new JavacTask(tb) .options("-XDrawDiagnostics", - "--add-reads", "bad*Source=m2") + "--add-reads", "bad*Source=m2x") .outdir(classes) .files(findJavaFiles(src)) .run() @@ -597,16 +598,16 @@ @Test public void testBadTargetName(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { }", + "module m1x { }", "package p1; class C1 { }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); String log = new JavacTask(tb) .options("-XDrawDiagnostics", - "--add-reads", "m1=badTarget!") + "--add-reads", "m1x=badTarget!") .outdir(classes) .files(findJavaFiles(src)) .run() @@ -620,16 +621,16 @@ @Test public void testSourceNameNotFound(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports p1; }", + "module m1x { exports p1; }", "package p1; public class C1 { }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); String log = new JavacTask(tb) .options("-XDrawDiagnostics", - "--add-reads", "missingSource=m1") + "--add-reads", "missingSource=m") .outdir(classes) .files(findJavaFiles(src)) .run() @@ -643,16 +644,16 @@ @Test public void testTargetNameNotFound(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports p1; }", + "module m1x { exports p1; }", "package p1; public class C1 { }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); String log = new JavacTask(tb) .options("-XDrawDiagnostics", - "--add-reads", "m1=missingTarget") + "--add-reads", "m1x=missingTarget") .outdir(classes) .files(findJavaFiles(src)) .run()
--- a/test/tools/javac/modules/AnnotationProcessing.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/AnnotationProcessing.java Fri Dec 16 08:17:55 2016 +0000 @@ -96,20 +96,20 @@ @Test public void testAPSingleModule(Path base) throws Exception { Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m1x"); Path classes = base.resolve("classes"); Files.createDirectories(classes); tb.writeJavaFiles(m1, - "module m1 { }", + "module m1x { }", "package impl; public class Impl { }"); String log = new JavacTask(tb) .options("--module-source-path", moduleSrc.toString(), "-processor", AP.class.getName(), - "-AexpectedEnclosedElements=m1=>impl") + "-AexpectedEnclosedElements=m1x=>impl") .outdir(classes) .files(findJavaFiles(moduleSrc)) .run() @@ -123,25 +123,25 @@ @Test public void testAPMultiModule(Path base) throws Exception { Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); - Path m2 = moduleSrc.resolve("m2"); + Path m1 = moduleSrc.resolve("m1x"); + Path m2 = moduleSrc.resolve("m2x"); Path classes = base.resolve("classes"); Files.createDirectories(classes); tb.writeJavaFiles(m1, - "module m1 { }", + "module m1x { }", "package impl1; public class Impl1 { }"); tb.writeJavaFiles(m2, - "module m2 { }", + "module m2x { }", "package impl2; public class Impl2 { }"); String log = new JavacTask(tb) .options("--module-source-path", moduleSrc.toString(), "-processor", AP.class.getName(), - "-AexpectedEnclosedElements=m1=>impl1,m2=>impl2") + "-AexpectedEnclosedElements=m1x=>impl1,m2x=>impl2") .outdir(classes) .files(findJavaFiles(moduleSrc)) .run() @@ -229,14 +229,14 @@ @Test public void testVerifyUsesProvides(Path base) throws Exception { Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m1x"); Path classes = base.resolve("classes"); Files.createDirectories(classes); tb.writeJavaFiles(m1, - "module m1 { exports api; uses api.Api; provides api.Api with impl.Impl; }", + "module m1x { exports api; uses api.Api; provides api.Api with impl.Impl; }", "package api; public class Api { }", "package impl; public class Impl extends api.Api { }"); @@ -334,20 +334,20 @@ @Test public void testQualifiedClassForProcessing(Path base) throws Exception { Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); - Path m2 = moduleSrc.resolve("m2"); + Path m1 = moduleSrc.resolve("m1x"); + Path m2 = moduleSrc.resolve("m2x"); Path classes = base.resolve("classes"); Files.createDirectories(classes); tb.writeJavaFiles(m1, - "module m1 { }", - "package impl; public class Impl { int m1; }"); + "module m1x { }", + "package impl; public class Impl { int m1x; }"); tb.writeJavaFiles(m2, - "module m2 { }", - "package impl; public class Impl { int m2; }"); + "module m2x { }", + "package impl; public class Impl { int m2x; }"); new JavacTask(tb) .options("--module-source-path", moduleSrc.toString()) @@ -357,13 +357,13 @@ .writeAll() .getOutput(Task.OutputKind.DIRECT); - List<String> expected = Arrays.asList("Note: field: m1"); + List<String> expected = Arrays.asList("Note: field: m1x"); for (Mode mode : new Mode[] {Mode.API, Mode.CMDLINE}) { List<String> log = new JavacTask(tb, mode) .options("-processor", QualifiedClassForProcessing.class.getName(), "--module-path", classes.toString()) - .classes("m1/impl.Impl") + .classes("m1x/impl.Impl") .outdir(classes) .run() .writeAll() @@ -379,8 +379,8 @@ @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { - if (processingEnv.getElementUtils().getModuleElement("m1") == null) { - throw new AssertionError("No m1 module found."); + if (processingEnv.getElementUtils().getModuleElement("m1x") == null) { + throw new AssertionError("No m1x module found."); } Messager messager = processingEnv.getMessager(); @@ -411,7 +411,7 @@ Files.createDirectories(classes); tb.writeJavaFiles(m1, - "module m1 { exports api; }", + "module m1x { exports api; }", "package api; public class Api { }"); List<String> log = new JavacTask(tb) @@ -422,7 +422,7 @@ .writeAll() .getOutputLines(Task.OutputKind.STDERR); - assertEquals(Arrays.asList("module: m1"), log); + assertEquals(Arrays.asList("module: m1x"), log); } @SupportedAnnotationTypes("*") @@ -451,12 +451,12 @@ Path m1 = moduleSrc.resolve("m1"); tb.writeJavaFiles(m1, - "@Deprecated module m1 { }"); + "@Deprecated module m1x { }"); - Path m2 = moduleSrc.resolve("m2"); + Path m2 = moduleSrc.resolve("m2x"); tb.writeJavaFiles(m2, - "@SuppressWarnings(\"\") module m2 { }"); + "@SuppressWarnings(\"\") module m2x { }"); Path classes = base.resolve("classes"); @@ -521,19 +521,19 @@ Files.createDirectories(classes); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m1x"); tb.writeJavaFiles(m1, - "module m1 { exports api1; }", + "module m1x { exports api1; }", "package api1; public class Api { GenApi ga; impl.Impl i; }"); writeFile("1", m1, "api1", "api"); writeFile("1", m1, "impl", "impl"); - Path m2 = moduleSrc.resolve("m2"); + Path m2 = moduleSrc.resolve("m2x"); tb.writeJavaFiles(m2, - "module m2 { requires m1; exports api2; }", + "module m2x { requires m1x; exports api2; }", "package api2; public class Api { api1.GenApi ga1; GenApi qa2; impl.Impl i;}"); writeFile("2", m2, "api2", "api"); @@ -555,12 +555,12 @@ .run() .writeAll(); - assertFileExists(classes, "m1", "api1", "GenApi.class"); - assertFileExists(classes, "m1", "impl", "Impl.class"); - assertFileExists(classes, "m1", "api1", "gen1"); - assertFileExists(classes, "m2", "api2", "GenApi.class"); - assertFileExists(classes, "m2", "impl", "Impl.class"); - assertFileExists(classes, "m2", "api2", "gen1"); + assertFileExists(classes, "m1x", "api1", "GenApi.class"); + assertFileExists(classes, "m1x", "impl", "Impl.class"); + assertFileExists(classes, "m1x", "api1", "gen1"); + assertFileExists(classes, "m2x", "api2", "GenApi.class"); + assertFileExists(classes, "m2x", "impl", "Impl.class"); + assertFileExists(classes, "m2x", "api2", "gen1"); } } @@ -667,18 +667,18 @@ if (round++ != 0) return false; - createClass("m1", "api1.GenApi", "package api1; public class GenApi {}"); - createClass("m1", "impl.Impl", "package impl; public class Impl {}"); - createClass("m2", "api2.GenApi", "package api2; public class GenApi {}"); - createClass("m2", "impl.Impl", "package impl; public class Impl {}"); + createClass("m1x", "api1.GenApi", "package api1; public class GenApi {}"); + createClass("m1x", "impl.Impl", "package impl; public class Impl {}"); + createClass("m2x", "api2.GenApi", "package api2; public class GenApi {}"); + createClass("m2x", "impl.Impl", "package impl; public class Impl {}"); - createResource("m1", "api1", "gen1"); - createResource("m2", "api2", "gen1"); + createResource("m1x", "api1", "gen1"); + createResource("m2x", "api2", "gen1"); - readResource("m1", "api1", "api", "1"); - readResource("m1", "impl", "impl", "1"); - readResource("m2", "api2", "api", "2"); - readResource("m2", "impl", "impl", "2"); + readResource("m1x", "api1", "api", "1"); + readResource("m1x", "impl", "impl", "1"); + readResource("m2x", "api2", "api", "2"); + readResource("m2x", "impl", "impl", "2"); Filer filer = processingEnv.getFiler(); @@ -745,7 +745,7 @@ Path m1 = base.resolve("module-src"); tb.writeJavaFiles(m1, - "module m1 { }"); + "module m1x { }"); writeFile("3", m1, "impl", "resource"); @@ -791,10 +791,10 @@ createSource(() -> filer.createResource(StandardLocation.CLASS_OUTPUT, "impl", "Impl3"), "impl.Impl3", ""); doReadResource(() -> filer.getResource(StandardLocation.SOURCE_PATH, "impl", "resource"), "3"); - createSource(() -> filer.createSourceFile("m1/impl.Impl4"), "impl.Impl4", "package impl; class Impl4 {}"); - createClass(() -> filer.createClassFile("m1/impl.Impl5"), "impl.Impl5", "package impl; class Impl5 {}"); - createSource(() -> filer.createResource(StandardLocation.CLASS_OUTPUT, "m1/impl", "Impl6"), "impl.Impl6", ""); - doReadResource(() -> filer.getResource(StandardLocation.SOURCE_PATH, "m1/impl", "resource"), "3"); + createSource(() -> filer.createSourceFile("m1x/impl.Impl4"), "impl.Impl4", "package impl; class Impl4 {}"); + createClass(() -> filer.createClassFile("m1x/impl.Impl5"), "impl.Impl5", "package impl; class Impl5 {}"); + createSource(() -> filer.createResource(StandardLocation.CLASS_OUTPUT, "m1x/impl", "Impl6"), "impl.Impl6", ""); + doReadResource(() -> filer.getResource(StandardLocation.SOURCE_PATH, "m1x/impl", "resource"), "3"); TypeElement jlObject = processingEnv.getElementUtils().getTypeElement("java.lang.Object"); @@ -806,8 +806,8 @@ //must not generate to unnamed package: expectFilerException(() -> filer.createSourceFile("Fail")); expectFilerException(() -> filer.createClassFile("Fail")); - expectFilerException(() -> filer.createSourceFile("m1/Fail")); - expectFilerException(() -> filer.createClassFile("m1/Fail")); + expectFilerException(() -> filer.createSourceFile("m1x/Fail")); + expectFilerException(() -> filer.createClassFile("m1x/Fail")); //cannot generate resources to modules that are not root modules: expectFilerException(() -> filer.createSourceFile("java.base/fail.Fail")); @@ -899,30 +899,30 @@ Files.createDirectories(classes); Path src = base.resolve("src"); - Path m1 = src.resolve("m1"); + Path m1 = src.resolve("m1x"); tb.writeJavaFiles(m1, - "module m1 { exports api; }", + "module m1x { exports api; }", "package api; public @interface A {}", "package api; public @interface B {}"); - Path m2 = src.resolve("m2"); + Path m2 = src.resolve("m2x"); tb.writeJavaFiles(m2, - "module m2 { exports api; }", + "module m2x { exports api; }", "package api; public @interface A {}", "package api; public @interface B {}"); - Path m3 = src.resolve("m3"); + Path m3 = src.resolve("m3x"); tb.writeJavaFiles(m3, - "module m3 { requires m1; }", + "module m3x { requires m1x; }", "package impl; import api.*; @A @B public class T {}"); - Path m4 = src.resolve("m4"); + Path m4 = src.resolve("m4x"); tb.writeJavaFiles(m4, - "module m4 { requires m2; }", + "module m4x { requires m2x; }", "package impl; import api.*; @A @B public class T {}"); List<String> log; @@ -931,7 +931,7 @@ log = new JavacTask(tb) .options("-processor", SelectAnnotationATestAP.class.getName() + "," + SelectAnnotationBTestAP.class.getName(), "--module-source-path", src.toString(), - "-m", "m1,m2") + "-m", "m1x,m2x") .outdir(classes) .run() .writeAll() @@ -946,7 +946,7 @@ log = new JavacTask(tb) .options("-processor", SelectAnnotationATestAP.class.getName() + "," + SelectAnnotationBTestAP.class.getName(), "--module-source-path", src.toString(), - "-m", "m3") + "-m", "m3x") .outdir(classes) .run() .writeAll() @@ -962,7 +962,7 @@ log = new JavacTask(tb) .options("-processor", SelectAnnotationATestAP.class.getName() + "," + SelectAnnotationBTestAP.class.getName(), "--module-source-path", src.toString(), - "-m", "m4") + "-m", "m4x") .outdir(classes) .run() .writeAll() @@ -978,7 +978,7 @@ } } - @SupportedAnnotationTypes("m2/api.A") + @SupportedAnnotationTypes("m2x/api.A") public static final class SelectAnnotationATestAP extends AbstractProcessor { @Override
--- a/test/tools/javac/modules/AnnotationProcessorsInModulesTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/AnnotationProcessorsInModulesTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -38,7 +38,6 @@ import toolbox.JavacTask; import toolbox.Task; -import toolbox.ToolBox; public class AnnotationProcessorsInModulesTest extends ModuleTestBase { @@ -47,7 +46,7 @@ } private static final String annotationProcessorModule1 = - "module anno_proc1 {\n" + + "module anno_proc1x {\n" + " requires java.compiler;\n" + "\n" + " provides javax.annotation.processing.Processor\n" + @@ -55,7 +54,7 @@ "}"; private static final String annotationProcessorModule2 = - "module anno_proc2 {\n" + + "module anno_proc2x {\n" + " requires java.compiler;\n" + "\n" + " provides javax.annotation.processing.Processor\n" + @@ -118,8 +117,8 @@ void initialization(Path base) throws Exception { moduleSrc = base.resolve("anno_proc_src"); - Path anno_proc1 = moduleSrc.resolve("anno_proc1"); - Path anno_proc2 = moduleSrc.resolve("anno_proc2"); + Path anno_proc1 = moduleSrc.resolve("anno_proc1x"); + Path anno_proc2 = moduleSrc.resolve("anno_proc2x"); processorCompiledModules = base.resolve("mods");
--- a/test/tools/javac/modules/AnnotationsOnModules.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/AnnotationsOnModules.java Fri Dec 16 08:17:55 2016 +0000 @@ -67,10 +67,10 @@ @Test public void testSimpleAnnotation(Path base) throws Exception { Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m1x"); tb.writeJavaFiles(m1, - "@Deprecated module m1 { }"); + "@Deprecated module m1x { }"); Path modulePath = base.resolve("module-path"); @@ -83,7 +83,7 @@ .run() .writeAll(); - ClassFile cf = ClassFile.read(modulePath.resolve("m1").resolve("module-info.class")); + ClassFile cf = ClassFile.read(modulePath.resolve("m1x").resolve("module-info.class")); RuntimeVisibleAnnotations_attribute annotations = (RuntimeVisibleAnnotations_attribute) cf.attributes.map.get(Attribute.RuntimeVisibleAnnotations); if (annotations == null || annotations.annotations.length != 1) { @@ -94,11 +94,11 @@ @Test public void testAnnotationWithImport(Path base) throws Exception { Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m1x"); tb.writeJavaFiles(m1, - "import m1.A; @A module m1 { }", - "package m1; import java.lang.annotation.*; @Target(ElementType.MODULE) public @interface A {}"); + "import m1x.A; @A module m1x { }", + "package m1x; import java.lang.annotation.*; @Target(ElementType.MODULE) public @interface A {}"); Path modulePath = base.resolve("module-path"); @@ -111,7 +111,7 @@ .run() .writeAll(); - ClassFile cf = ClassFile.read(modulePath.resolve("m1").resolve("module-info.class")); + ClassFile cf = ClassFile.read(modulePath.resolve("m1x").resolve("module-info.class")); RuntimeInvisibleAnnotations_attribute annotations = (RuntimeInvisibleAnnotations_attribute) cf.attributes.map.get(Attribute.RuntimeInvisibleAnnotations); if (annotations == null || annotations.annotations.length != 1) { @@ -122,13 +122,13 @@ @Test public void testModuleInfoAnnotationsInAPI(Path base) throws Exception { Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m1x"); tb.writeJavaFiles(m1, - "import m1.*; @A @Deprecated @E @E module m1 { }", - "package m1; import java.lang.annotation.*; @Target(ElementType.MODULE) public @interface A {}", - "package m1; import java.lang.annotation.*; @Target(ElementType.MODULE) @Repeatable(C.class) public @interface E {}", - "package m1; import java.lang.annotation.*; @Target(ElementType.MODULE) public @interface C { public E[] value(); }"); + "import m1x.*; @A @Deprecated @E @E module m1x { }", + "package m1x; import java.lang.annotation.*; @Target(ElementType.MODULE) public @interface A {}", + "package m1x; import java.lang.annotation.*; @Target(ElementType.MODULE) @Repeatable(C.class) public @interface E {}", + "package m1x; import java.lang.annotation.*; @Target(ElementType.MODULE) public @interface C { public E[] value(); }"); Path modulePath = base.resolve("module-path"); @@ -153,7 +153,7 @@ new JavacTask(tb) .options("--module-path", modulePath.toString(), - "--add-modules", "m1", + "--add-modules", "m1x", "-processor", AP.class.getName()) .outdir(out) .files(findJavaFiles(src)) @@ -162,10 +162,10 @@ new JavacTask(tb) .options("--module-path", modulePath.toString() + File.pathSeparator + out.toString(), - "--add-modules", "m1", + "--add-modules", "m1x", "-processor", AP.class.getName(), "-proc:only") - .classes("m1/m1.A") + .classes("m1x/m1x.A") .files(findJavaFiles(src)) .run() .writeAll(); @@ -176,10 +176,10 @@ @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { - ModuleElement m1 = processingEnv.getElementUtils().getModuleElement("m1"); + ModuleElement m1 = processingEnv.getElementUtils().getModuleElement("m1x"); Set<String> actualAnnotations = new HashSet<>(); Set<String> expectedAnnotations = - new HashSet<>(Arrays.asList("@m1.A", "@java.lang.Deprecated", "@m1.C({@m1.E, @m1.E})")); + new HashSet<>(Arrays.asList("@m1x.A", "@java.lang.Deprecated", "@m1x.C({@m1x.E, @m1x.E})")); for (AnnotationMirror am : m1.getAnnotationMirrors()) { actualAnnotations.add(am.toString()); @@ -197,17 +197,17 @@ @Test public void testModuleDeprecation(Path base) throws Exception { Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m1x"); tb.writeJavaFiles(m1, - "@Deprecated module m1 { }"); + "@Deprecated module m1x { }"); - Path m2 = moduleSrc.resolve("m2"); + Path m2 = moduleSrc.resolve("m2x"); tb.writeJavaFiles(m2, - "@Deprecated module m2 { }"); + "@Deprecated module m2x { }"); - Path m3 = moduleSrc.resolve("m3"); + Path m3 = moduleSrc.resolve("m3x"); Path modulePath = base.resolve("module-path"); @@ -218,12 +218,12 @@ for (String suppress : new String[] {"", "@Deprecated ", "@SuppressWarnings(\"deprecation\") "}) { tb.writeJavaFiles(m3, - suppress + "module m3 {\n" + - " requires m1;\n" + - " exports api to m1, m2;\n" + + suppress + "module m3x {\n" + + " requires m1x;\n" + + " exports api to m1x, m2x;\n" + "}", "package api; public class Api { }"); - System.err.println("compile m3"); + System.err.println("compile m3x"); actual = new JavacTask(tb) .options("--module-source-path", moduleSrc.toString(), "-XDrawDiagnostics") @@ -245,7 +245,7 @@ throw new AssertionError("Unexpected output: " + actual + "; suppress: " + suppress); } - System.err.println("compile m3 with -Xlint:-deprecation"); + System.err.println("compile m3x with -Xlint:-deprecation"); actual = new JavacTask(tb) .options("--module-source-path", moduleSrc.toString(), "-XDrawDiagnostics", @@ -258,7 +258,7 @@ if (suppress.isEmpty()) { expected = Arrays.asList( - "module-info.java:2:14: compiler.warn.has.been.deprecated.module: m1", + "module-info.java:2:14: compiler.warn.has.been.deprecated.module: m1x", "1 warning"); } else { expected = Arrays.asList(""); @@ -269,13 +269,13 @@ } //load the deprecated module-infos from classfile: - System.err.println("compile m3 with -Xlint:-deprecation, loading deprecated modules from classes"); + System.err.println("compile m3x with -Xlint:-deprecation, loading deprecated modules from classes"); actual = new JavacTask(tb) .options("--module-path", modulePath.toString(), "-XDrawDiagnostics", "-Xlint:deprecation") - .outdir(modulePath.resolve("m3")) - .files(findJavaFiles(moduleSrc.resolve("m3"))) + .outdir(modulePath.resolve("m3x")) + .files(findJavaFiles(moduleSrc.resolve("m3x"))) .run() .writeAll() .getOutputLines(OutputKind.DIRECT);
--- a/test/tools/javac/modules/AutomaticModules.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/AutomaticModules.java Fri Dec 16 08:17:55 2016 +0000 @@ -82,14 +82,14 @@ .run(); Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m1x"); Path classes = base.resolve("classes"); Files.createDirectories(classes); tb.writeJavaFiles(m1, - "module m1 { requires test.api; requires java.desktop; }", + "module m1x { requires test.api; requires java.desktop; }", "package impl; public class Impl { public void e(api.Api api) { api.actionPerformed(null); } }"); new JavacTask(tb) @@ -140,14 +140,14 @@ .run(); Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m1x"); Path classes = base.resolve("classes"); Files.createDirectories(classes); tb.writeJavaFiles(m1, - "module m1 { requires test.api; }", + "module m1x { requires test.api; }", "package impl; public class Impl { public void e(api.Api api) { api.run(\"\"); } }"); new JavacTask(tb) @@ -193,7 +193,7 @@ Files.createDirectories(depClasses); tb.writeJavaFiles(depSrc, - "module m1 { requires transitive automatic; }", + "module m1x { requires transitive automatic; }", "package dep; public class Dep { api.Api api; }"); new JavacTask(tb) @@ -203,7 +203,7 @@ .run() .writeAll(); - Path moduleJar = modulePath.resolve("m1.jar"); + Path moduleJar = modulePath.resolve("m1x.jar"); new JarTask(tb, moduleJar) .baseDir(depClasses) @@ -217,7 +217,7 @@ Files.createDirectories(testClasses); tb.writeJavaFiles(testSrc, - "module m2 { requires automatic; }", + "module m2x { requires automatic; }", "package test; public class Test { }"); new JavacTask(tb) @@ -260,13 +260,13 @@ Path moduleSrc = base.resolve("module-src"); - tb.writeJavaFiles(moduleSrc.resolve("m1"), - "module m1 { requires static automaticA; }", - "package impl; public class Impl { apiA.Api a; apiB.Api b; m2.M2 m;}"); + tb.writeJavaFiles(moduleSrc.resolve("m1x"), + "module m1x { requires static automaticA; }", + "package impl; public class Impl { apiA.Api a; apiB.Api b; m2x.M2 m;}"); - tb.writeJavaFiles(moduleSrc.resolve("m2"), - "module m2 { exports m2; }", - "package m2; public class M2 { }"); + tb.writeJavaFiles(moduleSrc.resolve("m2x"), + "module m2x { exports m2x; }", + "package m2x; public class M2 { }"); Path classes = base.resolve("classes"); @@ -283,7 +283,7 @@ .writeAll() .getOutputLines(Task.OutputKind.DIRECT); - List<String> expected = Arrays.asList("Impl.java:1:61: compiler.err.not.def.access.package.cant.access: m2.M2, m2", + List<String> expected = Arrays.asList("Impl.java:1:62: compiler.err.not.def.access.package.cant.access: m2x.M2, m2x", "1 error"); if (!expected.equals(log)) { @@ -301,7 +301,7 @@ .getOutputLines(Task.OutputKind.DIRECT); expected = Arrays.asList("Impl.java:1:51: compiler.err.doesnt.exist: apiB", - "Impl.java:1:61: compiler.err.not.def.access.package.cant.access: m2.M2, m2", + "Impl.java:1:62: compiler.err.not.def.access.package.cant.access: m2x.M2, m2x", "2 errors"); if (!expected.equals(log)) {
--- a/test/tools/javac/modules/DoclintOtherModules.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/DoclintOtherModules.java Fri Dec 16 08:17:55 2016 +0000 @@ -49,14 +49,14 @@ @Test public void testSimple(Path base) throws Exception { Path src = base.resolve("src"); - Path m1 = src.resolve("m1"); - Path m2 = src.resolve("m2"); + Path m1 = src.resolve("m1x"); + Path m2 = src.resolve("m2x"); tb.writeJavaFiles(m1, - "module m1 {}", - "package m1; /** @see m2.B */ @Deprecated public class A {}"); + "module m1x {}", + "package m1x; /** @see m2x.B */ @Deprecated public class A {}"); tb.writeJavaFiles(m2, - "module m2 { requires m1; exports m2; }", - "package m2; public class B extends Foo {} @Deprecated class Foo {}"); + "module m2x { requires m1x; exports m2x; }", + "package m2x; public class B extends Foo {} @Deprecated class Foo {}"); Path classes = base.resolve("classes"); Files.createDirectories(classes);
--- a/test/tools/javac/modules/DuplicateClassTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/DuplicateClassTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -37,7 +37,6 @@ import toolbox.JavacTask; import toolbox.Task; -import toolbox.ToolBox; public class DuplicateClassTest extends ModuleTestBase { @@ -48,13 +47,13 @@ @Test public void testSimple(Path base) throws Exception { - Path m1 = base.resolve("m1"); - Path m2 = base.resolve("m2"); + Path m1 = base.resolve("m1x"); + Path m2 = base.resolve("m2x"); tb.writeJavaFiles(m1, - "module m1 { }", + "module m1x { }", "package impl; public class Impl { }"); tb.writeJavaFiles(m2, - "module m2 { }", + "module m2x { }", "package impl; public class Impl { }"); Path classes = base.resolve("classes"); Files.createDirectories(classes);
--- a/test/tools/javac/modules/EdgeCases.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/EdgeCases.java Fri Dec 16 08:17:55 2016 +0000 @@ -97,9 +97,9 @@ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) { Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m1x"); - tb.writeJavaFiles(m1, "module m1 { }"); + tb.writeJavaFiles(m1, "module m1x { }"); Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(findJavaFiles(moduleSrc)); com.sun.source.util.JavacTask task = @@ -107,7 +107,7 @@ task.analyze(); - ModuleSymbol msym = (ModuleSymbol) task.getElements().getModuleElement("m1"); + ModuleSymbol msym = (ModuleSymbol) task.getElements().getModuleElement("m1x"); msym.outermostClass(); } @@ -118,9 +118,9 @@ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) { Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m1x"); - tb.writeJavaFiles(m1, "module m1 { }", + tb.writeJavaFiles(m1, "module m1x { }", "package p;", "package p; class T { }"); @@ -154,17 +154,17 @@ @Test public void testModuleImplicitModuleBoundaries(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports api1; }", + "module m1x { exports api1; }", "package api1; public class Api1 { public void call() { } }"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { requires m1; exports api2; }", + "module m2x { requires m1x; exports api2; }", "package api2; public class Api2 { public static api1.Api1 get() { return null; } }"); - Path src_m3 = src.resolve("m3"); + Path src_m3 = src.resolve("m3x"); tb.writeJavaFiles(src_m3, - "module m3 { requires m2; }", + "module m3x { requires m2x; }", "package test; public class Test { { api2.Api2.get().call(); api2.Api2.get().toString(); } }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); @@ -214,13 +214,13 @@ .run(); Path src = base.resolve("src"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { requires a; exports api2; }", + "module m2x { requires a; exports api2; }", "package api2; public class Api2 { public static api1.Api1 get() { return null; } }"); - Path src_m3 = src.resolve("m3"); + Path src_m3 = src.resolve("m3x"); tb.writeJavaFiles(src_m3, - "module m3 { requires a; requires m2; }", + "module m3x { requires a; requires m2x; }", "package test; public class Test { { api2.Api2.get(); api1.Api1 a1; } }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); @@ -245,7 +245,7 @@ @Test public void testEmptyImplicitModuleInfo(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); Files.createDirectories(src_m1); try (Writer w = Files.newBufferedWriter(src_m1.resolve("module-info.java"))) {} tb.writeJavaFiles(src_m1, @@ -262,7 +262,7 @@ .writeAll(); tb.writeJavaFiles(src_m1, - "module m1 {}"); + "module m1x {}"); new JavacTask(tb) .options("--source-path", src_m1.toString()) @@ -276,16 +276,16 @@ @Test public void testClassPackageClash(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { exports test.m1; }", - "package test.m1;\n" + + "module m1x { exports test.m1x; }", + "package test.m1x;\n" + "public class Test {}\n"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { requires m1; }", + "module m2x { requires m1x; }", "package test;\n" + - "public class m1 {}\n"); + "public class m1x {}\n"); Path classes = base.resolve("classes"); tb.createDirectories(classes); @@ -299,7 +299,7 @@ .getOutputLines(Task.OutputKind.DIRECT); List<String> expected = Arrays.asList( - "m1.java:2:8: compiler.err.clash.with.pkg.of.same.name: kindname.class, test.m1", + "m1x.java:2:8: compiler.err.clash.with.pkg.of.same.name: kindname.class, test.m1x", "1 error" ); @@ -383,7 +383,7 @@ @Test public void testModuleInfoNameMismatchSource(Path base) throws Exception { Path src = base.resolve("src"); - Path m1 = src.resolve("m1"); + Path m1 = src.resolve("m1x"); Files.createDirectories(m1); tb.writeJavaFiles(m1, "module other { }", "package test; public class Test {}"); @@ -400,8 +400,8 @@ .getOutputLines(OutputKind.DIRECT); List<String> expected = Arrays.asList( - "module-info.java:1:1: compiler.err.module.name.mismatch: other, m1", - "- compiler.err.cant.access: m1.module-info, (compiler.misc.cant.resolve.modules)", + "module-info.java:1:1: compiler.err.module.name.mismatch: other, m1x", + "- compiler.err.cant.access: m1x.module-info, (compiler.misc.cant.resolve.modules)", "2 errors"); if (!expected.equals(log)) { @@ -416,7 +416,7 @@ tb.writeJavaFiles(src, "module other { }", "package test; public class Test {}"); Path classes = base.resolve("classes"); - Path m1Classes = classes.resolve("m1"); + Path m1Classes = classes.resolve("m1x"); tb.createDirectories(m1Classes); new JavacTask(tb) @@ -428,7 +428,7 @@ Path src2 = base.resolve("src2"); Files.createDirectories(src2); - tb.writeJavaFiles(src2, "module use { requires m1; }"); + tb.writeJavaFiles(src2, "module use { requires m1x; }"); Path classes2 = base.resolve("classes2"); tb.createDirectories(classes2); @@ -443,7 +443,7 @@ .getOutputLines(OutputKind.DIRECT); List<String> expected = Arrays.asList( - "- compiler.err.cant.access: m1.module-info, (compiler.misc.bad.class.file.header: module-info.class, (compiler.misc.module.name.mismatch: other, m1))", + "- compiler.err.cant.access: m1x.module-info, (compiler.misc.bad.class.file.header: module-info.class, (compiler.misc.module.name.mismatch: other, m1x))", "1 error"); if (!expected.equals(log)) {
--- a/test/tools/javac/modules/ExportsUnexported.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/ExportsUnexported.java Fri Dec 16 08:17:55 2016 +0000 @@ -75,7 +75,7 @@ System.err.println("testing: " + test); Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); StringBuilder testCode = new StringBuilder(); List<String> expectedLog = new ArrayList<>(); int line = 1; @@ -99,7 +99,9 @@ default: throw new AssertionError(typeName.toString()); } - expectedLog.add("Api.java:" + line + ":" + col + ": compiler.warn.leaks.not.accessible.unexported: " + kindName + ", impl.impl." + typeName + ", m1"); + expectedLog.add("Api.java:" + line + ":" + col + + ": compiler.warn.leaks.not.accessible.unexported: " + + kindName + ", impl.impl." + typeName + ", m1x"); continue; } @@ -121,7 +123,7 @@ Collections.sort(expectedLog); tb.writeJavaFiles(src_m1, - "module m1 { exports api; }", + "module m1x { exports api; }", testCode.toString(), "package impl.impl; public class Cls { }", "package impl.impl; public class Exc extends Exception { }", @@ -155,22 +157,22 @@ @Test public void testAccessibleToSpecificOrAll(Path base) throws Exception { Path src = base.resolve("src"); - Path src_lib1 = src.resolve("lib1"); + Path src_lib1 = src.resolve("lib1x"); tb.writeJavaFiles(src_lib1, - "module lib1 { exports lib1; }", + "module lib1x { exports lib1; }", "package lib1; public class Lib1 {}"); - Path src_lib2 = src.resolve("lib2"); + Path src_lib2 = src.resolve("lib2x"); tb.writeJavaFiles(src_lib2, - "module lib2 { exports lib2; }", + "module lib2x { exports lib2; }", "package lib2; public class Lib2 {}"); Path src_api = src.resolve("api"); tb.writeJavaFiles(src_api, "module api {\n" + " exports api;\n" + - " exports qapi1 to qual1;\n" + - " exports qapi2 to qual1, qual2;\n" + - " requires transitive lib1;\n" + - " requires lib2;\n" + + " exports qapi1 to qual1x;\n" + + " exports qapi2 to qual1x, qual2x;\n" + + " requires transitive lib1x;\n" + + " requires lib2x;\n" + "}\n", "package api;\n" + "public class Api {\n" + @@ -190,10 +192,10 @@ "package impl;\n" + "public class Impl {\n" + "}"); - Path src_qual1 = src.resolve("qual1"); - tb.writeJavaFiles(src_qual1, "module qual1 { }"); - Path src_qual2 = src.resolve("qual2"); - tb.writeJavaFiles(src_qual2, "module qual2 { }"); + Path src_qual1 = src.resolve("qual1x"); + tb.writeJavaFiles(src_qual1, "module qual1x { }"); + Path src_qual2 = src.resolve("qual2x"); + tb.writeJavaFiles(src_qual2, "module qual2x { }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); @@ -209,7 +211,7 @@ .getOutputLines(Task.OutputKind.DIRECT); List<String> expected = Arrays.asList( - "Api.java:4:16: compiler.warn.leaks.not.accessible.not.required.transitive: kindname.class, lib2.Lib2, lib2", + "Api.java:4:16: compiler.warn.leaks.not.accessible.not.required.transitive: kindname.class, lib2.Lib2, lib2x", "Api.java:5:17: compiler.warn.leaks.not.accessible.unexported.qualified: kindname.class, qapi1.QApi1, api", "Api.java:6:16: compiler.warn.leaks.not.accessible.unexported: kindname.class, impl.Impl, api", "- compiler.err.warnings.and.werror",
--- a/test/tools/javac/modules/GetLocationForModuleTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/GetLocationForModuleTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -48,10 +48,10 @@ public void run(Path base) throws Exception { // Set up some trivial modules Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); - tb.writeJavaFiles(m1, "module m1 { }"); - Path m2 = moduleSrc.resolve("m2"); - tb.writeJavaFiles(m2, "module m2 { }"); + Path m1 = moduleSrc.resolve("m1x"); + tb.writeJavaFiles(m1, "module m1x { }"); + Path m2 = moduleSrc.resolve("m2x"); + tb.writeJavaFiles(m2, "module m2x { }"); Path modulePath = base.resolve("module-path"); Files.createDirectories(modulePath); @@ -69,7 +69,7 @@ // Test test(fm, StandardLocation.SYSTEM_MODULES, "java.base", "java.compiler"); - test(fm, StandardLocation.MODULE_PATH, "m1", "m2"); + test(fm, StandardLocation.MODULE_PATH, "m1x", "m2x"); } void test(JavaFileManager fm, JavaFileManager.Location locn, String... mods) throws IOException {
--- a/test/tools/javac/modules/HelloWorldTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/HelloWorldTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -123,9 +123,9 @@ @Test public void testModuleSourcePath(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); - tb.writeFile(src_m1.resolve("module-info.java"), "module m1 { }"); - tb.writeJavaFiles(src_m1, PKG_HELLO_WORLD); + Path src_m = src.resolve("m"); + tb.writeFile(src_m.resolve("module-info.java"), "module m { }"); + tb.writeJavaFiles(src_m, PKG_HELLO_WORLD); Path classes = base.resolve("classes"); Files.createDirectories(classes); @@ -133,13 +133,13 @@ new JavacTask(tb) .options("--module-source-path", src.toString()) .outdir(classes) - .files(src_m1.resolve("p/HelloWorld.java")) + .files(src_m.resolve("p/HelloWorld.java")) .run() .writeAll(); checkFiles( - classes.resolve("m1/module-info.class"), - classes.resolve("m1/p/HelloWorld.class")); + classes.resolve("m/module-info.class"), + classes.resolve("m/p/HelloWorld.class")); } void checkFiles(Path... files) throws Exception {
--- a/test/tools/javac/modules/LimitModulesTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/LimitModulesTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -36,7 +36,6 @@ import toolbox.JavacTask; import toolbox.Task; -import toolbox.ToolBox; public class LimitModulesTest extends ModuleTestBase { public static void main(String... args) throws Exception { @@ -78,18 +77,18 @@ @Test public void testEmptyItem(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { }"); - Path src_m2 = src.resolve("m2"); + "module m1x { }"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 { }"); + "module m2x { }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); new JavacTask(tb) .options("--module-source-path", src.toString(), - "--limit-modules", ",m1") + "--limit-modules", ",m1x") .outdir(classes) .files(findJavaFiles(src)) .run() @@ -97,7 +96,7 @@ new JavacTask(tb) .options("--module-source-path", src.toString(), - "--limit-modules", "m1,,m2") + "--limit-modules", "m1x,,m2x") .outdir(classes) .files(findJavaFiles(src)) .run() @@ -105,7 +104,7 @@ new JavacTask(tb) .options("--module-source-path", src.toString(), - "--limit-modules", "m1,") + "--limit-modules", "m1x,") .outdir(classes) .files(findJavaFiles(src)) .run()
--- a/test/tools/javac/modules/MOptionTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/MOptionTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -49,21 +49,21 @@ @Test public void testOneModule(Path base) throws Exception { Path src = base.resolve("src"); - Path m1 = src.resolve("m1"); + Path m1 = src.resolve("m1x"); Path build = base.resolve("build"); Files.createDirectories(build); tb.writeJavaFiles(m1, - "module m1 {}", + "module m1x {}", "package test; public class Test {}"); new JavacTask(tb) - .options("-m", "m1", "--module-source-path", src.toString(), "-d", build.toString()) + .options("-m", "m1x", "--module-source-path", src.toString(), "-d", build.toString()) .run(Task.Expect.SUCCESS) .writeAll(); - Path moduleInfoClass = build.resolve("m1/module-info.class"); - Path testTestClass = build.resolve("m1/test/Test.class"); + Path moduleInfoClass = build.resolve("m1x/module-info.class"); + Path testTestClass = build.resolve("m1x/test/Test.class"); FileTime moduleInfoTimeStamp = Files.getLastModifiedTime(moduleInfoClass); FileTime testTestTimeStamp = Files.getLastModifiedTime(testTestClass); @@ -81,7 +81,7 @@ Thread.sleep(2000); //timestamps new JavacTask(tb) - .options("-m", "m1", "--module-source-path", src.toString(), "-d", build.toString()) + .options("-m", "m1x", "--module-source-path", src.toString(), "-d", build.toString()) .run(Task.Expect.SUCCESS) .writeAll(); @@ -98,7 +98,7 @@ Files.setLastModifiedTime(testTest, FileTime.fromMillis(System.currentTimeMillis())); new JavacTask(tb) - .options("-m", "m1", "--module-source-path", src.toString(), "-d", build.toString()) + .options("-m", "m1x", "--module-source-path", src.toString(), "-d", build.toString()) .run(Task.Expect.SUCCESS) .writeAll(); @@ -114,17 +114,17 @@ @Test public void testNoOutputDir(Path base) throws Exception { Path src = base.resolve("src"); - Path m1 = src.resolve("m1"); + Path m1 = src.resolve("m1x"); Path build = base.resolve("build"); Files.createDirectories(build); tb.writeJavaFiles(m1, - "module m1 {}", + "module m1x {}", "package test; public class Test {}"); String log = new JavacTask(tb) .options("-XDrawDiagnostics", - "-m", "m1", + "-m", "m1x", "--module-source-path", src.toString()) .run(Task.Expect.FAIL) .writeAll() @@ -137,17 +137,17 @@ @Test public void testNoModuleSourcePath(Path base) throws Exception { Path src = base.resolve("src"); - Path m1 = src.resolve("m1"); + Path m1 = src.resolve("m1x"); Path build = base.resolve("build"); Files.createDirectories(build); tb.writeJavaFiles(m1, - "module m1 {}", + "module m1x {}", "package test; public class Test {}"); String log = new JavacTask(tb) .options("-XDrawDiagnostics", - "-m", "m1", + "-m", "m1x", "-d", build.toString()) .run(Task.Expect.FAIL) .writeAll() @@ -160,29 +160,29 @@ @Test public void testMultiModule(Path base) throws Exception { Path src = base.resolve("src"); - Path m1 = src.resolve("m1"); - Path m2 = src.resolve("m2"); + Path m1 = src.resolve("m1x"); + Path m2 = src.resolve("m2x"); Path build = base.resolve("build"); Files.createDirectories(build); tb.writeJavaFiles(m1, - "module m1 {}", + "module m1x {}", "package p1; public class C1 {}"); tb.writeJavaFiles(m2, - "module m2 {}", + "module m2x {}", "package p2; public class C2 {}"); new JavacTask(tb) - .options("-m", "m1,m2", "--module-source-path", src.toString(), "-d", build.toString()) + .options("-m", "m1x,m2x", "--module-source-path", src.toString(), "-d", build.toString()) .run(Task.Expect.SUCCESS) .writeAll(); - Path m1ModuleInfoClass = build.resolve("m1/module-info.class"); - Path classC1 = build.resolve("m1/p1/C1.class"); + Path m1ModuleInfoClass = build.resolve("m1x/module-info.class"); + Path classC1 = build.resolve("m1x/p1/C1.class"); - Path m2ModuleInfoClass = build.resolve("m2/module-info.class"); - Path classC2 = build.resolve("m2/p2/C2.class"); + Path m2ModuleInfoClass = build.resolve("m2x/module-info.class"); + Path classC2 = build.resolve("m2x/p2/C2.class"); FileTime m1ModuleInfoTimeStamp = Files.getLastModifiedTime(m1ModuleInfoClass); FileTime C1TimeStamp = Files.getLastModifiedTime(classC1); @@ -215,7 +215,7 @@ Thread.sleep(2000); //timestamps new JavacTask(tb) - .options("-m", "m1,m2", "--module-source-path", src.toString(), "-d", build.toString()) + .options("-m", "m1x,m2x", "--module-source-path", src.toString(), "-d", build.toString()) .run(Task.Expect.SUCCESS) .writeAll(); @@ -241,7 +241,7 @@ Files.setLastModifiedTime(C2Source, FileTime.fromMillis(System.currentTimeMillis())); new JavacTask(tb) - .options("-m", "m1,m2", "--module-source-path", src.toString(), "-d", build.toString()) + .options("-m", "m1x,m2x", "--module-source-path", src.toString(), "-d", build.toString()) .run(Task.Expect.SUCCESS) .writeAll();
--- a/test/tools/javac/modules/ModuleFinderTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/ModuleFinderTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -38,7 +38,6 @@ import toolbox.JarTask; import toolbox.JavacTask; import toolbox.Task; -import toolbox.ToolBox; public class ModuleFinderTest extends ModuleTestBase { @@ -50,7 +49,7 @@ @Test public void testDuplicateModulesOnPath(Path base) throws Exception { Path src = base.resolve("src"); - tb.writeJavaFiles(src, "module m1 { }"); + tb.writeJavaFiles(src, "module m1x { }"); Path classes = base.resolve("classes"); Files.createDirectories(classes); @@ -63,18 +62,18 @@ .run() .writeAll(); - new JarTask(tb, modules.resolve("m1-1.jar")) + new JarTask(tb, modules.resolve("m1x-1.jar")) .baseDir(classes) .files(".") .run(); - new JarTask(tb, modules.resolve("m1-2.jar")) + new JarTask(tb, modules.resolve("m1x-2.jar")) .baseDir(classes) .files(".") .run(); Path src2 = base.resolve("src2"); - tb.writeJavaFiles(src2, "module m2 { requires m1; }"); + tb.writeJavaFiles(src2, "module m2x { requires m1x; }"); String log = new JavacTask(tb, Task.Mode.CMDLINE) @@ -85,7 +84,7 @@ .writeAll() .getOutput(Task.OutputKind.DIRECT); - if (!log.contains("- compiler.err.duplicate.module.on.path: (compiler.misc.locn.module_path), m1")) + if (!log.contains("- compiler.err.duplicate.module.on.path: (compiler.misc.locn.module_path), m1x")) throw new Exception("expected output not found"); } }
--- a/test/tools/javac/modules/ModuleInfoTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/ModuleInfoTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -34,14 +34,12 @@ * @run main ModuleInfoTest */ -import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.Arrays; import toolbox.JavacTask; import toolbox.Task; -import toolbox.ToolBox; public class ModuleInfoTest extends ModuleTestBase { @@ -137,21 +135,129 @@ } /** - * Verify that missing exports are reported. + * Verify that missing exports targets are reported. */ @Test public void testExportsNotFound(Path base) throws Exception { Path src = base.resolve("src"); - tb.writeJavaFiles(src, "module M1 { exports p to M2; }"); + tb.writeJavaFiles(src, + "module M { exports p to N; }", + "package p; public class C {}"); String log = new JavacTask(tb) - .options("-XDrawDiagnostics") + .options("-XDrawDiagnostics", + "-Xlint:module") + .files(findJavaFiles(src)) + .run() + .writeAll() + .getOutput(Task.OutputKind.DIRECT); + + if (!log.contains("module-info.java:1:25: compiler.warn.module.not.found: N")) + throw new Exception("expected output not found, actual output: " + log); + } + + /** + * Verify that duplicated qualified missing exports targets are reported. + */ + @Test + public void testExportsNotFoundDuplicated(Path base) throws Exception { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, + "module M { exports p to N, N; }", + "package p; public class C {}"); + String log = new JavacTask(tb) + .options("-XDrawDiagnostics", + "-Xlint:module") .files(findJavaFiles(src)) .run(Task.Expect.FAIL) .writeAll() .getOutput(Task.OutputKind.DIRECT); - if (!log.contains("module-info.java:1:26: compiler.err.module.not.found: M2")) - throw new Exception("expected output not found"); + if (!log.contains("module-info.java:1:28: compiler.err.conflicting.exports.to.module: N")) + throw new Exception("expected output not found, actual output: " + log); + } + + /** + * Verify that missing exports target warning can be suppressed. + */ + @Test + public void testExportsNotFoundSuppress(Path base) throws Exception { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, + "@SuppressWarnings(\"module\") module M { exports p to N; }", + "package p; public class C {}"); + String log = new JavacTask(tb) + .options("-XDrawDiagnostics", + "-Xlint:module") + .files(findJavaFiles(src)) + .run() + .writeAll() + .getOutput(Task.OutputKind.DIRECT); + + if (!log.isEmpty()) + throw new Exception("expected output not found, actual output: " + log); + } + + /** + * Verify that missing opens targets are reported. + */ + @Test + public void testOpensNotFound(Path base) throws Exception { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, + "module M { opens p to N; }", + "package p; public class C {}"); + String log = new JavacTask(tb) + .options("-XDrawDiagnostics", + "-Xlint:module") + .files(findJavaFiles(src)) + .run() + .writeAll() + .getOutput(Task.OutputKind.DIRECT); + + if (!log.contains("module-info.java:1:23: compiler.warn.module.not.found: N")) + throw new Exception("expected output not found, actual output: " + log); + } + + /** + * Verify that duplicated qualified missing opens targets are reported. + */ + @Test + public void testOpensNotFoundDuplicated(Path base) throws Exception { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, + "module M { opens p to N, N; }", + "package p; public class C {}"); + String log = new JavacTask(tb) + .options("-XDrawDiagnostics", + "-Xlint:module") + .files(findJavaFiles(src)) + .run(Task.Expect.FAIL) + .writeAll() + .getOutput(Task.OutputKind.DIRECT); + + if (!log.contains("module-info.java:1:26: compiler.err.conflicting.opens.to.module: N")) + throw new Exception("expected output not found, actual output: " + log); + } + + /** + * Verify that missing opens target warning can be suppressed. + */ + @Test + public void testOpensNotFoundSuppress(Path base) throws Exception { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, + "@SuppressWarnings(\"module\") module M { opens p to N; }", + "package p; public class C {}"); + String log = new JavacTask(tb) + .options("-XDrawDiagnostics", + "-Xlint:module") + .files(findJavaFiles(src)) + .run() + .writeAll() + .getOutput(Task.OutputKind.DIRECT); + + if (!log.isEmpty()) + throw new Exception("expected output not found, actual output: " + log); } /** @@ -178,12 +284,12 @@ @Test public void testRequiresLoop(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); - tb.writeFile(src_m1.resolve("module-info.java"), "module m1 { requires m2; }"); - Path src_m2 = src.resolve("m2"); - tb.writeFile(src_m2.resolve("module-info.java"), "module m2 { requires m3; }"); - Path src_m3 = src.resolve("m3"); - tb.writeFile(src_m3.resolve("module-info.java"), "module m3 { requires m1; }"); + Path src_m1 = src.resolve("m1x"); + tb.writeFile(src_m1.resolve("module-info.java"), "module m1x { requires m2x; }"); + Path src_m2 = src.resolve("m2x"); + tb.writeFile(src_m2.resolve("module-info.java"), "module m2x { requires m3x; }"); + Path src_m3 = src.resolve("m3x"); + tb.writeFile(src_m3.resolve("module-info.java"), "module m3x { requires m1x; }"); Path classes = base.resolve("classes"); Files.createDirectories(classes); @@ -196,7 +302,7 @@ .writeAll() .getOutput(Task.OutputKind.DIRECT); - if (!log.contains("module-info.java:1:22: compiler.err.cyclic.requires: m3")) + if (!log.contains("module-info.java:1:23: compiler.err.cyclic.requires: m3x")) throw new Exception("expected output not found"); } @@ -206,12 +312,12 @@ @Test public void testRequiresTransitiveLoop(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); - tb.writeFile(src_m1.resolve("module-info.java"), "module m1 { requires m2; }"); - Path src_m2 = src.resolve("m2"); - tb.writeFile(src_m2.resolve("module-info.java"), "module m2 { requires transitive m3; }"); - Path src_m3 = src.resolve("m3"); - tb.writeFile(src_m3.resolve("module-info.java"), "module m3 { requires m1; }"); + Path src_m1 = src.resolve("m1x"); + tb.writeFile(src_m1.resolve("module-info.java"), "module m1x { requires m2x; }"); + Path src_m2 = src.resolve("m2x"); + tb.writeFile(src_m2.resolve("module-info.java"), "module m2x { requires transitive m3x; }"); + Path src_m3 = src.resolve("m3x"); + tb.writeFile(src_m3.resolve("module-info.java"), "module m3x { requires m1x; }"); Path classes = base.resolve("classes"); Files.createDirectories(classes); @@ -224,7 +330,7 @@ .writeAll() .getOutput(Task.OutputKind.DIRECT); - if (!log.contains("module-info.java:1:33: compiler.err.cyclic.requires: m3")) + if (!log.contains("module-info.java:1:34: compiler.err.cyclic.requires: m3x")) throw new Exception("expected output not found"); } @@ -234,10 +340,10 @@ @Test public void testDuplicateRequires(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); - tb.writeFile(src_m1.resolve("module-info.java"), "module m1 { }"); - Path src_m2 = src.resolve("m2"); - tb.writeFile(src_m2.resolve("module-info.java"), "module m2 { requires m1; requires m1; }"); + Path src_m1 = src.resolve("m1x"); + tb.writeFile(src_m1.resolve("module-info.java"), "module m1x { }"); + Path src_m2 = src.resolve("m2x"); + tb.writeFile(src_m2.resolve("module-info.java"), "module m2x { requires m1x; requires m1x; }"); Path classes = base.resolve("classes"); Files.createDirectories(classes); @@ -250,7 +356,7 @@ .writeAll() .getOutput(Task.OutputKind.DIRECT); - if (!log.contains("module-info.java:1:35: compiler.err.duplicate.requires: m1")) + if (!log.contains("module-info.java:1:37: compiler.err.duplicate.requires: m1x")) throw new Exception("expected output not found"); } @@ -260,10 +366,10 @@ @Test public void testDuplicateRequiresTransitiveStatic(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); - tb.writeFile(src_m1.resolve("module-info.java"), "module m1 { }"); - Path src_m2 = src.resolve("m2"); - tb.writeFile(src_m2.resolve("module-info.java"), "module m2 { requires transitive m1; requires static m1; }"); + Path src_m1 = src.resolve("m1x"); + tb.writeFile(src_m1.resolve("module-info.java"), "module m1x { }"); + Path src_m2 = src.resolve("m2x"); + tb.writeFile(src_m2.resolve("module-info.java"), "module m2x { requires transitive m1x; requires static m1x; }"); Path classes = base.resolve("classes"); Files.createDirectories(classes); @@ -276,7 +382,7 @@ .writeAll() .getOutput(Task.OutputKind.DIRECT); - if (!log.contains("module-info.java:1:53: compiler.err.duplicate.requires: m1")) + if (!log.contains("module-info.java:1:55: compiler.err.duplicate.requires: m1x")) throw new Exception("expected output not found"); } @@ -290,64 +396,64 @@ null); verifyConflictingExports_packages(base, "exports p; exports p;", - "module-info.java:1:32: compiler.err.conflicting.exports: p"); + "module-info.java:1:33: compiler.err.conflicting.exports: p"); verifyConflictingExports_packages(base, "exports p; opens p;", null); verifyConflictingExports_packages(base, - "exports p; exports p to m2;", - "module-info.java:1:32: compiler.err.conflicting.exports: p"); + "exports p; exports p to m2x;", + "module-info.java:1:33: compiler.err.conflicting.exports: p"); verifyConflictingExports_packages(base, - "exports p; opens p to m2;", + "exports p; opens p to m2x;", null); verifyConflictingExports_packages(base, "opens p; exports p;", null); verifyConflictingExports_packages(base, "opens p; opens p;", - "module-info.java:1:28: compiler.err.conflicting.opens: p"); + "module-info.java:1:29: compiler.err.conflicting.opens: p"); verifyConflictingExports_packages(base, - "opens p; exports p to m2;", + "opens p; exports p to m2x;", null); verifyConflictingExports_packages(base, - "opens p; opens p to m2;", - "module-info.java:1:28: compiler.err.conflicting.opens: p"); + "opens p; opens p to m2x;", + "module-info.java:1:29: compiler.err.conflicting.opens: p"); verifyConflictingExports_packages(base, - "exports p to m2; exports p;", - "module-info.java:1:38: compiler.err.conflicting.exports: p"); + "exports p to m2x; exports p;", + "module-info.java:1:40: compiler.err.conflicting.exports: p"); verifyConflictingExports_packages(base, - "exports p to m2; opens p;", + "exports p to m2x; opens p;", null); verifyConflictingExports_packages(base, - "exports p to m2; exports p to m2;", - "module-info.java:1:43: compiler.err.conflicting.exports.to.module: m2"); + "exports p to m2x; exports p to m2x;", + "module-info.java:1:45: compiler.err.conflicting.exports.to.module: m2x"); verifyConflictingExports_packages(base, - "exports p to m2; opens p to m2;", + "exports p to m2x; opens p to m2x;", null); verifyConflictingExports_packages(base, - "opens p to m2; exports p;", + "opens p to m2x; exports p;", null); verifyConflictingExports_packages(base, - "opens p to m2; opens p;", - "module-info.java:1:34: compiler.err.conflicting.opens: p"); + "opens p to m2x; opens p;", + "module-info.java:1:36: compiler.err.conflicting.opens: p"); verifyConflictingExports_packages(base, - "opens p to m2; exports p to m2;", + "opens p to m2x; exports p to m2x;", null); verifyConflictingExports_packages(base, - "opens p to m2; opens p to m2;", - "module-info.java:1:34: compiler.err.conflicting.opens: p"); + "opens p to m2x; opens p to m2x;", + "module-info.java:1:36: compiler.err.conflicting.opens: p"); verifyConflictingExports_packages(base, - "exports p to m2; exports p to m3;", - "module-info.java:1:38: compiler.err.conflicting.exports: p"); + "exports p to m2x; exports p to m3x;", + "module-info.java:1:40: compiler.err.conflicting.exports: p"); verifyConflictingExports_packages(base, - "exports p to m2; opens p to m3;", + "exports p to m2x; opens p to m3x;", null); verifyConflictingExports_packages(base, - "opens p to m2; exports p to m3;", + "opens p to m2x; exports p to m3x;", null); verifyConflictingExports_packages(base, - "opens p to m2; opens p to m3;", - "module-info.java:1:34: compiler.err.conflicting.opens: p"); + "opens p to m2x; opens p to m3x;", + "module-info.java:1:36: compiler.err.conflicting.opens: p"); } private void verifyConflictingExports_packages(Path base, String code, String expected) throws Exception { @@ -355,14 +461,14 @@ tb.cleanDirectory(base); Path src = base.resolve("src"); - tb.writeJavaFiles(src.resolve("m1"), - "module m1 { " + code + " }", + tb.writeJavaFiles(src.resolve("m1x"), + "module m1x { " + code + " }", "package p; public class P {}", "package q; public class Q {}"); - tb.writeJavaFiles(src.resolve("m2"), - "module m2 { requires m1; }"); - tb.writeJavaFiles(src.resolve("m3"), - "module m3 { requires m1; }"); + tb.writeJavaFiles(src.resolve("m2x"), + "module m2x { requires m1x; }"); + tb.writeJavaFiles(src.resolve("m3x"), + "module m3x { requires m1x; }"); Path classes = base.resolve("classes"); Files.createDirectories(classes); @@ -386,10 +492,10 @@ @Test public void testConflictingExports_modules(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); - tb.writeFile(src_m1.resolve("module-info.java"), "module m1 { }"); - Path src_m2 = src.resolve("m2"); - tb.writeFile(src_m2.resolve("module-info.java"), "module m2 { exports p to m1, m1; }"); + Path src_m1 = src.resolve("m1x"); + tb.writeFile(src_m1.resolve("module-info.java"), "module m1x { }"); + Path src_m2 = src.resolve("m2x"); + tb.writeFile(src_m2.resolve("module-info.java"), "module m2x { exports p to m1x, m1x; }"); Path classes = base.resolve("classes"); Files.createDirectories(classes); @@ -402,7 +508,7 @@ .writeAll() .getOutput(Task.OutputKind.DIRECT); - if (!log.contains("module-info.java:1:30: compiler.err.conflicting.exports.to.module: m1")) + if (!log.contains("module-info.java:1:32: compiler.err.conflicting.exports.to.module: m1x")) throw new Exception("expected output not found"); } @@ -413,7 +519,7 @@ @Test public void testAnnotations(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1.sub"); + Path src_m1 = src.resolve("m1x.sub"); Path classes = base.resolve("classes"); Files.createDirectories(classes);
--- a/test/tools/javac/modules/ModuleInfoTreeAccess.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/ModuleInfoTreeAccess.java Fri Dec 16 08:17:55 2016 +0000 @@ -46,7 +46,6 @@ import com.sun.source.util.TreePath; import com.sun.tools.javac.api.JavacTrees; -import toolbox.ToolBox; public class ModuleInfoTreeAccess extends ModuleTestBase { public static void main(String... args) throws Exception { @@ -66,14 +65,14 @@ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) { Path src = base.resolve("src"); - tb.writeJavaFiles(src, "/** Test module */ module m1 {}"); + tb.writeJavaFiles(src, "/** Test module */ module m1x {}"); Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(findJavaFiles(src)); JavacTask task = (JavacTask) compiler.getTask(null, fm, null, null, null, files); task.analyze(); JavacTrees trees = JavacTrees.instance(task); - ModuleElement mdle = (ModuleElement) task.getElements().getModuleElement("m1"); + ModuleElement mdle = (ModuleElement) task.getElements().getModuleElement("m1x"); TreePath path = trees.getPath(mdle); assertNotNull("path", path); @@ -91,14 +90,14 @@ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) { Path src = base.resolve("src"); - tb.writeJavaFiles(src, "import java.lang.Deprecated; /** Test module */ @Deprecated module m1 {}"); + tb.writeJavaFiles(src, "import java.lang.Deprecated; /** Test module */ @Deprecated module m1x {}"); Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(findJavaFiles(src)); JavacTask task = (JavacTask) compiler.getTask(null, fm, null, null, null, files); task.analyze(); JavacTrees trees = JavacTrees.instance(task); - ModuleElement mdle = (ModuleElement) task.getElements().getModuleElement("m1"); + ModuleElement mdle = (ModuleElement) task.getElements().getModuleElement("m1x"); TreePath path = trees.getPath(mdle); assertNotNull("path", path);
--- a/test/tools/javac/modules/ModulePathTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/ModulePathTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -113,7 +113,7 @@ public void testExplodedModuleOnPath(Path base) throws Exception { Path modSrc = base.resolve("modSrc"); tb.writeJavaFiles(modSrc, - "module m1 { exports p; }", + "module m1x { exports p; }", "package p; public class CC { }"); Path modClasses = base.resolve("modClasses"); Files.createDirectories(modClasses); @@ -126,7 +126,7 @@ Path src = base.resolve("src"); tb.writeJavaFiles(src, - "module m { requires m1 ; }", + "module m { requires m1x ; }", "class C { }"); Path classes = base.resolve("classes"); Files.createDirectories(classes); @@ -142,11 +142,11 @@ @Test public void testBadExplodedModuleOnPath(Path base) throws Exception { Path modClasses = base.resolve("modClasses"); - tb.writeFile(modClasses.resolve("module-info.class"), "module m1 { }"); + tb.writeFile(modClasses.resolve("module-info.class"), "module m1x { }"); Path src = base.resolve("src"); tb.writeJavaFiles(src, - "module m { requires m1 ; }", + "module m { requires m1x ; }", "class C { }"); Path classes = base.resolve("classes"); Files.createDirectories(classes); @@ -201,7 +201,7 @@ public void testModJarOnPath(Path base) throws Exception { Path jarSrc = base.resolve("jarSrc"); tb.writeJavaFiles(jarSrc, - "module m1 { exports p; }", + "module m1x { exports p; }", "package p; public class CC { }"); Path jarClasses = base.resolve("jarClasses"); Files.createDirectories(jarClasses); @@ -220,7 +220,7 @@ Path src = base.resolve("src"); tb.writeJavaFiles(src, - "module m { requires m1 ; }", + "module m { requires m1x ; }", "class C { }"); Path classes = base.resolve("classes"); Files.createDirectories(classes); @@ -255,7 +255,7 @@ public void testJModOnPath(Path base) throws Exception { Path jmodSrc = base.resolve("jmodSrc"); tb.writeJavaFiles(jmodSrc, - "module m1 { exports p; }", + "module m1x { exports p; }", "package p; public class CC { }"); Path jmodClasses = base.resolve("jmodClasses"); Files.createDirectories(jmodClasses); @@ -271,7 +271,7 @@ Path src = base.resolve("src"); tb.writeJavaFiles(src, - "module m { requires m1 ; }", + "module m { requires m1x ; }", "class C { }"); Path classes = base.resolve("classes"); Files.createDirectories(classes); @@ -305,10 +305,10 @@ @Test public void relativePath(Path base) throws Exception { Path modules = base.resolve("modules"); - new ModuleBuilder(tb, "m1").build(modules); + new ModuleBuilder(tb, "m1x").build(modules); Path src = base.resolve("src"); - tb.writeJavaFiles(src, "module m2 { requires m1; }", "class A { }"); + tb.writeJavaFiles(src, "module m2x { requires m1x; }", "class A { }"); new JavacTask(tb, Task.Mode.CMDLINE) .options("-XDrawDiagnostics", @@ -321,10 +321,10 @@ @Test public void duplicatePaths_1(Path base) throws Exception { Path modules = base.resolve("modules"); - new ModuleBuilder(tb, "m1").build(modules); + new ModuleBuilder(tb, "m1x").build(modules); Path src = base.resolve("src"); - tb.writeJavaFiles(src, "module m2 { requires m1; }", "class A { }"); + tb.writeJavaFiles(src, "module m2x { requires m1x; }", "class A { }"); new JavacTask(tb, Task.Mode.CMDLINE) .options("-XDrawDiagnostics", @@ -337,10 +337,10 @@ @Test public void duplicatePaths_2(Path base) throws Exception { Path modules = base.resolve("modules"); - new ModuleBuilder(tb, "m1").build(modules); + new ModuleBuilder(tb, "m1x").build(modules); Path src = base.resolve("src"); - tb.writeJavaFiles(src, "module m2 { requires m1; }", "class A { }"); + tb.writeJavaFiles(src, "module m2x { requires m1x; }", "class A { }"); new JavacTask(tb, Task.Mode.CMDLINE) .options("-XDrawDiagnostics", @@ -354,20 +354,20 @@ @Test public void oneModuleHidesAnother(Path base) throws Exception { Path modules = base.resolve("modules"); - new ModuleBuilder(tb, "m1") + new ModuleBuilder(tb, "m1x") .exports("pkg1") .classes("package pkg1; public class E { }") .build(modules); Path deepModuleDirSrc = base.resolve("deepModuleDirSrc"); Path deepModuleDir = modules.resolve("deepModuleDir"); - new ModuleBuilder(tb, "m1") + new ModuleBuilder(tb, "m1x") .exports("pkg2") .classes("package pkg2; public class E { }") .build(deepModuleDirSrc, deepModuleDir); Path src = base.resolve("src"); - tb.writeJavaFiles(src, "module m2 { requires m1; }", " package p; class A { void main() { pkg2.E.class.getName(); } }"); + tb.writeJavaFiles(src, "module m2x { requires m1x; }", " package p; class A { void main() { pkg2.E.class.getName(); } }"); new JavacTask(tb, Task.Mode.CMDLINE) .options("-XDrawDiagnostics", @@ -380,23 +380,23 @@ @Test public void modulesInDifferentContainers(Path base) throws Exception { Path modules = base.resolve("modules"); - new ModuleBuilder(tb, "m1") + new ModuleBuilder(tb, "m1x") .exports("one") .classes("package one; public class A { }") .build(modules); - new ModuleBuilder(tb, "m2") - .requires("m1", modules) + new ModuleBuilder(tb, "m2x") + .requires("m1x", modules) .build(base.resolve("tmp")); - jar(base.resolve("tmp/m2"), modules.resolve("m2.jar")); + jar(base.resolve("tmp/m2x"), modules.resolve("m2x.jar")); - new ModuleBuilder(tb, "m3") - .requires("m2", modules) + new ModuleBuilder(tb, "m3x") + .requires("m2x", modules) .build(base.resolve("tmp")); - jmod(base.resolve("tmp/m3"), modules.resolve("m3.jmod")); + jmod(base.resolve("tmp/m3x"), modules.resolve("m3x.jmod")); Path src = base.resolve("src"); - tb.writeJavaFiles(src, "module m { requires m3; requires m2; requires m1; }", + tb.writeJavaFiles(src, "module m { requires m3x; requires m2x; requires m1x; }", "package p; class A { void main() { one.A.class.getName(); } }"); new JavacTask(tb, Task.Mode.CMDLINE)
--- a/test/tools/javac/modules/ModuleSourcePathTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/ModuleSourcePathTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -76,8 +76,8 @@ @Test public void testUnnormalizedPath1(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); - tb.writeJavaFiles(src_m1, "module m1 { }"); + Path src_m1 = src.resolve("m1x"); + tb.writeJavaFiles(src_m1, "module m1x { }"); Path modules = base.resolve("modules"); Files.createDirectories(modules); @@ -93,8 +93,8 @@ @Test public void testUnnormalizedPath2(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); - tb.writeJavaFiles(src_m1, "module m1 { }"); + Path src_m1 = src.resolve("m1x"); + tb.writeJavaFiles(src_m1, "module m1x { }"); Path modules = base.resolve("modules"); Files.createDirectories(modules); @@ -124,15 +124,15 @@ new JavacTask(tb, Task.Mode.CMDLINE) .options("-XDrawDiagnostics", "--module-source-path", base + "/{src1,src2/inner_dir}") - .files(base.resolve("src1/m0/pkg0/A.java"), base.resolve("src2/inner_dir/m1/pkg1/A.java")) + .files(base.resolve("src1/m0x/pkg0/A.java"), base.resolve("src2/inner_dir/m1x/pkg1/A.java")) .outdir(modules) .run() .writeAll(); - checkFiles(modules.resolve("m0/pkg0/A.class"), - modules.resolve("m1/pkg1/A.class"), - modules.resolve("m0/module-info.class"), - modules.resolve("m1/module-info.class")); + checkFiles(modules.resolve("m0x/pkg0/A.class"), + modules.resolve("m1x/pkg1/A.class"), + modules.resolve("m0x/module-info.class"), + modules.resolve("m1x/module-info.class")); } @Test @@ -191,9 +191,9 @@ .writeAll(); for (int i = 0; i < modulePaths.length; i++) { - checkFiles(modules.resolve("m" + i + "/module-info.class")); + checkFiles(modules.resolve("m" + i + "x/module-info.class")); } - checkFiles(modules.resolve("m8/pkg8/A.class")); + checkFiles(modules.resolve("m8x/pkg8/A.class")); } @Test @@ -298,7 +298,7 @@ @Test public void duplicatePaths(Path base) throws Exception { Path src = base.resolve("src"); - tb.writeJavaFiles(src.resolve("m1"), "module m1 { }", "package a; class A { }"); + tb.writeJavaFiles(src.resolve("m1x"), "module m1x { }", "package a; class A { }"); final Path modules = base.resolve("modules"); tb.createDirectories(modules); @@ -306,17 +306,17 @@ new JavacTask(tb, Task.Mode.CMDLINE) .options("-XDrawDiagnostics", "--module-source-path", base + "/{src,src,src}") - .files(src.resolve("m1/a/A.java")) + .files(src.resolve("m1x/a/A.java")) .outdir(modules) .run() .writeAll(); - checkFiles(modules.resolve("m1/module-info.class")); + checkFiles(modules.resolve("m1x/module-info.class")); } @Test public void notExistentPaths(Path base) throws Exception { - tb.writeJavaFiles(base.resolve("m1"), "module m1 { requires m0; }", "package a; class A { }"); + tb.writeJavaFiles(base.resolve("m1x"), "module m1x { requires m0x; }", "package a; class A { }"); final Path modules = base.resolve("modules"); tb.createDirectories(modules); @@ -324,18 +324,18 @@ String log = new JavacTask(tb, Task.Mode.CMDLINE) .options("-XDrawDiagnostics", "--module-source-path", base + "/not_exist" + PATH_SEP + base + "/{not_exist,}") - .files(base.resolve("m1/a/A.java")) + .files(base.resolve("m1x/a/A.java")) .outdir(modules) .run(Task.Expect.FAIL) .writeAll() .getOutput(Task.OutputKind.DIRECT); - if (!log.contains("compiler.err.module.not.found: m0")) + if (!log.contains("compiler.err.module.not.found: m0x")) throw new Exception("expected output for not existent module source path not found"); } @Test public void notExistentPathShouldBeSkipped(Path base) throws Exception { - tb.writeJavaFiles(base.resolve("m1"), "module m1 { }", "package a; class A { }"); + tb.writeJavaFiles(base.resolve("m1x"), "module m1x { }", "package a; class A { }"); final Path modules = base.resolve("modules"); tb.createDirectories(modules); @@ -343,18 +343,18 @@ new JavacTask(tb, Task.Mode.CMDLINE) .options("-XDrawDiagnostics", "--module-source-path", base + "{/not_exist,/}") - .files(base.resolve("m1/a/A.java")) + .files(base.resolve("m1x/a/A.java")) .outdir(modules) .run() .writeAll(); - checkFiles(modules.resolve("m1/module-info.class")); + checkFiles(modules.resolve("m1x/module-info.class")); } @Test public void commas(Path base) throws Exception { Path src = base.resolve("src"); - tb.writeJavaFiles(src.resolve("m1"), "module m1 { }", "package a; class A { }"); + tb.writeJavaFiles(src.resolve("m1x"), "module m1x { }", "package a; class A { }"); final Path modules = base.resolve("modules"); tb.createDirectories(modules); @@ -362,12 +362,12 @@ new JavacTask(tb, Task.Mode.CMDLINE) .options("-XDrawDiagnostics", "--module-source-path", base + "/{,{,,,,src,,,}}") - .files(src.resolve("m1/a/A.java")) + .files(src.resolve("m1x/a/A.java")) .outdir(modules) .run() .writeAll(); - checkFiles(modules.resolve("m1/module-info.class")); + checkFiles(modules.resolve("m1x/module-info.class")); } @Test @@ -444,8 +444,8 @@ private void generateModules(Path base, String... paths) throws IOException { for (int i = 0; i < paths.length; i++) { - String moduleName = "m" + i; - String dependency = i > 0 ? "requires m" + (i - 1) + ";" : ""; + String moduleName = "m" + i + "x"; + String dependency = i > 0 ? "requires m" + (i - 1) + "x;" : ""; tb.writeJavaFiles(base.resolve(paths[i]).resolve(moduleName), "module " + moduleName + " { " + dependency + " }", "package pkg" + i + "; class A { }");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/modules/ModuleVersion.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @summary simple tests of module uses + * @library /tools/lib + * @modules jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + * jdk.jdeps/com.sun.tools.classfile + * @build toolbox.ToolBox toolbox.JavacTask toolbox.ModuleBuilder ModuleTestBase + * @run main ModuleVersion + */ + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +import com.sun.tools.classfile.Attribute; +import com.sun.tools.classfile.ClassFile; +import com.sun.tools.classfile.ConstantPoolException; +import com.sun.tools.classfile.Module_attribute; +import toolbox.JavacTask; +import toolbox.Task.Expect; +import toolbox.Task.OutputKind; + +public class ModuleVersion extends ModuleTestBase { + public static void main(String... args) throws Exception { + ModuleVersion t = new ModuleVersion(); + t.runTests(); + } + + @Test + public void testSetSingleModuleVersion(Path base) throws Exception { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, + "module m { }"); + Path classes = base.resolve("classes"); + Files.createDirectories(classes); + + String version = "1.2.3.4"; + + new JavacTask(tb) + .options("--module-version", version) + .outdir(classes) + .files(findJavaFiles(src)) + .run() + .writeAll(); + + checkModuleVersion(classes.resolve("module-info.class"), version); + } + + @Test + public void testMultipleModuleVersions(Path base) throws Exception { + Path src = base.resolve("src"); + Path m1 = src.resolve("m1"); + tb.writeJavaFiles(m1, + "module m1 { }"); + Path m2 = src.resolve("m2"); + tb.writeJavaFiles(m2, + "module m2 { }"); + Path classes = base.resolve("classes"); + Files.createDirectories(classes); + + String version = "1.2.3.4"; + + new JavacTask(tb) + .options("--module-source-path", src.toString(), + "--module-version", version) + .outdir(classes) + .files(findJavaFiles(src)) + .run() + .writeAll(); + + checkModuleVersion(classes.resolve("m1").resolve("module-info.class"), version); + checkModuleVersion(classes.resolve("m2").resolve("module-info.class"), version); + + String log = new JavacTask(tb, JavacTask.Mode.CMDLINE) + .options("--module-source-path", src.toString(), + "--module-version", "b", + "-XDrawDiagnostics") + .outdir(classes) + .files(findJavaFiles(src)) + .run(Expect.FAIL) + .writeAll() + .getOutput(OutputKind.DIRECT); + + String expectedLog = "bad value for --module-version option: 'b'"; + + if (!log.contains(expectedLog)) { + throw new AssertionError("Incorrect log: " + log); + } + } + + private void checkModuleVersion(Path classfile, String version) throws IOException, ConstantPoolException { + ClassFile cf = ClassFile.read(classfile); + + Module_attribute moduleAttribute = (Module_attribute) cf.attributes.get(Attribute.Module); + + if (moduleAttribute == null) { + throw new AssertionError("Version attribute missing!"); + } + + String actualVersion = cf.constant_pool.getUTF8Value(moduleAttribute.module_version_index); + + if (!version.equals(actualVersion)) { + throw new AssertionError("Incorrect version in the classfile: " + actualVersion); + } + } + +}
--- a/test/tools/javac/modules/ModulesAndClassPathTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/ModulesAndClassPathTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -58,14 +58,14 @@ Path jar = prepareTestJar(base); Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m"); Path classes = base.resolve("classes"); Files.createDirectories(classes); tb.writeJavaFiles(m1, - "module m1 { }", + "module m { }", "package impl; public class Impl { api.Api api; }"); List<String> modLog = new JavacTask(tb) @@ -86,7 +86,7 @@ new JavacTask(tb) .options("--class-path", jar.toString(), - "--add-reads", "m1=ALL-UNNAMED") + "--add-reads", "m=ALL-UNNAMED") .outdir(classes) .files(findJavaFiles(moduleSrc)) .run() @@ -95,7 +95,7 @@ new JavacTask(tb) .options("--class-path", jar.toString() + File.pathSeparator + System.getProperty("test.classes"), - "--add-reads", "m1=ALL-UNNAMED", + "--add-reads", "m=ALL-UNNAMED", "-processor", ProcessorImpl.class.getName()) .outdir(classes) .files(findJavaFiles(moduleSrc)) @@ -109,14 +109,14 @@ Path jar = prepareTestJar(base); Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m"); Path classes = base.resolve("classes"); Files.createDirectories(classes); tb.writeJavaFiles(m1, - "module m1 { }", + "module m { }", "package impl; public class Impl { api.Api api; }"); List<String> modLog = new JavacTask(tb) @@ -142,14 +142,14 @@ Path jar = prepareTestJar(base); Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m"); Path classes = base.resolve("classes"); Files.createDirectories(classes); tb.writeJavaFiles(m1, - "module m1 { }", + "module m { }", "package impl; public class Impl { api.Api api; }"); new JavacTask(tb) @@ -222,14 +222,14 @@ @Test public void testClassOutputVisibleForIncrementalCompilation(Path base) throws Exception { Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m"); Path classes = base.resolve("classes"); Files.createDirectories(classes); tb.writeJavaFiles(m1, - "module m1 { exports impl; }", + "module m { exports impl; }", "package impl; public class Impl { }", "package src; public class Src { }", "package test; public class TestCP extends impl.Impl { }",
--- a/test/tools/javac/modules/MultiModuleModeTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/MultiModuleModeTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -51,10 +51,10 @@ @Test public void testDuplicateModules(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); - tb.writeJavaFiles(src_m1, "module m1 { }"); - Path src_m2 = src.resolve("m2"); - tb.writeJavaFiles(src_m2, "module m1 { }"); + Path src_m1 = src.resolve("m1x"); + tb.writeJavaFiles(src_m1, "module m1x { }"); + Path src_m2 = src.resolve("m2x"); + tb.writeJavaFiles(src_m2, "module m1x { }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); @@ -67,15 +67,15 @@ .writeAll() .getOutput(Task.OutputKind.DIRECT); - if (!log.contains("module-info.java:1:1: compiler.err.duplicate.module: m1")) + if (!log.contains("module-info.java:1:1: compiler.err.duplicate.module: m1x")) throw new Exception("expected output not found"); } @Test public void testCantFindModule(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); - tb.writeJavaFiles(src_m1, "module m1 { }"); + Path src_m1 = src.resolve("m1x"); + tb.writeJavaFiles(src_m1, "module m1x { }"); Path misc = base.resolve("misc"); tb.writeJavaFiles(misc, "package p; class C { }"); Path classes = base.resolve("classes"); @@ -97,8 +97,8 @@ @Test public void testModuleNameMismatch(Path base) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); - tb.writeJavaFiles(src_m1, "module m2 { }"); + Path src_m1 = src.resolve("m1x"); + tb.writeJavaFiles(src_m1, "module m2x { }"); Path classes = base.resolve("classes"); tb.createDirectories(classes); @@ -111,22 +111,22 @@ .writeAll() .getOutput(Task.OutputKind.DIRECT); - if (!log.contains("module-info.java:1:8: compiler.err.module.name.mismatch: m2, m1")) + if (!log.contains("module-info.java:1:8: compiler.err.module.name.mismatch: m2x, m1x")) throw new Exception("expected output not found"); } @Test public void testImplicitModuleSource(Path base) throws Exception { Path src = base.resolve("src"); - tb.writeJavaFiles(src.resolve("m1"), "module m1 { }"); - tb.writeJavaFiles(src.resolve("m2"), "module m2 { requires m1; }"); + tb.writeJavaFiles(src.resolve("m1x"), "module m1x { }"); + tb.writeJavaFiles(src.resolve("m2x"), "module m2x { requires m1x; }"); Path modules = base.resolve("modules"); Files.createDirectories(modules); new JavacTask(tb) .options("--module-source-path", src.toString()) .outdir(modules) - .files(src.resolve("m2/module-info.java")) + .files(src.resolve("m2x/module-info.java")) .run() .writeAll(); } @@ -134,19 +134,19 @@ @Test public void testImplicitModuleClass(Path base) throws Exception { Path src1 = base.resolve("src1"); - tb.writeJavaFiles(src1.resolve("m1"), "module m1 { }"); + tb.writeJavaFiles(src1.resolve("m1x"), "module m1x { }"); Path modules1 = base.resolve("modules1"); Files.createDirectories(modules1); new JavacTask(tb) .options("--module-source-path", src1.toString()) .outdir(modules1) - .files(src1.resolve("m1/module-info.java")) + .files(src1.resolve("m1x/module-info.java")) .run() .writeAll(); Path src2= base.resolve("src2"); - tb.writeJavaFiles(src2.resolve("m2"), "module m2 { requires m1; }"); + tb.writeJavaFiles(src2.resolve("m2x"), "module m2x { requires m1x; }"); Path modules2 = base.resolve("modules2"); Files.createDirectories(modules2); @@ -154,7 +154,7 @@ .options("--module-path", modules1.toString(), "--module-source-path", src2.toString()) .outdir(modules2) - .files(src2.resolve("m2/module-info.java")) + .files(src2.resolve("m2x/module-info.java")) .run() .writeAll(); }
--- a/test/tools/javac/modules/OpenModulesTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/OpenModulesTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -61,14 +61,14 @@ @Test public void testStrongModule(Path base) throws Exception { - Path m1 = base.resolve("m1"); + Path m1 = base.resolve("m1x"); tb.writeJavaFiles(m1, - "module m1 { exports api1; opens api2; }", + "module m1x { exports api1; opens api2; }", "package api1; public class Api1 {}", "package api2; public class Api2 {}", "package impl; public class Impl {}"); Path classes = base.resolve("classes"); - Path m1Classes = classes.resolve("m1"); + Path m1Classes = classes.resolve("m1x"); tb.createDirectories(m1Classes); String log = new JavacTask(tb) @@ -87,9 +87,10 @@ .run() .writeAll() .getOutput(OutputKind.DIRECT) - .replace(System.getProperty("line.separator"), "\n"); + .replace(System.getProperty("line.separator"), "\n") + .replaceAll("@[^;]*;", ";"); - String expected = "module m1 {\n" + + String expected = "module m1x {\n" + " requires java.base;\n" + " exports api1;\n" + " opens api2;\n" + @@ -100,11 +101,11 @@ } //compiling against a strong module read from binary: - Path m2 = base.resolve("m2"); + Path m2 = base.resolve("m2x"); tb.writeJavaFiles(m2, - "module m2 { requires m1; }", + "module m2x { requires m1x; }", "package test; public class Test { api1.Api1 a1; api2.Api2 a2; }"); - Path m2Classes = classes.resolve("m2"); + Path m2Classes = classes.resolve("m2x"); tb.createDirectories(m2Classes); List<String> log2 = new JavacTask(tb) @@ -124,14 +125,14 @@ @Test public void testOpenModule(Path base) throws Exception { - Path m1 = base.resolve("m1"); + Path m1 = base.resolve("m1x"); tb.writeJavaFiles(m1, - "open module m1 { exports api1; }", + "open module m1x { exports api1; }", "package api1; public class Api1 {}", "package api2; public class Api2 {}", "package impl; public class Impl {}"); Path classes = base.resolve("classes"); - Path m1Classes = classes.resolve("m1"); + Path m1Classes = classes.resolve("m1x"); tb.createDirectories(m1Classes); String log = new JavacTask(tb) @@ -150,9 +151,10 @@ .run() .writeAll() .getOutput(OutputKind.DIRECT) - .replace(System.getProperty("line.separator"), "\n"); + .replace(System.getProperty("line.separator"), "\n") + .replaceAll("@[^;]*;", ";"); - String expected = "open module m1 {\n" + + String expected = "open module m1x {\n" + " requires java.base;\n" + " exports api1;\n" + "}"; @@ -162,11 +164,11 @@ } //compiling against a ordinary module read from binary: - Path m2 = base.resolve("m2"); + Path m2 = base.resolve("m2x"); tb.writeJavaFiles(m2, - "module m2 { requires m1; }", + "module m2x { requires m1x; }", "package test; public class Test { api1.Api1 a1; api2.Api2 a2; }"); - Path m2Classes = classes.resolve("m2"); + Path m2Classes = classes.resolve("m2x"); tb.createDirectories(m2Classes); List<String> log2 = new JavacTask(tb) @@ -186,14 +188,14 @@ @Test public void testOpenModuleNoOpens(Path base) throws Exception { - Path m1 = base.resolve("m1"); + Path m1 = base.resolve("m1x"); tb.writeJavaFiles(m1, - "open module m1 { exports api1; opens api2; }", + "open module m1x { exports api1; opens api2; }", "package api1; public class Api1 {}", "package api2; public class Api2 {}", "package impl; public class Impl {}"); Path classes = base.resolve("classes"); - Path m1Classes = classes.resolve("m1"); + Path m1Classes = classes.resolve("m1x"); tb.createDirectories(m1Classes); List<String> log = new JavacTask(tb) @@ -204,7 +206,7 @@ .writeAll() .getOutputLines(Task.OutputKind.DIRECT); - List<String> expected = Arrays.asList("module-info.java:1:32: compiler.err.no.opens.unless.strong", + List<String> expected = Arrays.asList("module-info.java:1:33: compiler.err.no.opens.unless.strong", "1 error"); if (!expected.equals(log)) @@ -214,12 +216,12 @@ @Test public void testNonZeroOpensInOpen(Path base) throws Exception { - Path m1 = base.resolve("m1"); + Path m1 = base.resolve("m1x"); tb.writeJavaFiles(m1, - "module m1 { opens api; }", + "module m1x { opens api; }", "package api; public class Api {}"); Path classes = base.resolve("classes"); - Path m1Classes = classes.resolve("m1"); + Path m1Classes = classes.resolve("m1x"); tb.createDirectories(m1Classes); new JavacTask(tb) @@ -235,6 +237,7 @@ Module_attribute newModule = new Module_attribute(module.attribute_name_index, module.module_name, module.module_flags | Module_attribute.ACC_OPEN, + module.module_version_index, module.requires, module.exports, module.opens, @@ -270,14 +273,17 @@ List<String> log = new JavacTask(tb) .options("-XDrawDiagnostics", "--module-path", classes.toString(), - "--add-modules", "m1") + "--add-modules", "m1x") .outdir(testClasses) .files(findJavaFiles(test)) .run(Expect.FAIL) .writeAll() .getOutputLines(Task.OutputKind.DIRECT); - List<String> expected = Arrays.asList("- compiler.err.cant.access: m1.module-info, (compiler.misc.bad.class.file.header: module-info.class, (compiler.misc.module.non.zero.opens: m1))", + List<String> expected = Arrays.asList( + "- compiler.err.cant.access: m1x.module-info, " + + "(compiler.misc.bad.class.file.header: module-info.class, " + + "(compiler.misc.module.non.zero.opens: m1x))", "1 error"); if (!expected.equals(log))
--- a/test/tools/javac/modules/OutputDirTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/OutputDirTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -100,7 +100,7 @@ public void testExplodedOutDir(Path base) throws Exception { Path modSrc = base.resolve("modSrc"); tb.writeJavaFiles(modSrc, - "module m1 { exports p; }", + "module m1x { exports p; }", "package p; public class CC { }"); Path modClasses = base.resolve("modClasses"); Files.createDirectories(modClasses); @@ -114,7 +114,7 @@ Path src = base.resolve("src"); Path src_m = src.resolve("m"); tb.writeJavaFiles(src_m, - "module m { requires m1 ; }", + "module m { requires m1x ; }", "class C { }"); String log = new JavacTask(tb, Task.Mode.CMDLINE) @@ -134,7 +134,7 @@ public void testInExplodedOutDir(Path base) throws Exception { Path modSrc = base.resolve("modSrc"); tb.writeJavaFiles(modSrc, - "module m1 { exports p; }", + "module m1x { exports p; }", "package p; public class CC { }"); Path modClasses = base.resolve("modClasses"); Files.createDirectories(modClasses); @@ -147,7 +147,7 @@ Path src = base.resolve("src"); tb.writeJavaFiles(src, - "module m { requires m1 ; }", + "module m { requires m1x ; }", "class C { }"); Path classes = modClasses.resolve("m");
--- a/test/tools/javac/modules/PackageConflictTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/PackageConflictTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -40,7 +40,6 @@ import toolbox.JavacTask; import toolbox.ModuleBuilder; import toolbox.Task; -import toolbox.ToolBox; public class PackageConflictTest extends ModuleTestBase { public static void main(String... args) throws Exception { @@ -70,13 +69,13 @@ @Test public void testDisjoint(Path base) throws Exception { - Path m1 = base.resolve("m1"); - Path m2 = base.resolve("m2"); + Path m1 = base.resolve("m1x"); + Path m2 = base.resolve("m2x"); tb.writeJavaFiles(m1, - "module m1 { }", + "module m1x { }", "package test; public class A { }"); tb.writeJavaFiles(m2, - "module m2 { }", + "module m2x { }", "package test; public class B { }"); Path classes = base.resolve("classes"); Files.createDirectories(classes); @@ -91,17 +90,17 @@ @Test public void testConflictInDependencies(Path base) throws Exception { - Path m1 = base.resolve("m1"); - Path m2 = base.resolve("m2"); - Path m3 = base.resolve("m3"); + Path m1 = base.resolve("m1x"); + Path m2 = base.resolve("m2x"); + Path m3 = base.resolve("m3x"); tb.writeJavaFiles(m1, - "module m1 { exports test; }", + "module m1x { exports test; }", "package test; public class A { }"); tb.writeJavaFiles(m2, - "module m2 { exports test; }", + "module m2x { exports test; }", "package test; public class B { }"); tb.writeJavaFiles(m3, - "module m3 { requires m1; requires m2; }", + "module m3x { requires m1x; requires m2x; }", "package impl; public class Impl { }"); Path classes = base.resolve("classes"); Files.createDirectories(classes); @@ -115,7 +114,7 @@ .getOutputLines(Task.OutputKind.DIRECT); List<String> expected = - Arrays.asList("module-info.java:1:1: compiler.err.package.clash.from.requires: m3, test, m1, m2", + Arrays.asList("module-info.java:1:1: compiler.err.package.clash.from.requires: m3x, test, m1x, m2x", "1 error"); if (!expected.equals(log)) {
--- a/test/tools/javac/modules/PackageMultipleModules.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/PackageMultipleModules.java Fri Dec 16 08:17:55 2016 +0000 @@ -49,14 +49,14 @@ @Test public void testSimple(Path base) throws Exception { - Path m1 = base.resolve("m1"); - Path m2 = base.resolve("m2"); + Path m1 = base.resolve("m1x"); + Path m2 = base.resolve("m2x"); tb.writeJavaFiles(m1, - "module m1 {}", + "module m1x {}", "package test; import test.B; public class A {}", "package test; public class A1 extends A {}"); tb.writeJavaFiles(m2, - "module m2 {}", + "module m2x {}", "package test; import test.A; public class B {}", "package test; public class B1 extends B {}"); Path classes = base.resolve("classes");
--- a/test/tools/javac/modules/PluginsInModulesTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/PluginsInModulesTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -39,7 +39,6 @@ import toolbox.JavacTask; import toolbox.Task; -import toolbox.ToolBox; public class PluginsInModulesTest extends ModuleTestBase { @@ -48,7 +47,7 @@ } private static final String pluginModule1 = - "module pluginMod1 {\n" + + "module pluginMod1x {\n" + " requires jdk.compiler;\n" + "\n" + " provides com.sun.source.util.Plugin\n" + @@ -95,7 +94,7 @@ void initialization(Path base) throws Exception { moduleSrc = base.resolve("plugin_mods_src"); - Path pluginMod1 = moduleSrc.resolve("pluginMod1"); + Path pluginMod1 = moduleSrc.resolve("pluginMod1x"); processorCompiledModules = base.resolve("mods");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/modules/PoorChoiceForModuleNameTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8160181 + * @summary Add lint warning for digits in module names + * @library /tools/lib + * @modules + * jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.code + * jdk.compiler/com.sun.tools.javac.main + * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase + * @run main PoorChoiceForModuleNameTest + */ + + +import java.nio.file.Path; + +import toolbox.JavacTask; +import toolbox.Task; + +public class PoorChoiceForModuleNameTest extends ModuleTestBase { + + public static void main(String... args) throws Exception { + new PoorChoiceForModuleNameTest().runTests(); + } + + @Test + public void testDigitsInModuleNames(Path base) throws Exception { + + Path src = base.resolve("src"); + + // Nitpickable module name + Path src_m1 = src.resolve("mango19"); + tb.writeJavaFiles(src_m1, "module mango19 { }"); + + // Acceptable module name. + Path src_m2 = src.resolve("mango20kg"); + tb.writeJavaFiles(src_m2, "module mango20kg { }"); + + // Nitpickable, but should not due to annotation. + Path src_m3 = src.resolve("mango100"); + tb.writeJavaFiles(src_m3, "@SuppressWarnings(\"module\") module mango100 { }"); + + Path classes = base.resolve("classes"); + tb.createDirectories(classes); + + String log = new JavacTask(tb) + .options("-XDrawDiagnostics", + "-Xlint:module", + "-Werror", + "--module-source-path", src.toString()) + .outdir(classes) + .files(findJavaFiles(src)) + .run(Task.Expect.FAIL) + .writeAll() + .getOutput(Task.OutputKind.DIRECT); + + if (!log.contains("module-info.java:1:8: compiler.warn.poor.choice.for.module.name: mango19") || + !log.contains("- compiler.err.warnings.and.werror") || + !log.contains("1 error") || + !log.contains("1 warning")) + throw new Exception("expected output not found: " + log); + } +} +
--- a/test/tools/javac/modules/ProvidesTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/ProvidesTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -68,11 +68,11 @@ @Test public void testMulti(Path base) throws Exception { Path src = base.resolve("src"); - tb.writeJavaFiles(src.resolve("m1"), - "module m1 { exports p1; }", + tb.writeJavaFiles(src.resolve("m1x"), + "module m1x { exports p1; }", "package p1; public class C1 { }"); - tb.writeJavaFiles(src.resolve("m2"), - "module m2 { requires m1; provides p1.C1 with p2.C2; }", + tb.writeJavaFiles(src.resolve("m2x"), + "module m2x { requires m1x; provides p1.C1 with p2.C2; }", "package p2; public class C2 extends p1.C1 { }"); Path modules = base.resolve("modules"); Files.createDirectories(modules);
--- a/test/tools/javac/modules/QueryBeforeEnter.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/QueryBeforeEnter.java Fri Dec 16 08:17:55 2016 +0000 @@ -77,17 +77,17 @@ @Test public void testUnnamed(Path base) throws Exception { Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m1x"); tb.writeJavaFiles(m1, - "module m1 { exports m1; }", - "package m1; public class M1 {}"); + "module m1x { exports m1x; }", + "package m1x; public class M1 {}"); - Path m2 = moduleSrc.resolve("m2"); + Path m2 = moduleSrc.resolve("m2x"); tb.writeJavaFiles(m2, - "module m2 { exports m2; }", - "package m2; public class M2 {}"); + "module m2x { exports m2x; }", + "package m2x; public class M2 {}"); Path modulePath = base.resolve("module-path"); @@ -138,32 +138,32 @@ fm.getJavaFileObjects(src.resolve("test").resolve("Test2.java"))); assertNotNull(task.getElements().getTypeElement("java.lang.String")); assertNotNull(task.getElements().getTypeElement("javax.tools.ToolProvider")); - assertNull(task.getElements().getTypeElement("m1.M1")); - assertNull(task.getElements().getTypeElement("m2.M2")); + assertNull(task.getElements().getTypeElement("m1x.M1")); + assertNull(task.getElements().getTypeElement("m2x.M2")); assertNotNull(task.getElements().getTypeElement("cp.CP")); assertNotNull(task.getElements().getTypeElement("test.Test1")); assertNotNull(task.getElements().getTypeElement("test.Test2")); assertNotNull(task.getElements().getModuleElement("java.base")); assertNotNull(task.getElements().getModuleElement("java.compiler")); - assertNull(task.getElements().getModuleElement("m1")); - assertNull(task.getElements().getModuleElement("m2")); + assertNull(task.getElements().getModuleElement("m1x")); + assertNull(task.getElements().getModuleElement("m2x")); } } @Test public void testSingleNamed(Path base) throws Exception { Path moduleSrc = base.resolve("module-src"); - Path m1 = moduleSrc.resolve("m1"); + Path m1 = moduleSrc.resolve("m1x"); tb.writeJavaFiles(m1, - "module m1 { exports m1; }", - "package m1; public class M1 {}"); + "module m1x { exports m1x; }", + "package m1x; public class M1 {}"); - Path m2 = moduleSrc.resolve("m2"); + Path m2 = moduleSrc.resolve("m2x"); tb.writeJavaFiles(m2, - "module m2 { exports m2; }", - "package m2; public class M2 {}"); + "module m2x { exports m2x; }", + "package m2x; public class M2 {}"); Path modulePath = base.resolve("module-path"); @@ -194,7 +194,7 @@ Path src = base.resolve("src"); tb.writeJavaFiles(src, - "module test { requires java.base; requires m1; } ", + "module test { requires java.base; requires m1x; } ", "package test; public class Test {}"); Path out = base.resolve("out"); @@ -214,13 +214,13 @@ fm.getJavaFileObjects(findJavaFiles(src))); assertNotNull(task.getElements().getTypeElement("java.lang.String")); assertNull(task.getElements().getTypeElement("javax.tools.ToolProvider")); - assertNotNull(task.getElements().getTypeElement("m1.M1")); - assertNull(task.getElements().getTypeElement("m2.M2")); + assertNotNull(task.getElements().getTypeElement("m1x.M1")); + assertNull(task.getElements().getTypeElement("m2x.M2")); assertNotNull(task.getElements().getTypeElement("test.Test")); assertNotNull(task.getElements().getModuleElement("java.base")); assertNull(task.getElements().getModuleElement("java.compiler")); - assertNotNull(task.getElements().getModuleElement("m1")); - assertNull(task.getElements().getModuleElement("m2")); + assertNotNull(task.getElements().getModuleElement("m1x")); + assertNull(task.getElements().getModuleElement("m2x")); assertNotNull(task.getElements().getModuleElement("test")); } } @@ -228,17 +228,17 @@ @Test public void testMultiModule(Path base) throws Exception { Path modulePathSrc = base.resolve("module-path-src"); - Path m1 = modulePathSrc.resolve("m1"); + Path m1 = modulePathSrc.resolve("m1x"); tb.writeJavaFiles(m1, - "module m1 { exports m1; }", - "package m1; public class M1 {}"); + "module m1x { exports m1x; }", + "package m1x; public class M1 {}"); - Path m2 = modulePathSrc.resolve("m2"); + Path m2 = modulePathSrc.resolve("m2x"); tb.writeJavaFiles(m2, - "module m2 { exports m2; }", - "package m2; public class M2 {}"); + "module m2x { exports m2x; }", + "package m2x; public class M2 {}"); Path modulePath = base.resolve("module-path"); @@ -267,17 +267,17 @@ .writeAll(); Path moduleSrc = base.resolve("module-src"); - Path m3 = moduleSrc.resolve("m3"); + Path m3 = moduleSrc.resolve("m3x"); tb.writeJavaFiles(m3, - "module m3 { requires m1; exports m3; }", - "package m3; public class M3 { }"); + "module m3x { requires m1x; exports m3x; }", + "package m3x; public class M3 { }"); - Path m4 = moduleSrc.resolve("m4"); + Path m4 = moduleSrc.resolve("m4x"); tb.writeJavaFiles(m4, - "module m4 { exports m4; }", - "package m4; public class M4 {}"); + "module m4x { exports m4x; }", + "package m4x; public class M4 {}"); Path out = base.resolve("out"); @@ -297,16 +297,16 @@ fm.getJavaFileObjects(findJavaFiles(moduleSrc))); assertNotNull(task.getElements().getTypeElement("java.lang.String")); assertNull(task.getElements().getTypeElement("javax.tools.ToolProvider")); - assertNotNull(task.getElements().getTypeElement("m1.M1")); - assertNull(task.getElements().getTypeElement("m2.M2")); - assertNotNull(task.getElements().getTypeElement("m3.M3")); - assertNotNull(task.getElements().getTypeElement("m4.M4")); + assertNotNull(task.getElements().getTypeElement("m1x.M1")); + assertNull(task.getElements().getTypeElement("m2x.M2")); + assertNotNull(task.getElements().getTypeElement("m3x.M3")); + assertNotNull(task.getElements().getTypeElement("m4x.M4")); assertNotNull(task.getElements().getModuleElement("java.base")); assertNull(task.getElements().getModuleElement("java.compiler")); - assertNotNull(task.getElements().getModuleElement("m1")); - assertNull(task.getElements().getModuleElement("m2")); - assertNotNull(task.getElements().getModuleElement("m3")); - assertNotNull(task.getElements().getModuleElement("m4")); + assertNotNull(task.getElements().getModuleElement("m1x")); + assertNull(task.getElements().getModuleElement("m2x")); + assertNotNull(task.getElements().getModuleElement("m3x")); + assertNotNull(task.getElements().getModuleElement("m4x")); } }
--- a/test/tools/javac/modules/RequiresStaticTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/RequiresStaticTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -146,19 +146,19 @@ /* * Set up the following module graph - * m1 -> m2 => m3 -=-> m4 --> m5 + * m1x -> m2x => m3x -=-> m4x --> m5 * \ / * \ / * v v - * m6 => m7 --> m8 + * m6x => m7x --> m8 * where -> is requires, => is requires transitive, --> is requires static, -=-> is requires transitive static */ Path getComplexSrc(Path base, String m1_extraImports, String m1_extraUses) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { requires m2; }", + "module m1x { requires m2x; }", "package p1;\n" + "import p2.C2;\n" + "import p3.C3;\n" @@ -169,49 +169,49 @@ + m1_extraUses + "}\n"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 {\n" - + " requires transitive m3;\n" - + " requires static m6;\n" + "module m2x {\n" + + " requires transitive m3x;\n" + + " requires static m6x;\n" + " exports p2;\n" + "}", "package p2;\n" + "public class C2 {p7.C7 c7; p6.C6 c6; p4.C4 c4;}\n"); - Path src_m3 = src.resolve("m3"); + Path src_m3 = src.resolve("m3x"); tb.writeJavaFiles(src_m3, - "module m3 { requires transitive static m4; exports p3; }", + "module m3x { requires transitive static m4x; exports p3; }", "package p3;\n" + "public class C3 { }\n"); - Path src_m4 = src.resolve("m4"); + Path src_m4 = src.resolve("m4x"); tb.writeJavaFiles(src_m4, - "module m4 { requires m5; requires static m6; exports p4; }", + "module m4x { requires m5x; requires static m6x; exports p4; }", "package p4;\n" + "public class C4 { p6.C6 c6; p7.C7 c7;}\n"); - Path src_m5 = src.resolve("m5"); + Path src_m5 = src.resolve("m5x"); tb.writeJavaFiles(src_m5, - "module m5 { exports p5; }", + "module m5x { exports p5; }", "package p5;\n" + "public class C5 { }\n"); - Path src_m6 = src.resolve("m6"); + Path src_m6 = src.resolve("m6x"); tb.writeJavaFiles(src_m6, - "module m6 { requires transitive m7; exports p6; }", + "module m6x { requires transitive m7x; exports p6; }", "package p6;\n" + "public class C6 { p7.C7 c7; }\n"); - Path src_m7 = src.resolve("m7"); + Path src_m7 = src.resolve("m7x"); tb.writeJavaFiles(src_m7, - "module m7 { requires static m8; exports p7; }", + "module m7x { requires static m8x; exports p7; }", "package p7;\n" + "public class C7 { p8.C8 c8; }\n"); - Path src_m8 = src.resolve("m8"); + Path src_m8 = src.resolve("m8x"); tb.writeJavaFiles(src_m8, - "module m8 { exports p8; }", + "module m8x { exports p8; }", "package p8;\n" + "public class C8 { }\n"); @@ -221,14 +221,14 @@ @Test public void testRequiresStatic(Path base) throws Exception { Path src = base.resolve("src"); - Path m1 = src.resolve("m1"); + Path m1 = src.resolve("m1x"); tb.writeJavaFiles(m1, - "module m1 { exports m1; }", - "package m1;" + + "module m1x { exports m1x; }", + "package m1x;" + "public class Api { }\n"); Path classes = base.resolve("classes"); - Path m1Classes = classes.resolve("m1"); + Path m1Classes = classes.resolve("m1x"); Files.createDirectories(m1Classes); new JavacTask(tb, Task.Mode.CMDLINE) @@ -237,25 +237,25 @@ .run() .writeAll(); - Path m3 = src.resolve("m3"); + Path m3 = src.resolve("m3x"); tb.writeJavaFiles(m3, - "module m3 { requires static m1; }", - "package m3;\n" + + "module m3x { requires static m1x; }", + "package m3x;\n" + "public class Test {\n" + " public static void main(String... args) {\n" + " try {\n" + - " Class.forName(\"m1.Api\");\n" + + " Class.forName(\"m1x.Api\");\n" + " } catch (ClassNotFoundException e) {\n" + " System.err.println(\"ok\");\n" + " }\n" + " }\n" + "}", - "package m3;\n" + + "package m3x;\n" + "public class ApiUse{\n" + - " m1.Api api;\n" + + " m1x.Api api;\n" + "}"); - Path m3Classes = classes.resolve("m3"); + Path m3Classes = classes.resolve("m3x"); Files.createDirectories(m3Classes); new JavacTask(tb, Task.Mode.CMDLINE) @@ -266,8 +266,8 @@ .writeAll(); String log = new JavaTask(tb) - .vmOptions("--module-path", m3Classes.toString(), "--add-modules", "m3") - .className("m3.Test") + .vmOptions("--module-path", m3Classes.toString(), "--add-modules", "m3x") + .className("m3x.Test") .run() .writeAll() .getOutput(OutputKind.STDERR); @@ -282,14 +282,14 @@ @Test public void testRequiresTransitiveStatic(Path base) throws Exception { Path src = base.resolve("src"); - Path m1 = src.resolve("m1"); + Path m1 = src.resolve("m1x"); tb.writeJavaFiles(m1, - "module m1 { exports m1; }", - "package m1;" + + "module m1x { exports m1x; }", + "package m1x;" + "public class Api { }\n"); Path classes = base.resolve("classes"); - Path m1Classes = classes.resolve("m1"); + Path m1Classes = classes.resolve("m1x"); Files.createDirectories(m1Classes); new JavacTask(tb, Task.Mode.CMDLINE) @@ -298,11 +298,11 @@ .run() .writeAll(); - Path m2 = src.resolve("m2"); + Path m2 = src.resolve("m2x"); tb.writeJavaFiles(m2, - "module m2 { requires transitive static m1; }"); + "module m2x { requires transitive static m1x; }"); - Path m2Classes = classes.resolve("m2"); + Path m2Classes = classes.resolve("m2x"); Files.createDirectories(m2Classes); new JavacTask(tb, Task.Mode.CMDLINE) @@ -312,25 +312,25 @@ .run() .writeAll(); - Path m3 = src.resolve("m3"); + Path m3 = src.resolve("m3x"); tb.writeJavaFiles(m3, - "module m3 { requires m2; }", - "package m3;\n" + + "module m3x { requires m2x; }", + "package m3x;\n" + "public class Test {\n" + " public static void main(String... args) {\n" + " try {\n" + - " Class.forName(\"m1.Api\");\n" + + " Class.forName(\"m1x.Api\");\n" + " } catch (ClassNotFoundException e) {\n" + " System.err.println(\"ok\");\n" + " }\n" + " }\n" + "}", - "package m3;\n" + + "package m3x;\n" + "public class ApiUse{\n" + - " m1.Api api;\n" + + " m1x.Api api;\n" + "}"); - Path m3Classes = classes.resolve("m3"); + Path m3Classes = classes.resolve("m3x"); Files.createDirectories(m3Classes); new JavacTask(tb, Task.Mode.CMDLINE) @@ -342,8 +342,8 @@ String log = new JavaTask(tb) .vmOptions("--module-path", m2Classes.toString() + File.pathSeparator + m3Classes.toString(), - "--add-modules", "m3") - .className("m3.Test") + "--add-modules", "m3x") + .className("m3x.Test") .run() .writeAll() .getOutput(OutputKind.STDERR); @@ -358,14 +358,14 @@ @Test public void testRequiresStaticTransitive(Path base) throws Exception { Path src = base.resolve("src"); - Path m1 = src.resolve("m1"); + Path m1 = src.resolve("m1x"); tb.writeJavaFiles(m1, - "module m1 { exports m1; }", - "package m1;" + + "module m1x { exports m1x; }", + "package m1x;" + "public class Api { }\n"); Path classes = base.resolve("classes"); - Path m1Classes = classes.resolve("m1"); + Path m1Classes = classes.resolve("m1x"); Files.createDirectories(m1Classes); new JavacTask(tb, Task.Mode.CMDLINE) @@ -374,11 +374,11 @@ .run() .writeAll(); - Path m2 = src.resolve("m2"); + Path m2 = src.resolve("m2x"); tb.writeJavaFiles(m2, - "module m2 { requires transitive static m1; }"); + "module m2x { requires transitive static m1x; }"); - Path m2Classes = classes.resolve("m2"); + Path m2Classes = classes.resolve("m2x"); Files.createDirectories(m2Classes); new JavacTask(tb, Task.Mode.CMDLINE)
--- a/test/tools/javac/modules/RequiresTransitiveTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/RequiresTransitiveTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -140,16 +140,16 @@ /* * Set up the following module graph - * m1 -> m2 => m3 => m4 -> m5 - * -> m6 => m7 + * m1x -> m2x => m3x => m4x -> m5x + * -> m6x => m7x * where -> is requires, => is requires transitive */ Path getComplexSrc(Path base, String m1_extraImports, String m1_extraUses) throws Exception { Path src = base.resolve("src"); - Path src_m1 = src.resolve("m1"); + Path src_m1 = src.resolve("m1x"); tb.writeJavaFiles(src_m1, - "module m1 { requires m2; }", + "module m1x { requires m2x; }", "package p1;\n" + "import p2.C2;\n" + "import p3.C3;\n" @@ -160,43 +160,43 @@ + m1_extraUses + "}\n"); - Path src_m2 = src.resolve("m2"); + Path src_m2 = src.resolve("m2x"); tb.writeJavaFiles(src_m2, - "module m2 {\n" - + " requires transitive m3;\n" - + " requires m6;\n" + "module m2x {\n" + + " requires transitive m3x;\n" + + " requires m6x;\n" + " exports p2;\n" + "}", "package p2;\n" + "public class C2 { }\n"); - Path src_m3 = src.resolve("m3"); + Path src_m3 = src.resolve("m3x"); tb.writeJavaFiles(src_m3, - "module m3 { requires transitive m4; exports p3; }", + "module m3x { requires transitive m4x; exports p3; }", "package p3;\n" + "public class C3 { }\n"); - Path src_m4 = src.resolve("m4"); + Path src_m4 = src.resolve("m4x"); tb.writeJavaFiles(src_m4, - "module m4 { requires m5; exports p4; }", + "module m4x { requires m5x; exports p4; }", "package p4;\n" + "public class C4 { }\n"); - Path src_m5 = src.resolve("m5"); + Path src_m5 = src.resolve("m5x"); tb.writeJavaFiles(src_m5, - "module m5 { exports p5; }", + "module m5x { exports p5; }", "package p5;\n" + "public class C5 { }\n"); - Path src_m6 = src.resolve("m6"); + Path src_m6 = src.resolve("m6x"); tb.writeJavaFiles(src_m6, - "module m6 { requires transitive m7; exports p6; }", + "module m6x { requires transitive m7x; exports p6; }", "package p6;\n" + "public class C6 { }\n"); - Path src_m7 = src.resolve("m7"); + Path src_m7 = src.resolve("m7x"); tb.writeJavaFiles(src_m7, - "module m7 { exports p7; }", + "module m7x { exports p7; }", "package p7;\n" + "public class C7 { }\n");
--- a/test/tools/javac/modules/ResolveTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/ResolveTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -36,7 +36,6 @@ import toolbox.JavacTask; import toolbox.Task; -import toolbox.ToolBox; public class ResolveTest extends ModuleTestBase { public static void main(String... args) throws Exception { @@ -83,11 +82,11 @@ @Test public void testUnexportedTypeUnreadableModule(Path base) throws Exception { Path src = base.resolve("src"); - tb.writeJavaFiles(src.resolve("m1"), - "module m1 { }", + tb.writeJavaFiles(src.resolve("m1x"), + "module m1x { }", "package p1; public class C1 { }"); - tb.writeJavaFiles(src.resolve("m2"), - "module m2 { }", + tb.writeJavaFiles(src.resolve("m2x"), + "module m2x { }", "package p2; public class C2 { p1.C1 c; }"); Path modules = base.resolve("modules"); Files.createDirectories(modules); @@ -107,11 +106,11 @@ @Test public void testUnexportedTypeReadableModule(Path base) throws Exception { Path src = base.resolve("src"); - tb.writeJavaFiles(src.resolve("m1"), - "module m1 { }", + tb.writeJavaFiles(src.resolve("m1x"), + "module m1x { }", "package p1; public class C1 { }"); - tb.writeJavaFiles(src.resolve("m2"), - "module m2 { requires m1; }", + tb.writeJavaFiles(src.resolve("m2x"), + "module m2x { requires m1x; }", "package p2; public class C2 { p1.C1 c; }"); Path modules = base.resolve("modules"); Files.createDirectories(modules); @@ -131,14 +130,14 @@ @Test public void testQualifiedExportedTypeReadableModule(Path base) throws Exception { Path src = base.resolve("src"); - tb.writeJavaFiles(src.resolve("m1"), - "module m1 { exports p1 to m3; }", + tb.writeJavaFiles(src.resolve("m1x"), + "module m1x { exports p1 to m3x; }", "package p1; public class C1 { }"); - tb.writeJavaFiles(src.resolve("m2"), - "module m2 { requires m1; }", + tb.writeJavaFiles(src.resolve("m2x"), + "module m2x { requires m1x; }", "package p2; public class C2 { p1.C1 c; }"); - tb.writeJavaFiles(src.resolve("m3"), - "module m3 { requires m1; }"); + tb.writeJavaFiles(src.resolve("m3x"), + "module m3x { requires m1x; }"); Path modules = base.resolve("modules"); Files.createDirectories(modules); @@ -157,11 +156,11 @@ @Test public void testExportedTypeUnreadableModule(Path base) throws Exception { Path src = base.resolve("src"); - tb.writeJavaFiles(src.resolve("m1"), - "module m1 { exports p1; }", + tb.writeJavaFiles(src.resolve("m1x"), + "module m1x { exports p1; }", "package p1; public class C1 { }"); - tb.writeJavaFiles(src.resolve("m2"), - "module m2 { }", + tb.writeJavaFiles(src.resolve("m2x"), + "module m2x { }", "package p2; public class C2 { p1.C1 c; }"); Path modules = base.resolve("modules"); Files.createDirectories(modules); @@ -181,11 +180,11 @@ @Test public void testExportedTypeReadableModule(Path base) throws Exception { Path src = base.resolve("src"); - tb.writeJavaFiles(src.resolve("m1"), - "module m1 { exports p1; }", + tb.writeJavaFiles(src.resolve("m1x"), + "module m1x { exports p1; }", "package p1; public class C1 { }"); - tb.writeJavaFiles(src.resolve("m2"), - "module m2 { requires m1; }", + tb.writeJavaFiles(src.resolve("m2x"), + "module m2x { requires m1x; }", "package p2; public class C2 { p1.C1 c; }"); Path modules = base.resolve("modules"); Files.createDirectories(modules); @@ -201,11 +200,11 @@ @Test public void testExportedTypeReadableModule2(Path base) throws Exception { Path src = base.resolve("src"); - tb.writeJavaFiles(src.resolve("m1"), - "module m1 { exports p1 to m2; }", + tb.writeJavaFiles(src.resolve("m1x"), + "module m1x { exports p1 to m2x; }", "package p1; public class C1 { }"); - tb.writeJavaFiles(src.resolve("m2"), - "module m2 { requires m1; }", + tb.writeJavaFiles(src.resolve("m2x"), + "module m2x { requires m1x; }", "package p2; public class C2 { p1.C1 c; }"); Path modules = base.resolve("modules"); Files.createDirectories(modules);
--- a/test/tools/javac/modules/ServiceProvidedButNotExportedOrUsedTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/ServiceProvidedButNotExportedOrUsedTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -78,13 +78,13 @@ @Test public void testImplementationMustBeInSameModuleAsProvidesDirective(Path base) throws Exception { Path src = base.resolve("src"); - tb.writeJavaFiles(src.resolve("m1"), - "module m1 { exports p1; }", + tb.writeJavaFiles(src.resolve("m1x"), + "module m1x { exports p1; }", "package p1; public class C1 { }"); - tb.writeJavaFiles(src.resolve("m2"), - "module m2 { requires m1; requires m3; provides p1.C1 with p2.C2; }"); - tb.writeJavaFiles(src.resolve("m3"), - "module m3 { requires m1; exports p2; }", + tb.writeJavaFiles(src.resolve("m2x"), + "module m2x { requires m1x; requires m3x; provides p1.C1 with p2.C2; }"); + tb.writeJavaFiles(src.resolve("m3x"), + "module m3x { requires m1x; exports p2; }", "package p2; public class C2 extends p1.C1 { }"); Path modules = base.resolve("modules"); Files.createDirectories(modules); @@ -97,7 +97,7 @@ .writeAll() .getOutputLines(Task.OutputKind.DIRECT); List<String> expected = Arrays.asList( - "module-info.java:1:39: compiler.err.service.implementation.not.in.right.module: m3", + "module-info.java:1:42: compiler.err.service.implementation.not.in.right.module: m3x", "1 error"); if (!output.containsAll(expected)) { throw new Exception("Expected output not found");
--- a/test/tools/javac/modules/SingleModuleModeTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/SingleModuleModeTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -61,8 +61,8 @@ @Test public void testTooManyModules(Path base) throws Exception { Path src = base.resolve("src"); - tb.writeJavaFiles(src.resolve("m1"), "module m1 { }"); - tb.writeJavaFiles(src.resolve("m2"), "module m2 { }"); + tb.writeJavaFiles(src.resolve("m1x"), "module m1x { }"); + tb.writeJavaFiles(src.resolve("m2x"), "module m2x { }"); String log = new JavacTask(tb) .options("-XDrawDiagnostics")
--- a/test/tools/javac/modules/UpgradeModulePathTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/UpgradeModulePathTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -38,7 +38,6 @@ import toolbox.JavacTask; import toolbox.ModuleBuilder; import toolbox.Task; -import toolbox.ToolBox; public class UpgradeModulePathTest extends ModuleTestBase { @@ -50,19 +49,19 @@ @Test public void simpleUsage(Path base) throws Exception { Path modules = base.resolve("modules"); - new ModuleBuilder(tb, "m1") + new ModuleBuilder(tb, "m1x") .exports("pkg1") .classes("package pkg1; public class E { }") .build(modules); final Path upgradeModules = base.resolve("upgradeModules"); - new ModuleBuilder(tb, "m1") + new ModuleBuilder(tb, "m1x") .exports("pkg2") .classes("package pkg2; public class E { }") .build(upgradeModules); Path src = base.resolve("src"); - tb.writeJavaFiles(src, "module m2 { requires m1; }", + tb.writeJavaFiles(src, "module m2x { requires m1x; }", "package p; class A { void main() { pkg2.E.class.getName(); } }"); new JavacTask(tb, Task.Mode.CMDLINE) @@ -76,19 +75,19 @@ @Test public void onlyUpgradeModulePath(Path base) throws Exception { final Path module = base.resolve("modules"); - new ModuleBuilder(tb, "m1") + new ModuleBuilder(tb, "m1x") .exports("pkg1") .classes("package pkg1; public class E { }") .build(module); final Path upgradeModule = base.resolve("upgradeModule"); - new ModuleBuilder(tb, "m1") + new ModuleBuilder(tb, "m1x") .exports("pkg2") .classes("package pkg2; public class E { }") .build(upgradeModule); Path src = base.resolve("src"); - tb.writeJavaFiles(src, "module m2 { requires m1; }", + tb.writeJavaFiles(src, "module m2x { requires m1x; }", "package p; class A { void main() { pkg2.E.class.getName(); } }"); new JavacTask(tb, Task.Mode.CMDLINE) @@ -101,28 +100,28 @@ @Test public void withModuleSourcePath(Path base) throws Exception { final Path module = base.resolve("modules"); - new ModuleBuilder(tb, "m1") + new ModuleBuilder(tb, "m1x") .exports("pkg1") .classes("package pkg1; public class E { }") .build(module); final Path upgradeModule = base.resolve("upgradeModule"); - new ModuleBuilder(tb, "m1") + new ModuleBuilder(tb, "m1x") .exports("pkg2") .classes("package pkg2; public class E { }") .build(upgradeModule); final Path s = base.resolve("source"); - tb.writeJavaFiles(s.resolve("m3"), "module m3 { }"); + tb.writeJavaFiles(s.resolve("m3x"), "module m3x { }"); final Path upgradeModule3 = base.resolve("upgradeModule"); - new ModuleBuilder(tb, "m3") + new ModuleBuilder(tb, "m3x") .exports("pkg3") .classes("package pkg3; public class E { }") .build(upgradeModule); Path src = base.resolve("src"); - tb.writeJavaFiles(src.resolve("m2"), "module m2 { requires m1; requires m3; }", + tb.writeJavaFiles(src.resolve("m2x"), "module m2x { requires m1x; requires m3x; }", "package p; class A { void main() { pkg2.E.class.getName(); } }"); new JavacTask(tb, Task.Mode.CMDLINE) @@ -138,19 +137,19 @@ @Test public void sameUpgradeAndModulePath(Path base) throws Exception { final Path module = base.resolve("modules"); - new ModuleBuilder(tb, "m1") + new ModuleBuilder(tb, "m1x") .exports("pkg1") .classes("package pkg1; public class E { }") .build(module); final Path upgradeModule = base.resolve("upgradeModule"); - new ModuleBuilder(tb, "m1") + new ModuleBuilder(tb, "m1x") .exports("pkg2") .classes("package pkg2; public class E { }") .build(upgradeModule); Path src = base.resolve("src"); - tb.writeJavaFiles(src, "module m2 { requires m1; }", + tb.writeJavaFiles(src, "module m2x { requires m1x; }", "package p; class A { void main() { pkg2.E.class.getName(); } }"); new JavacTask(tb, Task.Mode.CMDLINE) @@ -164,7 +163,7 @@ @Test public void dummyFileInUpgradeModulePath(Path base) throws Exception { final Path module = base.resolve("modules"); - new ModuleBuilder(tb, "m1") + new ModuleBuilder(tb, "m1x") .exports("pkg1") .classes("package pkg1; public class E { }") .build(module); @@ -173,7 +172,7 @@ tb.writeFile(dummy, ""); Path src = base.resolve("src"); - tb.writeJavaFiles(src, "module m2 { requires m1; }", + tb.writeJavaFiles(src, "module m2x { requires m1x; }", "package p; class A { void main() { pkg2.E.class.getName(); } }"); String output = new JavacTask(tb, Task.Mode.CMDLINE) @@ -192,28 +191,28 @@ @Test public void severalUpgradeModules(Path base) throws Exception { final Path module = base.resolve("modules"); - new ModuleBuilder(tb, "m1") + new ModuleBuilder(tb, "m1x") .exports("pkg1") .classes("package pkg1; public class A { }") .build(module); - new ModuleBuilder(tb, "m2") + new ModuleBuilder(tb, "m2x") .exports("pkg2") .classes("package pkg2; public class B { }") .build(module); Path upgradeModule = base.resolve("upgradeModule"); - new ModuleBuilder(tb, "m2") + new ModuleBuilder(tb, "m2x") .exports("pkg2") .classes("package pkg2; public class BC { }") .build(upgradeModule); - new ModuleBuilder(tb, "m3") + new ModuleBuilder(tb, "m3x") .exports("pkg3") .classes("package pkg3; public class DC { }") .build(upgradeModule); Path src = base.resolve("src"); - tb.writeJavaFiles(src, "module m4 { requires m1; requires m2; requires m3; }", + tb.writeJavaFiles(src, "module m4x { requires m1x; requires m2x; requires m3x; }", "package p; class A { void main() { pkg1.A.class.getName(); pkg2.BC.class.getName(); pkg3.DC.class.getName(); } }"); new JavacTask(tb, Task.Mode.CMDLINE) @@ -224,7 +223,7 @@ .writeAll(); Path src2 = base.resolve("src2"); - tb.writeJavaFiles(src2, "module m4 { requires m1; }", + tb.writeJavaFiles(src2, "module m4x { requires m1x; }", "package p; class A { void main() { pkg2.B.class.getName(); } }"); String log = new JavacTask(tb, Task.Mode.CMDLINE) @@ -243,25 +242,25 @@ @Test public void severalUpgradeModulePathsLastWin(Path base) throws Exception { final Path module = base.resolve("modules"); - new ModuleBuilder(tb, "m1") + new ModuleBuilder(tb, "m1x") .exports("pkg1") .classes("package pkg1; public class E { }") .build(module); final Path upgradeModule1 = base.resolve("upgradeModule1"); - new ModuleBuilder(tb, "m1") + new ModuleBuilder(tb, "m1x") .exports("pkg2") .classes("package pkg2; public class EC1 { }") .build(upgradeModule1); final Path upgradeModule2 = base.resolve("upgradeModule2"); - new ModuleBuilder(tb, "m1") + new ModuleBuilder(tb, "m1x") .exports("pkg2") .classes("package pkg2; public class EC2 { }") .build(upgradeModule2); Path src = base.resolve("src"); - tb.writeJavaFiles(src, "module m2 { requires m1; }", + tb.writeJavaFiles(src, "module m2x { requires m1x; }", "package p; class A { void main() { pkg2.EC2.class.getName(); } }"); new JavacTask(tb, Task.Mode.CMDLINE) @@ -273,7 +272,7 @@ .writeAll(); Path src2 = base.resolve("src2"); - tb.writeJavaFiles(src2, "module m2 { requires m1; }", + tb.writeJavaFiles(src2, "module m2x { requires m1x; }", "package p; class A { void main() { pkg2.EC1.class.getName(); } }"); final String log = new JavacTask(tb, Task.Mode.CMDLINE)
--- a/test/tools/javac/modules/UsesTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/modules/UsesTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -145,11 +145,11 @@ @Test public void testMulti(Path base) throws Exception { Path src = base.resolve("src"); - tb.writeJavaFiles(src.resolve("m1"), - "module m1 { exports p; }", + tb.writeJavaFiles(src.resolve("m1x"), + "module m1x { exports p; }", "package p; public class C { }"); - tb.writeJavaFiles(src.resolve("m2"), - "module m2 { requires m1; uses p.C; }"); + tb.writeJavaFiles(src.resolve("m2x"), + "module m2x { requires m1x; uses p.C; }"); Path modules = base.resolve("modules"); Files.createDirectories(modules); @@ -165,19 +165,19 @@ public void testMultiOnModulePath(Path base) throws Exception { Path modSrc = base.resolve("modSrc"); Path modules = base.resolve("modules"); - new ModuleBuilder(tb, "m1") + new ModuleBuilder(tb, "m1x") .exports("p") .classes("package p; public class C { }") .build(modules); - new ModuleBuilder(tb, "m2") - .requires("m1") + new ModuleBuilder(tb, "m2x") + .requires("m1x") .uses("p.C") .write(modSrc); new JavacTask(tb) .options("-p", modules.toString()) .outdir(modules) - .files(findJavaFiles(modSrc.resolve("m2"))) + .files(findJavaFiles(modSrc.resolve("m2x"))) .run(Task.Expect.SUCCESS) .writeAll(); } @@ -186,19 +186,19 @@ public void testMultiOnModulePathInner(Path base) throws Exception { Path modSrc = base.resolve("modSrc"); Path modules = base.resolve("modules"); - new ModuleBuilder(tb, "m1") + new ModuleBuilder(tb, "m1x") .exports("p") .classes("package p; public class C { public class Inner { } }") .build(modules); - new ModuleBuilder(tb, "m2") - .requires("m1") + new ModuleBuilder(tb, "m2x") + .requires("m1x") .uses("p.C.Inner") .write(modSrc); new JavacTask(tb) .options("-p", modules.toString()) .outdir(modules) - .files(findJavaFiles(modSrc.resolve("m2"))) + .files(findJavaFiles(modSrc.resolve("m2x"))) .run(Task.Expect.SUCCESS) .writeAll(); } @@ -248,11 +248,11 @@ @Test public void testUsesUnexportedService(Path base) throws Exception { Path src = base.resolve("src"); - tb.writeJavaFiles(src.resolve("m1"), - "module m1 { }", + tb.writeJavaFiles(src.resolve("m1x"), + "module m1x { }", "package p; public class C { }"); - tb.writeJavaFiles(src.resolve("m2"), - "module m2 { requires m1; uses p.C; }"); + tb.writeJavaFiles(src.resolve("m2x"), + "module m2x { requires m1x; uses p.C; }"); List<String> output = new JavacTask(tb) .options("-XDrawDiagnostics", "--module-source-path", src.toString()) @@ -262,7 +262,7 @@ .writeAll() .getOutputLines(Task.OutputKind.DIRECT); - List<String> expected = Arrays.asList("module-info.java:1:32: compiler.err.not.def.access.package.cant.access: p.C, p", + List<String> expected = Arrays.asList("module-info.java:1:34: compiler.err.not.def.access.package.cant.access: p.C, p", "1 error"); if (!output.containsAll(expected)) { throw new Exception("Expected output not found"); @@ -272,11 +272,11 @@ @Test public void testUsesUnexportedButProvidedService(Path base) throws Exception { Path src = base.resolve("src"); - tb.writeJavaFiles(src.resolve("m1"), - "module m1 { provides p.C with p.C; }", + tb.writeJavaFiles(src.resolve("m1x"), + "module m1x { provides p.C with p.C; }", "package p; public class C { }"); - tb.writeJavaFiles(src.resolve("m2"), - "module m2 { requires m1; uses p.C; }"); + tb.writeJavaFiles(src.resolve("m2x"), + "module m2x { requires m1x; uses p.C; }"); List<String> output = new JavacTask(tb) .options("-XDrawDiagnostics", "--module-source-path", src.toString()) @@ -286,7 +286,7 @@ .writeAll() .getOutputLines(Task.OutputKind.DIRECT); - List<String> expected = Arrays.asList("module-info.java:1:32: compiler.err.not.def.access.package.cant.access: p.C, p", + List<String> expected = Arrays.asList("module-info.java:1:34: compiler.err.not.def.access.package.cant.access: p.C, p", "1 error"); if (!output.containsAll(expected)) { throw new Exception("Expected output not found");
--- a/test/tools/javac/profiles/ProfileOptionTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/javac/profiles/ProfileOptionTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -75,7 +75,7 @@ void testInvalidProfile_API() throws Exception { JavaFileObject fo = new StringJavaFileObject("Test.java", "class Test { }"); String badName = "foo"; - List<String> opts = Arrays.asList("-profile", badName); + List<String> opts = Arrays.asList("--release", "8", "-profile", badName); StringWriter sw = new StringWriter(); try { JavacTask task = (JavacTask) javac.getTask(sw, fm, null, opts, null, @@ -89,7 +89,7 @@ @Test void testInvalidProfile_CommandLine() throws Exception { String badName = "foo"; - String[] opts = { "-profile", badName }; + String[] opts = { "--release", "8", "-profile", badName }; StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); int rc = com.sun.tools.javac.Main.compile(opts, pw); @@ -144,10 +144,19 @@ switch (t) { case JDK1_8: - case JDK1_9: if (ise != null) error("unexpected exception from compiler: " + ise); break; + case JDK1_9: + if (p == Profile.DEFAULT) + break; + if (ise == null) + error("IllegalStateException not thrown as expected"); + else if (!ise.getMessage().contains("option -profile " + + "not allowed with target " + t.name)) { + error("exception not thrown as expected: " + ise); + } + break; default: if (p == Profile.DEFAULT) break; @@ -157,6 +166,7 @@ + " is not valid for target release " + t.name)) { error("exception not thrown as expected: " + ise); } + break; } } } @@ -171,7 +181,7 @@ new DiagnosticCollector<JavaFileObject>(); List<String> opts = (p == Profile.DEFAULT) ? Collections.<String>emptyList() - : Arrays.asList("-profile", p.name); + : Arrays.asList("--release", "8", "-profile", p.name); JavacTask task = (JavacTask) javac.getTask(null, fm, dl, opts, null, Arrays.asList(fo)); task.analyze(); @@ -203,9 +213,12 @@ init(Profile.COMPACT2, javax.xml.XMLConstants.class); + //init(Profile.COMPACT3, + // javax.sql.rowset.Predicate.class, + // com.sun.security.auth.PolicyFile.class); // specifically included in 3 + init(Profile.COMPACT3, - javax.sql.rowset.Predicate.class, - com.sun.security.auth.PolicyFile.class); // specifically included in 3 + javax.sql.rowset.Predicate.class); init(Profile.DEFAULT, java.beans.BeanInfo.class);
--- a/test/tools/jdeps/modules/CheckModuleTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/jdeps/modules/CheckModuleTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -52,9 +52,9 @@ private static final Path SRC_DIR = Paths.get(TEST_SRC, "src"); private static final Path MODS_DIR = Paths.get("mods"); - // m4 and m5 are analyzed. Others are compiled to make sure they are present + // mIV and mV are analyzed. Others are compiled to make sure they are present // on the module path for analysis - private static final Set<String> modules = Set.of("unsafe", "m4", "m5", "mVI", "mVII", "m8"); + private static final Set<String> modules = Set.of("unsafe", "mIV", "mV", "mVI", "mVII", "mVIII"); private static final String JAVA_BASE = "java.base"; @@ -97,39 +97,39 @@ @DataProvider(name = "modules") public Object[][] unnamed() { return new Object[][]{ - { "m4", new ModuleMetaData[] { + { "mIV", new ModuleMetaData[] { // original - new ModuleMetaData("m4") + new ModuleMetaData("mIV") .requiresTransitive("java.compiler") .requires("java.logging") // unnused exports .exports("p4.internal", Set.of("mVI", "mVII")), // suggested version - new ModuleMetaData("m4") + new ModuleMetaData("mIV") .requires("java.compiler"), // reduced version - new ModuleMetaData("m4") + new ModuleMetaData("mIV") .requires("java.compiler") } }, - { "m5", new ModuleMetaData[] { + { "mV", new ModuleMetaData[] { // original - new ModuleMetaData("m5") + new ModuleMetaData("mV") .requiresTransitive("java.compiler") .requiresTransitive("java.logging") .requires("java.sql") - .requiresTransitive("m4"), + .requiresTransitive("mIV"), // suggested version - new ModuleMetaData("m5") + new ModuleMetaData("mV") .requiresTransitive("java.compiler") .requires("java.logging") .requiresTransitive("java.sql") - .requiresTransitive("m4"), + .requiresTransitive("mIV"), // reduced version - new ModuleMetaData("m5") + new ModuleMetaData("mV") .requiresTransitive("java.compiler") .requiresTransitive("java.sql") - .requiresTransitive("m4"), + .requiresTransitive("mIV"), } }, };
--- a/test/tools/jdeps/modules/InverseDeps.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/jdeps/modules/InverseDeps.java Fri Dec 16 08:17:55 2016 +0000 @@ -61,7 +61,7 @@ private static final Path LIBS_DIR = Paths.get("libs"); private static final Set<String> modules = new LinkedHashSet( - List.of("unsafe", "m4", "m5", "mVI", "mVII") + List.of("unsafe", "mIV", "mV", "mVI", "mVII") ); /** @@ -93,18 +93,18 @@ return new Object[][] { // --require and result { "java.sql", new String[][] { - new String[] { "java.sql", "m5" }, + new String[] { "java.sql", "mV" }, } }, { "java.compiler", new String[][] { - new String[] { "java.compiler", "m5" }, - new String[] { "java.compiler", "m4", "m5" }, + new String[] { "java.compiler", "mV" }, + new String[] { "java.compiler", "mIV", "mV" }, } }, { "java.logging", new String[][]{ - new String[] {"java.logging", "m5"}, - new String[] {"java.logging", "m4", "m5"}, - new String[] {"java.logging", "java.sql", "m5"}, + new String[] {"java.logging", "mV"}, + new String[] {"java.logging", "mIV", "mV"}, + new String[] {"java.logging", "java.sql", "mV"}, } }, { "jdk.unsupported", new String[][] { @@ -146,12 +146,12 @@ return new Object[][] { // -package and result { "p4", new String[][] { - new String[] { "m4", "m5"}, + new String[] { "mIV", "mV"}, } }, { "javax.tools", new String[][] { - new String[] {"java.compiler", "m5"}, - new String[] {"java.compiler", "m4", "m5"}, + new String[] {"java.compiler", "mV"}, + new String[] {"java.compiler", "mIV", "mV"}, } }, { "sun.misc", new String[][] { @@ -187,7 +187,7 @@ { "java.util.logging.*|org.safe.Lib", new String[][] { new String[] { "unsafe", "mVII"}, new String[] { "unsafe", "mVI", "mVII"}, - new String[] { "java.logging", "m5"}, + new String[] { "java.logging", "mV"}, } } }; @@ -224,7 +224,7 @@ { "java.util.logging.*|org.safe.Lib", new String[][] { new String[] { "unsafe.jar", "mVII.jar"}, new String[] { "unsafe.jar", "mVI.jar", "mVII.jar"}, - new String[] { "java.logging", "m5.jar"}, + new String[] { "java.logging", "mV.jar"}, } } };
--- a/test/tools/jdeps/modules/ModuleTest.java Thu Dec 15 11:47:25 2016 -0800 +++ b/test/tools/jdeps/modules/ModuleTest.java Fri Dec 16 08:17:55 2016 +0000 @@ -58,7 +58,7 @@ // the names of the modules in this test private static final String UNSUPPORTED = "unsupported"; - private static String[] modules = new String[] {"mI", "mII", "mIII", "m4", UNSUPPORTED}; + private static String[] modules = new String[] {"mI", "mII", "mIII", "mIV", UNSUPPORTED}; /** * Compiles all modules used by the test */ @@ -70,7 +70,7 @@ assertTrue(CompilerUtils.compileModule(SRC_DIR, MODS_DIR, UNSUPPORTED, "--add-exports", "java.base/jdk.internal.perf=" + UNSUPPORTED)); // m4 is not referenced - Arrays.asList("mI", "mII", "mIII", "m4") + Arrays.asList("mI", "mII", "mIII", "mIV") .forEach(mn -> assertTrue(CompilerUtils.compileModule(SRC_DIR, MODS_DIR, mn))); assertTrue(CompilerUtils.compile(SRC_DIR.resolve("mIII"), UNNAMED_DIR, "-p", MODS_DIR.toString()));
--- a/test/tools/jdeps/modules/src/m4/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m4 { - // not used in signature - requires transitive java.compiler; - - // unused dependence - requires java.logging; - - exports p4; - - // unuused qualified exports - exports p4.internal to mVI,mVII; -}
--- a/test/tools/jdeps/modules/src/m4/p4/Lib.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package p4; - -public class Lib { - public static boolean isPresent() { - return true; - } -}
--- a/test/tools/jdeps/modules/src/m4/p4/internal/Impl.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package p4.internal; - -import javax.tools.JavaCompiler; -import javax.tools.ToolProvider; - -public class Impl { - private final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); - - public String name() { - return Impl.class.getName(); - } - -}
--- a/test/tools/jdeps/modules/src/m5/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m5 { - // m4 requires transitive java.compiler - requires transitive m4; - requires transitive java.compiler; - - // java.sql should be requires transitive - requires java.sql; - - // java.logging is used for implementation only - requires transitive java.logging; - - exports p5; - - // m8 is not in the resolved graph but used by m8 - exports p5.internal to m8; -}
--- a/test/tools/jdeps/modules/src/m5/p5/Main.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package p5; - -import java.sql.Driver; -import javax.tools.JavaCompiler; -import javax.tools.ToolProvider; - -public class Main { - public void run(Driver driver) throws Exception { - driver.getParentLogger().config("test"); - - } - - public p4.Lib getLib() { - return new p4.Lib(); - } - - public JavaCompiler getCompiler() { - return ToolProvider.getSystemJavaCompiler(); - } - -}
--- a/test/tools/jdeps/modules/src/m5/p5/internal/T.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package p5.internal; - -public class T { -}
--- a/test/tools/jdeps/modules/src/m8/module-info.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -module m8 { - requires m5; - - // use p5.internal -}
--- a/test/tools/jdeps/modules/src/m8/p8/Main.java Thu Dec 15 11:47:25 2016 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package p8; - -import p5.internal.T; - -public class Main { - public static void main() { - T t = new T(); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/jdeps/modules/src/mIV/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module mIV { + // not used in signature + requires transitive java.compiler; + + // unused dependence + requires java.logging; + + exports p4; + + // unuused qualified exports + exports p4.internal to mVI,mVII; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/jdeps/modules/src/mIV/p4/Lib.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package p4; + +public class Lib { + public static boolean isPresent() { + return true; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/jdeps/modules/src/mIV/p4/internal/Impl.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package p4.internal; + +import javax.tools.JavaCompiler; +import javax.tools.ToolProvider; + +public class Impl { + private final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + + public String name() { + return Impl.class.getName(); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/jdeps/modules/src/mV/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module mV { + // mIV requires transitive java.compiler + requires transitive mIV; + requires transitive java.compiler; + + // java.sql should be requires transitive + requires java.sql; + + // java.logging is used for implementation only + requires transitive java.logging; + + exports p5; + + // m8 is not in the resolved graph but used by mVIII + exports p5.internal to mVIII; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/jdeps/modules/src/mV/p5/Main.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package p5; + +import java.sql.Driver; +import javax.tools.JavaCompiler; +import javax.tools.ToolProvider; + +public class Main { + public void run(Driver driver) throws Exception { + driver.getParentLogger().config("test"); + + } + + public p4.Lib getLib() { + return new p4.Lib(); + } + + public JavaCompiler getCompiler() { + return ToolProvider.getSystemJavaCompiler(); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/jdeps/modules/src/mV/p5/internal/T.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package p5.internal; + +public class T { +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/jdeps/modules/src/mVIII/module-info.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module mVIII { + requires mV; + + // use p5.internal +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/jdeps/modules/src/mVIII/p8/Main.java Fri Dec 16 08:17:55 2016 +0000 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package p8; + +import p5.internal.T; + +public class Main { + public static void main() { + T t = new T(); + } +}