Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Use SourceVersion.latestSupported() to avoid warning with JDK 7. #175

Merged
merged 1 commit into from

3 participants

@tbroyer
Collaborator

When using dagger-compiler in a Java 7 project, the compiler used to issue
a "Supported source version 'RELEASE_6' from annotation processor
'dagger.internal.codegen.InjectProcessor' less than -source '1.7'" warning.

See also http://stackoverflow.com/a/8188860/116472 and hibernate/hibernate-metamodelgen@d8ce150, among others (I trust JBoss more than others about using latestSupported() rather than latest(), maybe I'm wrong).

.../java/dagger/internal/codegen/FullGraphProcessor.java
((5 lines not shown))
public final class FullGraphProcessor extends AbstractProcessor {
private final Set<String> delayedModuleNames = new LinkedHashSet<String>();
+ @Override
+ public SourceVersion getSupportedSourceVersion() {
@JakeWharton Owner

Annotations on same line as method declaration.

@tbroyer Collaborator
tbroyer added a note

Oops! fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@tbroyer tbroyer Use SourceVersion.latestSupported() to avoid warning with JDK 7.
When using dagger-compiler in a Java 7 project, the compiler used to issue
a "Supported source version 'RELEASE_6' from annotation processor
'dagger.internal.codegen.InjectProcessor' less than -source '1.7'" warning.
6024e62
@swankjesse swankjesse merged commit 8ca183a into square:master
@tbroyer tbroyer deleted the tbroyer:supportedsourceversion branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 1, 2013
  1. @tbroyer

    Use SourceVersion.latestSupported() to avoid warning with JDK 7.

    tbroyer authored
    When using dagger-compiler in a Java 7 project, the compiler used to issue
    a "Supported source version 'RELEASE_6' from annotation processor
    'dagger.internal.codegen.InjectProcessor' less than -source '1.7'" warning.
This page is out of date. Refresh to see the latest.
View
6 compiler/src/main/java/dagger/internal/codegen/FullGraphProcessor.java
@@ -34,7 +34,6 @@
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
-import javax.annotation.processing.SupportedSourceVersion;
import javax.inject.Singleton;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
@@ -52,10 +51,13 @@
* Performs full graph analysis on a module.
*/
@SupportedAnnotationTypes("dagger.Module")
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
public final class FullGraphProcessor extends AbstractProcessor {
private final Set<String> delayedModuleNames = new LinkedHashSet<String>();
+ @Override public SourceVersion getSupportedSourceVersion() {
+ return SourceVersion.latestSupported();
+ }
+
/**
* Perform full-graph analysis on complete modules. This checks that all of
* the module's dependencies are satisfied.
View
6 compiler/src/main/java/dagger/internal/codegen/InjectProcessor.java
@@ -30,7 +30,6 @@
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
-import javax.annotation.processing.SupportedSourceVersion;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.inject.Singleton;
@@ -58,10 +57,13 @@
* {@literal @}{@code Inject}-annotated members of a class.
*/
@SupportedAnnotationTypes("javax.inject.Inject")
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
public final class InjectProcessor extends AbstractProcessor {
private final Set<String> remainingTypeNames = new LinkedHashSet<String>();
+ @Override public SourceVersion getSupportedSourceVersion() {
+ return SourceVersion.latestSupported();
+ }
+
@Override public boolean process(Set<? extends TypeElement> types, RoundEnvironment env) {
remainingTypeNames.addAll(getInjectedClassNames(env));
for (Iterator<String> i = remainingTypeNames.iterator(); i.hasNext();) {
View
6 compiler/src/main/java/dagger/internal/codegen/ProvidesProcessor.java
@@ -35,7 +35,6 @@
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
-import javax.annotation.processing.SupportedSourceVersion;
import javax.inject.Provider;
import javax.inject.Singleton;
import javax.lang.model.SourceVersion;
@@ -62,13 +61,16 @@
* for each {@code @Provides} method of a target class.
*/
@SupportedAnnotationTypes({ "dagger.Provides", "dagger.Module" })
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
public final class ProvidesProcessor extends AbstractProcessor {
private final LinkedHashMap<String, List<ExecutableElement>> remainingTypes =
new LinkedHashMap<String, List<ExecutableElement>>();
private static final String BINDINGS_MAP = JavaWriter.type(
Map.class, String.class.getCanonicalName(), Binding.class.getCanonicalName() + "<?>");
+ @Override public SourceVersion getSupportedSourceVersion() {
+ return SourceVersion.latestSupported();
+ }
+
// TODO: include @Provides methods from the superclass
@Override public boolean process(Set<? extends TypeElement> types, RoundEnvironment env) {
remainingTypes.putAll(providerMethodsByClass(env));
Something went wrong with that request. Please try again.