Commits

Artem Melentyev committed d4d6810

switch to java7. update deps
demo works

  • Participants
  • Parent commits f83236b

Comments (0)

Files changed (8)

     <dependency>
       <groupId>com.google.inject</groupId>
       <artifactId>guice</artifactId>
-      <version>2.0</version>
+      <version>3.0</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
   <version>0.2-SNAPSHOT</version>
   <description>Standalone project for demonstrate how to use juast with maven</description>
   <properties>
-    <juast.version>0.1</juast.version>
+    <juast.version>0.2-SNAPSHOT</juast.version>
   </properties>
   <dependencies>
     <dependency>
           <version>2.3.2-fix62</version> <!-- corrected 2.3.2 version for support multiple compiler args -->
           <configuration>
             <!-- Annotation processing works only on JDK 1.6+ -->
-            <source>1.6</source>
-            <target>1.6</target>
+            <source>1.7</source>
+            <target>1.7</target>
             <!-- Show warnings produced by juast -->
             <showWarnings>true</showWarnings>
             <!-- juast configuration -->

ecj/src/main/java/juast/ecj/EcjAnnotationProcessorProxy.java

  * Because javac can't create {@link EcjAnnotationProcessor} dirrectly.
  */
 @SupportedAnnotationTypes("*")
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
+@SupportedSourceVersion(SourceVersion.RELEASE_7)
 @SupportedOptions("juast.process")
 public class EcjAnnotationProcessorProxy extends AbstractProcessor {
 	private static boolean isSupported(ProcessingEnvironment processingEnv) {

javac/src/main/java/juast/javac/JavacAnnotationProcessor.java

 		getProcessingEnv().getContext().put(TaskListener.class, (TaskListener)null);
 		getProcessingEnv().getContext().put(TaskListener.class, newTaskListener);
 		
+		try { // protect classloader from closing
+			Field f = getProcessingEnv().getClass().getDeclaredField("processorClassLoader");
+			f.setAccessible(true);
+			ClassLoader cl = (ClassLoader) f.get(getProcessingEnv());
+			cl = new ClassLoader(cl) {};
+			f.set(getProcessingEnv(), cl);
+		} catch (Exception e) {
+			throw new RuntimeException(e);
+		}
 		return false;
 	}
 

javac/src/main/java/juast/javac/JavacAnnotationProcessorProxy.java

 import javax.lang.model.element.TypeElement;
 
 @SupportedAnnotationTypes("*")
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
+@SupportedSourceVersion(SourceVersion.RELEASE_7)
 @SupportedOptions("juast.process")
 public class JavacAnnotationProcessorProxy extends AbstractProcessor {
 
           <artifactId>maven-compiler-plugin</artifactId>
           <version>2.3.2-fix62</version>
           <configuration>
-            <source>1.6</source>
-            <target>1.6</target>
+            <source>1.7</source>
+            <target>1.7</target>
           </configuration>
         </plugin>
         <plugin>
       <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
-        <version>4.8.2</version>
+        <version>4.10</version>
       </dependency>
       <dependency>
         <groupId>commons-io</groupId>
         <artifactId>commons-io</artifactId>
-        <version>2.0.1</version>
+        <version>2.1</version>
       </dependency>
       <dependency>
         <groupId>commons-lang</groupId>
         <artifactId>commons-lang</artifactId>
-        <version>2.5</version>
+        <version>2.6</version>
       </dependency>
       <dependency>
         <groupId>org.mockito</groupId>
         <artifactId>mockito-core</artifactId>
-        <version>1.8.5</version>
+        <version>1.9.0</version>
       </dependency>
       <dependency>
         <groupId>org.eclipse.jdt.core.compiler</groupId>
         <artifactId>ecj</artifactId>
-        <version>3.6.1</version>
+        <version>3.7.1</version>
       </dependency>
     </dependencies>
   </dependencyManagement>

processors/src/main/java/juast/processors/SystemOutPrintlnProcessor.java

 	public static String errorMessage = "using System.out.println is bad practice";
 	
 	@Override
-	public void afterAnalyse(final CompilationUnit cu) {
+	public void afterParse(final CompilationUnit cu) {
 		cu.accept(new SuppressWarningsVisitor() {
 			@Override
 			public boolean enter(MethodInvExpr node) {

processors/src/test/java/juast/processors/AProcessorTest.java

 	}
 
 	Set<String> ignoredKeys = new HashSet<String>(Arrays.asList(
+			null, // XXX: Eclipse 3.7 messager
 			"compiler.note.proc.messager", 
 			"compiler.warn.proc.use.proc.or.implicit",
-			"compiler.warn.proc.unmatched.processor.options"));
+			"compiler.warn.proc.unmatched.processor.options",
+			"compiler.warn.source.no.bootclasspath"));
 
 	public void check(List<Diagnostic<? extends JavaFileObject>> res) {
 		Map<Long, Set<String>> expected = new HashMap<Long, Set<String>>(this.expectedErrors); // copy errors