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/MaskCommentsAndModifiers.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.Set; import java.util.stream.Collectors; import java.util.stream.Stream; /** * Within a String, mask code comments and ignored modifiers (within context). * * @author Robert Field */ class MaskCommentsAndModifiers { private final static Set<String> IGNORED_MODIFIERS = Stream.of( "public", "protected", "private", "static", "final" ) .collect( Collectors.toSet() ); private final static Set<String> OTHER_MODIFIERS = Stream.of( "abstract", "strictfp", "transient", "volatile", "synchronized", "native", "default" ) .collect( Collectors.toSet() ); // Builder to accumulate non-masked characters private final StringBuilder sbCleared = new StringBuilder(); // Builder to accumulate masked characters private final StringBuilder sbMask = new StringBuilder(); // The input string private final String str; // Entire input string length private final int length; // The next character position private int next = 0; // The current character private int c; // Do we mask-off ignored modifiers? Set by parameter and turned off after // initial modifier section private boolean maskModifiers; // Does the string end with an unclosed '/*' style comment? private boolean openComment = false; MaskCommentsAndModifiers(String s, boolean maskModifiers) { this.str = s; this.length = s.length(); this.maskModifiers = maskModifiers; read(); while (c >= 0) { next(); read(); } } String cleared() { return sbCleared.toString(); } String mask() { return sbMask.toString(); } boolean endsWithOpenComment() { return openComment; } /****** private implementation methods ******/ /** * Read the next character */ private int read() { return c = (next >= length) ? -1 : str.charAt(next++); } private void unread() { if (c >= 0) { --next; } } private void writeTo(StringBuilder sb, int ch) { sb.append((char)ch); } private void write(int ch) { if (ch != -1) { writeTo(sbCleared, ch); writeTo(sbMask, Character.isWhitespace(ch) ? ch : ' '); } } private void writeMask(int ch) { if (ch != -1) { writeTo(sbMask, ch); writeTo(sbCleared, Character.isWhitespace(ch) ? ch : ' '); } } private void write(CharSequence s) { for (int cp : s.chars().toArray()) { write(cp); } } private void writeMask(CharSequence s) { for (int cp : s.chars().toArray()) { writeMask(cp); } } private void next() { switch (c) { case '\'': case '"': maskModifiers = false; write(c); int match = c; while (read() >= 0 && c != match && c != '\n' && c != '\r') { write(c); if (c == '\\') { write(read()); } } write(c); // write match // line-end break; case '/': read(); switch (c) { case '*': writeMask('/'); writeMask(c); int prevc = 0; while (read() >= 0 && (c != '/' || prevc != '*')) { writeMask(c); prevc = c; } writeMask(c); openComment = c < 0; break; case '/': writeMask('/'); writeMask(c); while (read() >= 0 && c != '\n' && c != '\r') { writeMask(c); } writeMask(c); break; default: maskModifiers = false; write('/'); unread(); break; } break; case '@': do { write(c); read(); } while (Character.isJavaIdentifierPart(c)); while (Character.isWhitespace(c)) { write(c); read(); } // if this is an annotation with arguments, process those recursively if (c == '(') { write(c); boolean prevMaskModifiers = maskModifiers; int parenCnt = 1; while (read() >= 0) { if (c == ')') { if (--parenCnt == 0) { break; } } else if (c == '(') { ++parenCnt; } next(); // recurse to handle quotes and comments } write(c); // stuff in annotation arguments doesn't effect inside determination maskModifiers = prevMaskModifiers; } else { unread(); } break; default: if (Character.isJavaIdentifierStart(c)) { StringBuilder sb = new StringBuilder(); do { writeTo(sb, c); read(); } while (Character.isJavaIdentifierPart(c)); unread(); String id = sb.toString(); if (maskModifiers && IGNORED_MODIFIERS.contains(id)) { writeMask(sb); } else { write(sb); if (maskModifiers && !OTHER_MODIFIERS.contains(id)) { maskModifiers = false; } } } else { if (!Character.isWhitespace(c)) { maskModifiers = false; } write(c); } break; } } }
⏎ jdk/jshell/MaskCommentsAndModifiers.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, 36096👍, 0💬
Popular Posts:
Smack is an Open Source XMPP (Jabber) client library for instant messaging and presence. A pure Java...
Apache Log4j SLF4J Binding allows applications coded to the SLF4J API to use Log4j 2 as the implemen...
commons-fileupload-1.3.3 -sources.jaris the source JAR file for Apache Commons FileUpload 1.3., whic...
JDK 7 tools.jar is the JAR file for JDK 7 tools. It contains Java classes to support different JDK t...
A stream buffer is a stream-based representation of an XML infoset in Java. Stream buffers are desig...