< prev index next >

src/java.base/share/classes/jdk/internal/module/ModuleInfoExtender.java

Print this page

        

*** 68,77 **** --- 68,80 ---- private String osVersion; // the hashes for the Hashes attribute private ModuleHashes hashes; + // the value of the ModuleResolution attribute + private ModuleResolution moduleResolution; + private ModuleInfoExtender(InputStream in) { this.in = in; } /**
*** 119,128 **** --- 122,139 ---- this.hashes = hashes; return this; } /** + * Sets the value for the ModuleResolution attribute. + */ + public ModuleInfoExtender moduleResolution(ModuleResolution mres) { + this.moduleResolution = mres; + return this; + } + + /** * A ClassVisitor that supports adding class file attributes. If an * attribute already exists then the first occurence of the attribute * is replaced. */ private static class AttributeAddingClassVisitor extends ClassVisitor {
*** 181,205 **** ClassReader cr = new ClassReader(in); if (packages != null) cv.addAttribute(new ModulePackagesAttribute(packages)); - if (version != null) - cv.addAttribute(new ModuleVersionAttribute(version)); if (mainClass != null) cv.addAttribute(new ModuleMainClassAttribute(mainClass)); if (osName != null || osArch != null || osVersion != null) cv.addAttribute(new ModuleTargetAttribute(osName, osArch, osVersion)); if (hashes != null) cv.addAttribute(new ModuleHashesAttribute(hashes)); List<Attribute> attrs = new ArrayList<>(); // prototypes of attributes that should be parsed ! attrs.add(new ModuleAttribute()); attrs.add(new ModulePackagesAttribute()); - attrs.add(new ModuleVersionAttribute()); attrs.add(new ModuleMainClassAttribute()); attrs.add(new ModuleTargetAttribute()); attrs.add(new ModuleHashesAttribute()); cr.accept(cv, attrs.toArray(new Attribute[0]), 0); --- 192,215 ---- ClassReader cr = new ClassReader(in); if (packages != null) cv.addAttribute(new ModulePackagesAttribute(packages)); if (mainClass != null) cv.addAttribute(new ModuleMainClassAttribute(mainClass)); if (osName != null || osArch != null || osVersion != null) cv.addAttribute(new ModuleTargetAttribute(osName, osArch, osVersion)); if (hashes != null) cv.addAttribute(new ModuleHashesAttribute(hashes)); + if (moduleResolution != null) + cv.addAttribute(new ModuleResolutionAttribute(moduleResolution.value())); List<Attribute> attrs = new ArrayList<>(); // prototypes of attributes that should be parsed ! attrs.add(new ModuleAttribute(version)); attrs.add(new ModulePackagesAttribute()); attrs.add(new ModuleMainClassAttribute()); attrs.add(new ModuleTargetAttribute()); attrs.add(new ModuleHashesAttribute()); cr.accept(cv, attrs.toArray(new Attribute[0]), 0);
< prev index next >