1 /* 2 * Copyright (c) 2014, 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. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 package com.sun.tools.javac.platform; 26 27 import java.io.Closeable; 28 import java.io.IOException; 29 import java.nio.file.Path; 30 import java.util.Collection; 31 import java.util.List; 32 import java.util.Map; 33 34 import javax.annotation.processing.Processor; 35 36 import com.sun.source.util.Plugin; 37 38 /**A platform what can be selected using -platform <name> command line option. 39 * 40 * <p><b>This is NOT part of any supported API. 41 * If you write code that depends on this, you do so at your own risk. 42 * This code and its internal interfaces are subject to change or 43 * deletion without notice.</b> 44 */ 45 public interface PlatformProvider extends Closeable { 46 47 /**Name of the platform, will be used as the key for -release. 48 * 49 * @return the platform key 50 */ 51 String getName(); 52 53 /**Return paths that should be used as the current platforms's bootclasspath, or null if 54 * the default should be used. 55 * 56 * @return the current platforms's bootclasspath, or null for default 57 */ 58 Collection<Path> getPlatformPath(); 59 60 /**The source version that should be selected. Equivalent to -source N on the command line. 61 * 62 * @return the required source version 63 */ 64 String getSourceVersion(); 65 66 /**The target version that should be selected. Equivalent to -target N on the command line. 67 * 68 * @return the required target version 69 */ 70 String getTargetVersion(); 71 72 /**Description of annotation Processor or javac Plugin that should be enabled in the current 73 * javac run. 74 * 75 * @param <T> either Processor or Plugin 76 */ 77 interface PluginInfo<T> { 78 79 /**The name of the Processor or Plugin. 80 * 81 * @return name of the Processor or Plugin. 82 */ 83 String getName(); 84 85 /**Options for the Processor or Plugin. For plugin, the map will be converted to a collection 86 * by concatenating the map's keys, the '=' sign and the map's values. 87 * 88 * 89 * @return the options 90 */ 91 Map<String, String> getOptions(); 92 93 /**The Processor or Plugin instance. 94 * 95 * @return the Processor or Plugin instance. 96 */ 97 T getPlugin(); 98 } 99 100 /**Annotation Processors that should be enabled in the current javac run. 101 * 102 * @return annotation Processors 103 */ 104 List<PluginInfo<Processor>> getAnnotationProcessors(); 105 106 /**javac Plugins that should be enabled in the current javac run. 107 * 108 * @return javac Plugins 109 */ 110 List<PluginInfo<Plugin>> getPlugins(); 111 112 /**Additional command line options that should be passed to javac. 113 * 114 * @return additional command line options 115 */ 116 List<String> getAdditionalOptions(); 117 118 /**Perform cleanup for this PlatformProvider - this instance won't be used after this method 119 * is called. 120 * 121 * @throws IOException if unexpected problems occur during closing this provider 122 */ 123 void close() throws IOException; 124 }