当前位置: 首页>>代码示例>>Java>>正文


Java Profile类代码示例

本文整理汇总了Java中com.sun.tools.javac.jvm.Profile的典型用法代码示例。如果您正苦于以下问题:Java Profile类的具体用法?Java Profile怎么用?Java Profile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Profile类属于com.sun.tools.javac.jvm包,在下文中一共展示了Profile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addProfilesList

import com.sun.tools.javac.jvm.Profile; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
protected void addProfilesList(Content profileSummary, Content body) {
    Content h2 = HtmlTree.HEADING(HtmlTag.H2, profileSummary);
    Content profilesDiv = HtmlTree.DIV(h2);
    Content ul = new HtmlTree(HtmlTag.UL);
    String profileName;
    for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
        profileName = Profile.lookup(i).name;
        // If the profile has valid packages to be documented, add it to the
        // profiles list on overview-summary.html page.
        if (configuration.shouldDocumentProfile(profileName)) {
            Content profileLinkContent = getTargetProfileLink("classFrame",
                    new StringContent(profileName), profileName);
            Content li = HtmlTree.LI(profileLinkContent);
            ul.addContent(li);
        }
    }
    profilesDiv.addContent(ul);
    Content div = HtmlTree.DIV(HtmlStyle.contentContainer, profilesDiv);
    body.addContent(div);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:PackageIndexWriter.java

示例2: addProfilesList

