src/share/classes/com/sun/tools/jdeps/ClassFileReader.java

changeset 3368
f206126308bc
parent 2538
1e39ae45d8ac
child 3446
e468915bad3a
     1.1 --- a/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Mon Mar 27 08:22:58 2017 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Thu Apr 27 16:18:18 2017 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -34,8 +34,10 @@
    1.11  import java.nio.file.SimpleFileVisitor;
    1.12  import java.nio.file.attribute.BasicFileAttributes;
    1.13  import java.util.*;
    1.14 +import java.util.jar.Attributes;
    1.15  import java.util.jar.JarEntry;
    1.16  import java.util.jar.JarFile;
    1.17 +import java.util.jar.Manifest;
    1.18  
    1.19  /**
    1.20   * ClassFileReader reads ClassFile(s) of a given path that can be
    1.21 @@ -154,6 +156,8 @@
    1.22          }
    1.23      }
    1.24  
    1.25 +    public boolean isMultiReleaseJar() throws IOException { return false; }
    1.26 +
    1.27      public String toString() {
    1.28          return path.toString();
    1.29      }
    1.30 @@ -290,6 +294,16 @@
    1.31                  }
    1.32              };
    1.33          }
    1.34 +
    1.35 +        @Override
    1.36 +        public boolean isMultiReleaseJar() throws IOException {
    1.37 +            Manifest mf = this.jarfile.getManifest();
    1.38 +            if (mf != null) {
    1.39 +                Attributes atts = mf.getMainAttributes();
    1.40 +                return "true".equalsIgnoreCase(atts.getValue("Multi-Release"));
    1.41 +            }
    1.42 +            return false;
    1.43 +        }
    1.44      }
    1.45  
    1.46      class JarFileIterator implements Iterator<ClassFile> {

mercurial