package com.github.gfx.static_gson;

import java.io.IOException;

import javax.annotation.processing.Filer;
import javax.lang.model.element.Element;
import javax.tools.FileObject;
import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject;

public class SynchronizedFiler implements Filer {

    private final Filer parent;

    public SynchronizedFiler(Filer parent) {
        this.parent = parent;
    }

    @Override
    public synchronized JavaFileObject createSourceFile(CharSequence name,
            Element... originatingElements)
            throws IOException {
        return parent.createSourceFile(name, originatingElements);
    }

    @Override
    public synchronized JavaFileObject createClassFile(CharSequence name,
            Element... originatingElements)
            throws IOException {
        return parent.createClassFile(name, originatingElements);
    }

    @Override
    public synchronized FileObject createResource(JavaFileManager.Location location,
            CharSequence pkg,
            CharSequence relativeName,
            Element... originatingElements)
            throws IOException {
        return parent.createResource(location, pkg, relativeName, originatingElements);
    }

    @Override
    public synchronized FileObject getResource(JavaFileManager.Location location,
            CharSequence pkg,
            CharSequence relativeName) throws IOException {
        return parent.getResource(location, pkg, relativeName);
    }
}

@@ -432,37 +432,24 @@
 %0A    public 
-synchronized 
 JavaFileObje
@@ -556,32 +556,68 @@
 s IOException %7B%0A
+        synchronized (parent) %7B%0A    
         return p
@@ -659,32 +659,42 @@
 atingElements);%0A
+        %7D%0A
     %7D%0A%0A    @Over
@@ -709,29 +709,16 @@
  public 
-synchronized 
 JavaFile
@@ -828,32 +828,68 @@
 s IOException %7B%0A
+        synchronized (parent) %7B%0A    
         return p
@@ -930,32 +930,42 @@
 atingElements);%0A
+        %7D%0A
     %7D%0A%0A    @Over
@@ -976,37 +976,24 @@
 %0A    public 
-synchronized 
 FileObject c
@@ -1179,32 +1179,68 @@
 s IOException %7B%0A
+        synchronized (parent) %7B%0A    
         return p
@@ -1307,24 +1307,34 @@
 gElements);%0A
+        %7D%0A
     %7D%0A%0A    @
@@ -1353,29 +1353,16 @@
  public 
-synchronized 
 FileObje
@@ -1493,32 +1493,68 @@
 s IOException %7B%0A
+        synchronized (parent) %7B%0A    
         return p
@@ -1601,16 +1601,26 @@
 eName);%0A
+        %7D%0A
     %7D%0A%7D%0A

fix SynchronizedFiler