List of usage examples for org.eclipse.jdt.internal.compiler.impl CompilerOptions OPTION_ReportUnusedLocal
String OPTION_ReportUnusedLocal
To view the source code for org.eclipse.jdt.internal.compiler.impl CompilerOptions OPTION_ReportUnusedLocal.
Click Source Link
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:dacapo.eclipse.EclipseBuildTests.java
License:Open Source License
protected static Hashtable warningOptions(int kind) { // Values/*from w ww .ja v a2 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:lombok.RunTestsViaEcj.java
License:Open Source License
protected CompilerOptions ecjCompilerOptions() { CompilerOptions options = new CompilerOptions(); options.complianceLevel = Eclipse.getLatestEcjCompilerVersionConstant(); options.sourceLevel = Eclipse.getLatestEcjCompilerVersionConstant(); options.targetJDK = Eclipse.getLatestEcjCompilerVersionConstant(); options.docCommentSupport = false;/* ww w . ja v a2 s. c om*/ options.parseLiteralExpressionsAsConstants = true; options.inlineJsrBytecode = true; options.reportUnusedDeclaredThrownExceptionExemptExceptionAndThrowable = false; options.reportUnusedDeclaredThrownExceptionIncludeDocCommentReference = false; options.reportUnusedDeclaredThrownExceptionWhenOverriding = false; options.reportUnusedParameterIncludeDocCommentReference = false; options.reportUnusedParameterWhenImplementingAbstract = false; options.reportUnusedParameterWhenOverridingConcrete = false; options.reportDeadCodeInTrivialIfStatement = false; options.generateClassFiles = false; Map<String, String> warnings = new HashMap<String, String>(); warnings.put(CompilerOptions.OPTION_ReportUnusedLocal, "ignore"); warnings.put(CompilerOptions.OPTION_ReportUnusedLabel, "ignore"); warnings.put(CompilerOptions.OPTION_ReportUnusedImport, "ignore"); warnings.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, "ignore"); warnings.put(CompilerOptions.OPTION_Source, "1." + Eclipse.getEcjCompilerVersion()); options.set(warnings); return options; }
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.JavaProjectService.java
License:Open Source License
@Inject public JavaProjectService(EventService eventService, LocalFSMountStrategy fsMountStrategy, @Named("che.java.codeassistant.index.dir") String temp) { eventService.subscribe(new VirtualFileEventSubscriber()); this.fsMountStrategy = fsMountStrategy; tempDir = temp;// w ww. ja v a2 s . com 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(JavaCore.COMPILER_ANNOTATION_NULL_ANALYSIS, JavaCore.ENABLED); options.put(CompilerOptions.OPTION_Process_Annotations, JavaCore.ENABLED); options.put(CompilerOptions.OPTION_GenerateClassFiles, JavaCore.ENABLED); cache = CacheBuilder.newBuilder().expireAfterAccess(4, TimeUnit.HOURS) .removalListener(new RemovalListener<String, JavaProject>() { @Override public void onRemoval(RemovalNotification<String, JavaProject> notification) { JavaProject value = notification.getValue(); if (value != null) { closeProject(value); deleteDependencyDirectory(value.getWsId(), value.getProjectPath()); } } }).build(); }
From source file:org.eclipse.objectteams.otdt.tests.otjld.callinbinding.BaseCalls.java
License:Open Source License
@Override protected Map getCompilerOptions() { Map options = super.getCompilerOptions(); options.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.WARNING); // many tests actually suppress this warning return options; }
From source file:org.eclipse.objectteams.otdt.tests.otjld.calloutbinding.CalloutParameterBinding_LiftingAndLowering.java
License:Open Source License
public void test3241_importUsedInParammap1() { Map customOptions = getCompilerOptions(); customOptions.put(CompilerOptions.OPTION_ReportUnusedParameter, CompilerOptions.WARNING); customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.WARNING); customOptions.put(CompilerOptions.OPTION_ReportUnusedDeclaredThrownException, CompilerOptions.WARNING); customOptions.put(CompilerOptions.OPTION_ReportUnusedTypeArgumentsForMethodInvocation, CompilerOptions.WARNING);/*from w w w . j a v a 2 s. c o m*/ customOptions.put(CompilerOptions.OPTION_ReportUnusedLabel, CompilerOptions.WARNING); customOptions.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.WARNING); customOptions.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.WARNING); runConformTest(new String[] { "T3241iuip1Main.java", "\n" + "public class T3241iuip1Main {\n" + " public static void main(String[] args) {\n" + " new Team3241iuip1().test();\n" + " }\n" + "}\n" + " \n", "p1/T3241iuip1_1.java", "\n" + "package p1;\n" + "public class T3241iuip1_1 {\n" + " public static String getO() { return \"O\"; }\n" + "}\n" + " \n", "p1/T3241iuip1_2.java", "\n" + "package p1;\n" + "public class T3241iuip1_2 {\n" + " public String getK() { return \"K\"; }\n" + "}\n" + " \n", "Team3241iuip1.java", "\n" + "import p1.T3241iuip1_1;\n" + "import base p1.T3241iuip1_2;\n" + "public team class Team3241iuip1 {\n" + " protected class R playedBy T3241iuip1_2 {\n" + " protected R() { base(); }\n" + " String getOK () -> String getK()\n" + " with { result <- T3241iuip1_1.getO()+result }\n" + " }\n" + " void test() {\n" + " System.out.print(new R().getOK());\n" + " }\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.Modifiers.java
License:Open Source License
@Override @SuppressWarnings("unchecked") // working with raw map protected Map getCompilerOptions() { Map options = super.getCompilerOptions(); options.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.WARNING); // many tests actually suppress this warning return options; }
From source file:org.eclipse.objectteams.otdt.tests.otjld.regression.ReportedBugs.java
License:Open Source License
public void testB11_sh67() { Map customOptions = getCompilerOptions(); customOptions.put(CompilerOptions.OPTION_ReportUnusedParameter, CompilerOptions.WARNING); customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.WARNING); customOptions.put(CompilerOptions.OPTION_ReportUnusedDeclaredThrownException, CompilerOptions.WARNING); customOptions.put(CompilerOptions.OPTION_ReportUnusedTypeArgumentsForMethodInvocation, CompilerOptions.WARNING);//from ww w. j a v a2 s . c o m customOptions.put(CompilerOptions.OPTION_ReportUnusedLabel, CompilerOptions.WARNING); customOptions.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.WARNING); customOptions.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.WARNING); runTestExpectingWarnings(new String[] { "TB11sh67.java", "\n" + "public class TB11sh67 {\n" + " @SuppressWarnings(\"unused\")\n" + " private int secret;\n" + "}\n" + " \n", "TeamB11sh67.java", "\n" + "@SuppressWarnings({\"unused\",\"basecall\"})\n" + "public team class TeamB11sh67 {\n" + " void bar(int unused) {}\n" + " protected class R playedBy TB11sh67 {\n" + " int getSecret() -> get int secret; // <- decapsulation warning was masked by above @SuppressWarnings\n" + " callin void noBaseCall() {\n" + " }\n" + " }\n" + "}\n" + " \n" }, "----------\n" + "1. WARNING in TeamB11sh67.java (at line 6)\n" + " int getSecret() -> get int secret; // <- decapsulation warning was masked by above @SuppressWarnings\n" + " ^^^^^^\n" + "Access restriction of private field secret in type TB11sh67 is overridden by this binding (OTJLD 3.5(e)).\n" + "----------\n", customOptions); }
From source file:org.eclipse.objectteams.otdt.tests.otjld.regression.ReportedBugs.java
License:Open Source License
public void testB11_sh68() { Map customOptions = getCompilerOptions(); customOptions.put(CompilerOptions.OPTION_ReportUnusedParameter, CompilerOptions.WARNING); customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.WARNING); customOptions.put(CompilerOptions.OPTION_ReportUnusedDeclaredThrownException, CompilerOptions.WARNING); customOptions.put(CompilerOptions.OPTION_ReportUnusedTypeArgumentsForMethodInvocation, CompilerOptions.WARNING);/* w ww.j a v a 2 s .c o m*/ customOptions.put(CompilerOptions.OPTION_ReportUnusedLabel, CompilerOptions.WARNING); customOptions.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.WARNING); customOptions.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.WARNING); customOptions.put(CompilerOptions.OPTION_ReportUnusedWarningToken, CompilerOptions.WARNING); runTestExpectingWarnings(new String[] { "TB11sh68.java", "\n" + "public class TB11sh68 {\n" + " @SuppressWarnings(\"unused\")\n" + " private int secret;\n" + "}\n" + " \n", "TeamB11sh68.java", "\n" + "@SuppressWarnings({\"unused\",\"basecall\",\"restriction\"}) // last one is unnecessary\n" + "public team class TeamB11sh68 {\n" + " void bar(int unused) {}\n" + " @SuppressWarnings(\"basecall\") // unnesserary\n" + " protected class R playedBy TB11sh68 {\n" + " int getSecret() -> get int secret; // <- decapsulation warning was masked by above @SuppressWarnings\n" + " callin void noBaseCall() {\n" + " }\n" + " }\n" + "}\n" + " \n" }, "----------\n" + "1. WARNING in TeamB11sh68.java (at line 2)\n" + " @SuppressWarnings({\"unused\",\"basecall\",\"restriction\"}) // last one is unnecessary\n" + " ^^^^^^^^^^\n" + "Unnecessary @SuppressWarnings(\"basecall\")\n" + "----------\n" + "2. WARNING in TeamB11sh68.java (at line 2)\n" + " @SuppressWarnings({\"unused\",\"basecall\",\"restriction\"}) // last one is unnecessary\n" + " ^^^^^^^^^^^^^\n" + "Unnecessary @SuppressWarnings(\"restriction\")\n" + "----------\n" + "3. WARNING in TeamB11sh68.java (at line 7)\n" + " int getSecret() -> get int secret; // <- decapsulation warning was masked by above @SuppressWarnings\n" + " ^^^^^^\n" + "Access restriction of private field secret in type TB11sh68 is overridden by this binding (OTJLD 3.5(e)).\n" + "----------\n", customOptions); }