-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added annotation processor path to Compiler
RELNOTES=Add `withAnnotationProcessorPath()` to `Compiler`. PiperOrigin-RevId: 344881510
- Loading branch information
1 parent
cd2c0a8
commit 80a9ee0
Showing
3 changed files
with
135 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/test/java/com/google/testing/compile/AnnotationFileProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.google.testing.compile; | ||
|
||
import com.google.common.collect.ImmutableSet; | ||
import java.io.IOException; | ||
import java.io.UncheckedIOException; | ||
import java.util.Set; | ||
import javax.annotation.processing.AbstractProcessor; | ||
import javax.annotation.processing.Filer; | ||
import javax.annotation.processing.ProcessingEnvironment; | ||
import javax.annotation.processing.RoundEnvironment; | ||
import javax.lang.model.SourceVersion; | ||
import javax.lang.model.element.TypeElement; | ||
import javax.tools.StandardLocation; | ||
|
||
final class AnnotationFileProcessor extends AbstractProcessor { | ||
|
||
@Override | ||
public synchronized void init(ProcessingEnvironment processingEnv) { | ||
Filer filer = processingEnv.getFiler(); | ||
try { | ||
filer.getResource(StandardLocation.ANNOTATION_PROCESSOR_PATH, "", "tmp.txt"); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public Set<String> getSupportedAnnotationTypes() { | ||
return ImmutableSet.of("*"); | ||
} | ||
|
||
@Override | ||
public SourceVersion getSupportedSourceVersion() { | ||
return SourceVersion.latestSupported(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters