Example usage for org.eclipse.jdt.core JavaCore DISABLED

List of usage examples for org.eclipse.jdt.core JavaCore DISABLED

Introduction

In this page you can find the example usage for org.eclipse.jdt.core JavaCore DISABLED.

Prototype

String DISABLED

To view the source code for org.eclipse.jdt.core JavaCore DISABLED.

Click Source Link

Document

Configurable option value: .

Usage

From source file:at.bestsolution.javafx.ide.jdt.internal.jdt.JavaModelUtil.java

License:Open Source License

public static void setDefaultClassfileOptions(Map<String, String> map, String compliance) {
    map.put(JavaCore.COMPILER_CODEGEN_INLINE_JSR_BYTECODE,
            is50OrHigher(compliance) ? JavaCore.ENABLED : JavaCore.DISABLED);
    map.put(JavaCore.COMPILER_LOCAL_VARIABLE_ATTR, JavaCore.GENERATE);
    map.put(JavaCore.COMPILER_LINE_NUMBER_ATTR, JavaCore.GENERATE);
    map.put(JavaCore.COMPILER_SOURCE_FILE_ATTR, JavaCore.GENERATE);
    map.put(JavaCore.COMPILER_CODEGEN_UNUSED_LOCAL, JavaCore.PRESERVE);
}

From source file:com.codenvy.ide.ext.java.BaseTest.java

License:Open Source License

public BaseTest() {
    options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_7);
    options.put(JavaCore.CORE_ENCODING, "UTF-8");
    options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_7);
    options.put(CompilerOptions.OPTION_TargetPlatform, JavaCore.VERSION_1_7);
    options.put(AssistOptions.OPTION_PerformVisibilityCheck, AssistOptions.ENABLED);
    options.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.WARNING);
    options.put(CompilerOptions.OPTION_TaskTags, CompilerOptions.WARNING);
    options.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.WARNING);
    options.put(CompilerOptions.OPTION_SuppressWarnings, CompilerOptions.DISABLED);
    options.put(JavaCore.COMPILER_TASK_TAGS, "TODO,FIXME,XXX");
    options.put(JavaCore.COMPILER_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE, JavaCore.ENABLED);
    options.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.ENABLED);
    options.put(CompilerOptions.OPTION_Process_Annotations, JavaCore.DISABLED);
}

From source file:net.sf.j2s.core.builder.AbstractImageBuilder.java

License:Open Source License

protected Compiler newCompiler() {
    // disable entire javadoc support if not interested in diagnostics
    Map projectOptions = this.javaBuilder.javaProject.getOptions(true);
    String option = (String) projectOptions.get(JavaCore.COMPILER_PB_INVALID_JAVADOC);
    if (option == null || option.equals(JavaCore.IGNORE)) { // TODO (frederic) see why option is null sometimes while running model tests!?
        option = (String) projectOptions.get(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS);
        if (option == null || option.equals(JavaCore.IGNORE)) {
            option = (String) projectOptions.get(JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS);
            if (option == null || option.equals(JavaCore.IGNORE)) {
                option = (String) projectOptions.get(JavaCore.COMPILER_PB_UNUSED_IMPORT);
                if (option == null || option.equals(JavaCore.IGNORE)) { // Unused import need also to look inside javadoc comment
                    projectOptions.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.DISABLED);
                }/* www .j  a  va2 s .  c  o  m*/
            }
        }
    }

    // called once when the builder is initialized... can override if needed
    CompilerOptions compilerOptions = new CompilerOptions(projectOptions);
    compilerOptions.performMethodsFullRecovery = true;
    compilerOptions.performStatementsRecovery = true;
    Compiler newCompiler = new Compiler(this.nameEnvironment,
            DefaultErrorHandlingPolicies.proceedWithAllProblems(), compilerOptions, this,
            ProblemFactory.getProblemFactory(Locale.getDefault()));
    CompilerOptions options = newCompiler.options;
    // temporary code to allow the compiler to revert to a single thread
    String setting = System.getProperty("jdt.compiler.useSingleThread"); //$NON-NLS-1$
    newCompiler.useSingleThread = setting != null && setting.equals("true"); //$NON-NLS-1$

    // enable the compiler reference info support
    options.produceReferenceInfo = true;

    if (options.complianceLevel >= ClassFileConstants.JDK1_6 && options.processAnnotations) {
        // support for Java 6 annotation processors
        initializeAnnotationProcessorManager(newCompiler);
    }

    return newCompiler;
}

From source file:net.sf.j2s.core.builder.Java2ScriptBatchImageBuilder.java

License:Open Source License

