incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r801268 - in /sling/trunk/contrib/commons/compiler/src: main/java/org/apache/sling/commons/compiler/ main/java/org/apache/sling/commons/compiler/impl/ test/java/org/apache/sling/commons/compiler/impl/
Date Wed, 05 Aug 2009 15:34:09 GMT
Author: cziegeler
Date: Wed Aug  5 15:33:58 2009
New Revision: 801268

URL: http://svn.apache.org/viewvc?rev=801268&view=rev
Log:
Remove empty code and prints to system out.

Modified:
    sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/CompileUnit.java
    sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/CompilerEnvironment.java
    sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/JavaCompiler.java
    sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/impl/EclipseJavaCompiler.java
    sling/trunk/contrib/commons/compiler/src/test/java/org/apache/sling/commons/compiler/impl/CompilerJava5Test.java

Modified: sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/CompileUnit.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/CompileUnit.java?rev=801268&r1=801267&r2=801268&view=diff
==============================================================================
--- sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/CompileUnit.java
(original)
+++ sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/CompileUnit.java
Wed Aug  5 15:33:58 2009
@@ -16,21 +16,10 @@
  */
 package org.apache.sling.commons.compiler;
 
-/**
- *
- */
 public interface CompileUnit {
 
-    /**
-     *
-     * @return
-     */
     String getSourceFileName();
 
-    /**
-     *
-     * @return
-     */
     char[] getSourceFileContents();
 
     /**

Modified: sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/CompilerEnvironment.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/CompilerEnvironment.java?rev=801268&r1=801267&r2=801268&view=diff
==============================================================================
--- sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/CompilerEnvironment.java
(original)
+++ sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/CompilerEnvironment.java
Wed Aug  5 15:33:58 2009
@@ -16,28 +16,11 @@
  */
 package org.apache.sling.commons.compiler;
 
-/**
- *
- */
 public interface CompilerEnvironment {
 
-    /**
-     *
-     * @param className
-     * @return
-     * @throws Exception
-     */
     byte[] findClass(String className) throws Exception;
 
-    /**
-     *  
-     * @param packageName
-     * @return
-     */
     boolean isPackage(String packageName);
 
-    /**
-     *
-     */
     void cleanup();
 }

Modified: sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/JavaCompiler.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/JavaCompiler.java?rev=801268&r1=801267&r2=801268&view=diff
==============================================================================
--- sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/JavaCompiler.java
(original)
+++ sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/JavaCompiler.java
Wed Aug  5 15:33:58 2009
@@ -17,21 +17,11 @@
 package org.apache.sling.commons.compiler;
 
 /**
- * The <code>JavaCompiler</code> provides platform independant Java Compilation

+ * The <code>JavaCompiler</code> provides platform independant Java Compilation
  * support.
  */
 public interface JavaCompiler {
 
-	/**
-     *
-     * @param units
-     * @param env
-     * @param classWriter
-     * @param errorHandler
-     * @param generateDebugInfo
-     * @param sourceVersion
-     * @return
-     */
     boolean compile(CompileUnit[] units, CompilerEnvironment env,
                         ClassWriter classWriter, ErrorHandler errorHandler,
                         Options options);

Modified: sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/impl/EclipseJavaCompiler.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/impl/EclipseJavaCompiler.java?rev=801268&r1=801267&r2=801268&view=diff
==============================================================================
--- sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/impl/EclipseJavaCompiler.java
(original)
+++ sling/trunk/contrib/commons/compiler/src/main/java/org/apache/sling/commons/compiler/impl/EclipseJavaCompiler.java
Wed Aug  5 15:33:58 2009
@@ -16,40 +16,41 @@
  */
 package org.apache.sling.commons.compiler.impl;
 
+import java.io.BufferedReader;
+import java.io.CharArrayReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
 import org.apache.sling.commons.compiler.ClassWriter;
 import org.apache.sling.commons.compiler.CompileUnit;
-import org.apache.sling.commons.compiler.JavaCompiler;
 import org.apache.sling.commons.compiler.CompilerEnvironment;
 import org.apache.sling.commons.compiler.ErrorHandler;
+import org.apache.sling.commons.compiler.JavaCompiler;
 import org.apache.sling.commons.compiler.Options;
+import org.eclipse.jdt.core.compiler.CategorizedProblem;
+import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.compiler.ClassFile;
+import org.eclipse.jdt.internal.compiler.CompilationResult;
+import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies;
+import org.eclipse.jdt.internal.compiler.ICompilerRequestor;
+import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
+import org.eclipse.jdt.internal.compiler.IProblemFactory;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
 import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
 import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
 import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer;
 import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
 import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
-import org.eclipse.jdt.internal.compiler.IProblemFactory;
-import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
-import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies;
-import org.eclipse.jdt.internal.compiler.ICompilerRequestor;
-import org.eclipse.jdt.internal.compiler.CompilationResult;
-import org.eclipse.jdt.internal.compiler.ClassFile;
-import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
-import org.eclipse.jdt.core.compiler.CharOperation;
-import org.eclipse.jdt.core.compiler.CategorizedProblem;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Locale;
-import java.util.HashMap;
-import java.io.PrintWriter;
-import java.io.CharArrayReader;
-import java.io.BufferedReader;
-import java.io.IOException;
-
 /**
- * The <code>EclipseJavaCompiler</code> provides platform independant Java Compilation

+ * The <code>EclipseJavaCompiler</code> provides platform independant Java Compilation
  * support using the Eclipse Java Compiler (org.eclipse.jdt).
- * 
+ *
  * @scr.component metatype="no"
  * @scr.service interface="org.apache.sling.commons.compiler.JavaCompiler"
  */
@@ -66,13 +67,7 @@
     }
 
     /**
-     *
-     * @param units
-     * @param env
-     * @param classWriter
-     * @param errorHandler
-     * @param options
-     * @return
+     * @see org.apache.sling.commons.compiler.JavaCompiler#compile(org.apache.sling.commons.compiler.CompileUnit[],
org.apache.sling.commons.compiler.CompilerEnvironment, org.apache.sling.commons.compiler.ClassWriter,
org.apache.sling.commons.compiler.ErrorHandler, org.apache.sling.commons.compiler.Options)
      */
     public boolean compile(CompileUnit[] units, CompilerEnvironment env,
             ClassWriter classWriter, ErrorHandler errorHandler,
@@ -87,8 +82,8 @@
         if (options == null) {
             options = new Options();
         }
-        
-        HashMap props = new HashMap();
+
+        Map<String, String> props = new HashMap<String, String>();
         if (options.isGenerateDebugInfo()) {
             props.put("org.eclipse.jdt.core.compiler.debug.localVariable", "generate");
             props.put("org.eclipse.jdt.core.compiler.debug.lineNumber", "generate");
@@ -102,13 +97,13 @@
         }
         //options.put("org.eclipse.jdt.core.encoding", "UTF8");
         CompilerOptions settings = new CompilerOptions(props);
-        
+
         CompileContext context = new CompileContext(units, env, errorHandler, classWriter);
 
         if (log.isDebugEnabled()) {
             log.debug(settings.toString());
         }
-        
+
         org.eclipse.jdt.internal.compiler.Compiler compiler =
                 new org.eclipse.jdt.internal.compiler.Compiler(
                         context,
@@ -121,7 +116,7 @@
         compiler.compile(context.sourceUnits());
 
         context.cleanup();
-        
+
         return !context.hadErrors;
     }
 
@@ -139,16 +134,16 @@
 
         CompileContext(CompileUnit[] units,
         		CompilerEnvironment compEnv,
-        		ErrorHandler errorHandler, 
+        		ErrorHandler errorHandler,
         		ClassWriter classWriter) {
-            
+
         	compUnits = new HashMap<String,ICompilationUnit>(units.length);
             for (int i = 0; i < units.length; i++) {
                 CompilationUnitAdapter cua = new CompilationUnitAdapter(units[i]);
                 char[][] compoundName = CharOperation.arrayConcat(cua.getPackageName(), cua.getMainTypeName());
                 compUnits.put(CharOperation.toString(compoundName), new CompilationUnitAdapter(units[i]));
             }
-        	
+
         	this.compEnv = compEnv;
         	this.errorHandler = errorHandler;
             this.classWriter = classWriter;
@@ -156,10 +151,10 @@
         }
 
         ICompilationUnit[] sourceUnits() {
-        	return (ICompilationUnit[]) compUnits.values().toArray(
+        	return compUnits.values().toArray(
         			new ICompilationUnit[compUnits.size()]);
         }
-        
+
         //---------------------------------------------------< ICompilerRequestor >
         /**
          * {@inheritDoc}
@@ -206,7 +201,7 @@
         public NameEnvironmentAnswer findType(char[][] compoundTypeName) {
             // check 1st if type corresponds with any of current compilation units
             String fqn = CharOperation.toString(compoundTypeName);
-            ICompilationUnit cu = (ICompilationUnit) compUnits.get(fqn);
+            ICompilationUnit cu = compUnits.get(fqn);
             if (cu != null) {
                 return new NameEnvironmentAnswer(cu, null);
             }
@@ -248,7 +243,7 @@
             compEnv.cleanup();
         }
     }
-    
+
     private class CompilationUnitAdapter implements ICompilationUnit {
 
         CompileUnit compUnit;

Modified: sling/trunk/contrib/commons/compiler/src/test/java/org/apache/sling/commons/compiler/impl/CompilerJava5Test.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/compiler/src/test/java/org/apache/sling/commons/compiler/impl/CompilerJava5Test.java?rev=801268&r1=801267&r2=801268&view=diff
==============================================================================
--- sling/trunk/contrib/commons/compiler/src/test/java/org/apache/sling/commons/compiler/impl/CompilerJava5Test.java
(original)
+++ sling/trunk/contrib/commons/compiler/src/test/java/org/apache/sling/commons/compiler/impl/CompilerJava5Test.java
Wed Aug  5 15:33:58 2009
@@ -23,14 +23,14 @@
 import java.io.InputStreamReader;
 import java.io.Reader;
 
+import junit.framework.TestCase;
+
 import org.apache.sling.commons.compiler.ClassWriter;
 import org.apache.sling.commons.compiler.CompileUnit;
 import org.apache.sling.commons.compiler.CompilerEnvironment;
 import org.apache.sling.commons.compiler.ErrorHandler;
 import org.apache.sling.commons.compiler.Options;
 
-import junit.framework.TestCase;
-
 /**
  * Test case for java 5 support
  */
@@ -57,7 +57,6 @@
     //--------------------------------------------------< CompilerEnvironment >
 
     public byte[] findClass(String className) throws Exception {
-        System.out.println("findClass('" + className + "')");
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         InputStream in = cl.getResourceAsStream(className.replace('.', '/') + ".class");
         if (in == null) {
@@ -80,13 +79,10 @@
     }
 
     public char[] findSource(String className) throws Exception {
-        System.out.println("findSource('" + className + "')");
         return new char[0];
     }
 
     public boolean isPackage(String packageName) {
-        System.out.println("isPackage('" + packageName + "')");
-
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         InputStream in = cl.getResourceAsStream(packageName.replace('.', '/') + ".class");
         if (in != null) {
@@ -105,7 +101,7 @@
     //----------------------------------------------------------< ClassWriter >
 
     public void write(String className, byte[] data) throws Exception {
-        System.out.println("compiled class " + className + ", " + data.length + " bytes");
+        // nothing to do
     }
 
     //--------------------------------------------------------< misc. helpers >



Mime
View raw message