List of usage examples for org.eclipse.jdt.internal.compiler.impl CompilerOptions OPTION_SuppressWarnings
String OPTION_SuppressWarnings
To view the source code for org.eclipse.jdt.internal.compiler.impl CompilerOptions OPTION_SuppressWarnings.
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:ma.glasnost.orika.impl.generator.EclipseJdtCompiler.java
License:Apache License
private CompilerOptions getCompilerOptions() { Map<Object, Object> options = new HashMap<Object, Object>(); options.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE); options.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE); options.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE); options.put(CompilerOptions.OPTION_SuppressWarnings, CompilerOptions.ENABLED); options.put(CompilerOptions.OPTION_Source, JAVA_COMPILER_SOURCE_VERSION); options.put(CompilerOptions.OPTION_TargetPlatform, JAVA_COMPILER_CODEGEN_TARGET_PLATFORM_VERSION); options.put(CompilerOptions.OPTION_Encoding, JAVA_SOURCE_ENCODING); options.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.IGNORE); // Ignore unchecked types and raw types options.put(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION, CompilerOptions.IGNORE); options.put(JavaCore.COMPILER_PB_RAW_TYPE_REFERENCE, CompilerOptions.IGNORE); options.put(JavaCore.COMPILER_PB_VARARGS_ARGUMENT_NEED_CAST, CompilerOptions.IGNORE); return new CompilerOptions(options); }
From source file:org.apache.commons.jci.compilers.EclipseJavaCompilerSettings.java
License:Apache License
Map<String, String> toNativeSettings() { final Map<String, String> map = new HashMap<String, String>(defaultEclipseSettings); map.put(CompilerOptions.OPTION_SuppressWarnings, isWarnings() ? CompilerOptions.GENERATE : CompilerOptions.DO_NOT_GENERATE); map.put(CompilerOptions.OPTION_ReportDeprecation, isDeprecations() ? CompilerOptions.GENERATE : CompilerOptions.DO_NOT_GENERATE); map.put(CompilerOptions.OPTION_TargetPlatform, toNativeVersion(getTargetVersion())); map.put(CompilerOptions.OPTION_Source, toNativeVersion(getSourceVersion())); map.put(CompilerOptions.OPTION_Encoding, getSourceEncoding()); return map;// ww w . j av a 2 s .c om }
From source file:org.apache.commons.jci.compilers.EclipseJavaCompilerSettingsTestCase.java
License:Apache License
public void testDefaultSettings() { final Map<String, String> m = new EclipseJavaCompilerSettings().toNativeSettings(); assertEquals(CompilerOptions.DO_NOT_GENERATE, m.get(CompilerOptions.OPTION_SuppressWarnings)); assertEquals(CompilerOptions.DO_NOT_GENERATE, m.get(CompilerOptions.OPTION_ReportDeprecation)); assertEquals(CompilerOptions.VERSION_1_4, m.get(CompilerOptions.OPTION_TargetPlatform)); assertEquals(CompilerOptions.VERSION_1_4, m.get(CompilerOptions.OPTION_Source)); assertEquals("UTF-8", m.get(CompilerOptions.OPTION_Encoding)); }
From source file:org.apache.commons.jci.compilers.EclipseJavaCompilerSettingsTestCase.java
License:Apache License
public void testWarnings() { final EclipseJavaCompilerSettings s = new EclipseJavaCompilerSettings(); s.setWarnings(true);/*from w ww . ja v a 2 s . c om*/ assertEquals(CompilerOptions.GENERATE, s.toNativeSettings().get(CompilerOptions.OPTION_SuppressWarnings)); s.setWarnings(false); assertEquals(CompilerOptions.DO_NOT_GENERATE, s.toNativeSettings().get(CompilerOptions.OPTION_SuppressWarnings)); }
From source file:org.codehaus.plexus.compiler.eclipse.EclipseJavaCompiler.java
License:Open Source License
public List compile(CompilerConfiguration config) throws CompilerException { List errors = new LinkedList(); List classpathEntries = config.getClasspathEntries(); URL[] urls = new URL[1 + classpathEntries.size()]; int i = 0;/* w ww . j av a2 s.co m*/ try { urls[i++] = new File(config.getOutputLocation()).toURL(); for (Iterator it = classpathEntries.iterator(); it.hasNext();) { urls[i++] = new File((String) it.next()).toURL(); } } catch (MalformedURLException e) { throw new CompilerException("Error while converting the classpath entries to URLs.", e); } ClassLoader classLoader = new URLClassLoader(urls); SourceCodeLocator sourceCodeLocator = new SourceCodeLocator(config.getSourceLocations()); INameEnvironment env = new EclipseCompilerINameEnvironment(sourceCodeLocator, classLoader, errors); IErrorHandlingPolicy policy = DefaultErrorHandlingPolicies.proceedWithAllProblems(); // ---------------------------------------------------------------------- // Build settings from configuration // ---------------------------------------------------------------------- Map settings = new HashMap(); if (config.isDebug()) { settings.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE); settings.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE); settings.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE); } if (!config.isShowWarnings()) { // TODO: Implement. I'm not sure what value to pass - trygve // settings.put( CompilerOptions.OPTION_SuppressWarnings, ); settings.put(CompilerOptions.OPTION_SuppressWarnings, CompilerOptions.ENABLED); } String sourceVersion = decodeVersion(config.getSourceVersion()); if (sourceVersion != null) { settings.put(CompilerOptions.OPTION_Source, sourceVersion); } String targetVersion = decodeVersion(config.getTargetVersion()); if (targetVersion != null) { settings.put(CompilerOptions.OPTION_TargetPlatform, targetVersion); if (config.isOptimize()) { settings.put(CompilerOptions.OPTION_Compliance, targetVersion); } } if (StringUtils.isNotEmpty(config.getSourceEncoding())) { settings.put(CompilerOptions.OPTION_Encoding, config.getSourceEncoding()); } if (config.isShowDeprecation()) { settings.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.WARNING); } else { settings.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.IGNORE); } // ---------------------------------------------------------------------- // Set Eclipse-specific options // ---------------------------------------------------------------------- settings.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE); settings.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE); // compiler-specific extra options override anything else in the config object... Map extras = config.getCustomCompilerArguments(); if (extras != null && !extras.isEmpty()) { settings.putAll(extras); } IProblemFactory problemFactory = new DefaultProblemFactory(Locale.getDefault()); ICompilerRequestor requestor = new EclipseCompilerICompilerRequestor(config.getOutputLocation(), errors); List compilationUnits = new ArrayList(); for (Iterator it = config.getSourceLocations().iterator(); it.hasNext();) { String sourceRoot = (String) it.next(); Set sources = getSourceFilesForSourceRoot(config, sourceRoot); for (Iterator it2 = sources.iterator(); it2.hasNext();) { String source = (String) it2.next(); CompilationUnit unit = new CompilationUnit(source, makeClassName(source, sourceRoot), errors); compilationUnits.add(unit); } } // ---------------------------------------------------------------------- // Compile! // ---------------------------------------------------------------------- CompilerOptions options = new CompilerOptions(settings); Compiler compiler = new Compiler(env, policy, options, requestor, problemFactory); ICompilationUnit[] units = (ICompilationUnit[]) compilationUnits .toArray(new ICompilationUnit[compilationUnits.size()]); compiler.compile(units); return errors; }
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;// ww w . j a va2 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.thiesen.ecj4ant.Options.java
License:Open Source License
public static Map<String, String> defaultOptions() { return new HashMap<String, String>() { private static final long serialVersionUID = 1L; {// ww w .ja v a 2 s.c o m put(CompilerOptions.OPTION_Process_Annotations, CompilerOptions.ENABLED); put(CompilerOptions.OPTION_SuppressWarnings, CompilerOptions.ENABLED); put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED); // set the language level to jdk7 (the currently stable version) put(CompilerOptions.OPTION_Compliance, CompilerOptions.versionFromJdkLevel(ClassFileConstants.JDK1_7)); put(CompilerOptions.OPTION_Source, CompilerOptions.versionFromJdkLevel(ClassFileConstants.JDK1_7)); put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.versionFromJdkLevel(ClassFileConstants.JDK1_7)); } }; }
From source file:org.thiesen.ecj4ant.Options.java
License:Open Source License
public static Map<String, String> warnAllOptions() { return new HashMap<String, String>() { private static final long serialVersionUID = 1L; {/*from w w w. jav a 2 s. co m*/ put(CompilerOptions.OPTION_Process_Annotations, CompilerOptions.ENABLED); put(CompilerOptions.OPTION_SuppressWarnings, CompilerOptions.ENABLED); put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED); put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.WARNING); put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.WARNING); put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.WARNING); put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.WARNING); put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportMethodWithConstructorName, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportOverridingPackageDefaultMethod, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportHiddenCatchBlock, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUnusedParameter, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUnusedParameterWhenImplementingAbstract, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUnusedParameterWhenOverridingConcrete, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUnusedParameterIncludeDocCommentReference, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportSyntheticAccessEmulation, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportNoEffectAssignment, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportLocalVariableHiding, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportSpecialParameterHidingField, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportFieldHiding, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportTypeParameterHiding, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportPossibleAccidentalBooleanAssignment, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportIncompatibleNonInheritedInterfaceMethod, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportNoImplicitStringConversion, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportAssertIdentifier, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportEnumIdentifier, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportNonStaticAccessToStatic, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportIndirectStaticAccess, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportEmptyStatement, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUnnecessaryTypeCheck, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUnnecessaryElse, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUndocumentedEmptyBlock, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportInvalidJavadocTags, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportInvalidJavadocTagsDeprecatedRef, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportInvalidJavadocTagsNotVisibleRef, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportInvalidJavadocTagsVisibility, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportMissingJavadocTags, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportMissingJavadocTagsVisibility, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportMissingJavadocTagsOverriding, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportMissingJavadocComments, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportMissingJavadocTagDescription, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportMissingJavadocCommentsVisibility, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportMissingJavadocCommentsOverriding, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportFinallyBlockNotCompletingNormally, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUnusedDeclaredThrownException, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUnusedDeclaredThrownExceptionIncludeDocCommentReference, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUnusedDeclaredThrownExceptionExemptExceptionAndThrowable, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUnqualifiedFieldAccess, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportFinalParameterBound, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportMissingSerialVersion, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportVarargsArgumentNeedCast, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUnusedTypeArgumentsForMethodInvocation, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportAutoboxing, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportAnnotationSuperInterface, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportMissingOverrideAnnotation, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportMissingDeprecatedAnnotation, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportIncompleteEnumSwitch, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportForbiddenReference, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportDiscouragedReference, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUnhandledWarningToken, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUnusedWarningToken, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportUnusedLabel, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportParameterAssignment, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportFallthroughCase, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportOverridingMethodWithoutSuperInvocation, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportRedundantSuperinterface, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportComparingIdentical, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportMissingSynchronizedOnInheritedMethod, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportMissingHashCodeMethod, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportDeadCode, CompilerOptions.WARNING); put(CompilerOptions.OPTION_ReportDeadCodeInTrivialIfStatement, CompilerOptions.WARNING); } }; }