List of usage examples for org.eclipse.jdt.internal.compiler.impl CompilerOptions OPTION_ReportDeprecation
String OPTION_ReportDeprecation
To view the source code for org.eclipse.jdt.internal.compiler.impl CompilerOptions OPTION_ReportDeprecation.
Click Source Link
From source file:com.mysema.codegen.ECJEvaluatorFactory.java
License:Apache License
public static CompilerOptions getDefaultCompilerOptions() { String javaSpecVersion = System.getProperty("java.specification.version"); if (javaSpecVersion.equals("1.8")) { javaSpecVersion = "1.7"; }// w w w.j av a2 s . co m Map<String, Object> settings = Maps.newHashMap(); settings.put(CompilerOptions.OPTION_Source, javaSpecVersion); settings.put(CompilerOptions.OPTION_TargetPlatform, javaSpecVersion); settings.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.IGNORE); return new CompilerOptions(settings); }
From source file:com.tsc9526.monalisa.plugin.eclipse.jdt.JDTCompiler.java
License:Open Source License
public CompilerOptions getCompilerOptions() { Map<String, String> settings = new HashMap<String, String>(); settings.put(CompilerOptions.OPTION_ReportMissingSerialVersion, CompilerOptions.IGNORE); settings.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE); settings.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE); settings.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.IGNORE); settings.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.IGNORE); settings.put(CompilerOptions.OPTION_Encoding, "UTF-8"); settings.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE); String javaVersion = CompilerOptions.VERSION_1_6; if (System.getProperty("java.version").startsWith("1.5")) { javaVersion = CompilerOptions.VERSION_1_5; } else if (System.getProperty("java.version").startsWith("1.7")) { javaVersion = CompilerOptions.VERSION_1_7; } else if (System.getProperty("java.version").startsWith("1.8")) { javaVersion = CompilerOptions.VERSION_1_8; }/*from w ww.j a v a2 s. c o m*/ settings.put(CompilerOptions.OPTION_Source, javaVersion); settings.put(CompilerOptions.OPTION_TargetPlatform, javaVersion); settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.PRESERVE); settings.put(CompilerOptions.OPTION_Compliance, javaVersion); return new CompilerOptions(settings); }
From source file:com.xqbase.compiler.eclipse.EclipseJavaCompiler.java
License:Open Source License
public CompilerResult performCompile(CompilerConfiguration config) throws CompilerException { // added by xqbase-compiler-eclipse if (config.getGeneratedSourcesDirectory() != null) { config.getGeneratedSourcesDirectory().mkdirs(); }//from w w w . j a v a 2 s .c om List<CompilerMessage> errors = new LinkedList<CompilerMessage>(); List<String> classpathEntries = config.getClasspathEntries(); URL[] urls = new URL[1 + classpathEntries.size()]; int i = 0; try { urls[i++] = new File(config.getOutputLocation()).toURL(); for (String entry : classpathEntries) { urls[i++] = new File(entry).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<String, String> settings = new HashMap<String, String>(); 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()) { Map opts = new CompilerOptions().getMap(); for (Object optKey : opts.keySet()) { if (opts.get(optKey).equals(CompilerOptions.WARNING)) { settings.put((String) optKey, CompilerOptions.IGNORE); } } } 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<String, String> extras = config.getCustomCompilerArguments(); if (extras != null && !extras.isEmpty()) { settings.putAll(extras); } if (settings.containsKey("-properties")) { initializeWarnings(settings.get("-properties"), settings); settings.remove("-properties"); } IProblemFactory problemFactory = new DefaultProblemFactory(Locale.getDefault()); ICompilerRequestor requestor = new EclipseCompilerICompilerRequestor(config.getOutputLocation(), errors); List<CompilationUnit> compilationUnits = new ArrayList<CompilationUnit>(); for (String sourceRoot : config.getSourceLocations()) { Set<String> sources = getSourceFilesForSourceRoot(config, sourceRoot); for (String source : sources) { CompilationUnit unit = new CompilationUnit(source, makeClassName(source, sourceRoot), errors, config.getSourceEncoding()); compilationUnits.add(unit); } } // ---------------------------------------------------------------------- // Compile! // ---------------------------------------------------------------------- CompilerOptions options = new CompilerOptions(settings); Compiler compiler = new Compiler(env, policy, options, requestor, problemFactory); ICompilationUnit[] units = compilationUnits.toArray(new ICompilationUnit[compilationUnits.size()]); compiler.compile(units); CompilerResult compilerResult = new CompilerResult().compilerMessages(errors); for (CompilerMessage compilerMessage : errors) { if (compilerMessage.isError()) { compilerResult.setSuccess(false); continue; } } return compilerResult; }
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 2s. 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:jetbrick.template.compiler.JdtCompiler.java
License:Open Source License
private CompilerOptions getCompilerOptions() { Map<String, String> settings = new HashMap<String, String>(); settings.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE); settings.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE); settings.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.IGNORE); settings.put(CompilerOptions.OPTION_Encoding, JavaSource.JAVA_FILE_ENCODING); settings.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE); settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6); settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6); settings.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_6); CompilerOptions options = new CompilerOptions(settings); options.parseLiteralExpressionsAsConstants = true; return options; }
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:net.sf.jasperreports.eclipse.builder.jdt.JRJdtCompiler.java
License:Open Source License
protected Map<String, String> getJdtSettings() { if (settings == null) { settings = new HashMap<String, String>(); settings.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE); settings.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE); settings.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.IGNORE); // if (ctxt.getOptions().getJavaEncoding() != null) // {/*from ww w .j av a2 s . c o m*/ // settings.put(CompilerOptions.OPTION_Encoding, // ctxt.getOptions().getJavaEncoding()); // } // if (ctxt.getOptions().getClassDebugInfo()) // { // settings.put(CompilerOptions.OPTION_LocalVariableAttribute, // CompilerOptions.GENERATE); // } List<JRPropertiesUtil.PropertySuffix> properties = JRPropertiesUtil.getInstance(jasperReportsContext) .getProperties(JDT_PROPERTIES_PREFIX); for (Iterator<JRPropertiesUtil.PropertySuffix> it = properties.iterator(); it.hasNext();) { JRPropertiesUtil.PropertySuffix property = it.next(); String propVal = property.getValue(); if (propVal != null && propVal.length() > 0) { settings.put(property.getKey(), propVal); } } Properties systemProps = System.getProperties(); for (Enumeration<String> it = (Enumeration<String>) systemProps.propertyNames(); it .hasMoreElements();) { String propName = it.nextElement(); if (propName.startsWith(JDT_PROPERTIES_PREFIX)) { String propVal = systemProps.getProperty(propName); if (propVal != null && propVal.length() > 0) { settings.put(propName, propVal); } } } } return settings; }
From source file:net.sf.jasperreports.engine.design.JRJdtCompiler.java
License:LGPL
protected Map getJdtSettings() { final Map settings = new HashMap(); settings.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE); settings.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE); settings.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.IGNORE); // if (ctxt.getOptions().getJavaEncoding() != null) // {/*from ww w . j a va 2 s . co m*/ // settings.put(CompilerOptions.OPTION_Encoding, ctxt.getOptions().getJavaEncoding()); // } // if (ctxt.getOptions().getClassDebugInfo()) // { // settings.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE); // } List properties = JRProperties.getProperties(JDT_PROPERTIES_PREFIX); for (Iterator it = properties.iterator(); it.hasNext();) { JRProperties.PropertySuffix property = (JRProperties.PropertySuffix) it.next(); String propVal = property.getValue(); if (propVal != null && propVal.length() > 0) { settings.put(property.getKey(), propVal); } } Properties systemProps = System.getProperties(); for (Enumeration it = systemProps.propertyNames(); it.hasMoreElements();) { String propName = (String) it.nextElement(); if (propName.startsWith(JDT_PROPERTIES_PREFIX)) { String propVal = systemProps.getProperty(propName); if (propVal != null && propVal.length() > 0) { settings.put(propName, propVal); } } } return settings; }
From source file:org.ant4eclipse.ant.jdt.ecj.CompilerOptionsProvider.java
License:Open Source License
/** * <p>// ww w . j a va2 s . com * Returns the compiler options specified in the javac task. * </p> * * @param javac * the javac task * @return the compiler options specified in the javac task. */ @SuppressWarnings("unchecked") private static final StringMap getJavacCompilerOptions(Javac javac) { StringMap result = new StringMap(); /* * set the source option */ if (Utilities.hasText(javac.getSource())) { // get the source String source = javac.getSource(); // set the source if (source.equals("1.3")) { result.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_3); } else if (source.equals("1.4")) { result.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4); } else if (source.equals("1.5") || source.equals("5") || source.equals("5.0")) { result.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); } else if (source.equals("1.6") || source.equals("6") || source.equals("6.0")) { result.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6); } else if (source.equals("1.7") || source.equals("7") || source.equals("7.0")) { result.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7); } else if (source.equals("1.8") || source.equals("8") || source.equals("8.0")) { result.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8); } else { throw new Ant4EclipseException(EcjExceptionCodes.UNKNOWN_JAVA_SOURCE_OPTION_EXCEPTION, source); } } /* * set the target option */ if (Utilities.hasText(javac.getTarget())) { // get the target String target = javac.getTarget(); // set the target if (target.equals("1.3")) { result.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_3); result.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_3); } else if (target.equals("1.4")) { result.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4); result.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4); } else if (target.equals("1.5") || target.equals("5") || target.equals("5.0")) { result.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); result.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); } else if (target.equals("1.6") || target.equals("6") || target.equals("6.0")) { result.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6); result.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_6); } else if (target.equals("1.7") || target.equals("7") || target.equals("7.0")) { result.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_7); result.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_7); } else if (target.equals("1.8") || target.equals("8") || target.equals("8.0")) { result.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); result.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8); } else { throw new Ant4EclipseException(EcjExceptionCodes.UNKNOWN_JAVA_TARGET_OPTION_EXCEPTION, target); } } /* * set the debug options */ if (javac.getDebug()) { String debugLevel = javac.getDebugLevel(); if (debugLevel != null) { result.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE); result.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.DO_NOT_GENERATE); result.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.DO_NOT_GENERATE); if (debugLevel.length() != 0) { if (debugLevel.indexOf("vars") != -1) { result.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE); } if (debugLevel.indexOf("lines") != -1) { result.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE); } if (debugLevel.indexOf("source") != -1) { result.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE); } } } else { result.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE); result.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE); result.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE); } } else { result.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE); result.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.DO_NOT_GENERATE); result.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.DO_NOT_GENERATE); } /* * Handle the nowarn option. If none, then we generate all warnings. */ if (javac.getNowarn()) { // disable all warnings Map.Entry<String, String>[] entries = result.entrySet().toArray(new Map.Entry[result.size()]); for (Entry<String, String> entrie : entries) { Map.Entry<String, String> entry = entrie; if (entry.getValue().equals(CompilerOptions.WARNING)) { result.put(entry.getKey(), CompilerOptions.IGNORE); } } result.put(CompilerOptions.OPTION_TaskTags, Util.EMPTY_STRING); if (javac.getDeprecation()) { result.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.WARNING); result.put(CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, CompilerOptions.ENABLED); result.put(CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, CompilerOptions.ENABLED); } } else if (javac.getDeprecation()) { result.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.WARNING); result.put(CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, CompilerOptions.ENABLED); result.put(CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, CompilerOptions.ENABLED); } else { result.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.IGNORE); result.put(CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, CompilerOptions.DISABLED); result.put(CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, CompilerOptions.DISABLED); } /* * set the encoding option */ if (javac.getEncoding() != null) { result.put(CompilerOptions.OPTION_Encoding, javac.getEncoding()); } // return result return result; }
From source file:org.ant4eclipse.ant.jdt.ecj.JavacCompilerAdapter.java
License:Open Source License
/** * Creates a list with commandline arguments shared among all source files. * /* w w w . j av a 2 s . c om*/ * @param description * The description used for the compilation process. Not <code>null</code>. * * @return The list with commandline arguments. Not <code>null</code>. */ private List<String> createCommonArgs(CompileJobDescription description) { Map<String, String> options = description.getCompilerOptions(); List<String> result = new ArrayList<String>(); result.add(getCompileOptions(description)); Path bootclasspath = getJavac().getBootclasspath(); if (bootclasspath != null) { result.add("-bootclasspath"); result.add(getConcatenatedPath(bootclasspath.list())); } Path extdirs = getJavac().getExtdirs(); if (extdirs != null) { result.add("-extdirs"); result.add(getConcatenatedPath(extdirs.list())); } result.add("-classpath"); result.add(getClasspath(description)); result.add(String.format("-g:%s", getDebugOptions(description))); if (A4ELogging.isDebuggingEnabled()) { result.add("-verbose"); } if (options.containsKey(CompilerOptions.OPTION_Source)) { result.add("-source"); result.add(options.get(CompilerOptions.OPTION_Source)); } if (options.containsKey(CompilerOptions.OPTION_Compliance)) { result.add("-target"); result.add(options.get(CompilerOptions.OPTION_Compliance)); } if (options.containsKey(CompilerOptions.OPTION_Encoding)) { result.add("-encoding"); result.add(options.get(CompilerOptions.OPTION_Encoding)); } if (options.containsKey(CompilerOptions.OPTION_ReportDeprecation) || options.containsKey(CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode) || options.containsKey(CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod)) { result.add("-deprecation"); } return result; }