jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java
changeset 45004 ea3137042a61
parent 44359 c6761862ca0b
equal deleted inserted replaced
44789:73fd39e0702e 45004:ea3137042a61
   544      * Reads the ModuleTarget attribute
   544      * Reads the ModuleTarget attribute
   545      */
   545      */
   546     private ModuleTarget readModuleTargetAttribute(DataInput in, ConstantPool cpool)
   546     private ModuleTarget readModuleTargetAttribute(DataInput in, ConstantPool cpool)
   547         throws IOException
   547         throws IOException
   548     {
   548     {
   549         String osName = null;
   549         String targetPlatform = null;
   550         String osArch = null;
   550 
   551 
   551         int index = in.readUnsignedShort();
   552         int name_index = in.readUnsignedShort();
   552         if (index != 0)
   553         if (name_index != 0)
   553             targetPlatform = cpool.getUtf8(index);
   554             osName = cpool.getUtf8(name_index);
   554 
   555 
   555         return new ModuleTarget(targetPlatform);
   556         int arch_index = in.readUnsignedShort();
   556     }
   557         if (arch_index != 0)
       
   558             osArch = cpool.getUtf8(arch_index);
       
   559 
       
   560         return new ModuleTarget(osName, osArch);
       
   561     }
       
   562 
       
   563 
   557 
   564     /**
   558     /**
   565      * Reads the ModuleHashes attribute
   559      * Reads the ModuleHashes attribute
   566      */
   560      */
   567     private ModuleHashes readModuleHashesAttribute(DataInput in, ConstantPool cpool)
   561     private ModuleHashes readModuleHashesAttribute(DataInput in, ConstantPool cpool)
   609                 throw invalidModuleDescriptor("Bad module resolution flags:" + flags);
   603                 throw invalidModuleDescriptor("Bad module resolution flags:" + flags);
   610         }
   604         }
   611 
   605 
   612         return new ModuleResolution(flags);
   606         return new ModuleResolution(flags);
   613     }
   607     }
   614 
       
   615 
   608 
   616     /**
   609     /**
   617      * Returns true if the given attribute can be present at most once
   610      * Returns true if the given attribute can be present at most once
   618      * in the class file. Returns false otherwise.
   611      * in the class file. Returns false otherwise.
   619      */
   612      */