EMMA Coverage Report (generated Thu Dec 06 15:52:10 GMT 2007)
[all classes][com.sun.tools.javac.util]

COVERAGE SUMMARY FOR SOURCE FILE [Options.java]

nameclass, %method, %block, %line, %
Options.java100% (1/1)67%  (8/12)67%  (76/113)66%  (14.6/22)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Options100% (1/1)67%  (8/12)67%  (76/113)66%  (14.6/22)
put (OptionName, String): void 0%   (0/1)0%   (0/8)0%   (0/2)
putAll (Options): void 0%   (0/1)0%   (0/6)0%   (0/2)
remove (String): void 0%   (0/1)0%   (0/6)0%   (0/2)
size (): int 0%   (0/1)0%   (0/4)0%   (0/1)
lint (String): boolean 100% (1/1)62%  (21/34)61%  (0.6/1)
<static initializer> 100% (1/1)100% (5/5)100% (1/1)
Options (Context): void 100% (1/1)100% (12/12)100% (4/4)
get (OptionName): String 100% (1/1)100% (7/7)100% (1/1)
get (String): String 100% (1/1)100% (6/6)100% (1/1)
instance (Context): Options 100% (1/1)100% (14/14)100% (4/4)
keySet (): Set 100% (1/1)100% (4/4)100% (1/1)
put (String, String): void 100% (1/1)100% (7/7)100% (2/2)

1/*
2 * Copyright 2001-2006 Sun Microsystems, Inc.  All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25 
26package com.sun.tools.javac.util;
27 
28import com.sun.tools.javac.main.OptionName;
29import java.util.*;
30 
31/** A table of all command-line options.
32 *  If an option has an argument, the option name is mapped to the argument.
33 *  If a set option has no argument, it is mapped to itself.
34 *
35 *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
36 *  you write code that depends on this, you do so at your own risk.
37 *  This code and its internal interfaces are subject to change or
38 *  deletion without notice.</b>
39 */
40public class Options {
41    private static final long serialVersionUID = 0;
42 
43    /** The context key for the options. */
44    public static final Context.Key<Options> optionsKey =
45        new Context.Key<Options>();
46 
47    private LinkedHashMap<String,String> values;
48 
49    /** Get the Options instance for this context. */
50    public static Options instance(Context context) {
51        Options instance = context.get(optionsKey);
52        if (instance == null)
53            instance = new Options(context);
54        return instance;
55    }
56 
57    protected Options(Context context) {
58// DEBUGGING -- Use LinkedHashMap for reproducability
59        values = new LinkedHashMap<String,String>();
60        context.put(optionsKey, this);
61    }
62 
63    public String get(String name) {
64        return values.get(name);
65    }
66 
67    public String get(OptionName name) {
68        return values.get(name.optionName);
69    }
70 
71    public void put(String name, String value) {
72        values.put(name, value);
73    }
74 
75    public void put(OptionName name, String value) {
76        values.put(name.optionName, value);
77    }
78 
79    public void putAll(Options options) {
80        values.putAll(options.values);
81    }
82 
83    public void remove(String name) {
84        values.remove(name);
85    }
86 
87    public Set<String> keySet() {
88        return values.keySet();
89    }
90 
91    public int size() {
92        return values.size();
93    }
94 
95    static final String LINT = "-Xlint";
96 
97    /** Check for a lint suboption. */
98    public boolean lint(String s) {
99        // return true if either the specific option is enabled, or
100        // they are all enabled without the specific one being
101        // disabled
102        return
103            get(LINT + ":" + s)!=null ||
104            (get(LINT)!=null || get(LINT + ":all")!=null) &&
105                get(LINT+":-"+s)==null;
106    }
107}

[all classes][com.sun.tools.javac.util]
EMMA 2.0.5312 (C) Vladimir Roubtsov