protected Compiler newCompiler() {
    // disable entire javadoc support if not interested in diagnostics
    Map projectOptions = javaBuilder.javaProject.getOptions(true);
    String option = (String) projectOptions.get(JavaCore.COMPILER_PB_INVALID_JAVADOC);
    if (option == null || option.equals(JavaCore.IGNORE)) { // TODO (frederic) see why option is null sometimes while running model tests!?
        option = (String) projectOptions.get(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS);
        if (option == null || option.equals(JavaCore.IGNORE)) {
            option = (String) projectOptions.get(JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS);
            if (option == null || option.equals(JavaCore.IGNORE)) {
                option = (String) projectOptions.get(JavaCore.COMPILER_PB_UNUSED_IMPORT);
                if (option == null || option.equals(JavaCore.IGNORE)) { // Unused import need also to look inside javadoc comment
                    projectOptions.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.DISABLED);
                }/*ww  w .  j a  va  2s . c  o  m*/
            }
        }
    }

    // called once when the builder is initialized... can override if needed
    CompilerOptions compilerOptions = new CompilerOptions(projectOptions);
    compilerOptions.performMethodsFullRecovery = true;
    compilerOptions.performStatementsRecovery = true;
    Compiler newCompiler = new Java2ScriptImageCompiler(nameEnvironment,
            DefaultErrorHandlingPolicies.proceedWithAllProblems(), compilerOptions, this,
            ProblemFactory.getProblemFactory(Locale.getDefault()));
    CompilerOptions options = newCompiler.options;
    // temporary code to allow the compiler to revert to a single thread
    String setting = System.getProperty("jdt.compiler.useSingleThread"); //$NON-NLS-1$
    newCompiler.useSingleThread = setting != null && setting.equals("true"); //$NON-NLS-1$

    // enable the compiler reference info support
    options.produceReferenceInfo = true;

    if (options.complianceLevel >= ClassFileConstants.JDK1_6 && options.processAnnotations) {
        // support for Java 6 annotation processors
        initializeAnnotationProcessorManager(newCompiler);
    }

    return newCompiler;
}

From source file:org.ecipse.che.plugin.testing.testng.server.BaseTest.java

License:Open Source License

public BaseTest() {
    options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_8);
    options.put(JavaCore.CORE_ENCODING, "UTF-8");
    options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_8);
    options.put(CompilerOptions.OPTION_TargetPlatform, JavaCore.VERSION_1_8);
    options.put(AssistOptions.OPTION_PerformVisibilityCheck, AssistOptions.ENABLED);
    options.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.WARNING);
    options.put(CompilerOptions.OPTION_TaskTags, CompilerOptions.WARNING);
    options.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.WARNING);
    options.put(CompilerOptions.OPTION_SuppressWarnings, CompilerOptions.DISABLED);
    options.put(JavaCore.COMPILER_TASK_TAGS, "TODO,FIXME,XXX");
    options.put(JavaCore.COMPILER_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE, JavaCore.ENABLED);
    options.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.ENABLED);
    options.put(CompilerOptions.OPTION_Process_Annotations, JavaCore.DISABLED);
}

From source file:org.eclipse.che.jdt.quickfix.LocalCorrectionsQuickFixTest.java

License:Open Source License

