Fri, 12 Jul 2013 13:11:12 -0700
8020278: NPE in javadoc
Reviewed-by: mcimadamore, vromero
ohrstrom@1504 | 1 | /* |
ohrstrom@1504 | 2 | * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
ohrstrom@1504 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ohrstrom@1504 | 4 | * |
ohrstrom@1504 | 5 | * This code is free software; you can redistribute it and/or modify it |
ohrstrom@1504 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ohrstrom@1504 | 7 | * published by the Free Software Foundation. Oracle designates this |
ohrstrom@1504 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohrstrom@1504 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
ohrstrom@1504 | 10 | * |
ohrstrom@1504 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
ohrstrom@1504 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ohrstrom@1504 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ohrstrom@1504 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
ohrstrom@1504 | 15 | * accompanied this code). |
ohrstrom@1504 | 16 | * |
ohrstrom@1504 | 17 | * You should have received a copy of the GNU General Public License version |
ohrstrom@1504 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
ohrstrom@1504 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ohrstrom@1504 | 20 | * |
ohrstrom@1504 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohrstrom@1504 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohrstrom@1504 | 23 | * questions. |
ohrstrom@1504 | 24 | */ |
ohrstrom@1504 | 25 | package com.sun.tools.sjavac.comp; |
ohrstrom@1504 | 26 | |
ohrstrom@1504 | 27 | import com.sun.tools.javac.comp.Resolve; |
ohrstrom@1504 | 28 | import com.sun.tools.javac.util.Context; |
ohrstrom@1504 | 29 | import com.sun.tools.javac.code.Symbol; |
ohrstrom@1504 | 30 | |
ohrstrom@1504 | 31 | /** Subclass to Resolve that overrides collect. |
ohrstrom@1504 | 32 | * |
ohrstrom@1504 | 33 | * <p><b>This is NOT part of any supported API. |
ohrstrom@1504 | 34 | * If you write code that depends on this, you do so at your own |
ohrstrom@1504 | 35 | * risk. This code and its internal interfaces are subject to change |
ohrstrom@1504 | 36 | * or deletion without notice.</b></p> |
ohrstrom@1504 | 37 | */ |
ohrstrom@1504 | 38 | public class ResolveWithDeps extends Resolve { |
ohrstrom@1504 | 39 | |
ohrstrom@1504 | 40 | /** The dependency database |
ohrstrom@1504 | 41 | */ |
ohrstrom@1504 | 42 | protected Dependencies deps; |
ohrstrom@1504 | 43 | |
ohrstrom@1504 | 44 | protected ResolveWithDeps(Context context) { |
ohrstrom@1504 | 45 | super(context); |
ohrstrom@1504 | 46 | deps = Dependencies.instance(context); |
ohrstrom@1504 | 47 | } |
ohrstrom@1504 | 48 | |
ohrstrom@1504 | 49 | public static void preRegister(Context context) { |
ohrstrom@1504 | 50 | context.put(resolveKey, new Context.Factory<Resolve>() { |
ohrstrom@1504 | 51 | public Resolve make(Context c) { |
ohrstrom@1504 | 52 | Resolve instance = new ResolveWithDeps(c); |
ohrstrom@1504 | 53 | c.put(Resolve.class, instance); |
ohrstrom@1504 | 54 | return instance; |
ohrstrom@1504 | 55 | } |
ohrstrom@1504 | 56 | }); |
ohrstrom@1504 | 57 | } |
ohrstrom@1504 | 58 | /** Collect dependencies in the enclosing class |
ohrstrom@1504 | 59 | * @param from The enclosing class sym |
ohrstrom@1504 | 60 | * @param to The enclosing classes references this sym. |
ohrstrom@1504 | 61 | * */ |
ohrstrom@1504 | 62 | @Override |
ohrstrom@1504 | 63 | public void reportDependence(Symbol from, Symbol to) { |
ohrstrom@1504 | 64 | // Capture dependencies between the packages. |
ohrstrom@1504 | 65 | deps.collect(from.packge().fullname, to.packge().fullname); |
ohrstrom@1504 | 66 | } |
ohrstrom@1504 | 67 | } |