FileObjectWithLocation.java revision 2958:27da0c3ac83a
1168054Sflz/*
2168054Sflz * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
3168266Sgabor * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4168266Sgabor *
5168266Sgabor * This code is free software; you can redistribute it and/or modify it
6168266Sgabor * under the terms of the GNU General Public License version 2 only, as
7168266Sgabor * published by the Free Software Foundation.  Oracle designates this
8168266Sgabor * particular file as subject to the "Classpath" exception as provided
9168266Sgabor * by Oracle in the LICENSE file that accompanied this code.
10168266Sgabor *
11168054Sflz * This code is distributed in the hope that it will be useful, but WITHOUT
12168054Sflz * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13168064Sflz * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14168064Sflz * version 2 for more details (a copy is included in the LICENSE file that
15168064Sflz * accompanied this code).
16168064Sflz *
17168064Sflz * You should have received a copy of the GNU General Public License version
18168064Sflz * 2 along with this work; if not, write to the Free Software Foundation,
19168064Sflz * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20168064Sflz *
21168064Sflz * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22168064Sflz * or visit www.oracle.com if you need additional information or have any
23168064Sflz * questions.
24168064Sflz */
25168064Sflzpackage com.sun.tools.sjavac.comp;
26168064Sflz
27168054Sflzimport javax.tools.FileObject;
28168054Sflzimport javax.tools.ForwardingFileObject;
29168064Sflzimport javax.tools.JavaFileManager.Location;
30168054Sflz
31168064Sflzimport com.sun.tools.javac.api.ClientCodeWrapper.Trusted;
32171129Sobrien
33168939Stmclaugh@Trusted
34168131Sbmahpublic class FileObjectWithLocation<F extends FileObject> extends ForwardingFileObject<F> {
35168113Smarcus
36180225Smarcel    private final Location loc;
37168123Snetchild
38168939Stmclaugh    public FileObjectWithLocation(F delegate, Location loc) {
39168064Sflz        super(delegate);
40168054Sflz        this.loc = loc;
41168054Sflz    }
42168054Sflz
43168054Sflz    public Location getLocation() {
44168261Sache        return loc;
45168077Sflz    }
46168077Sflz
47168126Sale    public FileObject getDelegate() {
48168069Sgarga        return fileObject;
49168472Snovel    }
50179877Samdmi3
51168274Ssem    public String toString() {
52169073Saraujo        return "FileObjectWithLocation[" + fileObject + "]";
53168667Sstefan    }
54168274Ssem}
55188692Sbeat