Example usage for org.eclipse.jdt.internal.compiler.impl CompilerOptions OPTION_DocCommentSupport

List of usage examples for org.eclipse.jdt.internal.compiler.impl CompilerOptions OPTION_DocCommentSupport

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.impl CompilerOptions OPTION_DocCommentSupport.

Prototype

String OPTION_DocCommentSupport

To view the source code for org.eclipse.jdt.internal.compiler.impl CompilerOptions OPTION_DocCommentSupport.

Click Source Link

Usage

From source file:dacapo.eclipse.EclipseBuildTests.java

License:Open Source License

protected static Hashtable warningOptions(int kind) {
    // Values/*from  w ww.  j a v a  2  s . co  m*/
    Hashtable optionsMap = null;
    switch (kind) {
    case 0:
        optionsMap = JavaCore.getDefaultOptions();
        break;
    default:
        optionsMap = new Hashtable(350);
        break;
    }
    if (kind == 0) {
        // Default set since 3.1
        optionsMap.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.IGNORE);
    } else {
        boolean all = kind == 1;
        String generate = all ? CompilerOptions.GENERATE : CompilerOptions.DO_NOT_GENERATE;
        String warning = all ? CompilerOptions.WARNING : CompilerOptions.IGNORE;
        String enabled = all ? CompilerOptions.ENABLED : CompilerOptions.DISABLED;
        String preserve = all ? CompilerOptions.OPTIMIZE_OUT : CompilerOptions.PRESERVE;

        // Set options values
        optionsMap.put(CompilerOptions.OPTION_LocalVariableAttribute, generate);
        optionsMap.put(CompilerOptions.OPTION_LineNumberAttribute, generate);
        optionsMap.put(CompilerOptions.OPTION_SourceFileAttribute, generate);
        optionsMap.put(CompilerOptions.OPTION_PreserveUnusedLocal, preserve);
        optionsMap.put(CompilerOptions.OPTION_DocCommentSupport, enabled);
        optionsMap.put(CompilerOptions.OPTION_ReportMethodWithConstructorName, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportOverridingPackageDefaultMethod, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportDeprecation, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, enabled);
        optionsMap.put(CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, enabled);
        optionsMap.put(CompilerOptions.OPTION_ReportHiddenCatchBlock, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportUnusedLocal, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportUnusedParameter, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportUnusedImport, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportSyntheticAccessEmulation, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportNoEffectAssignment, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportNoImplicitStringConversion, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportNonStaticAccessToStatic, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportIndirectStaticAccess, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportIncompatibleNonInheritedInterfaceMethod, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportLocalVariableHiding, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportFieldHiding, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportPossibleAccidentalBooleanAssignment, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportEmptyStatement, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportAssertIdentifier, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportUndocumentedEmptyBlock, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportUnnecessaryTypeCheck, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportUnnecessaryElse, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportInvalidJavadoc, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportInvalidJavadocTags, enabled);
        optionsMap.put(CompilerOptions.OPTION_ReportMissingJavadocTags, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportMissingJavadocComments, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportFinallyBlockNotCompletingNormally, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportUnusedDeclaredThrownException, warning);
        optionsMap.put(CompilerOptions.OPTION_ReportUnqualifiedFieldAccess, warning);
        optionsMap.put(CompilerOptions.OPTION_TaskTags, all ? JavaCore.DEFAULT_TASK_TAGS : "");
        optionsMap.put(CompilerOptions.OPTION_TaskPriorities, all ? JavaCore.DEFAULT_TASK_PRIORITIES : "");
        optionsMap.put(CompilerOptions.OPTION_TaskCaseSensitive, enabled);
        optionsMap.put(CompilerOptions.OPTION_ReportUnusedParameterWhenImplementingAbstract, enabled);
        optionsMap.put(CompilerOptions.OPTION_ReportUnusedParameterWhenOverridingConcrete, enabled);
        optionsMap.put(CompilerOptions.OPTION_ReportSpecialParameterHidingField, enabled);
        optionsMap.put(CompilerOptions.OPTION_InlineJsr, enabled);
    }

    // Ignore 3.1 options
    optionsMap.put(CompilerOptions.OPTION_ReportMissingSerialVersion, CompilerOptions.IGNORE);
    optionsMap.put(CompilerOptions.OPTION_ReportEnumIdentifier, CompilerOptions.IGNORE);

    // Return created options map
    return optionsMap;
}