import com.sun.tools.javac.jvm.Profile; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
protected void addProfilesList(Profiles profiles, String text,
        String tableSummary, Content body) {
    Content heading = HtmlTree.HEADING(HtmlConstants.PROFILE_HEADING, true,
            profilesLabel);
    Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
    HtmlTree ul = new HtmlTree(HtmlTag.UL);
    ul.setTitle(profilesLabel);
    String profileName;
    for (int i = 1; i < profiles.getProfileCount(); i++) {
        profileName = (Profile.lookup(i)).name;
        // If the profile has valid packages to be documented, add it to the
        // left-frame generated for profile index.
        if (configuration.shouldDocumentProfile(profileName))
            ul.addContent(getProfile(profileName));
    }
    div.addContent(ul);
    body.addContent(div);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:ProfileIndexFrameWriter.java

示例3: initTestClasses

import com.sun.tools.javac.jvm.Profile; //导入依赖的package包/类
void initTestClasses() {
    // The following table assumes the existence of specific classes
    // in specific profiles, as defined in the Java SE 8 spec.
    init(Profile.COMPACT1,
            java.lang.String.class);

    init(Profile.COMPACT2,
            javax.xml.XMLConstants.class);

    //init(Profile.COMPACT3,
    //        javax.sql.rowset.Predicate.class,
    //        com.sun.security.auth.PolicyFile.class); // specifically included in 3

    init(Profile.COMPACT3,
            javax.sql.rowset.Predicate.class);

    init(Profile.DEFAULT,
            java.beans.BeanInfo.class);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:ProfileOptionTest.java

示例4: testClassesInProfiles

import com.sun.tools.javac.jvm.Profile; //导入依赖的package包/类
@Test
void testClassesInProfiles() throws Exception {
    for (Profile p: Profile.values()) {
        for (Map.Entry<Profile, List<JavaFileObject>> e: testClasses.entrySet()) {
            for (JavaFileObject fo: e.getValue()) {
                DiagnosticCollector<JavaFileObject> dl =
                        new DiagnosticCollector<JavaFileObject>();
                List<String> opts = (p == Profile.DEFAULT)
                        ? Collections.<String>emptyList()
                        : Arrays.asList("-profile", p.name);
                JavacTask task = (JavacTask) javac.getTask(null, fm, dl, opts, null,
                        Arrays.asList(fo));
                task.analyze();

                List<String> expectDiagCodes = (p.value >= e.getKey().value)
                        ? Collections.<String>emptyList()
                        : Arrays.asList("compiler.err.not.in.profile");

                checkDiags(opts + " " + fo.getName(), dl.getDiagnostics(), expectDiagCodes);
            }
        }
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:24,代码来源:ProfileOptionTest.java

示例5: initTestClasses

import com.sun.tools.javac.jvm.Profile; //导入依赖的package包/类
void initTestClasses() {
    // The following table assumes the existence of specific classes
    // in specific profiles, as defined in the Java SE 8 spec.
    init(Profile.COMPACT1,
            java.lang.String.class);

    init(Profile.COMPACT2,
            javax.xml.XMLConstants.class);

    init(Profile.COMPACT3,
            javax.sql.rowset.Predicate.class,
            com.sun.security.auth.PolicyFile.class); // specifically included in 3

    init(Profile.DEFAULT,
            java.beans.BeanInfo.class);
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:17,代码来源:ProfileOptionTest.java

示例6: initTestClasses

import com.sun.tools.javac.jvm.Profile; //导入依赖的package包/类
void initTestClasses() {
    // The following table assumes the existence of specific classes
    // in specific profiles, as defined in the Java SE 8 spec.
    init(Profile.COMPACT1,
            java.lang.String.class);

    init(Profile.COMPACT2,
            javax.xml.XMLConstants.class);

    init(Profile.COMPACT3,
            javax.sql.rowset.Predicate.class,
            com.sun.security.auth.PolicyFile.class); // specifically included in 3

    init(Profile.DEFAULT,
            java.beans.BeanInfo.class,
            javax.management.remote.rmi._RMIServer_Stub.class); // specifically excluded in 3
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:18,代码来源:ProfileOptionTest.java

示例7: formatArgument

import com.sun.tools.javac.jvm.Profile; //导入依赖的package包/类
/**
 * Format a single argument of a given diagnostic.
 *
 * @param d diagnostic whose argument is to be formatted
 * @param arg argument to be formatted
 * @param l locale object to be used for i18n
 * @return string representation of the diagnostic argument
 */
protected String formatArgument(JCDiagnostic d, Object arg, Locale l) {
    if (arg instanceof JCDiagnostic) {
        String s = null;
        depth++;
        try {
            s = formatMessage((JCDiagnostic)arg, l);
        }
        finally {
            depth--;
        }
        return s;
    }
    else if (arg instanceof JCExpression) {
        return expr2String((JCExpression)arg);
    }
    else if (arg instanceof Iterable<?>) {
        return formatIterable(d, (Iterable<?>)arg, l);
    }
    else if (arg instanceof Type) {
        return printer.visit((Type)arg, l);
    }
    else if (arg instanceof Symbol) {
        return printer.visit((Symbol)arg, l);
    }
    else if (arg instanceof JavaFileObject) {
        return ((JavaFileObject)arg).getName();
    }
    else if (arg instanceof Profile) {
        return ((Profile)arg).name;
    }
    else if (arg instanceof Formattable) {
        return ((Formattable)arg).toString(l, messages);
    }
    else {
        return String.valueOf(arg);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:46,代码来源:AbstractDiagnosticFormatter.java

示例8: generate

import com.sun.tools.javac.jvm.Profile; //导入依赖的package包/类
/**
 * Generate a profile package summary page for the left-hand bottom frame. Construct
 * the ProfilePackageFrameWriter object and then uses it generate the file.
 *
 * @param configuration the current configuration of the doclet.
 * @param packageDoc The package for which "profilename-package-frame.html" is to be generated.
 * @param profileValue the value of the profile being documented
 */
public static void generate(ConfigurationImpl configuration,
        PackageDoc packageDoc, int profileValue) {
    ProfilePackageFrameWriter profpackgen;
    try {
        String profileName = Profile.lookup(profileValue).name;
        profpackgen = new ProfilePackageFrameWriter(configuration, packageDoc,
                profileName);
        StringBuilder winTitle = new StringBuilder(profileName);
        String sep = " - ";
        winTitle.append(sep);
        String pkgName = Util.getPackageName(packageDoc);
        winTitle.append(pkgName);
        Content body = profpackgen.getBody(false,
                profpackgen.getWindowTitle(winTitle.toString()));
        Content profName = new StringContent(profileName);
        Content sepContent = new StringContent(sep);
        Content pkgNameContent = new RawHtml(pkgName);
        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
                profpackgen.getTargetProfileLink("classFrame", profName, profileName));
        heading.addContent(sepContent);
        heading.addContent(profpackgen.getTargetProfilePackageLink(packageDoc,
                "classFrame", pkgNameContent, profileName));
        body.addContent(heading);
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
        div.addStyle(HtmlStyle.indexContainer);
        profpackgen.addClassListing(div, profileValue);
        body.addContent(div);
        profpackgen.printHtmlDocument(
                configuration.metakeywords.getMetaKeywords(packageDoc), false, body);
        profpackgen.close();
    } catch (IOException exc) {
        configuration.standardmessage.error(
                "doclet.exception_encountered",
                exc.toString(), DocPaths.PACKAGE_FRAME.getPath());
        throw new DocletAbortException(exc);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:46,代码来源:ProfilePackageFrameWriter.java

示例9: getMetaKeywords

import com.sun.tools.javac.jvm.Profile; //导入依赖的package包/类
/**
 * Get the profile keywords.
 *
 * @param profile the profile being documented
 */
public String[] getMetaKeywords(Profile profile) {
    if( configuration.keywords ) {
        String profileName = profile.name;
        return new String[] { profileName + " " + "profile" };
    } else {
        return new String[] {};
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:MetaKeywords.java

示例10: ProfilePackageSummaryBuilder

import com.sun.tools.javac.jvm.Profile; //导入依赖的package包/类
/**
 * Construct a new ProfilePackageSummaryBuilder.
 *
 * @param context  the build context.
 * @param pkg the profile package being documented.
 * @param profilePackageWriter the doclet specific writer that will output the
 *        result.
 * @param profile the profile being documented.
 */
private ProfilePackageSummaryBuilder(Context context,
        PackageDoc pkg, ProfilePackageSummaryWriter profilePackageWriter,
        Profile profile) {
    super(context);
    this.packageDoc = pkg;
    this.profilePackageWriter = profilePackageWriter;
    this.profileName = profile.name;
    this.profileValue = profile.value;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:ProfilePackageSummaryBuilder.java

示例11: getProfilePackageSummaryWriter

import com.sun.tools.javac.jvm.Profile; //导入依赖的package包/类
@Override
public ProfilePackageSummaryWriter getProfilePackageSummaryWriter(
		PackageDoc arg0, PackageDoc arg1, PackageDoc arg2, Profile arg3)
		throws Exception {
	// TODO Auto-generated method stub
	return null;
}
 
开发者ID:WinRoad-NET,项目名称:htmldoclet4jdk8,代码行数:8,代码来源:WriterFactoryImpl.java

示例12: getSupplementaryFlags

import com.sun.tools.javac.jvm.Profile; //导入依赖的package包/类
/**
 * Returns any extra flags for a class symbol.
 * This information used to be provided using private annotations
 * in the class file in ct.sym; in time, this information will be
 * available from the module system.
 */
long getSupplementaryFlags(ClassSymbol c) {
    if (jrtIndex == null || !jrtIndex.isInJRT(c.classfile) || c.name == names.module_info) {
        return 0;
    }

    if (supplementaryFlags == null) {
        supplementaryFlags = new HashMap<>();
    }

    Long flags = supplementaryFlags.get(c.packge());
    if (flags == null) {
        long newFlags = 0;
        try {
            JRTIndex.CtSym ctSym = jrtIndex.getCtSym(c.packge().flatName());
            Profile minProfile = Profile.DEFAULT;
            if (ctSym.proprietary)
                newFlags |= PROPRIETARY;
            if (ctSym.minProfile != null)
                minProfile = Profile.lookup(ctSym.minProfile);
            if (profile != Profile.DEFAULT && minProfile.value > profile.value) {
                newFlags |= NOT_IN_PROFILE;
            }
        } catch (IOException ignore) {
        }
        supplementaryFlags.put(c.packge(), flags = newFlags);
    }
    return flags;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:35,代码来源:ClassFinder.java

示例13: testClassesInProfiles

import com.sun.tools.javac.jvm.Profile; //导入依赖的package包/类
@Test
void testClassesInProfiles() throws Exception {
    for (Profile p: Profile.values()) {
        for (Map.Entry<Profile, List<JavaFileObject>> e: testClasses.entrySet()) {
            for (JavaFileObject fo: e.getValue()) {
                DiagnosticCollector<JavaFileObject> dl =
                        new DiagnosticCollector<JavaFileObject>();
                List<String> opts = (p == Profile.DEFAULT)
                        ? Collections.<String>emptyList()
                        : Arrays.asList("--release", "8", "-profile", p.name);
                JavacTask task = (JavacTask) javac.getTask(null, fm, dl, opts, null,
                        Arrays.asList(fo));
                task.analyze();

                List<String> expectDiagCodes = new ArrayList<>();
                if (fo.getName().equals("TPolicyFile.java")) {
                    expectDiagCodes.add("compiler.warn.has.been.deprecated.for.removal");
                }

                if (p.value < e.getKey().value) {
                    expectDiagCodes.add("compiler.err.not.in.profile");
                }

                checkDiags(opts + " " + fo.getName(), dl.getDiagnostics(), expectDiagCodes);
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:ProfileOptionTest.java

示例14: init

import com.sun.tools.javac.jvm.Profile; //导入依赖的package包/类
void init(Profile p, Class<?>... classes) {
    List<JavaFileObject> srcs = new ArrayList<JavaFileObject>();
    for (Class<?> c: classes) {
        String name = "T" + c.getSimpleName();
        String src =
                "class T" + name + "{" + "\n" +
                "    Class<?> c = " + c.getName() + ".class;\n" +
                "}";
        srcs.add(new StringJavaFileObject(name + ".java", src));
    }
    testClasses.put(p, srcs);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:ProfileOptionTest.java

示例15: formatArgument

import com.sun.tools.javac.jvm.Profile; //导入依赖的package包/类
/**
 * Format a single argument of a given diagnostic.
 *
 * @param d diagnostic whose argument is to be formatted
 * @param arg argument to be formatted
 * @param l locale object to be used for i18n
 * @return string representation of the diagnostic argument
 */
protected String formatArgument(JCDiagnostic d, Object arg, Locale l) {
    if (arg instanceof JCDiagnostic) {
        String s = null;
        depth++;
        try {
            s = formatMessage((JCDiagnostic)arg, l);
        }
        finally {
            depth--;
        }
        return s;
    }
    else if (arg instanceof JCExpression) {
        return expr2String((JCExpression)arg);
    }
    else if (arg instanceof Iterable<?> && !(arg instanceof Path)) {
        return formatIterable(d, (Iterable<?>)arg, l);
    }
    else if (arg instanceof Type) {
        return printer.visit((Type)arg, l);
    }
    else if (arg instanceof Symbol) {
        return printer.visit((Symbol)arg, l);
    }
    else if (arg instanceof JavaFileObject) {
        return ((JavaFileObject)arg).getName();
    }
    else if (arg instanceof Profile) {
        return ((Profile)arg).name;
    }
    else if (arg instanceof Formattable) {
        return ((Formattable)arg).toString(l, messages);
    }
    else {
        return String.valueOf(arg);
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:46,代码来源:AbstractDiagnosticFormatter.java


注:本文中的com.sun.tools.javac.jvm.Profile类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。