Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JDK 11 jdk.jshell.jmod - JShell Tool
JDK 11 jdk.jshell.jmod is the JMOD file for JDK 11 JShell tool,
which can be invoked by the "jshell" command.
JDK 11 JShell tool compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\jdk.jshell.jmod.
JDK 11 JShell tool compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.
JDK 11 JShell tool source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\jdk.jshell.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/jshell/SnippetMaps.java
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package jdk.jshell;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.stream.Stream;
import static java.util.stream.Collectors.toList;
import static jdk.jshell.Util.PREFIX_PATTERN;
import static jdk.jshell.Util.REPL_PACKAGE;
import static jdk.internal.jshell.debug.InternalDebugControl.DBG_DEP;
/**
* Maintain relationships between the significant entities: Snippets,
* internal snippet index, Keys, etc.
* @author Robert Field
*/
final class SnippetMaps {
private final List<Snippet> keyIndexToSnippet = new ArrayList<>();
private final Set<Snippet> snippets = new LinkedHashSet<>();
private final Map<String, Set<Integer>> dependencies = new HashMap<>();
private final JShell state;
SnippetMaps(JShell proc) {
this.state = proc;
}
void installSnippet(Snippet sn) {
if (sn != null && snippets.add(sn)) {
if (sn.key() != null) {
sn.setId((state.idGenerator != null)
? state.idGenerator.apply(sn, sn.key().index())
: "" + sn.key().index());
setSnippet(sn.key().index(), sn);
}
}
}
private void setSnippet(int ki, Snippet snip) {
while (ki >= keyIndexToSnippet.size()) {
keyIndexToSnippet.add(null);
}
keyIndexToSnippet.set(ki, snip);
}
Snippet getSnippet(Key key) {
return getSnippet(key.index());
}
Snippet getSnippet(int ki) {
Snippet sn = getSnippetDeadOrAlive(ki);
return (sn != null && !sn.status().isActive())
? null
: sn;
}
Snippet getSnippetDeadOrAlive(int ki) {
if (ki >= keyIndexToSnippet.size()) {
return null;
}
return keyIndexToSnippet.get(ki);
}
List<Snippet> snippetList() {
return new ArrayList<>(snippets);
}
String packageAndImportsExcept(Set<Key> except, Collection<Snippet> plus) {
StringBuilder sb = new StringBuilder();
sb.append("package ").append(REPL_PACKAGE).append(";\n");
for (Snippet si : keyIndexToSnippet) {
if (si != null && si.status().isDefined() && (except == null || !except.contains(si.key()))) {
sb.append(si.importLine(state));
}
}
if (plus != null) {
plus.stream()
.forEach(psi -> sb.append(psi.importLine(state)));
}
return sb.toString();
}
List<Snippet> getDependents(Snippet snip) {
if (!snip.kind().isPersistent()) {
return Collections.emptyList();
}
Set<Integer> depset;
if (snip.unitName.equals("*")) {
// star import
depset = new HashSet<>();
for (Set<Integer> as : dependencies.values()) {
depset.addAll(as);
}
} else {
depset = dependencies.get(snip.name());
}
if (depset == null) {
return Collections.emptyList();
}
List<Snippet> deps = new ArrayList<>();
for (Integer dss : depset) {
Snippet dep = getSnippetDeadOrAlive(dss);
if (dep != null) {
deps.add(dep);
state.debug(DBG_DEP, "Found dependency %s -> %s\n", snip.name(), dep.name());
}
}
return deps;
}
void mapDependencies(Snippet snip) {
addDependencies(snip.declareReferences(), snip);
addDependencies(snip.bodyReferences(), snip);
}
private void addDependencies(Collection<String> refs, Snippet snip) {
if (refs == null) return;
for (String ref : refs) {
dependencies.computeIfAbsent(ref, k -> new HashSet<>())
.add(snip.key().index());
state.debug(DBG_DEP, "Added dependency %s -> %s\n", ref, snip.name());
}
}
String fullClassNameAndPackageToClass(String full, String pkg) {
Matcher mat = PREFIX_PATTERN.matcher(full);
if (mat.lookingAt()) {
return full.substring(mat.end());
}
state.debug(DBG_DEP, "SM %s %s\n", full, pkg);
List<String> klasses = importSnippets()
.filter(isi -> !isi.isStar)
.map(isi -> isi.fullname)
.collect(toList());
for (String k : klasses) {
if (k.equals(full)) {
return full.substring(full.lastIndexOf(".")+1, full.length());
}
}
List<String> pkgs = importSnippets()
.filter(isi -> isi.isStar)
.map(isi -> isi.fullname.substring(0, isi.fullname.lastIndexOf(".")))
.collect(toList());
pkgs.add(0, "java.lang");
for (String ipkg : pkgs) {
if (!ipkg.isEmpty() && ipkg.equals(pkg)) {
return full.substring(pkg.length() + 1);
}
}
return full;
}
/**
* Compute the set of imports to prepend to a snippet
* @return a stream of the import needed
*/
private Stream<ImportSnippet> importSnippets() {
return state.keyMap.importKeys()
.map(key -> (ImportSnippet)getSnippet(key))
.filter(sn -> sn != null && state.status(sn).isDefined());
}
}
⏎ jdk/jshell/SnippetMaps.java
Or download all of them as a single archive file:
File name: jdk.jshell-11.0.1-src.zip File size: 283093 bytes Release date: 2018-11-04 Download
⇒ JDK 11 jdk.jsobject.jmod - JS Object Module
2020-06-30, ≈61🔥, 0💬
Popular Posts:
JDK 7 tools.jar is the JAR file for JDK 7 tools. It contains Java classes to support different JDK t...
What Is jtds-1.2.2.jar? jtds-1.2.2.jar is the JAR files of jTDS Java library 1.2.2, which is a JDBC ...
The JDT project provides the tool plug-ins that implement a Java IDE supporting the development of a...
JDK 8 jconsole.jar is the JAR file for JDK 8 JConsole, which is a graphical monitoring tool to monit...
How to download and install ojdbc5.jar for Oracle 11g R1? ojdbc5.jar for Oracle 11g R1 is a Java 5 J...