JDK-8206878 : Deprecate constructors of 7-era visitors
  • Type: CSR
  • Component: core-libs
  • Sub-Component: javax.lang.model
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 12
  • Submitted: 2018-07-08
  • Updated: 2020-02-26
  • Resolved: 2018-07-10
Related Reports
CSR :  
Relates :  
Description
Summary
-------

Deprecate the constructors of the JDK 7-era visitors in `javax.lang.model.util`.

Problem
-------

With 6/1.6 support being removed from `javac`'s -source and -target options (JDK-802856), the 7-era visitors should be deprecated as well, following the pattern established in JDK-8172686.

Solution
--------

Deprecate the constructors in question.

Specification
-------------

    --- old/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor7.java	2018-07-08 12:29:41.734001000 -0700
    +++ new/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor7.java	2018-07-08 12:29:41.598001000 -0700
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2010, 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
    @@ -64,9 +64,12 @@
     
         /**
          * Constructor for concrete subclasses to call.
    +     *
    +     * @deprecated Release 7 is obsolete; update to a visitor for a newer
    +     * release level.
          */
    -    @SuppressWarnings("deprecation") // Superclass constructor deprecated
    +    @Deprecated
         protected AbstractAnnotationValueVisitor7() {
    -        super();
    +        super(); // Superclass constructor deprecated too
         }
     }
    --- old/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor7.java	2018-07-08 12:29:42.474001000 -0700
    +++ new/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor7.java	2018-07-08 12:29:42.334001000 -0700
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2010, 2018, Oacle 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
    @@ -67,9 +67,12 @@
     public abstract class AbstractElementVisitor7<R, P> extends AbstractElementVisitor6<R, P> {
         /**
          * Constructor for concrete subclasses to call.
    +     *
    +     * @deprecated Release 7 is obsolete; update to a visitor for a newer
    +     * release level.
          */
    -    @SuppressWarnings("deprecation") // Superclass constructor deprecated
    +    @Deprecated
         protected AbstractElementVisitor7(){
    -        super();
    +        super(); // Superclass constructor deprecated too
         }
     }
    --- old/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor7.java	2018-07-08 12:29:43.218001000 -0700
    +++ new/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor7.java	2018-07-08 12:29:43.082001000 -0700
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2010, 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
    @@ -67,10 +67,13 @@
     public abstract class AbstractTypeVisitor7<R, P> extends AbstractTypeVisitor6<R, P> {
         /**
          * Constructor for concrete subclasses to call.
    +     *
    +     * @deprecated Release 7 is obsolete; update to a visitor for a newer
    +     * release level.
          */
    -    @SuppressWarnings("deprecation") // Superclass constructor deprecated
    +    @Deprecated
         protected AbstractTypeVisitor7() {
    -        super();
    +        super();  // Superclass constructor deprecated too
         }
     
         /**
    --- old/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor7.java	2018-07-08 12:29:43.982001000 -0700
    +++ new/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor7.java	2018-07-08 12:29:43.838001000 -0700
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2010, 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
    @@ -81,10 +81,13 @@
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
          * default value.
    +     *
    +     * @deprecated Release 7 is obsolete; update to a visitor for a newer
    +     * release level.
          */
    -    @SuppressWarnings("deprecation") // Superclass constructor deprecated
    +    @Deprecated
         protected ElementKindVisitor7() {
    -        super(null);
    +        super(null); // Superclass constructor deprecated too
         }
     
         /**
    @@ -92,10 +95,13 @@
          * default value.
          *
          * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
    +     *
    +     * @deprecated Release 7 is obsolete; update to a visitor for a newer
    +     * release level.
          */
    -    @SuppressWarnings("deprecation") // Superclass constructor deprecated
    +    @Deprecated
         protected ElementKindVisitor7(R defaultValue) {
    -        super(defaultValue);
    +        super(defaultValue); // Superclass constructor deprecated too
         }
     
         /**
    --- old/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner7.java	2018-07-08 12:29:44.718001000 -0700
    +++ new/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner7.java	2018-07-08 12:29:44.578001000 -0700
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2010, 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
    @@ -94,10 +94,13 @@
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
          * default value.
    +     *
    +     * @deprecated Release 7 is obsolete; update to a visitor for a newer
    +     * release level.
          */
    -    @SuppressWarnings("deprecation") // Superclass constructor deprecated
    +    @Deprecated
         protected ElementScanner7(){
    -        super(null);
    +        super(null); // Superclass constructor deprecated too
         }
     
         /**
    @@ -105,10 +108,13 @@
          * default value.
          *
          * @param defaultValue the default value
    +     *
    +     * @deprecated Release 7 is obsolete; update to a visitor for a newer
    +     * release level.
          */
    -    @SuppressWarnings("deprecation") // Superclass constructor deprecated
    +    @Deprecated
         protected ElementScanner7(R defaultValue){
    -        super(defaultValue);
    +        super(defaultValue); // Superclass constructor deprecated too
         }
     
         /**
    --- old/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor7.java	2018-07-08 12:29:45.486001000 -0700
    +++ new/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor7.java	2018-07-08 12:29:45.346001000 -0700
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2010, 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
    @@ -71,10 +71,13 @@
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
          * default value.
    +     *
    +     * @deprecated Release 7 is obsolete; update to a visitor for a newer
    +     * release level.
          */
    -    @SuppressWarnings("deprecation") // Superclass constructor deprecated
    +    @Deprecated
         protected SimpleAnnotationValueVisitor7() {
    -        super(null);
    +        super(null); // Superclass constructor deprecated too
         }
     
         /**
    @@ -82,9 +85,12 @@
          * default value.
          *
          * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
    +     *
    +     * @deprecated Release 7 is obsolete; update to a visitor for a newer
    +     * release level.
          */
    -    @SuppressWarnings("deprecation") // Superclass constructor deprecated
    +    @Deprecated
         protected SimpleAnnotationValueVisitor7(R defaultValue) {
    -        super(defaultValue);
    +        super(defaultValue); // Superclass constructor deprecated too
         }
     }
    --- old/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor7.java	2018-07-08 12:29:46.214001000 -0700
    +++ new/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor7.java	2018-07-08 12:29:46.070001000 -0700
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2010, 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
    @@ -77,10 +77,13 @@
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
          * default value.
    +     *
    +     * @deprecated Release 7 is obsolete; update to a visitor for a newer
    +     * release level.
          */
    -    @SuppressWarnings("deprecation") // Superclass constructor deprecated
    +    @Deprecated
         protected SimpleElementVisitor7(){
    -        super(null);
    +        super(null); // Superclass constructor deprecated too
         }
     
         /**
    @@ -88,10 +91,13 @@
          * default value.
          *
          * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
    +     *
    +     * @deprecated Release 7 is obsolete; update to a visitor for a newer
    +     * release level.
          */
    -    @SuppressWarnings("deprecation") // Superclass constructor deprecated
    +    @Deprecated
         protected SimpleElementVisitor7(R defaultValue){
    -        super(defaultValue);
    +        super(defaultValue); // Superclass constructor deprecated too
         }
     
         /**
    --- old/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java	2018-07-08 12:29:46.966001000 -0700
    +++ new/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java	2018-07-08 12:29:46.830001000 -0700
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2010, 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
    @@ -77,10 +77,13 @@
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
          * default value.
    +     *
    +     * @deprecated Release 7 is obsolete; update to a visitor for a newer
    +     * release level.
          */
    -    @SuppressWarnings("deprecation") // Superclass constructor deprecated
    +    @Deprecated
         protected SimpleTypeVisitor7(){
    -        super(null);
    +        super(null); // Superclass constructor deprecated too
         }
     
         /**
    @@ -88,10 +91,13 @@
          * default value.
          *
          * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
    +     *
    +     * @deprecated Release 7 is obsolete; update to a visitor for a newer
    +     * release level.
          */
    -    @SuppressWarnings("deprecation") // Superclass constructor deprecated
    +    @Deprecated
         protected SimpleTypeVisitor7(R defaultValue){
    -        super(defaultValue);
    +        super(defaultValue); // Superclass constructor deprecated too
         }
     
         /**

    --- old/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor7.java	2018-07-08 12:29:47.698001000 -0700
    +++ new/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor7.java	2018-07-08 12:29:47.562001000 -0700
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2010, 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
    @@ -78,10 +78,13 @@
         /**
          * Constructor for concrete subclasses to call; uses {@code null}
          * for the default value.
    +     *
    +     * @deprecated Release 7 is obsolete; update to a visitor for a newer
    +     * release level.
          */
    -    @SuppressWarnings("deprecation") // Superclass constructor deprecated
    +    @Deprecated
         protected TypeKindVisitor7() {
    -        super(null);
    +        super(null); // Superclass constructor deprecated too
         }
     
         /**
    @@ -89,10 +92,13 @@
          * for the default value.
          *
          * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
    +     *
    +     * @deprecated Release 7 is obsolete; update to a visitor for a newer
    +     * release level.
          */
    -    @SuppressWarnings("deprecation") // Superclass constructor deprecated
    +    @Deprecated
         protected TypeKindVisitor7(R defaultValue) {
    -        super(defaultValue);
    +        super(defaultValue); // Superclass constructor deprecated too
         }
     
         /**

Comments
Added bug number to Problem statement and moving to Approved.
10-07-2018

Meta-comment about JIRA: The bug number is not linked in the Problem statement. Meta-meta-comment about JIRA: Adding comments is broken in this version of JIRA.
10-07-2018