8205455: jdeprscan issues annotation processor warning regarding RELEASE_10

Reviewed-by: jjg
This commit is contained in:
Stuart Marks 2018-06-25 18:49:30 -07:00
parent 7eeafb719f
commit 3e7196c114
3 changed files with 21 additions and 12 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -38,6 +38,7 @@ import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ExecutableElement;
@ -50,15 +51,12 @@ import javax.lang.model.util.Elements;
import javax.tools.Diagnostic;
import static javax.lang.model.SourceVersion.RELEASE_11;
/**
* Annotation processor for the Deprecation Scanner tool.
* Examines APIs for deprecated elements and records information
*
*/
@SupportedAnnotationTypes("java.lang.Deprecated")
@SupportedSourceVersion(RELEASE_11)
public class LoadProc extends AbstractProcessor {
Elements elements;
Messager messager;
@ -74,6 +72,11 @@ public class LoadProc extends AbstractProcessor {
messager = pe.getMessager();
}
@Override
public SourceVersion getSupportedSourceVersion() {
return SourceVersion.latest();
}
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (roundEnv.processingOver()) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -41,18 +41,16 @@ import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.element.ModuleElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.Elements;
import static javax.lang.model.SourceVersion.RELEASE_10;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.ModuleElement;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.Elements;
import javax.tools.Diagnostic;
@SupportedSourceVersion(RELEASE_10)
@SupportedAnnotationTypes("*")
public class TraverseProc extends AbstractProcessor {
Elements elements;
@ -71,6 +69,11 @@ public class TraverseProc extends AbstractProcessor {
messager = pe.getMessager();
}
@Override
public SourceVersion getSupportedSourceVersion() {
return SourceVersion.latest();
}
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (roundEnv.processingOver()) {

View File

@ -44,7 +44,10 @@ import static org.testng.Assert.assertTrue;
public class TestRelease {
static boolean invoke(String arg) {
return Main.call(System.out, System.err, "--list", "--release", arg);
System.err.println(">>> invoking Main.call with arguments: --list --release " + arg);
boolean r = Main.call(System.out, System.err, "--list", "--release", arg);
System.err.println(">>> Main.call returned " + r);
return r;
}
@Test