Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
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 (309)
Collections:
Other Resources:
JDK 17 jdk.jshell.jmod - JShell Tool
JDK 17 jdk.jshell.jmod is the JMOD file for JDK 17 JShell tool, which can be invoked by the "jshell" command.
JDK 17 JShell tool compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\jdk.jshell.jmod.
JDK 17 JShell tool compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 JShell tool source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\jdk.jshell.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/jshell/TypePrinter.java
/* * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package jdk.jshell; import static com.sun.tools.javac.code.Flags.COMPOUND; import static com.sun.tools.javac.code.Kinds.Kind.PCK; import com.sun.tools.javac.code.Printer; import com.sun.tools.javac.code.Symbol; import com.sun.tools.javac.code.Symbol.ClassSymbol; import com.sun.tools.javac.code.Symbol.PackageSymbol; import com.sun.tools.javac.code.Symbol.TypeSymbol; import com.sun.tools.javac.code.Type; import com.sun.tools.javac.code.Type.ClassType; import com.sun.tools.javac.code.Type.IntersectionClassType; import com.sun.tools.javac.code.Types; import com.sun.tools.javac.util.JavacMessages; import java.util.Locale; import java.util.function.BinaryOperator; import java.util.function.Function; import java.util.stream.Collectors; /** * Print types in source form. */ class TypePrinter extends Printer { private static final String OBJECT = "Object"; private final JavacMessages messages; private final Types types; private final BinaryOperator<String> fullClassNameAndPackageToClass; private final Function<TypeSymbol, String> anonymousToName; private final boolean printIntersectionTypes; private final AnonymousTypeKind anonymousTypesKind; /**Create a TypePrinter. * * @param messages javac's messages * @param fullClassNameAndPackageToClass convertor to convert full class names to * simple class names. * @param printIntersectionTypes whether intersection types should be printed * @param anonymousTypesKind how the anonymous types should be printed */ TypePrinter(JavacMessages messages, Types types, BinaryOperator<String> fullClassNameAndPackageToClass, boolean printIntersectionTypes, AnonymousTypeKind anonymousTypesKind) { this(messages, types, fullClassNameAndPackageToClass, cs -> cs.flatName().toString(), printIntersectionTypes, anonymousTypesKind); } /**Create a TypePrinter. * * @param messages javac's messages * @param fullClassNameAndPackageToClass convertor to convert full class names to * simple class names. * @param anonymousToName convertor from anonymous classes to name that should be printed * if anonymousTypesKind == AnonymousTypeKind.DECLARE * @param printIntersectionTypes whether intersection types should be printed * @param anonymousTypesKind how the anonymous types should be printed */ TypePrinter(JavacMessages messages, Types types, BinaryOperator<String> fullClassNameAndPackageToClass, Function<TypeSymbol, String> anonymousToName, boolean printIntersectionTypes, AnonymousTypeKind anonymousTypesKind) { this.messages = messages; this.types = types; this.fullClassNameAndPackageToClass = fullClassNameAndPackageToClass; this.anonymousToName = anonymousToName; this.printIntersectionTypes = printIntersectionTypes; this.anonymousTypesKind = anonymousTypesKind; } String toString(Type t) { return visit(t, Locale.getDefault()); } @Override protected String localize(Locale locale, String key, Object... args) { return messages.getLocalizedString(locale, key, args); } @Override protected String capturedVarId(Type.CapturedType t, Locale locale) { throw new InternalError("should never call this"); } @Override public String visitCapturedType(Type.CapturedType t, Locale locale) { return visit(t.wildcard, locale); } @Override public String visitType(Type t, Locale locale) { String s = (t.tsym == null || t.tsym.name == null) ? OBJECT // none : t.tsym.name.toString(); return s; } /** * Converts a class name into a (possibly localized) string. Anonymous inner * classes get converted into a localized string. * * @param t the type of the class whose name is to be rendered * @param longform if set, the class' fullname is displayed - if unset the * short name is chosen (w/o package) * @param locale the locale in which the string is to be rendered * @return localized string representation */ @Override protected String className(ClassType t, boolean longform, Locale locale) { TypeSymbol sym = t.tsym; if (sym.name.length() == 0 && (sym.flags() & COMPOUND) != 0) { if (printIntersectionTypes) { return ((IntersectionClassType) t).getExplicitComponents() .stream() .map(i -> visit(i, locale)) .collect(Collectors.joining("&")); } else { return visit(types.erasure(t), locale); } } else if (sym.name.length() == 0) { if (anonymousTypesKind == AnonymousTypeKind.DECLARE) { return anonymousToName.apply(sym); } // Anonymous String s; boolean isClass; ClassType norm = (ClassType) t.tsym.type; if (norm == null) { s = OBJECT; isClass = true; } else if (norm.interfaces_field != null && norm.interfaces_field.nonEmpty()) { s = visit(norm.interfaces_field.head, locale); isClass = false; } else { s = visit(norm.supertype_field, locale); isClass = true; } if (anonymousTypesKind == AnonymousTypeKind.DISPLAY) { s = isClass ? "<anonymous class extending " + s + ">" : "<anonymous class implementing " + s + ">"; } return s; } else if (longform) { String pkg = ""; for (Symbol psym = sym; psym != null; psym = psym.owner) { if (psym.kind == PCK) { pkg = psym.getQualifiedName().toString(); break; } } return fullClassNameAndPackageToClass.apply( sym.getQualifiedName().toString(), pkg ); } else { return sym.name.toString(); } } @Override public String visitClassSymbol(ClassSymbol sym, Locale locale) { return sym.name.isEmpty() ? sym.flatname.toString() // Anonymous : sym.fullname.toString(); } @Override public String visitPackageSymbol(PackageSymbol s, Locale locale) { return s.isUnnamed() ? "" // Unnamed package : s.fullname.toString(); } /** Specifies how the anonymous classes should be handled. */ public enum AnonymousTypeKind { /* The anonymous class is printed as the name of its supertype. */ SUPER, /* The anonymous class is printed as converted by the anonymousToName * convertor. */ DECLARE, /* The anonymous class is printed in a human readable form. */ DISPLAY; } }
⏎ jdk/jshell/TypePrinter.java
Or download all of them as a single archive file:
File name: jdk.jshell-17.0.5-src.zip File size: 302589 bytes Release date: 2022-09-13 Download
⇒ JDK 17 jdk.jsobject.jmod - JS Object Module
2023-08-03, 5926👍, 0💬
Popular Posts:
What Is fop.jar? I got it from the fop-2.7-bin.zip. fop.jar in fop-2.7-bin.zip is the JAR file for F...
How to display XML element type information with the jaxp\TypeInfoWriter.java provided in the Apache...
Apache Log4j provides the interface that applications should code to and provides the adapter compon...
How to read XML document with DTD validation from socket connections with the socket\DelayedInput.ja.. .
The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms, it was develo...