From source file:org.ebayopensource.dsf.javatojs.util.AstParserHelper.java

License:Open Source License

/**
 * create AND CONFIGURE an AST Parser using Java5 compliance levels...
 *//*from ww  w . j  a va  2  s .c o  m*/
public static ASTParser newParser(boolean parseComments) {
    // Enable/disable JavaDoc parsing
    COMPILER_OPTION.put(CompilerOptions.OPTION_DocCommentSupport,
            parseComments ? CompilerOptions.ENABLED : CompilerOptions.DISABLED);
    // Create the AST: AST.JLS3 handles JDK 1.0, 1.1, 1.2, 1.3, 1.4, 1.5
    ASTParser astParser = ASTParser.newParser(AST.JLS3);
    astParser.setCompilerOptions(COMPILER_OPTION);
    astParser.setKind(ASTParser.K_COMPILATION_UNIT);
    return astParser;
}

From source file:org.eclipse.objectteams.otdt.tests.compiler.errorreporting.TeamContainmentTest.java

License:Open Source License

public void testRoleLackingJavadoc1() {
    createFile("MyBase", "/** Comment for MyBase. */" + NL + "public class MyBase " + NL + "{ " + NL + "}");

    createFile("MyTeam", "/** Comment for MyTeam. */" + NL + "public team class MyTeam " + NL + "{ " + NL
            + "   public class MyRole playedBy MyBase" + NL + "    {" + NL + "   }" + NL + "}");

    Map<String, String> options = new HashMap<String, String>();
    options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
    options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
    options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
    options.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED);
    options.put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.ERROR);
    options.put(CompilerOptions.OPTION_ReportInvalidJavadocTags, CompilerOptions.ERROR);
    options.put(CompilerOptions.OPTION_ReportMissingJavadocComments, CompilerOptions.ERROR);

    compileFile("MyTeam", null, options);

    assertTrue(hasExpectedProblems(new int[] { IProblem.JavadocMissing })); // reported only once!
}

From source file:org.eclipse.objectteams.otdt.tests.compiler.errorreporting.TeamContainmentTest.java

License:Open Source License

public void testRoleLackingJavadoc2() {
    createFile("MyBase", "/** Comment for MyBase. */" + NL + "public class MyBase " + NL + "{ " + NL + "}");

    createFile("MyTeam", "/** Comment for MyTeam. */" + NL + "public team class MyTeam " + NL + "{ " + NL
            + "   protected class MyRole playedBy MyBase" + NL + "    {" + NL + "   }" + NL + "}");

    Map<String, String> options = new HashMap<String, String>();
    options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
    options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
    options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
    options.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED);
    options.put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.ERROR);
    options.put(CompilerOptions.OPTION_ReportInvalidJavadocTags, CompilerOptions.ERROR);
    options.put(CompilerOptions.OPTION_ReportMissingJavadocComments, CompilerOptions.ERROR);

    compileFile("MyTeam", null, options);

    assertTrue(isCompilationSuccessful());
}

From source file:org.eclipse.objectteams.otdt.tests.compiler.TestBase.java

License:Open Source License

public void compileFile(String fname, String[] classpath) {
    Map<String, String> options = new HashMap<String, String>();
    options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
    options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
    options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
    options.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED);
    options.put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.ERROR);
    options.put(CompilerOptions.OPTION_ReportInvalidJavadocTags, CompilerOptions.ERROR);
    compileFile(fname, classpath, options);
}

From source file:org.eclipse.objectteams.otdt.tests.otjld.callinbinding.CallinMethodBinding.java

