jdk/make/modules/tools/src/com/sun/classanalyzer/ConstantPoolAnalyzer.java
author jcoomes
Thu, 20 May 2010 08:32:11 -0700
changeset 5545 c531522ec99a
parent 4524 697144bd8b04
child 5506 202f599c92aa
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4524
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     1
/*
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     2
 * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     4
 *
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     7
 * published by the Free Software Foundation.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     8
 *
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    13
 * accompanied this code).
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    14
 *
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    18
 *
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    21
 * have any questions.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    22
 */
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    23
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    24
package com.sun.classanalyzer;
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    25
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    26
/**
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    27
 *
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    28
 * @author Mandy Chung
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    29
 */
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    30
public class ConstantPoolAnalyzer {
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    31
    public static void main(String[] args) throws Exception {
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    32
        String jdkhome = null;
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    33
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    34
        // process arguments
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    35
        int i = 0;
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    36
        while (i < args.length) {
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    37
            String arg = args[i++];
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    38
            if (arg.equals("-jdkhome")) {
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    39
                if (i < args.length) {
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    40
                    jdkhome = args[i++];
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    41
                } else {
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    42
                    usage();
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    43
                }
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    44
            }
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    45
        }
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    46
        if (jdkhome == null) {
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    47
            usage();
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    48
        }
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    49
        ClassPath.setJDKHome(jdkhome);
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    50
        ClassPath.parseAllClassFiles();
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    51
    }
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    52
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    53
    private static void usage() {
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    54
        System.out.println("Usage: ConstantPoolAnalyzer <options>");
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    55
        System.out.println("Options: ");
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    56
        System.out.println("\t-jdkhome <JDK home> where all jars will be parsed");
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    57
        System.out.println("\t-cpath <classpath> where classes and jars will be parsed");
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    58
        System.exit(-1);
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    59
    }
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    60
}