1 /* |
1 /* |
2 * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
47 class Server implements Runnable { |
47 class Server implements Runnable { |
48 private final BufferedReader in; |
48 private final BufferedReader in; |
49 private final OutputStream out; |
49 private final OutputStream out; |
50 private final boolean isSocket; |
50 private final boolean isSocket; |
51 private static final JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); |
51 private static final JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); |
52 private static Logger logger = Logger.getLogger("com.sun.tools.javac"); |
52 private static final Logger logger = Logger.getLogger("com.sun.tools.javac"); |
53 static class CwdFileManager extends ForwardingJavaFileManager<JavaFileManager> { |
53 static class CwdFileManager extends ForwardingJavaFileManager<JavaFileManager> { |
54 String cwd; |
54 String cwd; |
55 CwdFileManager(JavaFileManager fileManager) { |
55 CwdFileManager(JavaFileManager fileManager) { |
56 super(fileManager); |
56 super(fileManager); |
57 } |
57 } |
67 // { |
67 // { |
68 // return super.getFileForInput(getAbsoluteName(name)); |
68 // return super.getFileForInput(getAbsoluteName(name)); |
69 // } |
69 // } |
70 } |
70 } |
71 // static CwdFileManager fm = new CwdFileManager(tool.getStandardFileManager()); |
71 // static CwdFileManager fm = new CwdFileManager(tool.getStandardFileManager()); |
72 static StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null); |
72 static final StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null); |
73 static { |
73 static { |
74 // Use the same file manager for all compilations. This will |
74 // Use the same file manager for all compilations. This will |
75 // cache jar files in the standard file manager. Use |
75 // cache jar files in the standard file manager. Use |
76 // tool.getStandardFileManager().close() to release. |
76 // tool.getStandardFileManager().close() to release. |
77 // FIXME tool.setFileManager(fm); |
77 // FIXME tool.setFileManager(fm); |