Java Code Examples for javax.tools.StandardLocation#NATIVE_HEADER_OUTPUT

The following examples show how to use javax.tools.StandardLocation#NATIVE_HEADER_OUTPUT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Locations.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
void initHandlers() {
    handlersForLocation = new HashMap<Location, LocationHandler>();
    handlersForOption = new EnumMap<Option, LocationHandler>(Option.class);

    LocationHandler[] handlers = {
        new BootClassPathLocationHandler(),
        new ClassPathLocationHandler(),
        new SimpleLocationHandler(StandardLocation.SOURCE_PATH, Option.SOURCEPATH),
        new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_PATH, Option.PROCESSORPATH),
        new OutputLocationHandler((StandardLocation.CLASS_OUTPUT), Option.D),
        new OutputLocationHandler((StandardLocation.SOURCE_OUTPUT), Option.S),
        new OutputLocationHandler((StandardLocation.NATIVE_HEADER_OUTPUT), Option.H)
    };

    for (LocationHandler h: handlers) {
        handlersForLocation.put(h.location, h);
        for (Option o: h.options)
            handlersForOption.put(o, h);
    }
}
 
Example 2
Source File: Locations.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
void initHandlers() {
    handlersForLocation = new HashMap<Location, LocationHandler>();
    handlersForOption = new EnumMap<Option, LocationHandler>(Option.class);

    LocationHandler[] handlers = {
        new BootClassPathLocationHandler(),
        new ClassPathLocationHandler(),
        new SimpleLocationHandler(StandardLocation.SOURCE_PATH, Option.SOURCEPATH),
        new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_PATH, Option.PROCESSORPATH),
        new OutputLocationHandler((StandardLocation.CLASS_OUTPUT), Option.D),
        new OutputLocationHandler((StandardLocation.SOURCE_OUTPUT), Option.S),
        new OutputLocationHandler((StandardLocation.NATIVE_HEADER_OUTPUT), Option.H)
    };

    for (LocationHandler h: handlers) {
        handlersForLocation.put(h.location, h);
        for (Option o: h.options)
            handlersForOption.put(o, h);
    }
}
 
Example 3
Source File: Locations.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
void initHandlers() {
    handlersForLocation = new HashMap<Location, LocationHandler>();
    handlersForOption = new EnumMap<Option, LocationHandler>(Option.class);

    LocationHandler[] handlers = {
        new BootClassPathLocationHandler(),
        new ClassPathLocationHandler(),
        new SimpleLocationHandler(StandardLocation.SOURCE_PATH, Option.SOURCEPATH),
        new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_PATH, Option.PROCESSORPATH),
        new OutputLocationHandler((StandardLocation.CLASS_OUTPUT), Option.D),
        new OutputLocationHandler((StandardLocation.SOURCE_OUTPUT), Option.S),
        new OutputLocationHandler((StandardLocation.NATIVE_HEADER_OUTPUT), Option.H)
    };

    for (LocationHandler h: handlers) {
        handlersForLocation.put(h.location, h);
        for (Option o: h.options)
            handlersForOption.put(o, h);
    }
}
 
Example 4
Source File: Locations.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
void initHandlers() {
    handlersForLocation = new HashMap<Location, LocationHandler>();
    handlersForOption = new EnumMap<Option, LocationHandler>(Option.class);

    LocationHandler[] handlers = {
        new BootClassPathLocationHandler(),
        new ClassPathLocationHandler(),
        new SimpleLocationHandler(StandardLocation.SOURCE_PATH, Option.SOURCEPATH),
        new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_PATH, Option.PROCESSORPATH),
        new OutputLocationHandler((StandardLocation.CLASS_OUTPUT), Option.D),
        new OutputLocationHandler((StandardLocation.SOURCE_OUTPUT), Option.S),
        new OutputLocationHandler((StandardLocation.NATIVE_HEADER_OUTPUT), Option.H)
    };

    for (LocationHandler h: handlers) {
        handlersForLocation.put(h.location, h);
        for (Option o: h.options)
            handlersForOption.put(o, h);
    }
}
 