@Test
public void testUnusedVariable4() throws Exception {
    Hashtable hashtable = JavaCore.getOptions();
    hashtable.put(JavaCore.COMPILER_PB_UNUSED_LOCAL, JavaCore.ERROR);
    hashtable.put(JavaCore.COMPILER_PB_UNUSED_PARAMETER, JavaCore.ERROR);
    hashtable.put(JavaCore.COMPILER_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE, JavaCore.DISABLED);
    JavaCore.setOptions(hashtable);/*  w ww .j a  v  a2s .  c o m*/

    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E {\n");
    buf.append("    /**\n");
    buf.append("     * @param i\n");
    buf.append("     */\n");
    buf.append("    private void foo(int i) {\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);

    CompilationUnit astRoot = getASTRoot(cu);
    ArrayList proposals = collectCorrections(cu, astRoot);
    assertNumberOfProposals(proposals, 1);
    assertCorrectLabels(proposals);

    CUCorrectionProposal proposal = (CUCorrectionProposal) proposals.get(0);
    String preview = getPreviewContent(proposal);

    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E {\n");
    buf.append("    /**\n");
    buf.append("     */\n");
    buf.append("    private void foo() {\n");
    buf.append("    }\n");
    buf.append("}\n");
    assertEqualString(preview, buf.toString());
}

From source file:org.eclipse.che.jdt.quickfix.LocalCorrectionsQuickFixTest.java

License:Open Source License

@Test
public void testUnnecessaryThrownException3() throws Exception {
    Hashtable hashtable = JavaCore.getOptions();
    hashtable.put(JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION, JavaCore.ERROR);
    hashtable.put(JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_INCLUDE_DOC_COMMENT_REFERENCE,
            JavaCore.DISABLED);
    JavaCore.setOptions(hashtable);//  ww w. j  a  va 2  s . com

    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("import java.io.IOException;\n");
    buf.append("import java.text.ParseException;\n");
    buf.append("public class E {\n");
    buf.append("    /**\n");
    buf.append("     * @param i\n");
    buf.append("     * @throws IOException\n");
    buf.append("     * @throws ParseException\n");
    buf.append("     */\n");
    buf.append("    public void foo(int i) throws IOException, ParseException {\n");
    buf.append("        if  (i == 0) {\n");
    buf.append("            throw new IOException();\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);

    CompilationUnit astRoot = getASTRoot(cu);
    ArrayList proposals = collectCorrections(cu, astRoot);
    assertNumberOfProposals(proposals, 1);
    assertCorrectLabels(proposals);

    CUCorrectionProposal proposal = (CUCorrectionProposal) proposals.get(0);
    String preview = getPreviewContent(proposal);

    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("import java.io.IOException;\n");
    buf.append("import java.text.ParseException;\n");
    buf.append("public class E {\n");
    buf.append("    /**\n");
    buf.append("     * @param i\n");
    buf.append("     * @throws IOException\n");
    buf.append("     */\n");
    buf.append("    public void foo(int i) throws IOException {\n");
    buf.append("        if  (i == 0) {\n");
    buf.append("            throw new IOException();\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    assertEqualString(preview, buf.toString());
}

From source file:org.eclipse.che.jdt.quickfix.LocalCorrectionsQuickFixTest.java

License:Open Source License

@Test
public void testMissingEnumConstantsInCase1() throws Exception {
    Hashtable options = JavaCore.getOptions();
    options.put(JavaCore.COMPILER_PB_INCOMPLETE_ENUM_SWITCH, JavaCore.WARNING);
    options.put(JavaCore.COMPILER_PB_SUPPRESS_WARNINGS, JavaCore.DISABLED);

    JavaCore.setOptions(options);/*from ww w. ja  v  a  2 s . c o m*/

    IPackageFragment pack1 = fSourceFolder.createPackageFragment("p", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package p;\n");
    buf.append("\n");
    buf.append("public class E {\n");
    buf.append("    enum MyEnum {\n");
    buf.append("        X1, X2, X3\n");
    buf.append("    }\n");
    buf.append("    \n");
    buf.append("    public void foo(MyEnum x) {\n");
    buf.append("        switch (x) {\n");
    buf.append("        \n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);

    CompilationUnit astRoot = getASTRoot(cu);
    ArrayList proposals = collectCorrections(cu, astRoot, 3);

    assertCorrectLabels(proposals);
    assertNumberOfProposals(proposals, 2);

    String[] expected = new String[2];
    buf = new StringBuffer();
    buf.append("package p;\n");
    buf.append("\n");
    buf.append("public class E {\n");
    buf.append("    enum MyEnum {\n");
    buf.append("        X1, X2, X3\n");
    buf.append("    }\n");
    buf.append("    \n");
    buf.append("    public void foo(MyEnum x) {\n");
    buf.append("        switch (x) {\n");
    buf.append("            default :\n");
    buf.append("                break;\n");
    buf.append("        \n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    expected[0] = buf.toString();

    buf = new StringBuffer();
    buf.append("package p;\n");
    buf.append("\n");
    buf.append("public class E {\n");
    buf.append("    enum MyEnum {\n");
    buf.append("        X1, X2, X3\n");
    buf.append("    }\n");
    buf.append("    \n");
    buf.append("    public void foo(MyEnum x) {\n");
    buf.append("        switch (x) {\n");
    buf.append("            case X1 :\n");
    buf.append("                break;\n");
    buf.append("            case X2 :\n");
    buf.append("                break;\n");
    buf.append("            case X3 :\n");
    buf.append("                break;\n");
    buf.append("            default :\n");
    buf.append("                break;\n");
    buf.append("        \n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    expected[1] = buf.toString();

    assertExpectedExistInProposals(proposals, expected);
}

From source file:org.eclipse.che.jdt.quickfix.LocalCorrectionsQuickFixTest.java

License:Open Source License

@Test
public void testMissingEnumConstantsInCase2() throws Exception {
    Hashtable options = JavaCore.getOptions();
    options.put(JavaCore.COMPILER_PB_INCOMPLETE_ENUM_SWITCH, JavaCore.WARNING);
    options.put(JavaCore.COMPILER_PB_SUPPRESS_WARNINGS, JavaCore.DISABLED);
    JavaCore.setOptions(options);/*  w w w. j a v  a  2 s  . c o  m*/

    IPackageFragment pack1 = fSourceFolder.createPackageFragment("p", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package p;\n");
    buf.append("\n");
    buf.append("public class E {\n");
    buf.append("    enum MyEnum {\n");
    buf.append("        X1, X2, X3\n");
    buf.append("    }\n");
    buf.append("    \n");
    buf.append("    public void foo(MyEnum x) {\n");
    buf.append("        switch (x) {\n");
    buf.append("            case X1 :\n");
    buf.append("                break;\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);

    CompilationUnit astRoot = getASTRoot(cu);
    ArrayList proposals = collectCorrections(cu, astRoot, 2);

    assertCorrectLabels(proposals);
    assertNumberOfProposals(proposals, 2);

    String[] expected = new String[2];
    buf = new StringBuffer();
    buf.append("package p;\n");
    buf.append("\n");
    buf.append("public class E {\n");
    buf.append("    enum MyEnum {\n");
    buf.append("        X1, X2, X3\n");
    buf.append("    }\n");
    buf.append("    \n");
    buf.append("    public void foo(MyEnum x) {\n");
    buf.append("        switch (x) {\n");
    buf.append("            case X1 :\n");
    buf.append("                break;\n");
    buf.append("            default :\n");
    buf.append("                break;\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    expected[0] = buf.toString();

    buf = new StringBuffer();
    buf.append("package p;\n");
    buf.append("\n");
    buf.append("public class E {\n");
    buf.append("    enum MyEnum {\n");
    buf.append("        X1, X2, X3\n");
    buf.append("    }\n");
    buf.append("    \n");
    buf.append("    public void foo(MyEnum x) {\n");
    buf.append("        switch (x) {\n");
    buf.append("            case X1 :\n");
    buf.append("                break;\n");
    buf.append("            case X2 :\n");
    buf.append("                break;\n");
    buf.append("            case X3 :\n");
    buf.append("                break;\n");
    buf.append("            default :\n");
    buf.append("                break;\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    expected[1] = buf.toString();

    assertExpectedExistInProposals(proposals, expected);
}

From source file:org.eclipse.che.jdt.quickfix.LocalCorrectionsQuickFixTest.java

License:Open Source License

@Test
public void testMissingEnumConstantsInCase3() throws Exception {
    //https://bugs.eclipse.org/bugs/show_bug.cgi?id=372840
    Hashtable options = JavaCore.getOptions();
    options.put(JavaCore.COMPILER_PB_INCOMPLETE_ENUM_SWITCH, JavaCore.WARNING);
    options.put(JavaCore.COMPILER_PB_SWITCH_MISSING_DEFAULT_CASE, JavaCore.WARNING);
    options.put(JavaCore.COMPILER_PB_SUPPRESS_WARNINGS, JavaCore.DISABLED);
    JavaCore.setOptions(options);/*from  ww  w . java 2  s.co  m*/

    IPackageFragment pack1 = fSourceFolder.createPackageFragment("p", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package p;\n");
    buf.append("\n");
    buf.append("public class E {\n");
    buf.append("    enum MyEnum {\n");
    buf.append("        X1, X2, X3\n");
    buf.append("    }\n");
    buf.append("    \n");
    buf.append("    public void foo(MyEnum x) {\n");
    buf.append("        switch (x) {\n");
    buf.append("            case X1 :\n");
    buf.append("                break;\n");
    buf.append("            case X2 :\n");
    buf.append("                break;\n");
    buf.append("            case X3 :\n");
    buf.append("                break;\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);

    CompilationUnit astRoot = getASTRoot(cu);
    ArrayList proposals = collectCorrections(cu, astRoot);

    assertCorrectLabels(proposals);
    assertNumberOfProposals(proposals, 1);

    String[] expected = new String[1];
    buf = new StringBuffer();
    buf.append("package p;\n");
    buf.append("\n");
    buf.append("public class E {\n");
    buf.append("    enum MyEnum {\n");
    buf.append("        X1, X2, X3\n");
    buf.append("    }\n");
    buf.append("    \n");
    buf.append("    public void foo(MyEnum x) {\n");
    buf.append("        switch (x) {\n");
    buf.append("            case X1 :\n");
    buf.append("                break;\n");
    buf.append("            case X2 :\n");
    buf.append("                break;\n");
    buf.append("            case X3 :\n");
    buf.append("                break;\n");
    buf.append("            default :\n");
    buf.append("                break;\n");
    buf.append("        }\n");
    buf.append("    }\n");
    buf.append("}\n");
    expected[0] = buf.toString();

    assertExpectedExistInProposals(proposals, expected);
}