Skip to content

Commit

Permalink
#804 for Gradle 5: resource read ok, but writing suppressed
Browse files Browse the repository at this point in the history
  • Loading branch information
elucash committed Dec 29, 2018
1 parent 54edbd1 commit 0c6904b
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions value-processor/src/org/immutables/value/processor/Processor.java
Expand Up @@ -24,7 +24,9 @@
import javax.annotation.processing.Filer;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.lang.model.element.Element;
import javax.tools.FileObject;
import javax.tools.Diagnostic.Kind;
import javax.tools.JavaFileManager.Location;
import org.immutables.generator.AbstractGenerator;
import org.immutables.generator.ForwardingFiler;
Expand Down Expand Up @@ -144,14 +146,19 @@ protected Filer delegate() {
}

@Override
public FileObject getResource(Location location, CharSequence pkg, CharSequence relativeName)
public FileObject createResource(
Location location,
CharSequence pkg,
CharSequence relativeName,
Element... originatingElements)
throws IOException {
throw new FileNotFoundException(
String.format("Restricted read %s/%s/%s (triggered by -A%s)",
location,
pkg,
relativeName,
GRADLE_INCREMENTAL));
String message = String.format("Suppressed writing of resource %s/%s/%s (triggered by enabling -A%s)",
location,
pkg,
relativeName,
GRADLE_INCREMENTAL);
getMessager().printMessage(Kind.MANDATORY_WARNING, message);
throw new FileNotFoundException(message);
}
};
}
Expand Down

0 comments on commit 0c6904b

Please sign in to comment.