summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--branches/sca-equinox/tools/maven/maven-eclipse-compiler/src/main/java/org/apache/tuscany/sca/tools/maven/compiler/CompilerRequestor.java20
-rw-r--r--branches/sca-equinox/tools/maven/maven-eclipse-compiler/src/main/java/org/apache/tuscany/sca/tools/maven/compiler/FileCompilationUnit.java3
-rw-r--r--branches/sca-equinox/tools/maven/maven-eclipse-compiler/src/main/java/org/apache/tuscany/sca/tools/maven/compiler/JavaCompiler.java7
3 files changed, 17 insertions, 13 deletions
diff --git a/branches/sca-equinox/tools/maven/maven-eclipse-compiler/src/main/java/org/apache/tuscany/sca/tools/maven/compiler/CompilerRequestor.java b/branches/sca-equinox/tools/maven/maven-eclipse-compiler/src/main/java/org/apache/tuscany/sca/tools/maven/compiler/CompilerRequestor.java
index c0d280b9ae..3df4b4d602 100644
--- a/branches/sca-equinox/tools/maven/maven-eclipse-compiler/src/main/java/org/apache/tuscany/sca/tools/maven/compiler/CompilerRequestor.java
+++ b/branches/sca-equinox/tools/maven/maven-eclipse-compiler/src/main/java/org/apache/tuscany/sca/tools/maven/compiler/CompilerRequestor.java
@@ -33,10 +33,12 @@ import org.eclipse.jdt.internal.compiler.ICompilerRequestor;
class CompilerRequestor implements ICompilerRequestor {
private String outputDirectory;
+ private boolean showWarnings;
private List<CompilerError> compilerErrors;
- public CompilerRequestor(String outputDirectory, List<CompilerError> compilerErrors) {
+ public CompilerRequestor(String outputDirectory, boolean showWarnings, List<CompilerError> compilerErrors) {
this.outputDirectory = outputDirectory;
+ this.showWarnings = showWarnings;
this.compilerErrors = compilerErrors;
}
@@ -47,13 +49,15 @@ class CompilerRequestor implements ICompilerRequestor {
// Convert JDT IProblems into plexus CompilerErrors
for (IProblem problem: result.getProblems()) {
if (problem.isWarning()) {
- compilerErrors.add(new CompilerError(new String(problem.getOriginatingFileName()),
- false,
- problem.getSourceLineNumber(),
- problem.getSourceStart(),
- problem.getSourceLineNumber(),
- problem.getSourceEnd(),
- problem.getMessage()));
+ if (showWarnings) {
+ compilerErrors.add(new CompilerError(new String(problem.getOriginatingFileName()),
+ false,
+ problem.getSourceLineNumber(),
+ problem.getSourceStart(),
+ problem.getSourceLineNumber(),
+ problem.getSourceEnd(),
+ problem.getMessage()));
+ }
} else if (problem.isError()) {
hasErrors = true;
diff --git a/branches/sca-equinox/tools/maven/maven-eclipse-compiler/src/main/java/org/apache/tuscany/sca/tools/maven/compiler/FileCompilationUnit.java b/branches/sca-equinox/tools/maven/maven-eclipse-compiler/src/main/java/org/apache/tuscany/sca/tools/maven/compiler/FileCompilationUnit.java
index 5d6e80a9ea..08ed7f034e 100644
--- a/branches/sca-equinox/tools/maven/maven-eclipse-compiler/src/main/java/org/apache/tuscany/sca/tools/maven/compiler/FileCompilationUnit.java
+++ b/branches/sca-equinox/tools/maven/maven-eclipse-compiler/src/main/java/org/apache/tuscany/sca/tools/maven/compiler/FileCompilationUnit.java
@@ -34,6 +34,7 @@ import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
* @version $Rev: $ $Date: $
*/
class FileCompilationUnit implements ICompilationUnit {
+ private final static char fileSeparator = System.getProperty("file.separator").charAt(0);
private String className;
private String sourceFile;
@@ -64,7 +65,7 @@ class FileCompilationUnit implements ICompilationUnit {
}
public char[] getFileName() {
- return sourceFile.toCharArray();
+ return (className.replace('.', fileSeparator) + ".java").toCharArray();
}
public char[] getMainTypeName() {
diff --git a/branches/sca-equinox/tools/maven/maven-eclipse-compiler/src/main/java/org/apache/tuscany/sca/tools/maven/compiler/JavaCompiler.java b/branches/sca-equinox/tools/maven/maven-eclipse-compiler/src/main/java/org/apache/tuscany/sca/tools/maven/compiler/JavaCompiler.java
index b777a09cab..536a249255 100644
--- a/branches/sca-equinox/tools/maven/maven-eclipse-compiler/src/main/java/org/apache/tuscany/sca/tools/maven/compiler/JavaCompiler.java
+++ b/branches/sca-equinox/tools/maven/maven-eclipse-compiler/src/main/java/org/apache/tuscany/sca/tools/maven/compiler/JavaCompiler.java
@@ -22,6 +22,7 @@ package org.apache.tuscany.sca.tools.maven.compiler;
import static org.codehaus.plexus.compiler.CompilerOutputStyle.ONE_OUTPUT_FILE_PER_INPUT_FILE;
import static org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies.proceedWithAllProblems;
import static org.eclipse.jdt.internal.compiler.impl.CompilerOptions.DISABLED;
+import static org.eclipse.jdt.internal.compiler.impl.CompilerOptions.ENABLED;
import static org.eclipse.jdt.internal.compiler.impl.CompilerOptions.GENERATE;
import static org.eclipse.jdt.internal.compiler.impl.CompilerOptions.IGNORE;
import static org.eclipse.jdt.internal.compiler.impl.CompilerOptions.OPTION_Encoding;
@@ -53,6 +54,7 @@ import org.eclipse.jdt.internal.compiler.Compiler;
import org.eclipse.jdt.internal.compiler.ICompilerRequestor;
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
/**
@@ -101,9 +103,6 @@ public class JavaCompiler extends AbstractCompiler {
if (configuration.getSourceEncoding() != null && !(configuration.getSourceEncoding().length() == 0)) {
settings.put(OPTION_Encoding, configuration.getSourceEncoding());
}
- if (!configuration.isShowWarnings()) {
- settings.put(OPTION_SuppressWarnings, DISABLED);
- }
if (configuration.isShowDeprecation()) {
settings.put(OPTION_ReportDeprecation, WARNING);
} else {
@@ -113,7 +112,7 @@ public class JavaCompiler extends AbstractCompiler {
// Create a compiler
List<CompilerError> compilerErrors = new ArrayList<CompilerError>();
INameEnvironment nameEnvironment = new ClassLoaderNameEnvironment(classLoader, configuration.getSourceLocations());
- ICompilerRequestor requestor = new CompilerRequestor(configuration.getOutputLocation(), compilerErrors);
+ ICompilerRequestor requestor = new CompilerRequestor(configuration.getOutputLocation(), configuration.isShowWarnings(), compilerErrors);
Compiler compiler = new Compiler(nameEnvironment,
proceedWithAllProblems(),
settings,