License:Open Source License

public void test4143_callinToTeamMethod3() {
    Map customOptions = getCompilerOptions();
    customOptions.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED);
    customOptions.put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.WARNING);

    runConformTest(new String[] { "Team4143cttm3.java", "\n" + "/**\n" + " * @role R\n" + " */\n"
            + "public team class Team4143cttm3 {\n" + "    private void k(String s) {\n" + // extra difficulty: team method is private
            "        System.out.print(s);\n" + "    }\n" + "    public static void main(String[] args) {\n"
            + "        new Team4143cttm3().activate();\n" + "        new T4143cttm3().test(\"OK\");\n"
            + "    }\n" + "}\n" + "    \n", "T4143cttm3.java",
            "\n" + "public class T4143cttm3 {\n" + "    public void test(String s) {\n" + "        // nop\n"
                    + "    }\n" + "}\n" + "    \n",
            "Team4143cttm3/R.java",
            "\n" + "team package Team4143cttm3;\n" + "protected class R playedBy T4143cttm3 {\n"
                    + "    k <- after test;\n" + "}\n" + "    \n" },
            "OK", null/*classLibraries*/, true/*shouldFlushOutputDirectory*/, null/*vmArguments*/,
            customOptions, null/*no custom requestor*/);
}

From source file:org.eclipse.objectteams.otdt.tests.otjld.other.Misc.java

License:Open Source License

public void test04m_javadocBaseImportReference1() {
    Map customOptions = getCompilerOptions();
    customOptions.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED);
    customOptions.put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.ERROR);
    customOptions.put(CompilerOptions.OPTION_ReportInvalidJavadocTags, CompilerOptions.ENABLED);
    customOptions.put(CompilerOptions.OPTION_ReportInvalidJavadocTagsVisibility, CompilerOptions.PROTECTED);
    runConformTest(//from  w ww. j  a  va2s.  c  o m
            new String[] { "pteam/Team0m4jbir1.java",
                    "package pteam;\n" + "import base pbase.T0m4jbir1;\n" + "public team class Team0m4jbir1 {\n"
                            + "   /** Role for {@link T0m4jbir1} as its base.\n" + "     * @see T0m4jbir1\n"
                            + "     */\n" + "   protected class R playedBy T0m4jbir1 {} \n" + "}\n",
                    "pbase/T0m4jbir1.java", "package pbase;\n" + "public class T0m4jbir1 {}\n" },
            "", null/*classLibraries*/, false/*shouldFlushOutputDirectory*/, null/*vmArguments*/, customOptions,
            null/*requestor*/);
}

From source file:org.eclipse.objectteams.otdt.tests.otjld.rolesandteams.FileStructure.java

License:Open Source License

public void test1522_roleTagInJavadoc2() {
    Map customOptions = getCompilerOptions();
    // -enableJavadoc
    customOptions.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED);
    // -warn:+javadoc
    customOptions.put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.WARNING);
    customOptions.put(CompilerOptions.OPTION_ReportMissingJavadocTags, CompilerOptions.WARNING);
    // part of +javadoc but not needed:
    //       customOptions.put(CompilerOptions.OPTION_ReportInvalidJavadocTagsDeprecatedRef, CompilerOptions.ENABLED);
    //       customOptions.put(CompilerOptions.OPTION_ReportInvalidJavadocTagsNotVisibleRef, CompilerOptions.ENABLED);
    //       customOptions.put(CompilerOptions.OPTION_ReportMissingJavadocTagsVisibility, CompilerOptions.PRIVATE);
    runTestExpectingWarnings(//  ww  w. j  a  v  a  2  s . c o  m
            new String[] { "Team1522rtij2.java",
                    "\n" + "/**\n" + "  * A team with a role file.\n" + "  * @role R1522rtij2_1\n" + "  */\n"
                            + "public team class Team1522rtij2 {\n" + "    /** @param bar a R1522rtij2_2 */\n"
                            + "    void foo(R1522rtij2_2 bar) {} // ensure it's loaded\n" + "}\n" + "    \n",
                    "Team1522rtij2/R1522rtij2_1.java",
                    "\n" + "team package Team1522rtij2;\n" + "protected class R1522rtij2_1 {}\n" + "    \n",
                    "Team1522rtij2/R1522rtij2_2.java",
                    "\n" + "team package Team1522rtij2;\n" + "protected class R1522rtij2_2 {}\n" + "    \n" },
            "----------\n" + "1. WARNING in Team1522rtij2.java (at line 6)\n"
                    + "   public team class Team1522rtij2 {\n" + "                     ^^^^^^^^^^^^^\n"
                    + "Javadoc: Missing tag for role file R1522rtij2_2 (OTJLD 1.2.5(d)).\n" + "----------\n",
            customOptions);
}

