JDK-8230739 : Remove default constructors from java.compiler
  • Type: CSR
  • Component: core-libs
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 14
  • Submitted: 2019-09-09
  • Updated: 2019-09-12
  • Resolved: 2019-09-11
Related Reports
CSR :  
Description
Summary
-------
Add explicit constructors to two classes in the `java.compiler` module relying on default constructors.

Problem
-------

Formal classes relying on default constructors.

Solution
--------

Add explicit constructors to the classes in question.

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

    --- old/src/java.compiler/share/classes/javax/tools/DiagnosticCollector.java    2019-09-08 19:55:24.828001000 -0700
    +++ new/src/java.compiler/share/classes/javax/tools/DiagnosticCollector.java    2019-09-08 19:55:24.688001000 -0700
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2006, 2019, 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
    @@ -43,6 +43,11 @@
         private List<Diagnostic<? extends S>> diagnostics =
                 Collections.synchronizedList(new ArrayList<Diagnostic<? extends S>>());
     
    +    /**
    +     * Creates a new instance of DiagnosticCollector.
    +     */
    +    public DiagnosticCollector() {}
    +
         public void report(Diagnostic<? extends S> diagnostic) {
             Objects.requireNonNull(diagnostic);
             diagnostics.add(diagnostic);
    --- old/src/java.compiler/share/classes/javax/tools/ToolProvider.java    2019-09-08 19:55:25.164001000 -0700
    +++ new/src/java.compiler/share/classes/javax/tools/ToolProvider.java    2019-09-08 19:55:25.032001000 -0700
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2005, 2019, 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
    @@ -45,6 +45,12 @@
         private static final String systemJavaCompilerName   = "com.sun.tools.javac.api.JavacTool";
     
         /**
    +     * Do not call.
    +     */
    +    @Deprecated(forRemoval=true, since="14")
    +    public ToolProvider() {}
    +
    +    /**
          * Returns the Java&trade; programming language compiler provided
          * with this platform.
          * <p>The file manager returned by calling



Comments
Moving to Approved.
11-09-2019