Example 5
Source File: Locations.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
void initHandlers() {
    handlersForLocation = new HashMap<Location, LocationHandler>();
    handlersForOption = new EnumMap<Option, LocationHandler>(Option.class);

    LocationHandler[] handlers = {
        new BootClassPathLocationHandler(),
        new ClassPathLocationHandler(),
        new SimpleLocationHandler(StandardLocation.SOURCE_PATH, Option.SOURCEPATH),
        new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_PATH, Option.PROCESSORPATH),
        new OutputLocationHandler((StandardLocation.CLASS_OUTPUT), Option.D),
        new OutputLocationHandler((StandardLocation.SOURCE_OUTPUT), Option.S),
        new OutputLocationHandler((StandardLocation.NATIVE_HEADER_OUTPUT), Option.H)
    };

    for (LocationHandler h: handlers) {
        handlersForLocation.put(h.location, h);
        for (Option o: h.options)
            handlersForOption.put(o, h);
    }
}
 
Example 6
Source File: Locations.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
void initHandlers() {
    handlersForLocation = new HashMap<Location, LocationHandler>();
    handlersForOption = new EnumMap<Option, LocationHandler>(Option.class);

    LocationHandler[] handlers = {
        new BootClassPathLocationHandler(),
        new ClassPathLocationHandler(),
        new SimpleLocationHandler(StandardLocation.SOURCE_PATH, Option.SOURCEPATH),
        new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_PATH, Option.PROCESSORPATH),
        new OutputLocationHandler((StandardLocation.CLASS_OUTPUT), Option.D),
        new OutputLocationHandler((StandardLocation.SOURCE_OUTPUT), Option.S),
        new OutputLocationHandler((StandardLocation.NATIVE_HEADER_OUTPUT), Option.H)
    };

    for (LocationHandler h: handlers) {
        handlersForLocation.put(h.location, h);
        for (Option o: h.options)
            handlersForOption.put(o, h);
    }
}
 
Example 7
Source File: Locations.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
void initHandlers() {
    handlersForLocation = new HashMap<Location, LocationHandler>();
    handlersForOption = new EnumMap<Option, LocationHandler>(Option.class);

    LocationHandler[] handlers = {
        new BootClassPathLocationHandler(),
        new ClassPathLocationHandler(),
        new SimpleLocationHandler(StandardLocation.SOURCE_PATH, Option.SOURCEPATH),
        new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_PATH, Option.PROCESSORPATH),
        new OutputLocationHandler((StandardLocation.CLASS_OUTPUT), Option.D),
        new OutputLocationHandler((StandardLocation.SOURCE_OUTPUT), Option.S),
        new OutputLocationHandler((StandardLocation.NATIVE_HEADER_OUTPUT), Option.H)
    };

    for (LocationHandler h: handlers) {
        handlersForLocation.put(h.location, h);
        for (Option o: h.options)
            handlersForOption.put(o, h);
    }
}
 
Example 8
Source File: JNIWriter.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** Emit a class file for a given class.
 *  @param c      The class from which a class file is generated.
 */
public FileObject write(ClassSymbol c) throws IOException {
    String className = c.flatName().toString();
    Location outLocn;
    if (multiModuleMode) {
        ModuleSymbol msym = c.owner.kind == MDL ? (ModuleSymbol) c.owner : c.packge().modle;
        outLocn = fileManager.getLocationForModule(StandardLocation.NATIVE_HEADER_OUTPUT, msym.name.toString());
    } else {
        outLocn = StandardLocation.NATIVE_HEADER_OUTPUT;
    }
    FileObject outFile
        = fileManager.getFileForOutput(outLocn,
            "", className.replaceAll("[.$]", "_") + ".h", null);
    PrintWriter out = new PrintWriter(outFile.openWriter());
    try {
        write(out, c);
        if (verbose)
            log.printVerbose("wrote.file", outFile);
        out.close();
        out = null;
    } finally {
        if (out != null) {
            // if we are propogating an exception, delete the file
            out.close();
            outFile.delete();
            outFile = null;
        }
    }
    return outFile; // may be null if write failed
}
 
