Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/langtools/tools/javac/6589361/T6589361.java
41149 views
1
/*
2
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/**
25
* @test
26
* @bug 6589361
27
* @summary 6589361:Failing building ct.sym file as part of the control build
28
* @modules jdk.compiler/com.sun.tools.javac.file
29
* jdk.compiler/com.sun.tools.javac.util
30
*/
31
32
import com.sun.tools.javac.file.JavacFileManager;
33
import com.sun.tools.javac.util.Context;
34
import java.io.File;
35
import javax.tools.FileObject;
36
import javax.tools.JavaFileObject;
37
import javax.tools.JavaFileObject.Kind;
38
import javax.tools.StandardLocation;
39
import java.util.Set;
40
import java.util.HashSet;
41
42
public class T6589361 {
43
public static void main(String [] args) throws Exception {
44
JavacFileManager fm = null;
45
try {
46
fm = new JavacFileManager(new Context(), false, null);
47
Set<JavaFileObject.Kind> set = new HashSet<JavaFileObject.Kind>();
48
set.add(JavaFileObject.Kind.CLASS);
49
Iterable<JavaFileObject> files = fm.list(StandardLocation.PLATFORM_CLASS_PATH, "java.lang", set, false);
50
for (JavaFileObject file : files) {
51
// Note: Zip/Jar entry names use '/', not File.separator, but just to be sure,
52
// we normalize the filename as well.
53
if (file.getName().replace(File.separatorChar, '/').contains("java/lang/Object.class")) {
54
String str = fm.inferBinaryName(StandardLocation.PLATFORM_CLASS_PATH, file);
55
if (!str.equals("java.lang.Object")) {
56
System.err.println("file object: " + file);
57
System.err.println(" class: " + file.getClass());
58
System.err.println(" name: " + file.getName());
59
System.err.println("binary name: " + str);
60
throw new AssertionError("Error in JavacFileManager.inferBinaryName method!");
61
}
62
else {
63
return;
64
}
65
}
66
}
67
}
68
finally {
69
if (fm != null) {
70
fm.close();
71
}
72
}
73
throw new AssertionError("Could not find java/lang/Object.class while compiling");
74
}
75
76
}
77
78