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 17 jdk.compiler.jmod - Compiler Tool
JDK 17 jdk.compiler.jmod is the JMOD file for JDK 17 Compiler tool,
which can be invoked by the "javac" command.
JDK 17 Compiler tool compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\jdk.compiler.jmod.
JDK 17 Compiler tool compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 Compiler source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\jdk.compiler.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ com/sun/tools/sjavac/comp/PathAndPackageVerifier.java
/*
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.sun.tools.sjavac.comp;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import javax.tools.JavaFileObject;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.util.TaskEvent;
import com.sun.source.util.TaskListener;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCFieldAccess;
import com.sun.tools.javac.tree.JCTree.JCIdent;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
import com.sun.tools.javac.util.Name;
import com.sun.tools.sjavac.Log;
public class PathAndPackageVerifier implements TaskListener {
// Stores the set of compilation units whose source file path does not
// match the package declaration.
Set<CompilationUnitTree> misplacedCompilationUnits = new HashSet<>();
@Override
@DefinedBy(Api.COMPILER_TREE)
public void finished(TaskEvent e) {
if (e.getKind() == TaskEvent.Kind.ANALYZE) {
CompilationUnitTree cu = e.getCompilationUnit();
if (cu == null)
return;
JavaFileObject jfo = cu.getSourceFile();
if (jfo == null)
return; // No source file -> package doesn't matter
JCTree pkg = (JCTree) cu.getPackageName();
if (pkg == null)
return; // Default package. See JDK-8048144.
Path dir = Paths.get(jfo.toUri()).normalize().getParent();
if (!checkPathAndPackage(dir, pkg))
misplacedCompilationUnits.add(cu);
}
if (e.getKind() == TaskEvent.Kind.COMPILATION) {
for (CompilationUnitTree cu : misplacedCompilationUnits) {
Log.error("Misplaced compilation unit.");
Log.error(" Directory: " + Paths.get(cu.getSourceFile().toUri()).getParent());
Log.error(" Package: " + cu.getPackageName());
}
}
}
public boolean errorsDiscovered() {
return misplacedCompilationUnits.size() > 0;
}
/* Returns true if dir matches pkgName.
*
* Examples:
* (a/b/c, a.b.c) gives true
* (i/j/k, i.x.k) gives false
*
* Currently (x/a/b/c, a.b.c) also gives true. See JDK-8059598.
*/
private boolean checkPathAndPackage(Path dir, JCTree pkgName) {
Iterator<String> pathIter = new ParentIterator(dir);
Iterator<String> pkgIter = new EnclosingPkgIterator(pkgName);
while (pathIter.hasNext() && pkgIter.hasNext()) {
if (!pathIter.next().equals(pkgIter.next()))
return false;
}
return !pkgIter.hasNext(); /*&& !pathIter.hasNext() See JDK-8059598 */
}
/* Iterates over the names of the parents of the given path:
* Example: dir1/dir2/dir3 results in dir3 -> dir2 -> dir1
*/
private static class ParentIterator implements Iterator<String> {
Path next;
ParentIterator(Path initial) {
next = initial;
}
@Override
public boolean hasNext() {
return next != null;
}
@Override
public String next() {
String tmp = next.getFileName().toString();
next = next.getParent();
return tmp;
}
}
/* Iterates over the names of the enclosing packages:
* Example: pkg1.pkg2.pkg3 results in pkg3 -> pkg2 -> pkg1
*/
private static class EnclosingPkgIterator implements Iterator<String> {
JCTree next;
EnclosingPkgIterator(JCTree initial) {
next = initial;
}
@Override
public boolean hasNext() {
return next != null;
}
@Override
public String next() {
Name name;
if (next instanceof JCIdent identNext) {
name = identNext.name;
next = null;
} else {
JCFieldAccess fa = (JCFieldAccess) next;
name = fa.name;
next = fa.selected;
}
return name.toString();
}
}
}
⏎ com/sun/tools/sjavac/comp/PathAndPackageVerifier.java
Or download all of them as a single archive file:
File name: jdk.compiler-17.0.5-src.zip File size: 1450209 bytes Release date: 2022-09-13 Download
⇒ JDK 17 jdk.crypto.cryptoki.jmod - Crypto KI Module
2023-10-15, ≈125🔥, 0💬
Popular Posts:
What is the jaxp\SourceValidator.jav aprovided in the Apache Xerces package? I have Apache Xerces 2....
JDK 11 jrt-fs.jar is the JAR file for JDK 11 JRT-FS (Java RunTime - File System) defined in the "jdk...
What Is poi-ooxml-5.2.3.jar? poi-ooxml-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which...
What Is commons-fileupload-1.3.3 .jar?commons-fileupload-1.3.3 .jaris the JAR file for Apache Common...
JDK 17 jdk.jconsole.jmod is the JMOD file for JDK 17 JConsole tool, which can be invoked by the "jco...