Example 9
Source File: Locations.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
void initHandlers() {
    handlersForLocation = new HashMap<>();
    handlersForOption = new EnumMap<>(Option.class);

    BasicLocationHandler[] handlers = {
        new BootClassPathLocationHandler(StandardLocation.PLATFORM_CLASS_PATH),
        new BootClassPathLocationHandler(StandardLocation.SYSTEM_MODULES),
        new ClassFileLocationHandler(),
        new SimpleLocationHandler(StandardLocation.SOURCE_PATH, Option.SOURCE_PATH),
        new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_PATH, Option.PROCESSOR_PATH),
        new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_MODULE_PATH, Option.PROCESSOR_MODULE_PATH),
        new OutputLocationHandler(StandardLocation.CLASS_OUTPUT, Option.D),
        new OutputLocationHandler(StandardLocation.SOURCE_OUTPUT, Option.S),
        new OutputLocationHandler(StandardLocation.NATIVE_HEADER_OUTPUT, Option.H),
        new ModuleSourceFileLocationHandler(),
        new PatchModulesLocationHandler(),
        new ModuleFileLocationHandler(StandardLocation.UPGRADE_MODULE_PATH, Option.UPGRADE_MODULE_PATH),
        new ModuleFileLocationHandler(StandardLocation.MODULE_PATH, Option.MODULE_PATH)
    };

    for (BasicLocationHandler h : handlers) {
        handlersForLocation.put(h.location, h);
        for (Option o : h.options) {
            handlersForOption.put(o, h);
        }
    }
}
 
Example 10
Source File: JNIWriter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/** Emit a class file for a given class.
 *  @param c      The class from which a class file is generated.
 */
public FileObject write(ClassSymbol c) throws IOException {
    String className = c.flatName().toString();
    Location outLocn;
    if (multiModuleMode) {
        ModuleSymbol msym = c.owner.kind == MDL ? (ModuleSymbol) c.owner : c.packge().modle;
        outLocn = fileManager.getLocationForModule(StandardLocation.NATIVE_HEADER_OUTPUT, msym.name.toString());
    } else {
        outLocn = StandardLocation.NATIVE_HEADER_OUTPUT;
    }
    FileObject outFile
        = fileManager.getFileForOutput(outLocn,
            "", className.replaceAll("[.$]", "_") + ".h", null);
    PrintWriter out = new PrintWriter(outFile.openWriter());
    try {
        write(out, c);
        if (verbose)
            log.printVerbose("wrote.file", outFile);
        out.close();
        out = null;
    } finally {
        if (out != null) {
            // if we are propogating an exception, delete the file
            out.close();
            outFile.delete();
            outFile = null;
        }
    }
    return outFile; // may be null if write failed
}
 
Example 11
Source File: Locations.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void initHandlers() {
    handlersForLocation = new HashMap<>();
    handlersForOption = new EnumMap<>(Option.class);

    BasicLocationHandler[] handlers = {
        new BootClassPathLocationHandler(),
        new ClassPathLocationHandler(),
        new SimpleLocationHandler(StandardLocation.SOURCE_PATH, Option.SOURCE_PATH),
        new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_PATH, Option.PROCESSOR_PATH),
        new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_MODULE_PATH, Option.PROCESSOR_MODULE_PATH),
        new OutputLocationHandler(StandardLocation.CLASS_OUTPUT, Option.D),
        new OutputLocationHandler(StandardLocation.SOURCE_OUTPUT, Option.S),
        new OutputLocationHandler(StandardLocation.NATIVE_HEADER_OUTPUT, Option.H),
        new ModuleSourcePathLocationHandler(),
        new PatchModulesLocationHandler(),
        new ModulePathLocationHandler(StandardLocation.UPGRADE_MODULE_PATH, Option.UPGRADE_MODULE_PATH),
        new ModulePathLocationHandler(StandardLocation.MODULE_PATH, Option.MODULE_PATH),
        new SystemModulesLocationHandler(),
    };

    for (BasicLocationHandler h : handlers) {
        handlersForLocation.put(h.location, h);
        for (Option o : h.options) {
            handlersForOption.put(o, h);
        }
    }
}