author | rfield |
Mon, 25 Apr 2016 08:50:16 -0700 | |
changeset 37644 | 33cf53901cac |
child 39370 | 437ba9bd2582 |
permissions | -rw-r--r-- |
37644
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
1 |
/* |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
4 |
* |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
10 |
* |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
15 |
* accompanied this code). |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
16 |
* |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
20 |
* |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
23 |
* questions. |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
24 |
*/ |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
25 |
|
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
26 |
package jdk.jshell; |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
27 |
|
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
28 |
import java.util.IdentityHashMap; |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
29 |
import java.util.List; |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
30 |
import javax.tools.Diagnostic; |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
31 |
import javax.tools.JavaFileObject; |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
32 |
|
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
33 |
/** |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
34 |
* The outer wrap for a set of snippets wrapped in a generated class |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
35 |
* @author Robert Field |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
36 |
*/ |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
37 |
public class OuterImportSnippetWrap extends OuterWrap { |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
38 |
|
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
39 |
private final Snippet snippet; |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
40 |
|
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
41 |
OuterImportSnippetWrap(Wrap wrap, Snippet snippet) { |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
42 |
super(wrap); |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
43 |
this.snippet = snippet; |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
44 |
} |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
45 |
|
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
46 |
@Override |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
47 |
Diag wrapDiag(Diagnostic<? extends JavaFileObject> d) { |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
48 |
return new WrappedDiagnostic(d) { |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
49 |
|
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
50 |
@Override |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
51 |
Snippet snippetOrNull() { |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
52 |
return snippet; |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
53 |
} |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
54 |
}; |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
55 |
} |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
56 |
|
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
57 |
@Override |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
58 |
public String toString() { |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
59 |
return "OISW(" + w + ")"; |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
60 |
} |
33cf53901cac
8154485: JShell: infrastructure for multi-Snippet class wrappers
rfield
parents:
diff
changeset
|
61 |
} |