From source file:org.eclipse.objectteams.otdt.tests.otjld.rolesandteams.FileStructure.java

License:Open Source License

public void test1522_roleTagInJavadoc3() {
    Map customOptions = getCompilerOptions();
    customOptions.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED);
    customOptions.put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.WARNING);
    customOptions.put(CompilerOptions.OPTION_ReportMissingJavadocTags, CompilerOptions.WARNING);
    runTestExpectingWarnings(//from   w  ww. j ava  2  s  . c o m
            new String[] { "Team1522rtij3.java",
                    "\n" + "/**\n" + "  * A team with a role file.\n"
                            + "  * @role R1522rtij3_1 this is really a role file\n"
                            + "  * @role R1522rtij3_2 this role is inline\n" + "  */\n"
                            + "public team class Team1522rtij3 {\n" + "    protected class R1522rtij3_2 {}\n"
                            + "    \n" + "    /** @param bar a R1522rtij3_2 */\n"
                            + "    void foo(R1522rtij3_2 bar) {}\n" + "}\n" + "    \n",
                    "Team1522rtij3/R1522rtij3_1.java",
                    "\n" + "team package Team1522rtij3;\n" + "protected class R1522rtij3_1 {}\n" + "    \n" },
            "----------\n" + "1. WARNING in Team1522rtij3.java (at line 5)\n"
                    + "   * @role R1522rtij3_2 this role is inline\n" + "           ^^^^^^^^^^^^\n"
                    + "Javadoc: R1522rtij3_2 is an inline role, whereas the @role tag should only be used for role files (OTJLD 1.2.5(d)).\n"
                    + "----------\n",
            customOptions);
}

From source file:org.eclipse.objectteams.otdt.tests.otjld.rolesandteams.FileStructure.java

License:Open Source License

public void test1522_roleTagInJavadoc4() {
    Map customOptions = getCompilerOptions();
    customOptions.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED);
    customOptions.put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.WARNING);
    customOptions.put(CompilerOptions.OPTION_ReportMissingJavadocTags, CompilerOptions.WARNING);
    runTestExpectingWarnings(/*from w ww .  jav  a  2s. c  o m*/
            new String[] { "Team1522rtij4.java",
                    "\n" + "/**\n" + "  * A team with a role file.\n" + "  * @role R1522rtij4_1\n"
                            + "  * @role String\n" + "  */\n" + "public team class Team1522rtij4 {\n"
                            + "    protected class R1522rtij4_2 {}\n" + "\n"
                            + "    /** @param bar a R1522rtij4_2 */\n" + "    void foo(R1522rtij4_2 bar) {}\n"
                            + "}\n" + "    \n",
                    "Team1522rtij4/R1522rtij4_1.java",
                    "\n" + "team package Team1522rtij4;\n" + "protected class R1522rtij4_1 {}\n" + "    \n" },
            "----------\n" + "1. WARNING in Team1522rtij4.java (at line 5)\n" + "   * @role String\n"
                    + "           ^^^^^^\n"
                    + "Javadoc: String cannot be resolved to a role of this team (OTJLD 1.2.5(d)).\n"
                    + "----------\n",
            customOptions);
}