diff -Nru ecj-3.13.3/CONTRIBUTING ecj-3.16.0/CONTRIBUTING --- ecj-3.13.3/CONTRIBUTING 1970-01-01 00:00:00.000000000 +0000 +++ ecj-3.16.0/CONTRIBUTING 2018-12-06 10:38:58.000000000 +0000 @@ -0,0 +1,59 @@ +# Contributing to Eclipse Java development tools + +Thanks for your interest in this project. + +## Project description + +The JDT project provides the tool plug-ins that implement a Java IDE supporting +the development of any Java application, including Eclipse plug-ins. It adds a +Java project nature and Java perspective to the Eclipse Workbench as well as a +number of views, editors, wizards, builders, and code merging and refactoring +tools. The JDT project allows Eclipse to be a development environment for +itself. + +* https://projects.eclipse.org/projects/eclipse.jdt + +## Developer resources + +Information regarding source code management, builds, coding standards, and +more. + +* https://projects.eclipse.org/projects/eclipse.jdt/developer + +The project maintains the following source code repositories + +* http://git.eclipse.org/c/jdt/eclipse.jdt.core.binaries.git +* http://git.eclipse.org/c/jdt/eclipse.jdt.core.git +* http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git +* http://git.eclipse.org/c/jdt/eclipse.jdt.git +* http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git + +This project uses Bugzilla to track ongoing development and issues. + +* Search for issues: https://eclipse.org/bugs/buglist.cgi?product=JDT +* Create a new report: https://eclipse.org/bugs/enter_bug.cgi?product=JDT + +Be sure to search for existing bugs before you create another one. Remember that +contributions are always welcome! + +## Eclipse Contributor Agreement + +Before your contribution can be accepted by the project team contributors must +electronically sign the Eclipse Contributor Agreement (ECA). + +* http://www.eclipse.org/legal/ECA.php + +Commits that are provided by non-committers must have a Signed-off-by field in +the footer indicating that the author is aware of the terms by which the +contribution has been provided to the project. The non-committer must +additionally have an Eclipse Foundation account and must have a signed Eclipse +Contributor Agreement (ECA) on file. + +For more information, please see the Eclipse Committer Handbook: +https://www.eclipse.org/projects/handbook/#resources-commit + +## Contact + +Contact the project developers via the project's "dev" list. + +* https://dev.eclipse.org/mailman/listinfo/jdt-dev \ No newline at end of file diff -Nru ecj-3.13.3/debian/changelog ecj-3.16.0/debian/changelog --- ecj-3.13.3/debian/changelog 2018-04-17 14:40:08.000000000 +0000 +++ ecj-3.16.0/debian/changelog 2019-03-02 10:43:15.000000000 +0000 @@ -1,3 +1,32 @@ +ecj (3.16.0-1~18.04) bionic; urgency=medium + + * Backport for OpenJDK 11. LP: #1814133. + + -- Matthias Klose Sat, 02 Mar 2019 11:43:15 +0100 + +ecj (3.16.0-1) unstable; urgency=medium + + * Team upload. + * New upstream release (from the R4_10 tag, identifies itself as 3.16.0) + - Refreshed the patches + - Updated the version of the Maven pom + * Standards-Version updated to 4.3.0 + * Updated the watch file + + -- Emmanuel Bourg Fri, 11 Jan 2019 13:17:10 +0100 + +ecj (3.14.0-1) unstable; urgency=medium + + * Team upload. + * New upstream release (from the R4_8 tag, identifies itself as 3.14.0) + - Refreshed the patches + - Updated the version of the Maven pom + - Fixed the man page + * Standards-Version updated to 4.2.0 + * Use salsa.debian.org Vcs-* URLs + + -- Emmanuel Bourg Mon, 06 Aug 2018 19:48:52 +0200 + ecj (3.13.3-1) unstable; urgency=medium * Team upload. diff -Nru ecj-3.13.3/debian/control ecj-3.16.0/debian/control --- ecj-3.13.3/debian/control 2018-04-17 14:38:03.000000000 +0000 +++ ecj-3.16.0/debian/control 2019-01-11 12:14:37.000000000 +0000 @@ -8,9 +8,9 @@ debhelper (>= 11), default-jdk-headless, maven-repo-helper -Standards-Version: 4.1.4 -Vcs-Git: https://anonscm.debian.org/git/pkg-java/ecj.git -Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/ecj.git +Standards-Version: 4.3.0 +Vcs-Git: https://salsa.debian.org/java-team/ecj.git +Vcs-Browser: https://salsa.debian.org/java-team/ecj Homepage: http://www.eclipse.org/jdt/core/index.php Package: ecj diff -Nru ecj-3.13.3/debian/copyright ecj-3.16.0/debian/copyright --- ecj-3.13.3/debian/copyright 2018-04-17 14:34:03.000000000 +0000 +++ ecj-3.16.0/debian/copyright 2019-01-11 12:14:37.000000000 +0000 @@ -9,7 +9,7 @@ org.eclipse.jdt.core/notes/* Files: * -Copyright: 2000-2017, IBM Corporation and others +Copyright: 2000-2018, IBM Corporation and others 2005-2013, BEA Systems, Inc. 2008-2014, Technical University Berlin 2013, Jesper S Moller diff -Nru ecj-3.13.3/debian/patches/fix-manpage.patch ecj-3.16.0/debian/patches/fix-manpage.patch --- ecj-3.13.3/debian/patches/fix-manpage.patch 1970-01-01 00:00:00.000000000 +0000 +++ ecj-3.16.0/debian/patches/fix-manpage.patch 2019-01-11 12:14:37.000000000 +0000 @@ -0,0 +1,20 @@ +Description: Fixes the manpage +Author: Emmanuel Bourg +Forwarded: https://github.com/eclipse/eclipse.jdt.core/pull/12 +--- a/org.eclipse.jdt.core/scripts/ecj.1 ++++ b/org.eclipse.jdt.core/scripts/ecj.1 +@@ -1,4 +1,4 @@ +-.TH ecj "13 March 2017" ++.TH ecj 1 "13 March 2017" + .LP + .SH NAME + ecj \- the eclipse JDT Batch Compiler +@@ -19,7 +19,7 @@ + .ul + Module Options + .sp +-.B --add-exports \--add-modules \--add-reads \--limit-modules \-p|--module-path \--module-source-path \ --processor-module-path \--system ++.B \--add-exports \--add-modules \--add-reads \--limit-modules \-p|--module-path \--module-source-path \ --processor-module-path \--system + .sp + .ul + ClassPath Options diff -Nru ecj-3.13.3/debian/patches/remove-model-dependency.patch ecj-3.16.0/debian/patches/remove-model-dependency.patch --- ecj-3.13.3/debian/patches/remove-model-dependency.patch 2018-04-17 14:34:03.000000000 +0000 +++ ecj-3.16.0/debian/patches/remove-model-dependency.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -Description: Removes the dependency on the dom module (not required, pulls too many Eclipse dependencies) -Author: Emmanuel Bourg -Forwarded: not-needed ---- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IModulePathEntry.java -+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IModulePathEntry.java -@@ -10,7 +10,6 @@ - *******************************************************************************/ - package org.eclipse.jdt.internal.compiler.env; - --import org.eclipse.jdt.core.IJavaProject; - import org.eclipse.jdt.core.compiler.CharOperation; - - /** -@@ -82,7 +81,7 @@ - } - - /** Tests whether the current entry represents the given java project. */ -- public default boolean equalsProject(IJavaProject project) { -+ public default boolean equalsProject(Object project) { - return false; - } - } -\ No newline at end of file diff -Nru ecj-3.13.3/debian/patches/restore-java-1.9-option.patch ecj-3.16.0/debian/patches/restore-java-1.9-option.patch --- ecj-3.13.3/debian/patches/restore-java-1.9-option.patch 2018-04-12 11:04:52.000000000 +0000 +++ ecj-3.16.0/debian/patches/restore-java-1.9-option.patch 2019-01-11 12:15:31.000000000 +0000 @@ -3,11 +3,11 @@ Forwarded: no --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java -@@ -214,6 +214,7 @@ +@@ -221,6 +221,7 @@ public static final String VERSION_1_6 = "1.6"; //$NON-NLS-1$ public static final String VERSION_1_7 = "1.7"; //$NON-NLS-1$ public static final String VERSION_1_8 = "1.8"; //$NON-NLS-1$ + public static final String VERSION_1_9 = "1.9"; //$NON-NLS-1$ public static final String VERSION_9 = "9"; //$NON-NLS-1$ - public static final String ERROR = "error"; //$NON-NLS-1$ - public static final String WARNING = "warning"; //$NON-NLS-1$ + public static final String VERSION_10 = "10"; //$NON-NLS-1$ + public static final String VERSION_11 = "11"; //$NON-NLS-1$ diff -Nru ecj-3.13.3/debian/patches/series ecj-3.16.0/debian/patches/series --- ecj-3.13.3/debian/patches/series 2018-04-17 14:34:03.000000000 +0000 +++ ecj-3.16.0/debian/patches/series 2019-01-11 12:14:37.000000000 +0000 @@ -1,2 +1,2 @@ -remove-model-dependency.patch restore-java-1.9-option.patch +fix-manpage.patch diff -Nru ecj-3.13.3/debian/poms/ecj.pom ecj-3.16.0/debian/poms/ecj.pom --- ecj-3.13.3/debian/poms/ecj.pom 2018-04-17 14:34:03.000000000 +0000 +++ ecj-3.16.0/debian/poms/ecj.pom 2019-01-11 12:16:28.000000000 +0000 @@ -6,7 +6,7 @@ 4.0.0 org.eclipse.jdt.core.compiler ecj - 3.13.2 + 3.16.0 jar Eclipse ECJ Eclipse JDT Core Batch Compiler diff -Nru ecj-3.13.3/debian/watch ecj-3.16.0/debian/watch --- ecj-3.13.3/debian/watch 2018-04-17 14:34:03.000000000 +0000 +++ ecj-3.16.0/debian/watch 2019-01-11 12:14:37.000000000 +0000 @@ -5,5 +5,5 @@ # The package caries the version of the compiler and the version of the platform # has to be hardcoded here to detect the new releases. # -opts="uversionmangle=s/_/./g;s/^4\.9/3.15/;s/^4\.8/3.14/;s/^4\.7/3.13/;s/^4\.6/3.12/;s/^4\.5/3.11/;s/^4\.4/3.10/;s/^4\.3/3.9/;s/^4\.2/3.8/;s/^(\d+)\.(\d+)$/$1.$2.0/,repack,compression=xz" \ +opts="uversionmangle=s/_/./g;s/^4\.11/3.17/;s/^4\.10/3.16/;s/^4\.9/3.15/;s/^4\.8/3.14/;s/^4\.7/3.13/;s/^4\.6/3.12/;s/^4\.5/3.11/;s/^4\.4/3.10/;s/^4\.3/3.9/;s/^4\.2/3.8/;s/^(\d+)\.(\d+)$/$1.$2.0/,repack,compression=xz" \ https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/refs/ .*/eclipse.jdt.core-R([\d_]+).tar.gz diff -Nru ecj-3.13.3/LICENSE ecj-3.16.0/LICENSE --- ecj-3.13.3/LICENSE 1970-01-01 00:00:00.000000000 +0000 +++ ecj-3.16.0/LICENSE 2018-12-06 10:38:58.000000000 +0000 @@ -0,0 +1,277 @@ +Eclipse Public License - v 2.0 + + THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE + PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION + OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + + a) in the case of the initial Contributor, the initial content + Distributed under this Agreement, and + + b) in the case of each subsequent Contributor: + i) changes to the Program, and + ii) additions to the Program; + where such changes and/or additions to the Program originate from + and are Distributed by that particular Contributor. A Contribution + "originates" from a Contributor if it was added to the Program by + such Contributor itself or anyone acting on such Contributor's behalf. + Contributions do not include changes or additions to the Program that + are not Modified Works. + +"Contributor" means any person or entity that Distributes the Program. + +"Licensed Patents" mean patent claims licensable by a Contributor which +are necessarily infringed by the use or sale of its Contribution alone +or when combined with the Program. + +"Program" means the Contributions Distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this Agreement +or any Secondary License (as applicable), including Contributors. + +"Derivative Works" shall mean any work, whether in Source Code or other +form, that is based on (or derived from) the Program and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. + +"Modified Works" shall mean any work in Source Code or other form that +results from an addition to, deletion from, or modification of the +contents of the Program, including, for purposes of clarity any new file +in Source Code form that contains any contents of the Program. Modified +Works shall not include works that contain only declarations, +interfaces, types, classes, structures, or files of the Program solely +in each case in order to link to, bind by name, or subclass the Program +or Modified Works thereof. + +"Distribute" means the acts of a) distributing or b) making available +in any manner that enables the transfer of a copy. + +"Source Code" means the form of a Program preferred for making +modifications, including but not limited to software source code, +documentation source, and configuration files. + +"Secondary License" means either the GNU General Public License, +Version 2.0, or any later versions of that license, including any +exceptions or additional permissions as identified by the initial +Contributor. + +2. GRANT OF RIGHTS + + a) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free copyright + license to reproduce, prepare Derivative Works of, publicly display, + publicly perform, Distribute and sublicense the Contribution of such + Contributor, if any, and such Derivative Works. + + b) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free patent + license under Licensed Patents to make, use, sell, offer to sell, + import and otherwise transfer the Contribution of such Contributor, + if any, in Source Code or other form. This patent license shall + apply to the combination of the Contribution and the Program if, at + the time the Contribution is added by the Contributor, such addition + of the Contribution causes such combination to be covered by the + Licensed Patents. The patent license shall not apply to any other + combinations which include the Contribution. No hardware per se is + licensed hereunder. + + c) Recipient understands that although each Contributor grants the + licenses to its Contributions set forth herein, no assurances are + provided by any Contributor that the Program does not infringe the + patent or other intellectual property rights of any other entity. + Each Contributor disclaims any liability to Recipient for claims + brought by any other entity based on infringement of intellectual + property rights or otherwise. As a condition to exercising the + rights and licenses granted hereunder, each Recipient hereby + assumes sole responsibility to secure any other intellectual + property rights needed, if any. For example, if a third party + patent license is required to allow Recipient to Distribute the + Program, it is Recipient's responsibility to acquire that license + before distributing the Program. + + d) Each Contributor represents that to its knowledge it has + sufficient copyright rights in its Contribution, if any, to grant + the copyright license set forth in this Agreement. + + e) Notwithstanding the terms of any Secondary License, no + Contributor makes additional grants to any Recipient (other than + those set forth in this Agreement) as a result of such Recipient's + receipt of the Program under the terms of a Secondary License + (if permitted under the terms of Section 3). + +3. REQUIREMENTS + +3.1 If a Contributor Distributes the Program in any form, then: + + a) the Program must also be made available as Source Code, in + accordance with section 3.2, and the Contributor must accompany + the Program with a statement that the Source Code for the Program + is available under this Agreement, and informs Recipients how to + obtain it in a reasonable manner on or through a medium customarily + used for software exchange; and + + b) the Contributor may Distribute the Program under a license + different than this Agreement, provided that such license: + i) effectively disclaims on behalf of all other Contributors all + warranties and conditions, express and implied, including + warranties or conditions of title and non-infringement, and + implied warranties or conditions of merchantability and fitness + for a particular purpose; + + ii) effectively excludes on behalf of all other Contributors all + liability for damages, including direct, indirect, special, + incidental and consequential damages, such as lost profits; + + iii) does not attempt to limit or alter the recipients' rights + in the Source Code under section 3.2; and + + iv) requires any subsequent distribution of the Program by any + party to be under a license that satisfies the requirements + of this section 3. + +3.2 When the Program is Distributed as Source Code: + + a) it must be made available under this Agreement, or if the + Program (i) is combined with other material in a separate file or + files made available under a Secondary License, and (ii) the initial + Contributor attached to the Source Code the notice described in + Exhibit A of this Agreement, then the Program may be made available + under the terms of such Secondary Licenses, and + + b) a copy of this Agreement must be included with each copy of + the Program. + +3.3 Contributors may not remove or alter any copyright, patent, +trademark, attribution notices, disclaimers of warranty, or limitations +of liability ("notices") contained within the Program from any copy of +the Program which they Distribute, provided that Contributors may add +their own appropriate notices. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities +with respect to end users, business partners and the like. While this +license is intended to facilitate the commercial use of the Program, +the Contributor who includes the Program in a commercial product +offering should do so in a manner which does not create potential +liability for other Contributors. Therefore, if a Contributor includes +the Program in a commercial product offering, such Contributor +("Commercial Contributor") hereby agrees to defend and indemnify every +other Contributor ("Indemnified Contributor") against any losses, +damages and costs (collectively "Losses") arising from claims, lawsuits +and other legal actions brought by a third party against the Indemnified +Contributor to the extent caused by the acts or omissions of such +Commercial Contributor in connection with its distribution of the Program +in a commercial product offering. The obligations in this section do not +apply to any claims or Losses relating to any actual or alleged +intellectual property infringement. In order to qualify, an Indemnified +Contributor must: a) promptly notify the Commercial Contributor in +writing of such claim, and b) allow the Commercial Contributor to control, +and cooperate with the Commercial Contributor in, the defense and any +related settlement negotiations. The Indemnified Contributor may +participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those performance +claims and warranties, and if a court requires any other Contributor to +pay any damages as a result, the Commercial Contributor must pay +those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT +PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS" +BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR +IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF +TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR +PURPOSE. Each Recipient is solely responsible for determining the +appropriateness of using and distributing the Program and assumes all +risks associated with its exercise of rights under this Agreement, +including but not limited to the risks and costs of program errors, +compliance with applicable laws, damage to or loss of data, programs +or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT +PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS +SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST +PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE +EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that the +Program itself (excluding combinations of the Program with other software +or hardware) infringes such Recipient's patent(s), then such Recipient's +rights granted under Section 2(b) shall terminate as of the date such +litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign the +responsibility to serve as the Agreement Steward to a suitable separate +entity. Each new version of the Agreement will be given a distinguishing +version number. The Program (including Contributions) may always be +Distributed subject to the version of the Agreement under which it was +received. In addition, after a new version of the Agreement is published, +Contributor may elect to Distribute the Program (including its +Contributions) under the new version. + +Except as expressly stated in Sections 2(a) and 2(b) above, Recipient +receives no rights or licenses to the intellectual property of any +Contributor under this Agreement, whether expressly, by implication, +estoppel or otherwise. All rights in the Program not expressly granted +under this Agreement are reserved. Nothing in this Agreement is intended +to be enforceable by any entity that is not a Contributor or Recipient. +No third-party beneficiary rights are created under this Agreement. + +Exhibit A - Form of Secondary Licenses Notice + +"This Source Code may also be made available under the following +Secondary Licenses when the conditions for such availability set forth +in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), +version(s), and exceptions or additional permissions here}." + + Simply including a copy of this Agreement, including this Exhibit A + is not sufficient to license the Source Code under Secondary Licenses. + + If it is not possible or desirable to put the notice in a particular + file, then You may include the notice in a location (such as a LICENSE + file in a relevant directory) where a recipient would be likely to + look for such a notice. + + You may add additional accurate notices of copyright ownership. \ No newline at end of file diff -Nru ecj-3.13.3/NOTICE ecj-3.16.0/NOTICE --- ecj-3.13.3/NOTICE 1970-01-01 00:00:00.000000000 +0000 +++ ecj-3.16.0/NOTICE 2018-12-06 10:38:58.000000000 +0000 @@ -0,0 +1,35 @@ +# Notices for Eclipse Java development tools + +This content is produced and maintained by the Eclipse Java development tools +project. + +* Project home: https://projects.eclipse.org/projects/eclipse.jdt + +## Trademarks + +Eclipse Java development tools, Java development tools, Eclipse JDT, and JDT are +trademarks of the Eclipse Foundation. + +## Copyright + +All content is the property of the respective authors or their employers. For +more information regarding authorship of content, please consult the listed +source code repository logs. + +## Declared Project Licenses + +This program and the accompanying materials are made available under the terms +of the Eclipse Public License v. 2.0 which is available at +http://www.eclipse.org/legal/epl-2.0. + +SPDX-License-Identifier: EPL-2.0 + +## Source Code + +The project maintains the following source code repositories: + +* http://git.eclipse.org/c/jdt/eclipse.jdt.core.binaries.git +* http://git.eclipse.org/c/jdt/eclipse.jdt.core.git +* http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git +* http://git.eclipse.org/c/jdt/eclipse.jdt.git +* http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git \ No newline at end of file diff -Nru ecj-3.13.3/org.eclipse.jdt.annotation/about.html ecj-3.16.0/org.eclipse.jdt.annotation/about.html --- ecj-3.13.3/org.eclipse.jdt.annotation/about.html 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.annotation/about.html 2018-12-06 10:38:58.000000000 +0000 @@ -2,27 +2,35 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + About -

About This Content

- -

June 5, 2006

-

License

+

About This Content

-

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

+

November 30, 2017

+

License

-

If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at http://www.eclipse.org.

+

+ The Eclipse Foundation makes available all content in this plug-in + ("Content"). Unless otherwise indicated below, the Content + is provided to you under the terms and conditions of the Eclipse + Public License Version 2.0 ("EPL"). A copy of the EPL is + available at http://www.eclipse.org/legal/epl-2.0. + For purposes of the EPL, "Program" will mean the Content. +

+ +

+ If you did not receive this Content directly from the Eclipse + Foundation, the Content is being redistributed by another party + ("Redistributor") and different terms and conditions may + apply to your use of any object code in the Content. Check the + Redistributor's license that was provided with the Content. If no such + license exists, contact the Redistributor. Unless otherwise indicated + below, the terms and conditions of the EPL still apply to any source + code in the Content and such source code may be obtained at http://www.eclipse.org. +

\ No newline at end of file diff -Nru ecj-3.13.3/org.eclipse.jdt.annotation/build.properties ecj-3.16.0/org.eclipse.jdt.annotation/build.properties --- ecj-3.13.3/org.eclipse.jdt.annotation/build.properties 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.annotation/build.properties 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ ############################################################################### # Copyright (c) 2011 Stephan Herrmann and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 +# +# This program and the accompanying materials +# are made available under the terms of the Eclipse Public License 2.0 # which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html +# https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 # # Contributors: # Stephan Herrmann - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.annotation/bundle.properties ecj-3.16.0/org.eclipse.jdt.annotation/bundle.properties --- ecj-3.13.3/org.eclipse.jdt.annotation/bundle.properties 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.annotation/bundle.properties 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ ############################################################################### # Copyright (c) 2011 Stephan Herrmann. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 +# +# This program and the accompanying materials +# are made available under the terms of the Eclipse Public License 2.0 # which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html +# https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 # # Contributors: # Stephan Herrmann - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.annotation/META-INF/MANIFEST.MF ecj-3.16.0/org.eclipse.jdt.annotation/META-INF/MANIFEST.MF --- ecj-3.13.3/org.eclipse.jdt.annotation/META-INF/MANIFEST.MF 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.annotation/META-INF/MANIFEST.MF 2018-12-06 10:38:58.000000000 +0000 @@ -3,7 +3,8 @@ Bundle-Name: %bundleName Bundle-Localization: bundle Bundle-SymbolicName: org.eclipse.jdt.annotation -Bundle-Version: 2.1.100.qualifier +Bundle-Version: 2.2.200.qualifier Export-Package: org.eclipse.jdt.annotation Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: %providerName +Automatic-Module-Name: org.eclipse.jdt.annotation diff -Nru ecj-3.13.3/org.eclipse.jdt.annotation/pom.xml ecj-3.16.0/org.eclipse.jdt.annotation/pom.xml --- ecj-3.13.3/org.eclipse.jdt.annotation/pom.xml 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.annotation/pom.xml 2018-12-06 10:38:58.000000000 +0000 @@ -14,11 +14,11 @@ eclipse.jdt.core eclipse.jdt.core - 4.7.3-SNAPSHOT + 4.10.0-SNAPSHOT org.eclipse.jdt org.eclipse.jdt.annotation - 2.1.100-SNAPSHOT + 2.2.200-SNAPSHOT eclipse-plugin diff -Nru ecj-3.13.3/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/Checks.java ecj-3.16.0/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/Checks.java --- ecj-3.13.3/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/Checks.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/Checks.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2016 Stephan Herrmann and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/DefaultLocation.java ecj-3.16.0/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/DefaultLocation.java --- ecj-3.13.3/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/DefaultLocation.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/DefaultLocation.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2014 Stephan Herrmann and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/NonNullByDefault.java ecj-3.16.0/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/NonNullByDefault.java --- ecj-3.13.3/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/NonNullByDefault.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/NonNullByDefault.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2011, 2014 Stephan Herrmann and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - initial API and implementation @@ -17,7 +20,6 @@ import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; /** * Applying this annotation to a declaration has the effect that type references, @@ -47,7 +49,8 @@ * package-info.java is used. *

*

- * Note: Since org.eclipse.jdt.annotation 2.0.0, this annotation also applies to field and local variable declarations. + * Note: Since org.eclipse.jdt.annotation 2.0.0, this annotation also applies to field and + * local variable declarations and since 2.2.0 also to parameter and module declarations. * For the old API, see * * @NonNullByDefault in 1.1.0. @@ -56,7 +59,6 @@ */ @Documented @Retention(RetentionPolicy.CLASS) -@Target({ ElementType.PACKAGE, ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.LOCAL_VARIABLE }) public @interface NonNullByDefault { /** * Specifies the set of locations within the annotated declaration that should be affected by the nonnull default. diff -Nru ecj-3.13.3/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/NonNull.java ecj-3.16.0/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/NonNull.java --- ecj-3.13.3/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/NonNull.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/NonNull.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2011, 2013 Stephan Herrmann and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/Nullable.java ecj-3.16.0/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/Nullable.java --- ecj-3.13.3/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/Nullable.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/Nullable.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2011, 2013 Stephan Herrmann and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/package-info.java ecj-3.16.0/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/package-info.java --- ecj-3.13.3/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/package-info.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.annotation/src/org/eclipse/jdt/annotation/package-info.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2011, 2016 Stephan Herrmann and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.annotation_v1/about.html ecj-3.16.0/org.eclipse.jdt.annotation_v1/about.html --- ecj-3.13.3/org.eclipse.jdt.annotation_v1/about.html 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.annotation_v1/about.html 2018-12-06 10:38:58.000000000 +0000 @@ -2,27 +2,35 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + About -

About This Content

- -

June 5, 2006

-

License

+

About This Content

-

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

+

November 30, 2017

+

License

-

If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at http://www.eclipse.org.

+

+ The Eclipse Foundation makes available all content in this plug-in + ("Content"). Unless otherwise indicated below, the Content + is provided to you under the terms and conditions of the Eclipse + Public License Version 2.0 ("EPL"). A copy of the EPL is + available at http://www.eclipse.org/legal/epl-2.0. + For purposes of the EPL, "Program" will mean the Content. +

+ +

+ If you did not receive this Content directly from the Eclipse + Foundation, the Content is being redistributed by another party + ("Redistributor") and different terms and conditions may + apply to your use of any object code in the Content. Check the + Redistributor's license that was provided with the Content. If no such + license exists, contact the Redistributor. Unless otherwise indicated + below, the terms and conditions of the EPL still apply to any source + code in the Content and such source code may be obtained at http://www.eclipse.org. +

\ No newline at end of file diff -Nru ecj-3.13.3/org.eclipse.jdt.annotation_v1/build.properties ecj-3.16.0/org.eclipse.jdt.annotation_v1/build.properties --- ecj-3.13.3/org.eclipse.jdt.annotation_v1/build.properties 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.annotation_v1/build.properties 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ ############################################################################### # Copyright (c) 2011 Stephan Herrmann and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 +# +# This program and the accompanying materials +# are made available under the terms of the Eclipse Public License 2.0 # which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html +# https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 # # Contributors: # Stephan Herrmann - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.annotation_v1/bundle.properties ecj-3.16.0/org.eclipse.jdt.annotation_v1/bundle.properties --- ecj-3.13.3/org.eclipse.jdt.annotation_v1/bundle.properties 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.annotation_v1/bundle.properties 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ ############################################################################### # Copyright (c) 2011 Stephan Herrmann. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 +# +# This program and the accompanying materials +# are made available under the terms of the Eclipse Public License 2.0 # which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html +# https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 # # Contributors: # Stephan Herrmann - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.annotation_v1/META-INF/MANIFEST.MF ecj-3.16.0/org.eclipse.jdt.annotation_v1/META-INF/MANIFEST.MF --- ecj-3.13.3/org.eclipse.jdt.annotation_v1/META-INF/MANIFEST.MF 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.annotation_v1/META-INF/MANIFEST.MF 2018-12-06 10:38:58.000000000 +0000 @@ -3,7 +3,8 @@ Bundle-Name: %bundleName Bundle-Localization: bundle Bundle-SymbolicName: org.eclipse.jdt.annotation -Bundle-Version: 1.1.100.qualifier +Bundle-Version: 1.1.400.qualifier Export-Package: org.eclipse.jdt.annotation Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-Vendor: %providerName +Automatic-Module-Name: org.eclipse.jdt.annotation diff -Nru ecj-3.13.3/org.eclipse.jdt.annotation_v1/pom.xml ecj-3.16.0/org.eclipse.jdt.annotation_v1/pom.xml --- ecj-3.13.3/org.eclipse.jdt.annotation_v1/pom.xml 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.annotation_v1/pom.xml 2018-12-06 10:38:58.000000000 +0000 @@ -1,6 +1,6 @@ List - * Constraints: - * A << F corresponds to: F.collectSubstitutes(..., A, ..., CONSTRAINT_EXTENDS (1)) - * A = F corresponds to: F.collectSubstitutes(..., A, ..., CONSTRAINT_EQUAL (0)) - * A >> F corresponds to: F.collectSubstitutes(..., A, ..., CONSTRAINT_SUPER (2)) -*/ +@Override public void collectSubstitutes(Scope scope, TypeBinding actualType, InferenceContext inferenceContext, int constraint) { if ((this.tagBits & TagBits.HasTypeVariable) == 0) return; @@ -126,10 +126,12 @@ return this.leafComponentType.mentionsAny(parameters, idx); } +@Override void collectInferenceVariables(Set variables) { this.leafComponentType.collectInferenceVariables(variables); } +@Override TypeBinding substituteInferenceVariable(InferenceVariable var, TypeBinding substituteType) { TypeBinding substitutedLeaf = this.leafComponentType.substituteInferenceVariable(var, substituteType); if (TypeBinding.notEquals(substitutedLeaf, this.leafComponentType)) @@ -141,17 +143,14 @@ * brakets leafUniqueKey * p.X[][] --> [[Lp/X; */ +@Override public char[] computeUniqueKey(boolean isLeaf) { char[] brackets = new char[this.dimensions]; for (int i = this.dimensions - 1; i >= 0; i--) brackets[i] = '['; return CharOperation.concat(brackets, this.leafComponentType.computeUniqueKey(isLeaf)); } -/** - * Answer the receiver's constant pool name. - * NOTE: This method should only be used during/after code gen. - * e.g. '[Ljava/lang/Object;' - */ +@Override public char[] constantPoolName() { if (this.constantPoolName != null) return this.constantPoolName; @@ -160,6 +159,7 @@ for (int i = this.dimensions - 1; i >= 0; i--) brackets[i] = '['; return this.constantPoolName = CharOperation.concat(brackets, this.leafComponentType.signature()); } +@Override public String debugName() { if (this.hasTypeAnnotations()) return annotatedDebugName(); @@ -169,6 +169,7 @@ return this.leafComponentType.debugName() + brackets.toString(); } +@Override public String annotatedDebugName() { StringBuffer brackets = new StringBuffer(this.dimensions * 2); brackets.append(this.leafComponentType.annotatedDebugName()); @@ -188,6 +189,7 @@ return brackets.toString(); } +@Override public int dimensions() { return this.dimensions; } @@ -217,16 +219,31 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#erasure() */ +@Override public TypeBinding erasure() { TypeBinding erasedType = this.leafComponentType.erasure(); if (TypeBinding.notEquals(this.leafComponentType, erasedType)) return this.environment.createArrayType(erasedType, this.dimensions); return this; } + +@Override +public ArrayBinding upwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { + TypeBinding leafType = this.leafComponentType.upwardsProjection(scope, mentionedTypeVariables); + return scope.environment().createArrayType(leafType, this.dimensions, this.typeAnnotations); +} + +@Override +public ArrayBinding downwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { + TypeBinding leafType = this.leafComponentType.downwardsProjection(scope, mentionedTypeVariables); + return scope.environment().createArrayType(leafType, this.dimensions, this.typeAnnotations); +} + public LookupEnvironment environment() { return this.environment; } +@Override public char[] genericTypeSignature() { if (this.genericTypeSignature == null) { @@ -237,16 +254,19 @@ return this.genericTypeSignature; } +@Override public PackageBinding getPackage() { return this.leafComponentType.getPackage(); } +@Override public int hashCode() { return this.leafComponentType == null ? super.hashCode() : this.leafComponentType.hashCode(); } /* Answer true if the receiver type can be assigned to the argument type (right) */ +@Override public boolean isCompatibleWith(TypeBinding otherType, Scope captureScope) { if (equalsEquals(this, otherType)) return true; @@ -267,6 +287,13 @@ case Binding.INTERSECTION_TYPE : return ((WildcardBinding) otherType).boundCheck(this); + case Binding.INTERSECTION_TYPE18: + for (ReferenceBinding intersecting : ((IntersectionTypeBinding18) otherType).intersectingTypes) { + if (!isCompatibleWith(intersecting, captureScope)) + return false; + } + return true; + case Binding.TYPE_PARAMETER : // check compatibility with capture of ? super X if (otherType.isCapture()) { @@ -292,7 +319,7 @@ } @Override -public boolean isSubtypeOf(TypeBinding otherType) { +public boolean isSubtypeOf(TypeBinding otherType, boolean simulatingBugJDK8026527) { if (equalsEquals(this, otherType)) return true; @@ -302,12 +329,18 @@ if (otherArray.leafComponentType.isBaseType()) return false; // relying on the fact that all equal arrays are identical if (this.dimensions == otherArray.dimensions) - return this.leafComponentType.isSubtypeOf(otherArray.leafComponentType); + return this.leafComponentType.isSubtypeOf(otherArray.leafComponentType, simulatingBugJDK8026527); if (this.dimensions < otherArray.dimensions) return false; // cannot assign 'String[]' into 'Object[][]' but can assign 'byte[][]' into 'Object[]' break; case Binding.BASE_TYPE : return false; + case Binding.INTERSECTION_TYPE18: + for (ReferenceBinding intersecting : ((IntersectionTypeBinding18) otherType).intersectingTypes) { + if (!isSubtypeOf(intersecting, simulatingBugJDK8026527)) + return false; + } + return true; } switch (otherType.leafComponentType().id) { case TypeIds.T_JavaLangObject : @@ -318,18 +351,22 @@ return false; } +@Override public boolean isProperType(boolean admitCapture18) { return this.leafComponentType.isProperType(admitCapture18); } +@Override public int kind() { return ARRAY_TYPE; } +@Override public TypeBinding leafComponentType(){ return this.leafComponentType; } +@Override public char[] nullAnnotatedReadableName(CompilerOptions options, boolean shortNames) /* java.lang.Object @o.e.j.a.NonNull[] */ { if (this.nullTagBitsPerDimension == null) return shortNames ? shortReadableName() : readableName(); @@ -362,15 +399,12 @@ * Answer the problem id associated with the receiver. * NoError if the receiver is a valid binding. */ +@Override public int problemId() { return this.leafComponentType.problemId(); } -/** -* Answer the source name for the type. -* In the case of member types, as the qualified name from its top level type. -* For example, for a member type N defined inside M & A: "A.M.N". -*/ +@Override public char[] qualifiedSourceName() { char[] brackets = new char[this.dimensions * 2]; for (int i = this.dimensions * 2 - 1; i >= 0; i -= 2) { @@ -379,6 +413,7 @@ } return CharOperation.concat(this.leafComponentType.qualifiedSourceName(), brackets); } +@Override public char[] readableName() /* java.lang.Object[] */ { char[] brackets = new char[this.dimensions * 2]; for (int i = this.dimensions * 2 - 1; i >= 0; i -= 2) { @@ -388,6 +423,7 @@ return CharOperation.concat(this.leafComponentType.readableName(), brackets); } +@Override public void setTypeAnnotations(AnnotationBinding[] annotations, boolean evalNullAnnotations) { this.tagBits |= TagBits.HasTypeAnnotations; if (annotations == null || annotations.length == 0) @@ -422,6 +458,7 @@ this.tagBits |= this.nullTagBitsPerDimension[0]; // outer-most dimension } } +@Override public char[] shortReadableName(){ char[] brackets = new char[this.dimensions * 2]; for (int i = this.dimensions * 2 - 1; i >= 0; i -= 2) { @@ -430,6 +467,7 @@ } return CharOperation.concat(this.leafComponentType.shortReadableName(), brackets); } +@Override public char[] sourceName() { char[] brackets = new char[this.dimensions * 2]; for (int i = this.dimensions * 2 - 1; i >= 0; i -= 2) { @@ -438,6 +476,7 @@ } return CharOperation.concat(this.leafComponentType.sourceName(), brackets); } +@Override public void swapUnresolved(UnresolvedReferenceBinding unresolvedType, ReferenceBinding resolvedType, LookupEnvironment env) { if (this.leafComponentType == unresolvedType) { //$IDENTITY-COMPARISON$ this.leafComponentType = env.convertUnresolvedBinaryToRawType(resolvedType); @@ -458,9 +497,11 @@ this.tagBits |= this.leafComponentType.tagBits & (TagBits.HasTypeVariable | TagBits.HasDirectWildcard | TagBits.HasMissingType | TagBits.HasCapturedWildcard); } } +@Override public String toString() { return this.leafComponentType != null ? debugName() : "NULL TYPE ARRAY"; //$NON-NLS-1$ } +@Override public TypeBinding unannotated() { return this.hasTypeAnnotations() ? this.environment.getUnannotatedType(this) : this; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BaseTypeBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BaseTypeBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BaseTypeBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BaseTypeBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2014 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -136,21 +139,25 @@ /** * int -> I */ + @Override public char[] computeUniqueKey(boolean isLeaf) { return constantPoolName(); } /* Answer the receiver's constant pool name. */ + @Override public char[] constantPoolName() { return this.constantPoolName; } + @Override public TypeBinding clone(TypeBinding enclosingType) { return new BaseTypeBinding(this.id, this.simpleName, this.constantPoolName); } + @Override public PackageBinding getPackage() { return null; @@ -158,6 +165,7 @@ /* Answer true if the receiver type can be assigned to the argument type (right) */ + @Override public final boolean isCompatibleWith(TypeBinding right, Scope captureScope) { if (equalsEquals(this, right)) return true; @@ -169,10 +177,12 @@ return this == TypeBinding.NULL && !right.isBaseType(); } + @Override public void setTypeAnnotations(AnnotationBinding[] annotations, boolean evalNullAnnotations) { super.setTypeAnnotations(annotations, false); // never set nullTagBits on base types } + @Override public TypeBinding unannotated() { if (!this.hasTypeAnnotations()) return this; @@ -201,6 +211,7 @@ * T_null is acting as an unchecked exception * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#isUncheckedException(boolean) */ + @Override public boolean isUncheckedException(boolean includeSupertype) { return this == TypeBinding.NULL; } @@ -208,25 +219,31 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.Binding#kind() */ + @Override public int kind() { return Binding.BASE_TYPE; } + @Override public char[] qualifiedSourceName() { return this.simpleName; } + @Override public char[] readableName() { return this.simpleName; } + @Override public char[] shortReadableName() { return this.simpleName; } + @Override public char[] sourceName() { return this.simpleName; } + @Override public String toString() { return this.hasTypeAnnotations() ? annotatedDebugName() : new String(readableName()); } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryModuleBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryModuleBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryModuleBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryModuleBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2017 GK Software AG, and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2017, 2018 GK Software SE, and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - initial API and implementation @@ -15,24 +18,35 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; +import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation; +import org.eclipse.jdt.internal.compiler.env.IBinaryModule; import org.eclipse.jdt.internal.compiler.env.IModule; import org.eclipse.jdt.internal.compiler.env.IModule.IModuleReference; import org.eclipse.jdt.internal.compiler.env.IModule.IPackageExport; import org.eclipse.jdt.internal.compiler.env.IModule.IService; +import org.eclipse.jdt.internal.compiler.util.Util; import org.eclipse.jdt.internal.compiler.env.IModuleAwareNameEnvironment; public class BinaryModuleBinding extends ModuleBinding { private static class AutomaticModuleBinding extends ModuleBinding { + boolean autoNameFromManifest; + public AutomaticModuleBinding(IModule module, LookupEnvironment existingEnvironment) { super(module.name(), existingEnvironment); existingEnvironment.root.knownModules.put(this.moduleName, this); this.isAuto = true; + this.autoNameFromManifest = module.isAutoNameFromManifest(); this.requires = Binding.NO_MODULES; this.requiresTransitive = Binding.NO_MODULES; this.exportedPackages = Binding.NO_PACKAGES; } + @Override + public boolean hasUnstableAutoName() { + return !this.autoNameFromManifest; + } + @Override public ModuleBinding[] getRequiresTransitive() { if (this.requiresTransitive == NO_MODULES) { char[][] autoModules = ((IModuleAwareNameEnvironment)this.environment.nameEnvironment).getAllAutomaticModules(); @@ -55,7 +69,10 @@ private IService[] unresolvedProvides; /** - * Construct a named module from binary, could be an auto module. + * Construct a named module from binary, could be an auto module - or from an info from Java Model. + *

+ * precondition: module must be either IBinaryModule or IModule.AutoModule + *

*

* Side effects: adds the new module to root.knownModules and resolves its directives. *

@@ -63,18 +80,19 @@ public static ModuleBinding create(IModule module, LookupEnvironment existingEnvironment) { if (module.isAutomatic()) return new AutomaticModuleBinding(module, existingEnvironment); - return new BinaryModuleBinding(module, existingEnvironment); + return new BinaryModuleBinding((IBinaryModule) module, existingEnvironment); } - private BinaryModuleBinding(IModule module, LookupEnvironment existingEnvironment) { + private BinaryModuleBinding(IBinaryModule module, LookupEnvironment existingEnvironment) { super(module.name(), existingEnvironment); existingEnvironment.root.knownModules.put(this.moduleName, this); cachePartsFrom(module); } - void cachePartsFrom(IModule module) { + void cachePartsFrom(IBinaryModule module) { if (module.isOpen()) this.modifiers |= ClassFileConstants.ACC_OPEN; + this.tagBits |= module.getTagBits(); IModuleReference[] requiresReferences = module.requires(); this.requires = new ModuleBinding[requiresReferences.length]; @@ -99,8 +117,38 @@ this.unresolvedOpens = module.opens(); this.unresolvedUses = module.uses(); this.unresolvedProvides = module.provides(); + if (this.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled) { + scanForNullDefaultAnnotation(module); + } + if ((this.tagBits & TagBits.AnnotationDeprecated) != 0 || this.environment.globalOptions.storeAnnotations) { + this.setAnnotations(BinaryTypeBinding.createAnnotations(module.getAnnotations(), this.environment, null), true); + } } - + + private void scanForNullDefaultAnnotation(IBinaryModule binaryModule) { + // trimmed-down version of BinaryTypeBinding.scanForNullDefaultAnnotation() + char[][] nonNullByDefaultAnnotationName = this.environment.getNonNullByDefaultAnnotationName(); + if (nonNullByDefaultAnnotationName == null) + return; // not well-configured to use null annotations + + IBinaryAnnotation[] annotations = binaryModule.getAnnotations(); + if (annotations != null) { + int nullness = NO_NULL_DEFAULT; + int length = annotations.length; + for (int i = 0; i < length; i++) { + char[] annotationTypeName = annotations[i].getTypeName(); + if (annotationTypeName[0] != Util.C_RESOLVED) + continue; + int typeBit = this.environment.getNullAnnotationBit(BinaryTypeBinding.signature2qualifiedTypeName(annotationTypeName)); + if (typeBit == TypeIds.BitNonNullByDefaultAnnotation) { + // using NonNullByDefault we need to inspect the details of the value() attribute: + nullness |= BinaryTypeBinding.getNonNullByDefaultValue(annotations[i], this.environment); + } + } + this.defaultNullness = nullness; + } + } + @Override public PackageBinding[] getExports() { if (this.exportedPackages == null && this.unresolvedExports != null) @@ -120,13 +168,15 @@ int count = 0; for (int i = 0; i < this.unresolvedExports.length; i++) { IPackageExport export = this.unresolvedExports[i]; - PackageBinding declaredPackage = getVisiblePackage(CharOperation.splitOn('.', export.name())); + PackageBinding declaredPackage = forcedGetExportedPackage(CharOperation.splitOn('.', export.name())); if (declaredPackage != null) { this.exportedPackages[count++] = declaredPackage; - declaredPackage.isExported = Boolean.TRUE; - recordExportRestrictions(declaredPackage, export.targets()); - } else { - // TODO(SHMOD): report incomplete module path? + if (declaredPackage instanceof SplitPackageBinding) + declaredPackage = ((SplitPackageBinding) declaredPackage).getIncarnation(this); + if (declaredPackage != null) { + declaredPackage.isExported = Boolean.TRUE; + recordExportRestrictions(declaredPackage, export.targets()); + } } } if (count < this.exportedPackages.length) @@ -139,7 +189,11 @@ PackageBinding declaredPackage = getVisiblePackage(CharOperation.splitOn('.', opens.name())); if (declaredPackage != null) { this.openedPackages[count++] = declaredPackage; - recordOpensRestrictions(declaredPackage, opens.targets()); + if (declaredPackage instanceof SplitPackageBinding) + declaredPackage = ((SplitPackageBinding) declaredPackage).getIncarnation(this); + if (declaredPackage != null) { + recordOpensRestrictions(declaredPackage, opens.targets()); + } } else { // TODO(SHMOD): report incomplete module path? } @@ -148,6 +202,23 @@ System.arraycopy(this.openedPackages, 0, this.openedPackages = new PackageBinding[count], 0, count); } + PackageBinding forcedGetExportedPackage(char[][] compoundName) { + // when resolving "exports" in a binary module we simply assume the package must exist, + // since this has been checked already when compiling that module. + PackageBinding binding = getVisiblePackage(compoundName); + if (binding != null) + return binding; + if (compoundName.length > 1) { + PackageBinding parent = forcedGetExportedPackage(CharOperation.subarray(compoundName, 0, compoundName.length-1)); + binding = new PackageBinding(compoundName, parent, this.environment, this); + parent.addPackage(binding, this, true); + return binding; + } + binding = new PackageBinding(compoundName[0], this.environment, this); + addPackage(binding, true); + return binding; + } + @Override public TypeBinding[] getUses() { if (this.uses == null) { @@ -183,4 +254,8 @@ this.implementations.put(this.services[i], impls); } } + @Override + public AnnotationBinding[] getAnnotations() { + return retrieveAnnotations(this); + } } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -46,6 +49,7 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ast.Annotation; +import org.eclipse.jdt.internal.compiler.classfmt.AnnotationInfo; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.classfmt.ExternalAnnotationProvider.IMethodAnnotationWalker; import org.eclipse.jdt.internal.compiler.classfmt.MethodInfoWithAnnotations; @@ -74,6 +78,8 @@ @SuppressWarnings({ "rawtypes", "unchecked" }) public class BinaryTypeBinding extends ReferenceBinding { + public static final char[] TYPE_QUALIFIER_DEFAULT = "TypeQualifierDefault".toCharArray(); //$NON-NLS-1$ + private static final IBinaryMethod[] NO_BINARY_METHODS = new IBinaryMethod[0]; // all of these fields are ONLY guaranteed to be initialized if accessed using their public accessor method @@ -141,6 +147,7 @@ throw new IllegalStateException(); } +@Override public TypeBinding clone(TypeBinding outerType) { BinaryTypeBinding copy = new BinaryTypeBinding(this); copy.enclosingType = (ReferenceBinding) outerType; @@ -161,6 +168,13 @@ } static AnnotationBinding createAnnotation(IBinaryAnnotation annotationInfo, LookupEnvironment env, char[][][] missingTypeNames) { + // temporary debug for Bug 532176 - [10] NPE during reconcile + if (annotationInfo instanceof AnnotationInfo) { + RuntimeException ex = ((AnnotationInfo) annotationInfo).exceptionDuringDecode; + if (ex != null) + new IllegalStateException("Accessing annotation with decode error", ex).printStackTrace(); //$NON-NLS-1$ + } + //-- IBinaryElementValuePair[] binaryPairs = annotationInfo.getElementValuePairs(); int length = binaryPairs == null ? 0 : binaryPairs.length; ElementValuePair[] pairs = length == 0 ? Binding.NO_ELEMENT_VALUE_PAIRS : new ElementValuePair[length]; @@ -308,6 +322,7 @@ if (needFieldsAndMethods) cachePartsFrom(binaryType, true); } +@Override public boolean canBeSeenBy(Scope sco) { ModuleBinding mod = sco.module(); return mod.canAccess(this.fPackage) && super.canBeSeenBy(sco); @@ -315,6 +330,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#availableFields() */ +@Override public FieldBinding[] availableFields() { if (!isPrototype()) { @@ -375,6 +391,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#availableMethods() */ +@Override public MethodBinding[] availableMethods() { if (!isPrototype()) { @@ -535,14 +552,12 @@ FieldBinding field = this.fields[i]; if (!field.isDeprecated()) { field.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly; - field.tagBits |= this.tagBits & TagBits.AnnotationTerminallyDeprecated; } } for (int i = 0, max = this.methods.length; i < max; i++) { MethodBinding method = this.methods[i]; if (!method.isDeprecated()) { method.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly; - method.tagBits |= this.tagBits & TagBits.AnnotationTerminallyDeprecated; } } } @@ -636,14 +651,15 @@ } private int getNullDefaultFrom(IBinaryAnnotation[] declAnnotations) { + int result = 0; if (declAnnotations != null) { for (IBinaryAnnotation annotation : declAnnotations) { char[][] typeName = signature2qualifiedTypeName(annotation.getTypeName()); if (this.environment.getNullAnnotationBit(typeName) == TypeIds.BitNonNullByDefaultAnnotation) - return getNonNullByDefaultValue(annotation); + result |= getNonNullByDefaultValue(annotation, this.environment); } } - return Binding.NO_NULL_DEFAULT; + return result; } private void createFields(IBinaryField[] iFields, IBinaryType binaryType, long sourceLevel, char[][][] missingTypeNames) { @@ -777,6 +793,7 @@ while ((nextChar = methodDescriptor[++end]) != Util.C_NAME_END){/*empty*/} if (i >= startIndex) { // skip the synthetic arg if necessary + // checking for param specific non-null default is not necessary here as no type arguments are present (application to params themselves is handled by ImplicitNullAnnotationVerifier) parameters[i - startIndex] = this.environment.getTypeFromSignature(methodDescriptor, index, end, false, this, missingTypeNames, walker.toMethodParameter(visibleIdx++)); // 'paramAnnotations' line up with 'parameters' // int parameter to method.getParameterAnnotations() include the synthetic arg @@ -834,8 +851,12 @@ } else { java.util.ArrayList types = new java.util.ArrayList(2); short rank = 0; - while (wrapper.signature[wrapper.start] != Util.C_PARAM_END) - types.add(this.environment.getTypeFromTypeSignature(wrapper, typeVars, this, missingTypeNames, walker.toMethodParameter(rank++))); + while (wrapper.signature[wrapper.start] != Util.C_PARAM_END) { + IBinaryAnnotation[] binaryParameterAnnotations = method.getParameterAnnotations(rank, this.fileName); + ITypeAnnotationWalker updatedWalker = NonNullDefaultAwareTypeAnnotationWalker.updateWalkerForParamNonNullDefault(walker, getNullDefaultFrom(binaryParameterAnnotations), this.environment); + types.add(this.environment.getTypeFromTypeSignature(wrapper, typeVars, this, missingTypeNames, updatedWalker.toMethodParameter(rank))); + rank++; + } wrapper.start++; // skip ')' int numParam = types.size(); parameters = new TypeBinding[numParam]; @@ -1037,6 +1058,7 @@ * * NOTE: enclosingType of a binary type is resolved when needed */ +@Override public ReferenceBinding enclosingType() { // should not delegate to prototype. if ((this.tagBits & TagBits.HasUnresolvedEnclosingType) == 0) return this.enclosingType; @@ -1047,6 +1069,7 @@ return this.enclosingType; } // NOTE: the type of each field of a binary type is resolved when needed +@Override public FieldBinding[] fields() { if (!isPrototype()) { @@ -1129,6 +1152,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#genericTypeSignature() */ +@Override public char[] genericTypeSignature() { if (!isPrototype()) return this.prototype.computeGenericTypeSignature(this.typeVariables); @@ -1136,6 +1160,7 @@ } //NOTE: the return type, arg & exception types of each method of a binary type are resolved when needed +@Override public MethodBinding getExactConstructor(TypeBinding[] argumentTypes) { if (!isPrototype()) @@ -1168,6 +1193,7 @@ //NOTE: the return type, arg & exception types of each method of a binary type are resolved when needed //searches up the hierarchy as long as no potential (but not exact) match was found. +@Override public MethodBinding getExactMethod(char[] selector, TypeBinding[] argumentTypes, CompilationUnitScope refScope) { // sender from refScope calls recordTypeReference(this) @@ -1216,6 +1242,7 @@ return null; } //NOTE: the type of a field of a binary type is resolved when needed +@Override public FieldBinding getField(char[] fieldName, boolean needResolve) { if (!isPrototype()) @@ -1234,6 +1261,7 @@ /** * Rewrite of default memberTypes() to avoid resolving eagerly all member types when one is requested */ +@Override public ReferenceBinding getMemberType(char[] typeName) { if (!isPrototype()) { @@ -1256,6 +1284,7 @@ return null; } // NOTE: the return type, arg & exception types of each method of a binary type are resolved when needed +@Override public MethodBinding[] getMethods(char[] selector) { if (!isPrototype()) @@ -1296,6 +1325,7 @@ } // Answer methods named selector, which take no more than the suggestedParameterLength. // The suggested parameter length is optional and may not be guaranteed by every type. +@Override public MethodBinding[] getMethods(char[] selector, int suggestedParameterLength) { if (!isPrototype()) @@ -1338,12 +1368,14 @@ return Binding.NO_METHODS; } +@Override public boolean hasMemberTypes() { if (!isPrototype()) return this.prototype.hasMemberTypes(); return this.memberTypes.length > 0; } // NOTE: member types of binary types are resolved when needed +@Override public TypeVariableBinding getTypeVariable(char[] variableName) { if (!isPrototype()) return this.prototype.getTypeVariable(variableName); @@ -1352,6 +1384,7 @@ variable.resolve(); return variable; } +@Override public boolean hasTypeBit(int bit) { if (!isPrototype()) @@ -1416,6 +1449,7 @@ * Returns true if a type is identical to another one, * or for generic types, true if compared to its raw type. */ +@Override public boolean isEquivalentTo(TypeBinding otherType) { if (TypeBinding.equalsEquals(this, otherType)) return true; @@ -1437,6 +1471,7 @@ } return false; } +@Override public boolean isGenericType() { if (!isPrototype()) @@ -1444,6 +1479,7 @@ return this.typeVariables != Binding.NO_TYPE_VARIABLES; } +@Override public boolean isHierarchyConnected() { if (!isPrototype()) @@ -1451,10 +1487,12 @@ return (this.tagBits & (TagBits.HasUnresolvedSuperclass | TagBits.HasUnresolvedSuperinterfaces)) == 0; } +@Override public boolean isRepeatableAnnotationType() { if (!isPrototype()) throw new IllegalStateException(); return this.containerAnnotationType != null; } +@Override public int kind() { if (!isPrototype()) @@ -1465,6 +1503,7 @@ return Binding.TYPE; } // NOTE: member types of binary types are resolved when needed +@Override public ReferenceBinding[] memberTypes() { if (!isPrototype()) { if ((this.tagBits & TagBits.HasUnresolvedMemberTypes) == 0) @@ -1489,6 +1528,7 @@ return this.memberTypes; } // NOTE: the return type, arg & exception types of each method of a binary type are resolved when needed +@Override public MethodBinding[] methods() { if (!isPrototype()) { @@ -1511,6 +1551,7 @@ return this.methods; } +@Override public TypeBinding prototype() { return this.prototype; } @@ -1519,6 +1560,7 @@ return this == this.prototype; //$IDENTITY-COMPARISON$ } +@Override public ReferenceBinding containerAnnotationType() { if (!isPrototype()) throw new IllegalStateException(); if (this.containerAnnotationType instanceof UnresolvedReferenceBinding) { @@ -1578,6 +1620,7 @@ method.modifiers &= ~ExtraCompilerModifiers.AccUnresolved; return method; } +@Override AnnotationBinding[] retrieveAnnotations(Binding binding) { if (!isPrototype()) @@ -1586,17 +1629,20 @@ return AnnotationBinding.addStandardAnnotations(super.retrieveAnnotations(binding), binding.getAnnotationTagBits(), this.environment); } +@Override public void setContainerAnnotationType(ReferenceBinding value) { if (!isPrototype()) throw new IllegalStateException(); this.containerAnnotationType = value; } +@Override public void tagAsHavingDefectiveContainerType() { if (!isPrototype()) throw new IllegalStateException(); if (this.containerAnnotationType != null && this.containerAnnotationType.isValidBinding()) this.containerAnnotationType = new ProblemReferenceBinding(this.containerAnnotationType.compoundName, this.containerAnnotationType, ProblemReasons.DefectiveContainerAnnotationType); } +@Override SimpleLookupTable storedAnnotations(boolean forceInitialize, boolean forceStore) { if (!isPrototype()) @@ -1628,7 +1674,7 @@ && fieldType.acceptsNonNullDefault()) { int nullDefaultFromField = getNullDefaultFrom(field.getAnnotations()); if (nullDefaultFromField == Binding.NO_NULL_DEFAULT - ? hasNonNullDefaultFor(DefaultLocationField, true, -1) + ? hasNonNullDefaultFor(DefaultLocationField, -1) : (nullDefaultFromField & DefaultLocationField) != 0) { fieldBinding.type = this.environment.createAnnotatedType(fieldType, new AnnotationBinding[] { this.environment.getNonNullAnnotation() }); @@ -1666,8 +1712,12 @@ } if (explicitNullness && this.externalAnnotationStatus.isPotentiallyUnannotatedLib()) this.externalAnnotationStatus = ExternalAnnotationStatus.TYPE_IS_ANNOTATED; - if (!explicitNullness && (this.tagBits & TagBits.AnnotationNonNullByDefault) != 0) { - fieldBinding.tagBits |= TagBits.AnnotationNonNull; + if (!explicitNullness) { + int nullDefaultFromField = getNullDefaultFrom(field.getAnnotations()); + if (nullDefaultFromField == Binding.NO_NULL_DEFAULT ? hasNonNullDefaultFor(DefaultLocationField, -1) + : (nullDefaultFromField & DefaultLocationField) != 0) { + fieldBinding.tagBits |= TagBits.AnnotationNonNull; + } } } @@ -1700,22 +1750,14 @@ ? returnWalker.getAnnotationsAtCursor(methodBinding.returnType.id, false) : method.getAnnotations(); if (annotations != null) { + int methodDefaultNullness = NO_NULL_DEFAULT; for (int i = 0; i < annotations.length; i++) { char[] annotationTypeName = annotations[i].getTypeName(); if (annotationTypeName[0] != Util.C_RESOLVED) continue; int typeBit = this.environment.getNullAnnotationBit(signature2qualifiedTypeName(annotationTypeName)); if (typeBit == TypeIds.BitNonNullByDefaultAnnotation) { - methodBinding.defaultNullness = getNonNullByDefaultValue(annotations[i]); - if (methodBinding.defaultNullness == Binding.NULL_UNSPECIFIED_BY_DEFAULT) { - methodBinding.tagBits |= TagBits.AnnotationNullUnspecifiedByDefault; - } else if (methodBinding.defaultNullness != 0) { - methodBinding.tagBits |= TagBits.AnnotationNonNullByDefault; - if (methodBinding.defaultNullness == Binding.NONNULL_BY_DEFAULT && this.environment.usesNullTypeAnnotations()) { - // reading a decl-nnbd in a project using type annotations, mimic corresponding semantics by enumerating: - methodBinding.defaultNullness |= Binding.DefaultLocationParameter | Binding.DefaultLocationReturnType; - } - } + methodDefaultNullness |= getNonNullByDefaultValue(annotations[i], this.environment); } else if (typeBit == TypeIds.BitNonNullAnnotation) { methodBinding.tagBits |= TagBits.AnnotationNonNull; if (this.environment.usesNullTypeAnnotations()) { @@ -1734,6 +1776,7 @@ } } } + methodBinding.defaultNullness = methodDefaultNullness; } // parameters: @@ -1816,7 +1859,6 @@ IBinaryAnnotation[] annotations = binaryType.getAnnotations(); boolean isPackageInfo = CharOperation.equals(sourceName(), TypeConstants.PACKAGE_INFO_NAME); if (annotations != null) { - long annotationBit = 0L; int nullness = NO_NULL_DEFAULT; int length = annotations.length; for (int i = 0; i < length; i++) { @@ -1826,66 +1868,44 @@ int typeBit = this.environment.getNullAnnotationBit(signature2qualifiedTypeName(annotationTypeName)); if (typeBit == TypeIds.BitNonNullByDefaultAnnotation) { // using NonNullByDefault we need to inspect the details of the value() attribute: - nullness = getNonNullByDefaultValue(annotations[i]); - if (nullness == NULL_UNSPECIFIED_BY_DEFAULT) { - annotationBit = TagBits.AnnotationNullUnspecifiedByDefault; - } else if (nullness != 0) { - annotationBit = TagBits.AnnotationNonNullByDefault; - if (nullness == Binding.NONNULL_BY_DEFAULT && this.environment.usesNullTypeAnnotations()) { - // reading a decl-nnbd in a project using type annotations, mimic corresponding semantics by enumerating: - nullness |= Binding.DefaultLocationParameter | Binding.DefaultLocationReturnType | Binding.DefaultLocationField; - } - } - this.defaultNullness = nullness; - break; + nullness |= getNonNullByDefaultValue(annotations[i], this.environment); } } - if (annotationBit != 0L) { - this.tagBits |= annotationBit; + this.defaultNullness = nullness; + if (nullness != NO_NULL_DEFAULT) { if (isPackageInfo) - packageBinding.defaultNullness = nullness; + packageBinding.setDefaultNullness(nullness); return; } } if (isPackageInfo) { // no default annotations found in package-info - packageBinding.defaultNullness = Binding.NO_NULL_DEFAULT; + packageBinding.setDefaultNullness(Binding.NO_NULL_DEFAULT); return; } ReferenceBinding enclosingTypeBinding = this.enclosingType; if (enclosingTypeBinding != null) { - if (setNullDefault(enclosingTypeBinding.tagBits, enclosingTypeBinding.getNullDefault())) + if (setNullDefault(enclosingTypeBinding.getNullDefault())) return; } // no annotation found on the type or its enclosing types // check the package-info for default annotation if not already done before - if (packageBinding.defaultNullness == Binding.NO_NULL_DEFAULT && !isPackageInfo + if (packageBinding.getDefaultNullness() == Binding.NO_NULL_DEFAULT && !isPackageInfo && ((this.typeBits & (TypeIds.BitAnyNullAnnotation)) == 0)) { // this will scan the annotations in package-info ReferenceBinding packageInfo = packageBinding.getType(TypeConstants.PACKAGE_INFO_NAME, packageBinding.enclosingModule); if (packageInfo == null) { - packageBinding.defaultNullness = Binding.NO_NULL_DEFAULT; + packageBinding.setDefaultNullness(Binding.NO_NULL_DEFAULT); } } // no @NonNullByDefault at type level, check containing package: - setNullDefault(0L, packageBinding.defaultNullness); + setNullDefault(packageBinding.getDefaultNullness()); } -boolean setNullDefault(long oldNullTagBits, int newNullDefault) { +boolean setNullDefault(int newNullDefault) { this.defaultNullness = newNullDefault; - if (newNullDefault != 0) { - if (newNullDefault == Binding.NULL_UNSPECIFIED_BY_DEFAULT) - this.tagBits |= TagBits.AnnotationNullUnspecifiedByDefault; - else - this.tagBits |= TagBits.AnnotationNonNullByDefault; - return true; - } - if ((oldNullTagBits & TagBits.AnnotationNonNullByDefault) != 0) { - this.tagBits |= TagBits.AnnotationNonNullByDefault; - return true; - } else if ((oldNullTagBits & TagBits.AnnotationNullUnspecifiedByDefault) != 0) { - this.tagBits |= TagBits.AnnotationNullUnspecifiedByDefault; + if (newNullDefault != Binding.NO_NULL_DEFAULT) { return true; } return false; @@ -1893,22 +1913,26 @@ /** given an application of @NonNullByDefault convert the annotation argument (if any) into a bitvector a la {@link Binding#NullnessDefaultMASK} */ // pre: null annotation analysis is enabled -int getNonNullByDefaultValue(IBinaryAnnotation annotation) { +static int getNonNullByDefaultValue(IBinaryAnnotation annotation, LookupEnvironment environment) { + char[] annotationTypeName = annotation.getTypeName(); char[][] typeName = signature2qualifiedTypeName(annotationTypeName); IBinaryElementValuePair[] elementValuePairs = annotation.getElementValuePairs(); if (elementValuePairs == null || elementValuePairs.length == 0 ) { // no argument: apply default default - ReferenceBinding annotationType = this.environment.getType(typeName, this.environment.UnNamedModule); // TODO(SHMOD): null annotations from a module? + ReferenceBinding annotationType = environment.getType(typeName, environment.UnNamedModule); // TODO(SHMOD): null annotations from a module? if (annotationType == null) return 0; if (annotationType.isUnresolvedType()) - annotationType = ((UnresolvedReferenceBinding) annotationType).resolve(this.environment, false); + annotationType = ((UnresolvedReferenceBinding) annotationType).resolve(environment, false); + int nullness = evaluateTypeQualifierDefault(annotationType); + if (nullness != 0) + return nullness; MethodBinding[] annotationMethods = annotationType.methods(); if (annotationMethods != null && annotationMethods.length == 1) { Object value = annotationMethods[0].getDefaultValue(); return Annotation.nullLocationBitsFromAnnotationValue(value); } - return NONNULL_BY_DEFAULT; // custom unconfigurable NNBD + return DefaultLocationsForTrueValue; // custom unconfigurable NNBD } else if (elementValuePairs.length > 0) { // evaluate the contained EnumConstantSignatures: int nullness = 0; @@ -1921,7 +1945,33 @@ } } -private char[][] signature2qualifiedTypeName(char[] typeSignature) { +public static int evaluateTypeQualifierDefault(ReferenceBinding annotationType) { + for (AnnotationBinding annotationOnAnnotation : annotationType.getAnnotations()) { + if(CharOperation.equals(annotationOnAnnotation.getAnnotationType().compoundName[annotationOnAnnotation.type.compoundName.length-1], TYPE_QUALIFIER_DEFAULT)) { + ElementValuePair[] pairs2 = annotationOnAnnotation.getElementValuePairs(); + if(pairs2 != null) { + for (ElementValuePair elementValuePair : pairs2) { + char[] name = elementValuePair.getName(); + if(CharOperation.equals(name, TypeConstants.VALUE)) { + int nullness = 0; + Object value = elementValuePair.getValue(); + if(value instanceof Object[]) { + Object[] values = (Object[]) value; + for (Object value1 : values) + nullness |= Annotation.nullLocationBitsFromElementTypeAnnotationValue(value1); + } else { + nullness |= Annotation.nullLocationBitsFromElementTypeAnnotationValue(value); + } + return nullness; + } + } + } + } + } + return 0; +} + +static char[][] signature2qualifiedTypeName(char[] typeSignature) { return CharOperation.splitOn('/', typeSignature, 1, typeSignature.length-1); // cut off leading 'L' and trailing ';' } @@ -1955,6 +2005,7 @@ * * NOTE: superclass of a binary type is resolved when needed */ +@Override public ReferenceBinding superclass() { if (!isPrototype()) { @@ -1986,6 +2037,7 @@ return this.superclass; } // NOTE: superInterfaces of binary types are resolved when needed +@Override public ReferenceBinding[] superInterfaces() { if (!isPrototype()) { @@ -2023,6 +2075,7 @@ this.tagBits &= ~TagBits.HasUnresolvedSuperinterfaces; return this.superInterfaces; } +@Override public TypeVariableBinding[] typeVariables() { if (!isPrototype()) { @@ -2036,6 +2089,7 @@ this.tagBits &= ~TagBits.HasUnresolvedTypeVariables; return this.typeVariables; } +@Override public String toString() { if (this.hasTypeAnnotations()) @@ -2127,9 +2181,11 @@ return buffer.toString(); } +@Override public TypeBinding unannotated() { return this.prototype; } +@Override public TypeBinding withoutToplevelNullAnnotation() { if (!hasNullTypeAnnotations()) return this; @@ -2138,6 +2194,7 @@ return this.environment.createAnnotatedType(this.prototype, newAnnotations); return this.prototype; } +@Override MethodBinding[] unResolvedMethods() { // for the MethodVerifier so it doesn't resolve types if (!isPrototype()) @@ -2146,6 +2203,7 @@ return this.methods; } +@Override public FieldBinding[] unResolvedFields() { if (!isPrototype()) @@ -2153,6 +2211,7 @@ return this.fields; } +@Override public ModuleBinding module() { if (!isPrototype()) return this.prototype.module; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -70,8 +73,11 @@ // Nullness defaults: public static final int NO_NULL_DEFAULT = 0; - // SE5 style: - public static final int NONNULL_BY_DEFAULT = 1; + + // not used any longer (was in the old implementation when NonNullByDefault only supported a boolean arg) + // corresponds to #DefaultLocationsForTrueValue + // public static final int NONNULL_BY_DEFAULT = 1; + public static final int NULL_UNSPECIFIED_BY_DEFAULT = 2; // JSR308 style: /** @@ -103,6 +109,8 @@ */ public static final int DefaultLocationArrayContents = ASTNode.Bit10; + public static final int DefaultLocationsForTrueValue = DefaultLocationParameter | DefaultLocationReturnType | DefaultLocationField; + public static final int NullnessDefaultMASK = NULL_UNSPECIFIED_BY_DEFAULT | // included to terminate search up the parent chain DefaultLocationParameter | DefaultLocationReturnType | DefaultLocationField | diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -67,6 +70,7 @@ // annotation support public boolean insideTypeAnnotation = false; + public Statement blockStatement; public BlockScope(BlockScope parent) { this(parent, true); @@ -439,6 +443,7 @@ return null; } +@Override public LocalVariableBinding findVariable(char[] variableName) { int varLength = variableName.length; for (int i = this.localIndex-1; i >= 0; i--) { // lookup backward to reach latest additions first @@ -825,7 +830,6 @@ && sourceType.scope.referenceContext.allocation.enclosingInstance != null; // reject allocation and super constructor call if (denyEnclosingArgInConstructorCall - && currentMethodScope.isConstructorCall && !isAnonymousAndHasEnclosing && (TypeBinding.equalsEquals(sourceType, targetEnclosingType) || (!onlyExactMatch && sourceType.findSuperTypeOriginatingFrom(targetEnclosingType) != null))) { return BlockScope.NoEnclosingInstanceInConstructorCall; @@ -971,6 +975,7 @@ * (unit, type or method) in case the problem handler decides it is necessary * to abort. */ +@Override public ProblemReporter problemReporter() { return methodScope().problemReporter(); } @@ -1018,10 +1023,12 @@ } // start position in this scope - for ordering scopes vs. variables +@Override int startIndex() { return this.startIndex; } +@Override public String toString() { return toString(0); } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2013, 2017 GK Software AG. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - initial API and implementation @@ -1022,6 +1025,7 @@ } // debugging: + @Override public String toString() { StringBuffer buf = new StringBuffer("Type Bounds:\n"); //$NON-NLS-1$ TypeBound[] flattened = flatten(); diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding18.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding18.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding18.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding18.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2013, 2014 GK Software AG. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - initial API and implementation @@ -66,20 +69,24 @@ return true; } + @Override public void initializeBounds(Scope scope, ParameterizedTypeBinding capturedParameterizedType) { // nothing to initialize here (and cannot use super methods which requires wildcard to be set). } + @Override public TypeBinding clone(TypeBinding enclosingType) { return new CaptureBinding18(this); } + @Override public MethodBinding[] getMethods(char[] selector) { if (this.upperBounds.length == 1 && this.upperBounds[0] instanceof ReferenceBinding) return ((ReferenceBinding)this.upperBounds[0]).getMethods(selector); return super.getMethods(selector); } + @Override public TypeBinding erasure() { if (this.upperBounds != null && this.upperBounds.length > 1) { ReferenceBinding[] erasures = new ReferenceBinding[this.upperBounds.length]; @@ -101,6 +108,7 @@ /** * @see TypeBinding#isEquivalentTo(TypeBinding) */ + @Override public boolean isEquivalentTo(TypeBinding otherType) { // from CaptureBinding: if (equalsEquals(this, otherType)) return true; @@ -125,6 +133,7 @@ return false; } + @Override public boolean isCompatibleWith(TypeBinding otherType, Scope captureScope) { if (TypeBinding.equalsEquals(this, otherType)) return true; @@ -175,6 +184,7 @@ } } + @Override public TypeBinding findSuperTypeOriginatingFrom(TypeBinding otherType) { if (this.upperBounds != null && this.upperBounds.length > 1) { for (int i = 0; i < this.upperBounds.length; i++) { @@ -188,6 +198,7 @@ return super.findSuperTypeOriginatingFrom(otherType); } + @Override TypeBinding substituteInferenceVariable(InferenceVariable var, TypeBinding substituteType) { if (this.inRecursiveFunction) return this; this.inRecursiveFunction = true; @@ -269,6 +280,7 @@ } } + @Override public boolean isProperType(boolean admitCapture18) { if (!admitCapture18) return false; @@ -292,6 +304,7 @@ int recursionLevel = 0; // used to give a hint at recursive types without going into infinity + @Override public char[] readableName() { if (this.lowerBound == null && this.firstBound != null) { if (this.prototype.recursionLevel < 2) { @@ -318,6 +331,7 @@ return super.readableName(); } + @Override public char[] shortReadableName() { if (this.lowerBound == null && this.firstBound != null) { if (this.prototype.recursionLevel < 2) { diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -14,6 +17,8 @@ * Bug 456497 - [1.8][null] during inference nullness from target type is lost against weaker hint from applicability analysis * Bug 456924 - StackOverflowError during compilation * Bug 462790 - [null] NPE in Expression.computeConversion() + * Jesper S Møller - Contributions for bug 381345 : [1.8] Take care of the Java 8 major version + * Bug 527554 - [18.3] Compiler support for JEP 286 Local-Variable Type *******************************************************************************/ package org.eclipse.jdt.internal.compiler.lookup; @@ -91,6 +96,7 @@ } // Captures may get cloned and annotated during type inference. + @Override public TypeBinding clone(TypeBinding enclosingType) { return new CaptureBinding(this); } @@ -100,6 +106,7 @@ * p.X { capture of ? } --> !*123; (Lp/X; in declaring type except if leaf) * p.X { capture of ? extends p.Y } --> !+Lp/Y;123; (Lp/X; in declaring type except if leaf) */ + @Override public char[] computeUniqueKey(boolean isLeaf) { StringBuffer buffer = new StringBuffer(); if (isLeaf) { @@ -116,6 +123,7 @@ return uniqueKey; } + @Override public String debugName() { if (this.wildcard != null) { @@ -135,6 +143,7 @@ return super.debugName(); } + @Override public char[] genericTypeSignature() { // captures have no signature per JVMS 4.7.9.1, approximate one by erasure: if (this.inRecursiveFunction) { @@ -271,10 +280,74 @@ evaluateNullAnnotations(scope, null); } } + @Override + public ReferenceBinding upwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { + if (enterRecursiveProjectionFunction()) { + try { + for (int i = 0; i < mentionedTypeVariables.length; ++i) { + if (TypeBinding.equalsEquals(this, mentionedTypeVariables[i])) { + TypeBinding upperBoundForProjection = this.upperBoundForProjection(); + return ((ReferenceBinding)upperBoundForProjection).upwardsProjection(scope, mentionedTypeVariables); + } + } + return this; + } finally { + exitRecursiveProjectionFunction(); + } + } else { + return scope.getJavaLangObject(); + } + } + public TypeBinding upperBoundForProjection() { + TypeBinding upperBound = null; + if (this.wildcard != null) { + ReferenceBinding[] supers = this.superInterfaces(); + if (this.wildcard.boundKind == Wildcard.EXTENDS) { + if (supers.length > 0) { + ReferenceBinding[] allBounds = new ReferenceBinding[supers.length + 1]; + System.arraycopy(supers, 0, allBounds, 1, supers.length); + allBounds[0] = this.superclass(); + ReferenceBinding[] glbs = Scope.greaterLowerBound(allBounds); + if (glbs == null) { + upperBound = new ProblemReferenceBinding(null, null, ProblemReasons.ParameterBoundMismatch); + } else if (glbs.length == 1) { + upperBound = glbs[0]; + } else { + upperBound = this.environment.createIntersectionType18(glbs); + } + } else { + upperBound = this.superclass; + } + } else { + // ITB18.isCompatibleWith does not handle the presence of j.l.Object among intersecting types, + // so it returns false when checking (I&J).isCompatibleWith(Object&I&J) + // TODO see if this can be handled in ITB18.isCompatibleWith() itself + boolean superClassIsObject = TypeBinding.equalsEquals(this.superclass(), this.environment.getResolvedJavaBaseType(TypeConstants.JAVA_LANG_OBJECT, null)); + if (supers.length == 0) { + upperBound = this.superclass(); + } else if (supers.length == 1) { + upperBound = superClassIsObject ? supers[0] : this.environment.createIntersectionType18(new ReferenceBinding[] {this.superclass(), supers[0]}); + } else { + if (superClassIsObject) { + upperBound = this.environment.createIntersectionType18(supers); + } else { + ReferenceBinding[] allBounds = new ReferenceBinding[supers.length + 1]; + System.arraycopy(supers, 0, allBounds, 1, supers.length); + allBounds[0] = this.superclass(); + upperBound = this.environment.createIntersectionType18(allBounds); + } + } + } + } else { + upperBound = super.upperBound(); + } + return upperBound; + } /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#isCapture() */ + @Override public boolean isCapture() { return true; } @@ -282,6 +355,7 @@ /** * @see TypeBinding#isEquivalentTo(TypeBinding) */ + @Override public boolean isEquivalentTo(TypeBinding otherType) { if (equalsEquals(this, otherType)) return true; if (otherType == null) return false; @@ -307,6 +381,7 @@ return super.isProperType(admitCapture18); } + @Override public char[] readableName() { if (this.wildcard != null) { StringBuffer buffer = new StringBuffer(10); @@ -323,6 +398,7 @@ return super.readableName(); } + @Override public char[] signableName() { if (this.wildcard != null) { StringBuffer buffer = new StringBuffer(10); @@ -337,6 +413,7 @@ return super.readableName(); } + @Override public char[] shortReadableName() { if (this.wildcard != null) { StringBuffer buffer = new StringBuffer(10); @@ -452,6 +529,23 @@ return this.wildcard; } + @Override + public ReferenceBinding downwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { + ReferenceBinding result = null; + if (enterRecursiveProjectionFunction()) { + for (int i = 0; i < mentionedTypeVariables.length; ++i) { + if (TypeBinding.equalsEquals(this, mentionedTypeVariables[i])) { + if (this.lowerBound != null) { + result = (ReferenceBinding) this.lowerBound.downwardsProjection(scope, mentionedTypeVariables); + } + break; + } + } + exitRecursiveProjectionFunction(); + } + return result; + } + /* * CaptureBinding needs even more propagation, because we are creating a naked type * (during CaptureBinding(WildcardBinding,ReferenceBinding,int,int,ASTNode,int) @@ -472,6 +566,7 @@ return derived; } + @Override public String toString() { if (this.wildcard != null) { StringBuffer buffer = new StringBuffer(10); diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CatchParameterBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CatchParameterBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CatchParameterBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CatchParameterBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2003, 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -34,6 +37,7 @@ this.preciseTypes[length] = raisedException; return; } + @Override public boolean isCatchParameter() { return true; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -273,7 +276,7 @@ int count = 0; nextMember : for (int i = 0; i < length; i++) { TypeDeclaration memberContext = this.referenceContext.memberTypes[i]; - if (this.environment().isProcessingAnnotations && this.environment().isMissingType(memberContext.name)) { + if (this.environment().root.isProcessingAnnotations && this.environment().isMissingType(memberContext.name)) { throw new SourceTypeCollisionException(); // resolved a type ref before APT generated the type } switch(TypeDeclaration.kind(memberContext.modifiers)) { @@ -453,6 +456,7 @@ sourceType.modifiers |= ExtraCompilerModifiers.AccGenericSignature; } + @Override void resolveTypeParameter(TypeParameter typeParameter) { typeParameter.resolve(this); } @@ -465,7 +469,7 @@ ReferenceBinding enclosingType = sourceType.enclosingType(); boolean isMemberType = sourceType.isMemberType(); if (isMemberType) { - if (!sourceType.isStatic()) + if (sourceType.hasEnclosingInstanceContext()) modifiers |= (enclosingType.modifiers & ExtraCompilerModifiers.AccGenericSignature); modifiers |= (enclosingType.modifiers & ClassFileConstants.AccStrictfp); // checks for member types before local types to catch local members @@ -1349,6 +1353,7 @@ * (unit, type or method) in case the problem handler decides it is necessary * to abort. */ + @Override public ProblemReporter problemReporter() { MethodScope outerMethodScope; if ((outerMethodScope = outerMostMethodScope()) == null) { @@ -1398,6 +1403,7 @@ return this.parent.checkRedundantDefaultNullness(nullBits, sourceStart); } + @Override public String toString() { if (this.referenceContext != null) return "--- Class Scope ---\n\n" //$NON-NLS-1$ diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -122,8 +125,8 @@ moduleDecl.createScope(this); moduleDecl.checkAndSetModifiers(); } - } else if (this.environment.module != this.environment.UnNamedModule) { - problemReporter().unnamedPackageInNamedModule(this.environment.module); + } else if (module() != this.environment.UnNamedModule) { + problemReporter().unnamedPackageInNamedModule(module()); } } else { if ((this.fPackage = this.environment.createPackage(this.currentPackageName)) == null) { @@ -155,7 +158,7 @@ int count = 0; nextType: for (int i = 0; i < typeLength; i++) { TypeDeclaration typeDecl = types[i]; - if (this.environment.isProcessingAnnotations && this.environment.isMissingType(typeDecl.name)) + if (this.environment.root.isProcessingAnnotations && this.environment.isMissingType(typeDecl.name)) throw new SourceTypeCollisionException(); // resolved a type ref before APT generated the type ReferenceBinding typeBinding = this.fPackage.getType0(typeDecl.name); if (Binding.isValid(typeBinding) && this.fPackage instanceof SplitPackageBinding && !this.environment.module.canAccess(typeBinding.fPackage)) @@ -163,7 +166,7 @@ recordSimpleReference(typeDecl.name); // needed to detect collision cases if (Binding.isValid(typeBinding) && !(typeBinding instanceof UnresolvedReferenceBinding)) { // if its an unresolved binding - its fixed up whenever its needed, see UnresolvedReferenceBinding.resolve() - if (this.environment.isProcessingAnnotations) + if (this.environment.root.isProcessingAnnotations) throw new SourceTypeCollisionException(); // resolved a type ref before APT generated the type // if a type exists, check that its a valid type // it can be a NotFound problem type if its a secondary type referenced before its primary type found in additional units @@ -359,6 +362,8 @@ this.topLevelTypes[i].scope.connectTypeHierarchy(); } void faultInImports() { + if (this.tempImports != null) + return; // faultInImports already in progress boolean unresolvedFound = false; // should report unresolved only if we are not suppressing caching of failed resolutions boolean reportUnresolved = !this.suppressImportErrors; @@ -488,6 +493,7 @@ if (this.tempImports.length > this.importPtr) System.arraycopy(this.tempImports, 0, this.tempImports = new ImportBinding[this.importPtr], 0, this.importPtr); this.imports = this.tempImports; + this.tempImports = null; int length = this.imports.length; this.typeOrPackageCache = new HashtableOfObject(length); for (int i = 0; i < length; i++) { @@ -672,12 +678,25 @@ return this.captureID++; } +@Override +public ModuleBinding module() { + if (!this.referenceContext.isModuleInfo() && + this.referenceContext.types == null && + this.referenceContext.currentPackage == null && + this.referenceContext.imports == null) { + this.environment = this.environment.UnNamedModule.environment; + return this.environment.UnNamedModule; + } + return super.module(); +} + /* Answer the problem reporter to use for raising new problems. * * Note that as a side-effect, this updates the current reference context * (unit, type or method) in case the problem handler decides it is necessary * to abort. */ +@Override public ProblemReporter problemReporter() { ProblemReporter problemReporter = this.referenceContext.problemReporter; problemReporter.referenceContext = this.referenceContext; @@ -860,6 +879,7 @@ rootRefs[i] = this.rootReferences.elementAt(i); this.referenceContext.compilationResult.rootReferences = rootRefs; } +@Override public String toString() { return "--- CompilationUnit Scope : " + new String(this.referenceContext.getFileName()); //$NON-NLS-1$ } @@ -1041,7 +1061,7 @@ return (nonNullByDefaultValue & location) != 0; } if (this.fPackage != null) - return (this.fPackage.defaultNullness & location) != 0; + return (this.fPackage.getDefaultNullness() & location) != 0; return false; } @@ -1052,7 +1072,7 @@ return target; } if (this.fPackage != null) { - return (this.fPackage.defaultNullness == nullBits) ? this.fPackage : null; + return this.fPackage.findDefaultNullnessTarget(n -> n == nullBits); } return null; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExceptionFormula.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExceptionFormula.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExceptionFormula.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExceptionFormula.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2013, 2015 GK Software AG. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - initial API and implementation @@ -39,6 +42,7 @@ this.relation = EXCEPTIONS_CONTAINED; } + @Override public Object reduce(InferenceContext18 inferenceContext) { // JLS 18.2.5 Scope scope = inferenceContext.scope; @@ -110,6 +114,7 @@ return result.toArray(new ConstraintFormula[result.size()]); } + @Override Collection inputVariables(final InferenceContext18 context) { // from 18.5.2. if (this.left instanceof LambdaExpression) { @@ -151,6 +156,7 @@ return EMPTY_VARIABLE_LIST; } + @Override public String toString() { StringBuffer buf = new StringBuffer().append(LEFT_ANGLE_BRACKET); this.left.printExpression(4, buf); diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExpressionFormula.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExpressionFormula.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExpressionFormula.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExpressionFormula.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2013, 2017 GK Software AG. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - initial API and implementation @@ -53,6 +56,7 @@ this.isSoft = isSoft; } + @Override public Object reduce(InferenceContext18 inferenceContext) throws InferenceFailureException { if (this.relation == POTENTIALLY_COMPATIBLE) { @@ -462,6 +466,7 @@ return erasedLeaf; } + @Override Collection inputVariables(final InferenceContext18 context) { // from 18.5.2. if (this.left instanceof LambdaExpression) { @@ -522,6 +527,7 @@ } // debugging: + @Override public String toString() { StringBuffer buf = new StringBuffer().append(LEFT_ANGLE_BRACKET); this.left.printExpression(4, buf); diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintFormula.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintFormula.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintFormula.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintFormula.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2013, 2015 GK Software AG. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintTypeFormula.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintTypeFormula.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintTypeFormula.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintTypeFormula.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2013, 2016 GK Software AG. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2013, 2018 GK Software AG, and others + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - initial API and implementation @@ -58,6 +61,7 @@ ConstraintTypeFormula() { } // return: ReductionResult or ConstraintFormula[] + @Override public Object reduce(InferenceContext18 inferenceContext) { switch (this.relation) { case COMPATIBLE: @@ -101,7 +105,7 @@ if (!checkIVFreeTVmatch(this.left, this.right)) checkIVFreeTVmatch(this.right, this.left); // 18.2.4: - return reduceTypeEquality(inferenceContext.object); + return reduceTypeEquality(inferenceContext.object, inferenceContext); case TYPE_ARGUMENT_CONTAINED: // 18.2.3: if (this.right.kind() != Binding.WILDCARD_TYPE) { // "If T is a type" ... all alternatives require "wildcard" @@ -160,7 +164,7 @@ return false; } - private Object reduceTypeEquality(TypeBinding object) { + private Object reduceTypeEquality(TypeBinding object, InferenceContext18 inferenceContext) { // 18.2.4 if (this.left.kind() == Binding.WILDCARD_TYPE) { if (this.right.kind() == Binding.WILDCARD_TYPE) { @@ -213,19 +217,31 @@ } return constraints; } - if (this.left.isArrayType() && this.right.isArrayType() && this.left.dimensions() == this.right.dimensions()) { - // checking dimensions already now is an optimization over reducing one dim at a time - return ConstraintTypeFormula.create(this.left.leafComponentType(), this.right.leafComponentType(), SAME, this.isSoft); + if (this.left.isArrayType() && this.right.isArrayType()) { + if (this.left.dimensions() == this.right.dimensions()) { + // checking dimensions in one step is an optimization over reducing one dim at a time + return ConstraintTypeFormula.create(this.left.leafComponentType(), this.right.leafComponentType(), SAME, this.isSoft); + } else if (this.left.dimensions() > 0 && this.right.dimensions() > 0) { + TypeBinding leftPrime = peelOneDimension(this.left, inferenceContext.environment); + TypeBinding rightPrime = peelOneDimension(this.right, inferenceContext.environment); + return ConstraintTypeFormula.create(leftPrime, rightPrime, SAME, this.isSoft); + } } } } return FALSE; } + private TypeBinding peelOneDimension(TypeBinding arrayType, LookupEnvironment env) { + if (arrayType.dimensions() == 1) + return arrayType.leafComponentType(); + return env.createArrayType(arrayType.leafComponentType(), arrayType.dimensions()-1); + } + private Object reduceSubType(Scope scope, TypeBinding subCandidate, TypeBinding superCandidate) { // 18.2.3 Subtyping Constraints if (subCandidate.isProperType(true) && superCandidate.isProperType(true)) { - if (subCandidate.isCompatibleWith(superCandidate, scope)) + if (subCandidate.isSubtypeOf(superCandidate, InferenceContext18.SIMULATE_BUG_JDK_8026527)) return TRUE; return FALSE; } @@ -242,16 +258,18 @@ case Binding.TYPE: case Binding.RAW_TYPE: { - if (subCandidate.isSubtypeOf(superCandidate)) + if (subCandidate.isSubtypeOf(superCandidate, InferenceContext18.SIMULATE_BUG_JDK_8026527)) return TRUE; return FALSE; } case Binding.PARAMETERIZED_TYPE: { List constraints = new ArrayList<>(); + boolean isFirst = true; while (superCandidate != null && superCandidate.kind() == Binding.PARAMETERIZED_TYPE && subCandidate != null) { if (!addConstraintsFromTypeParameters(subCandidate, (ParameterizedTypeBinding) superCandidate, constraints)) - return FALSE; + if (isFirst) return FALSE; + isFirst = false; // travel to enclosing types to check if they have type parameters, too: superCandidate = superCandidate.enclosingType(); subCandidate = subCandidate.enclosingType(); @@ -365,9 +383,6 @@ } boolean addConstraintsFromTypeParameters(TypeBinding subCandidate, ParameterizedTypeBinding ca, List constraints) { - TypeBinding[] ai = ca.arguments; // C - if (ai == null) - return true; // no arguments here means nothing to check TypeBinding cb = subCandidate.findSuperTypeOriginatingFrom(ca); // C if (cb == null) return false; // nothing here means we failed @@ -378,6 +393,9 @@ return ca.isParameterizedWithOwnVariables(); } TypeBinding[] bi = ((ParameterizedTypeBinding) cb).arguments; + TypeBinding[] ai = ca.arguments; // C + if (ai == null) + return true; // no arguments here means nothing to check if (cb.isRawType() || bi == null || bi.length == 0) return (this.isSoft && InferenceContext18.SIMULATE_BUG_JDK_8026527) ? true : false; // FALSE would conform to the spec for (int i = 0; i < ai.length; i++) @@ -390,6 +408,7 @@ TypeBinding.equalsEquals(this.left, that.left) && TypeBinding.equalsEquals(this.right, that.right)); } + @Override public boolean applySubstitution(BoundSet solutionSet, InferenceVariable[] variables) { super.applySubstitution(solutionSet, variables); for (int i=0; i is a well-formed type, ... ParameterizedTypeBinding ptb = blockScope.environment().createParameterizedType(genericType, aprime, targetTypeWithWildCards.enclosingType()); TypeVariableBinding[] vars = ptb.genericType().typeVariables(); - ParameterizedTypeBinding captured = ptb.capture(blockScope, -1, -1); + ParameterizedTypeBinding captured = ptb.capture(blockScope, lambda.sourceStart, lambda.sourceEnd); for (int i = 0; i < vars.length; i++) { if (vars[i].boundCheck(captured, aprime[i], blockScope, lambda) == BoundCheckStatus.MISMATCH) return null; @@ -1136,7 +1140,7 @@ } else { ReferenceBinding[] glbs = Scope.greaterLowerBound((ReferenceBinding[])upperBounds); if (glbs == null) { - throw new UnsupportedOperationException("no glb for "+Arrays.asList(upperBounds)); //$NON-NLS-1$ + return null; } else if (glbs.length == 1) { glb = glbs[0]; } else { @@ -1164,12 +1168,15 @@ zs[j] = freshCapture(variables[j]); final BoundSet kurrentBoundSet = tmpBoundSet; Substitution theta = new Substitution() { + @Override public LookupEnvironment environment() { return InferenceContext18.this.environment; } + @Override public boolean isRawSubstitution() { return false; } + @Override public TypeBinding substitute(TypeVariableBinding typeVariable) { for (int j = 0; j < numVars; j++) if (TypeBinding.equalsEquals(variables[j], typeVariable)) @@ -1273,6 +1280,7 @@ static void sortTypes(TypeBinding[] types) { Arrays.sort(types, new Comparator() { + @Override public int compare(TypeBinding o1, TypeBinding o2) { int i1 = o1.id, i2 = o2.id; return (i1 variables) { variables.add(this); } + @Override public ReferenceBinding[] superInterfaces() { return Binding.NO_SUPERINTERFACES; } + @Override public char[] qualifiedSourceName() { throw new UnsupportedOperationException(); } + @Override public char[] sourceName() { return this.sourceName; } + @Override public char[] readableName() { return this.sourceName; } + @Override public boolean hasTypeBit(int bit) { throw new UnsupportedOperationException(); } + @Override public String debugName() { return String.valueOf(this.sourceName); } + @Override public String toString() { return debugName(); } + @Override public int hashCode() { int code = this.typeParameter.hashCode() + 17 * this.rank; if (this.site != null) { @@ -196,6 +214,7 @@ } return code; } + @Override public boolean equals(Object obj) { if (!(obj instanceof InferenceVariable)) return false; @@ -205,6 +224,7 @@ && TypeBinding.equalsEquals(this.typeParameter, other.typeParameter); } + @Override public TypeBinding erasure() { // lazily initialize field that may be required in super.erasure(): if (this.superclass == null) diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InnerEmulationDependency.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InnerEmulationDependency.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InnerEmulationDependency.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InnerEmulationDependency.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/IntersectionTypeBinding18.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/IntersectionTypeBinding18.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/IntersectionTypeBinding18.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/IntersectionTypeBinding18.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -14,6 +17,8 @@ * Bug 428019 - [1.8][compiler] Type inference failure with nested generic invocation. * Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for * Bug 405104 - [1.8][compiler][codegen] Implement support for serializeable lambdas + * Jesper S Møller - Contributions for bug 381345 : [1.8] Take care of the Java 8 major version + * Bug 527554 - [18.3] Compiler support for JEP 286 Local-Variable Type *******************************************************************************/ package org.eclipse.jdt.internal.compiler.lookup; @@ -24,7 +29,15 @@ import org.eclipse.jdt.internal.compiler.ast.Wildcard; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -public class IntersectionTypeBinding18 extends ReferenceBinding { // abstraction used for intersection casts in Java 8 + type inference at 1.8+ +/** + * Abstraction used for intersection casts in Java 8 + and inferred types: + *
    + *
  • type inference at 1.8+
  • + *
  • lub at 1.8+
  • + *
  • projections for 'var' at 10+
  • + *
+ */ +public class IntersectionTypeBinding18 extends ReferenceBinding { public ReferenceBinding [] intersectingTypes; private ReferenceBinding javaLangObject; @@ -72,6 +85,7 @@ return contracts; } + @Override public boolean hasTypeBit(int bit) { // Stephan ?? for (int i = 0; i < this.length; i++) { if (this.intersectingTypes[i].hasTypeBit(bit)) @@ -80,10 +94,12 @@ return false; } + @Override public boolean canBeInstantiated() { return false; } + @Override public boolean canBeSeenBy(PackageBinding invocationPackage) { for (int i = 0; i < this.length; i++) { if (!this.intersectingTypes[i].canBeSeenBy(invocationPackage)) @@ -92,6 +108,7 @@ return true; } + @Override public boolean canBeSeenBy(Scope scope) { for (int i = 0; i < this.length; i++) { if (!this.intersectingTypes[i].canBeSeenBy(scope)) @@ -100,6 +117,7 @@ return true; } + @Override public boolean canBeSeenBy(ReferenceBinding receiverType, ReferenceBinding invocationType) { for (int i = 0; i < this.length; i++) { if (!this.intersectingTypes[i].canBeSeenBy(receiverType, invocationType)) @@ -109,22 +127,32 @@ } + @Override public char[] constantPoolName() { + TypeBinding erasure = erasure(); + if (erasure != this) //$IDENTITY-COMPARISON$ + return erasure.constantPoolName(); + if (this.intersectingTypes[0].id == TypeIds.T_JavaLangObject && this.intersectingTypes.length > 1) + return this.intersectingTypes[1].constantPoolName(); // improve stack map return this.intersectingTypes[0].constantPoolName(); } + @Override public PackageBinding getPackage() { throw new UnsupportedOperationException(); // cannot be referred to } + @Override public ReferenceBinding[] getIntersectingTypes() { return this.intersectingTypes; } + @Override public ReferenceBinding superclass() { return this.intersectingTypes[0].isClass() ? this.intersectingTypes[0] : this.javaLangObject; } + @Override public ReferenceBinding [] superInterfaces() { if (this.intersectingTypes[0].isClass()) { ReferenceBinding [] superInterfaces = new ReferenceBinding[this.length - 1]; @@ -141,6 +169,7 @@ /* Answer true if the receiver type can be assigned to the argument type (right) */ + @Override public boolean isCompatibleWith(TypeBinding right, Scope scope) { // easy way out? @@ -185,16 +214,35 @@ } @Override - public boolean isSubtypeOf(TypeBinding other) { + public boolean isSubtypeOf(TypeBinding other, boolean simulatingBugJDK8026527) { if (TypeBinding.equalsEquals(this, other)) return true; for (int i = 0; i < this.intersectingTypes.length; i++) { - if (this.intersectingTypes[i].isSubtypeOf(other)) + if (this.intersectingTypes[i].isSubtypeOf(other, false)) return true; } return false; } + @Override + public TypeBinding erasure() { + int classIdx = -1; + for (int i = 0; i < this.intersectingTypes.length; i++) { + if (this.intersectingTypes[i].isClass() && this.intersectingTypes[i].id != TypeIds.T_JavaLangObject) { // ignore j.l.Object to improve stack map + if (classIdx == -1) { + classIdx = i; + } else { + classIdx = Integer.MAX_VALUE; + break; + } + } + } + if (classIdx > -1 && classIdx < Integer.MAX_VALUE) + return this.intersectingTypes[classIdx].erasure(); + return this; + } + + @Override public char[] qualifiedSourceName() { StringBuffer qualifiedSourceName = new StringBuffer(16); for (int i = 0; i < this.length; i++) { @@ -205,6 +253,7 @@ return qualifiedSourceName.toString().toCharArray(); } + @Override public char[] sourceName() { StringBuffer srcName = new StringBuffer(16); for (int i = 0; i < this.length; i++) { @@ -215,6 +264,7 @@ return srcName.toString().toCharArray(); } + @Override public char[] readableName() { StringBuffer readableName = new StringBuffer(16); for (int i = 0; i < this.length; i++) { @@ -224,6 +274,7 @@ } return readableName.toString().toCharArray(); } + @Override public char[] shortReadableName() { StringBuffer shortReadableName = new StringBuffer(16); for (int i = 0; i < this.length; i++) { @@ -233,12 +284,15 @@ } return shortReadableName.toString().toCharArray(); } + @Override public boolean isIntersectionType18() { return true; } + @Override public int kind() { return Binding.INTERSECTION_TYPE18; } + @Override public String debugName() { StringBuffer debugName = new StringBuffer(16); for (int i = 0; i < this.length; i++) { @@ -248,6 +302,7 @@ } return debugName.toString(); } + @Override public String toString() { return debugName(); } @@ -272,6 +327,24 @@ } @Override + public ReferenceBinding upwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { + ReferenceBinding[] projectedTypes = new ReferenceBinding[this.intersectingTypes.length]; + for (int i = 0; i < this.intersectingTypes.length; ++i) { + projectedTypes[i] = this.intersectingTypes[i].upwardsProjection(scope, mentionedTypeVariables); + } + return (ReferenceBinding) scope.environment().createIntersectionType18(projectedTypes); + } + + @Override + public ReferenceBinding downwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { + ReferenceBinding[] projectedTypes = new ReferenceBinding[this.intersectingTypes.length]; + for (int i = 0; i < this.intersectingTypes.length; ++i) { + projectedTypes[i] = this.intersectingTypes[i].downwardsProjection(scope, mentionedTypeVariables); + } + return (ReferenceBinding) scope.environment().createIntersectionType18(projectedTypes); + } + + @Override public boolean mentionsAny(TypeBinding[] parameters, int idx) { if (super.mentionsAny(parameters, idx)) return true; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2014 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -45,21 +48,35 @@ public EmptyWithAstNode(ASTNode node) { this.node = node; } + @Override public TypeBinding[] genericTypeArguments() { return null;} + @Override public boolean isSuperAccess() {return false;} + @Override public boolean isTypeAccess() {return false;} + @Override public void setActualReceiverType(ReferenceBinding receiverType) {/* empty */} + @Override public void setDepth(int depth) {/* empty */ } + @Override public void setFieldIndex(int depth) {/* empty */ } + @Override public int sourceEnd() {return this.node.sourceEnd; } + @Override public int sourceStart() {return this.node.sourceStart; } + @Override public TypeBinding invocationTargetType() { return null; } + @Override public boolean receiverIsImplicitThis() { return false; } + @Override public InferenceContext18 freshInferenceContext(Scope scope) { return null; } + @Override public ExpressionContext getExpressionContext() { return ExpressionContext.VANILLA_CONTEXT; } @Override public boolean isQualifiedSuper() { return false; } + @Override public boolean checkingPotentialCompatibility() { return false; } + @Override public void acceptPotentiallyCompatibleMethods(MethodBinding[] methods) { /* ignore */ } } } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/IQualifiedTypeResolutionListener.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/IQualifiedTypeResolutionListener.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/IQualifiedTypeResolutionListener.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/IQualifiedTypeResolutionListener.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2012 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalTypeBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalTypeBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalTypeBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalTypeBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -17,8 +20,8 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ast.ASTNode; -import org.eclipse.jdt.internal.compiler.ast.Annotation; import org.eclipse.jdt.internal.compiler.ast.CaseStatement; +import org.eclipse.jdt.internal.compiler.ast.LambdaExpression; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.ast.TypeReference; @@ -48,6 +51,10 @@ if (methodBinding != null) { this.enclosingMethod = methodBinding; } + MethodScope lambdaScope = scope.enclosingLambdaScope(); + if (lambdaScope != null) { + ((LambdaExpression) lambdaScope.referenceContext).addLocalType(this); + } } public LocalTypeBinding(LocalTypeBinding prototype) { @@ -108,25 +115,7 @@ return this.superclass; // default answer } -protected void checkRedundantNullnessDefaultRecurse(ASTNode location, Annotation[] annotations, long nullBits, boolean useNullTypeAnnotations) { - - if (!isPrototype()) throw new IllegalStateException(); - - long outerDefault = 0; - if (this.enclosingMethod != null) { - outerDefault = useNullTypeAnnotations - ? this.enclosingMethod.defaultNullness - : this.enclosingMethod.tagBits & (TagBits.AnnotationNonNullByDefault|TagBits.AnnotationNullUnspecifiedByDefault); - } - if (outerDefault != 0) { - if (outerDefault == nullBits) { - this.scope.problemReporter().nullDefaultAnnotationIsRedundant(location, annotations, this.enclosingMethod); - } - return; - } - super.checkRedundantNullnessDefaultRecurse(location, annotations, nullBits, useNullTypeAnnotations); -} - +@Override public char[] computeUniqueKey(boolean isLeaf) { if (!isPrototype()) return this.prototype.computeUniqueKey(isLeaf); @@ -156,6 +145,7 @@ return uniqueKey; } +@Override public char[] constantPoolName() /* java/lang/Object */ { if (this.constantPoolName != null) return this.constantPoolName; @@ -169,12 +159,14 @@ return this.constantPoolName; } +@Override public TypeBinding clone(TypeBinding outerType) { LocalTypeBinding copy = new LocalTypeBinding(this); copy.enclosingType = (SourceTypeBinding) outerType; return copy; } +@Override public int hashCode() { return this.enclosingType.hashCode(); } @@ -183,6 +175,7 @@ * Slam the source name so that the signature is syntactically correct. * (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=99686) */ +@Override public char[] genericTypeSignature() { if (!isPrototype()) @@ -197,6 +190,7 @@ return super.genericTypeSignature(); } +@Override public char[] readableName() /*java.lang.Object, p.X */ { char[] readableName; if (isAnonymousType()) { @@ -222,6 +216,7 @@ return readableName; } +@Override public char[] shortReadableName() /*Object*/ { char[] shortReadableName; if (isAnonymousType()) { @@ -266,11 +261,22 @@ this.constantPoolName = computedConstantPoolName; } +public void transferConstantPoolNameTo(TypeBinding substType) { + if (this.constantPoolName != null && substType instanceof LocalTypeBinding) { + LocalTypeBinding substLocalType = (LocalTypeBinding) substType; + if (substLocalType.constantPoolName == null) { + substLocalType.setConstantPoolName(this.constantPoolName); + this.scope.compilationUnitScope().constantPoolNameUsage.put(substLocalType.constantPoolName, substLocalType); + } + } +} + /* * Overriden for code assist. In this case, the constantPoolName() has not been computed yet. * Slam the source name so that the signature is syntactically correct. * (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=102284) */ +@Override public char[] signature() { if (!isPrototype()) @@ -285,6 +291,7 @@ return super.signature(); } +@Override public char[] sourceName() { if (isAnonymousType()) { return CharOperation.concat(TypeConstants.ANONYM_PREFIX, anonymousOriginalSuperType().sourceName(), TypeConstants.ANONYM_SUFFIX); @@ -292,6 +299,7 @@ return this.sourceName; } +@Override public String toString() { if (this.hasTypeAnnotations()) return annotatedDebugName() + " (local)"; //$NON-NLS-1$ @@ -306,6 +314,7 @@ /* Trigger the dependency mechanism forcing the innerclass emulation * to be propagated to all dependent source types. */ +@Override public void updateInnerEmulationDependents() { if (!isPrototype()) throw new IllegalStateException(); if (this.dependents != null) { diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,10 +1,13 @@ /******************************************************************************* * Copyright (c) 2000, 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ * + * SPDX-License-Identifier: EPL-2.0 + * * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann - Contributions for @@ -14,9 +17,15 @@ * bug 365859 - [compiler][null] distinguish warnings based on flow analysis vs. null annotations * bug 331649 - [compiler][null] consider null annotations for fields * Bug 466308 - [hovering] Javadoc header for parameter is wrong with annotation-based null analysis + * Jesper S Møller - Contributions for + * Bug 527554 - [18.3] Compiler support for JEP 286 Local-Variable Type + * *******************************************************************************/ package org.eclipse.jdt.internal.compiler.lookup; +import java.util.HashSet; +import java.util.Set; + import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; @@ -46,6 +55,8 @@ public FakedTrackingVariable closeTracker; // track closing of instances of type AutoCloseable, maybe null + public Set uninitializedInMethod; + // for synthetic local variables // if declaration slot is not positionned, the variable will not be listed in attribute // note that the name of a variable should be chosen so as not to conflict with user ones (usually starting with a space char is all needed) @@ -72,6 +83,7 @@ /* API * Answer the receiver's binding type from Binding.BindingID. */ + @Override public final int kind() { return LOCAL; } @@ -87,6 +99,7 @@ * without parameter names (see org.eclipse.jdt.internal.core.util.BindingKeyResolver.SyntheticLocalVariableBinding): * p.X { void foo(int i0, int i1) { } } --> Lp/X;.foo()V#arg1#0#1 */ + @Override public char[] computeUniqueKey(boolean isLeaf) { StringBuffer buffer = new StringBuffer(); @@ -160,6 +173,7 @@ return uniqueKey; } + @Override public AnnotationBinding[] getAnnotations() { if (this.declaringScope == null) { if ((this.tagBits & TagBits.AnnotationResolved) != 0) { @@ -245,6 +259,7 @@ this.initializationCount++; } + @Override public void setAnnotations(AnnotationBinding[] annotations, Scope scope, boolean forceStore) { // note: we don's use this.declaringScope because we might be called before Scope.addLocalVariable(this) // which is where this.declaringScope is set. @@ -260,6 +275,7 @@ this.initializationPCs = null; } + @Override public String toString() { String s = super.toString(); @@ -287,6 +303,7 @@ return s; } + @Override public boolean isParameter() { return ((this.tagBits & TagBits.IsArgument) != 0); } @@ -308,4 +325,23 @@ } return null; } + + public void markInitialized() { + // Signals that the type is correctly set now - This is for extension in subclasses + } + public void markReferenced() { + // Signal that the name is used - This is for extension in subclasses + } + + public boolean isUninitializedIn(Scope scope) { + if (this.uninitializedInMethod != null) + return this.uninitializedInMethod.contains(scope.methodScope()); + return false; + } + + public void markAsUninitializedIn(Scope scope) { + if (this.uninitializedInMethod == null) + this.uninitializedInMethod = new HashSet<>(); + this.uninitializedInMethod.add(scope.methodScope()); + } } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -117,7 +120,7 @@ private ArrayList missingTypes; Set typesBeingConnected; // SHARED - public boolean isProcessingAnnotations = false; + public boolean isProcessingAnnotations = false; // ROOT_ONLY public boolean mayTolerateMissingType = false; PackageBinding nullableAnnotationPackage; // the package supposed to contain the Nullable annotation type @@ -203,7 +206,8 @@ if (this.useModuleSystem) { IModule mod = ((IModuleAwareNameEnvironment) this.nameEnvironment).getModule(name); if (mod != null) { - moduleBinding = BinaryModuleBinding.create(mod, this); + this.typeRequestor.accept(mod, this); + moduleBinding = this.root.knownModules.get(name); } } else return this.UnNamedModule; @@ -211,10 +215,6 @@ return moduleBinding; } -@Deprecated -public ReferenceBinding askForType(char[][] compoundName) { - return askForType(compoundName, this.UnNamedModule); -} /** * Ask the name environment for a type which corresponds to the compoundName. * Answer null if the name cannot be found. @@ -300,6 +300,8 @@ ReferenceBinding candidate = null; for (NameEnvironmentAnswer answer : answers) { if (answer == null) continue; + if (candidate != null && candidate.problemId() == ProblemReasons.Ambiguous) + return candidate; // saw enough ModuleBinding answerModule = answer.moduleBinding != null ? answer.moduleBinding : this.UnNamedModule; PackageBinding answerPackage = packageBinding; @@ -343,8 +345,6 @@ continue; } candidate = combine(candidate, answerPackage.getType0(name), clientModule); - if (candidate != null && candidate.problemId() == ProblemReasons.Ambiguous) - return candidate; // saw enough } return candidate; } @@ -422,9 +422,15 @@ } else { moduleBinding = this.knownModules.get(moduleName); if (moduleBinding == null && this.nameEnvironment instanceof IModuleAwareNameEnvironment) { - assert answer.isBinaryType(); IModule iModule = ((IModuleAwareNameEnvironment) this.nameEnvironment).getModule(moduleName); - moduleBinding = BinaryModuleBinding.create(iModule, this); + try { + this.typeRequestor.accept(iModule, this); + moduleBinding = this.knownModules.get(moduleName); + } catch (NullPointerException e) { + System.err.println("Bug 529367: moduleName: " + new String(moduleName) + "iModule null" + //$NON-NLS-1$ //$NON-NLS-2$ + (iModule == null ? "true" : "false")); //$NON-NLS-1$ //$NON-NLS-2$] + throw e; + } } } return moduleBinding; @@ -678,6 +684,7 @@ case Binding.WILDCARD_TYPE : case Binding.INTERSECTION_TYPE : case Binding.TYPE_PARAMETER : + case Binding.INTERSECTION_TYPE18: switch (type.erasure().id) { case TypeIds.T_JavaLangBoolean : return TypeBinding.BOOLEAN; @@ -699,8 +706,6 @@ break; case Binding.POLY_TYPE: return ((PolyTypeBinding) type).computeBoxingType(); - case Binding.INTERSECTION_TYPE18: - return computeBoxingType(type.getIntersectingTypes()[0]); } return type; } @@ -724,7 +729,7 @@ if (packageBinding == null || packageBinding == TheNotFoundPackage) { if (this.useModuleSystem) { if (this.module.isUnnamed()) { - char[][] declaringModules = ((IModuleAwareNameEnvironment) this.nameEnvironment).getModulesDeclaringPackage(null, constantPoolName[0], ModuleBinding.ANY); + char[][] declaringModules = ((IModuleAwareNameEnvironment) this.nameEnvironment).getUniqueModulesDeclaringPackage(null, constantPoolName[0], ModuleBinding.ANY); if (declaringModules != null) { for (char[] mod : declaringModules) { ModuleBinding declaringModule = this.root.getModule(mod); @@ -757,7 +762,7 @@ } } } else { - packageBinding = this.module.getVisiblePackage(parent, constantPoolName[i]); + packageBinding = this.module.getVisiblePackage(parent, constantPoolName[i], true); } } if (packageBinding == null || packageBinding == TheNotFoundPackage) { @@ -770,9 +775,19 @@ } } if (packageBinding instanceof SplitPackageBinding) { - PackageBinding incarnation = ((SplitPackageBinding) packageBinding).getIncarnation(this.module); - if (incarnation != null) - packageBinding = incarnation; + PackageBinding candidate = null; + // select from incarnations the unique package containing CUs, if any: + for (PackageBinding incarnation : ((SplitPackageBinding) packageBinding).incarnations) { + if (incarnation.hasCompilationUnit(false)) { + if (candidate != null) { + candidate = null; + break; // likely to report "accessible from more than one module" downstream + } + candidate = incarnation; + } + } + if (candidate != null) + return candidate; } return packageBinding; } @@ -784,12 +799,12 @@ public ReferenceBinding convertToParameterizedType(ReferenceBinding originalType) { if (originalType != null) { boolean isGeneric = originalType.isGenericType(); - if (!isGeneric && originalType.isStatic()) + if (!isGeneric && !originalType.hasEnclosingInstanceContext()) return originalType; ReferenceBinding originalEnclosingType = originalType.enclosingType(); ReferenceBinding convertedEnclosingType = originalEnclosingType; boolean needToConvert = isGeneric; - if (originalEnclosingType != null && !originalType.isStatic()) { + if (originalEnclosingType != null && originalType.hasEnclosingInstanceContext()) { convertedEnclosingType = convertToParameterizedType(originalEnclosingType); needToConvert |= TypeBinding.notEquals(originalEnclosingType, convertedEnclosingType); } @@ -799,7 +814,6 @@ } return originalType; } - /** * Returns the given binding's raw type binding. * @param type the TypeBinding to raw convert @@ -848,20 +862,24 @@ convertedType = needToConvert ? createRawType((ReferenceBinding)originalType.erasure(), null) : originalType; } else { ReferenceBinding convertedEnclosing; - if (originalEnclosing.kind() == Binding.RAW_TYPE) { - needToConvert |= !((ReferenceBinding)originalType).isStatic(); - convertedEnclosing = originalEnclosing; - } else if (forceRawEnclosingType && !needToConvert/*stop recursion when conversion occurs*/) { - convertedEnclosing = (ReferenceBinding) convertToRawType(originalEnclosing, forceRawEnclosingType); - needToConvert = TypeBinding.notEquals(originalEnclosing, convertedEnclosing); // only convert generic or parameterized types - } else if (needToConvert || ((ReferenceBinding)originalType).isStatic()) { - convertedEnclosing = (ReferenceBinding) convertToRawType(originalEnclosing, false); + if (!((ReferenceBinding)originalType).hasEnclosingInstanceContext()) { + convertedEnclosing = (ReferenceBinding) originalEnclosing.original(); } else { - convertedEnclosing = convertToParameterizedType(originalEnclosing); + if (originalEnclosing.kind() == Binding.RAW_TYPE) { + convertedEnclosing = originalEnclosing; + needToConvert = true; + } else if (forceRawEnclosingType && !needToConvert/*stop recursion when conversion occurs*/) { + convertedEnclosing = (ReferenceBinding) convertToRawType(originalEnclosing, forceRawEnclosingType); + needToConvert = TypeBinding.notEquals(originalEnclosing, convertedEnclosing); // only convert generic or parameterized types + } else if (needToConvert) { + convertedEnclosing = (ReferenceBinding) convertToRawType(originalEnclosing, false); + } else { + convertedEnclosing = convertToParameterizedType(originalEnclosing); + } } if (needToConvert) { convertedType = createRawType((ReferenceBinding) originalType.erasure(), convertedEnclosing); - } else if (TypeBinding.notEquals(originalEnclosing, convertedEnclosing) && !originalType.isStatic()) { + } else if (TypeBinding.notEquals(originalEnclosing, convertedEnclosing)) { convertedType = createParameterizedType((ReferenceBinding) originalType.erasure(), null, convertedEnclosing); } else { convertedType = originalType; @@ -992,7 +1010,7 @@ @Override public int compare(TypeBinding o1, TypeBinding o2) { // - return o1.isClass() ? -1 : (o2.isClass() ? 1 : 0); + return o1.isClass() ? -1 : (o2.isClass() ? 1 : CharOperation.compareTo(o1.readableName(), o2.readableName())); } }); } @@ -1145,10 +1163,13 @@ } public ParameterizedGenericMethodBinding createParameterizedGenericMethod(MethodBinding genericMethod, TypeBinding[] typeArguments) { - return createParameterizedGenericMethod(genericMethod, typeArguments, false, false); + return createParameterizedGenericMethod(genericMethod, typeArguments, null); +} +public ParameterizedGenericMethodBinding createParameterizedGenericMethod(MethodBinding genericMethod, TypeBinding[] typeArguments, TypeBinding targetType) { + return createParameterizedGenericMethod(genericMethod, typeArguments, false, false, targetType); } public ParameterizedGenericMethodBinding createParameterizedGenericMethod(MethodBinding genericMethod, TypeBinding[] typeArguments, - boolean inferredWithUncheckedConversion, boolean hasReturnProblem) + boolean inferredWithUncheckedConversion, boolean hasReturnProblem, TypeBinding targetType) { // cached info is array of already created parameterized types for this type ParameterizedGenericMethodBinding[] cachedInfo = (ParameterizedGenericMethodBinding[])this.uniqueParameterizedGenericMethodBindings.get(genericMethod); @@ -1162,6 +1183,7 @@ ParameterizedGenericMethodBinding cachedMethod = cachedInfo[index]; if (cachedMethod == null) break nextCachedMethod; if (cachedMethod.isRaw) continue nextCachedMethod; + if (cachedMethod.targetType != targetType) continue nextCachedMethod; //$IDENTITY-COMPARISON$ if (cachedMethod.inferredWithUncheckedConversion != inferredWithUncheckedConversion) continue nextCachedMethod; TypeBinding[] cachedArguments = cachedMethod.typeArguments; int cachedArgLength = cachedArguments == null ? 0 : cachedArguments.length; @@ -1191,11 +1213,11 @@ } // add new binding ParameterizedGenericMethodBinding parameterizedGenericMethod = - new ParameterizedGenericMethodBinding(genericMethod, typeArguments, this, inferredWithUncheckedConversion, hasReturnProblem); + new ParameterizedGenericMethodBinding(genericMethod, typeArguments, this, inferredWithUncheckedConversion, hasReturnProblem, targetType); cachedInfo[index] = parameterizedGenericMethod; return parameterizedGenericMethod; } -public PolymorphicMethodBinding createPolymorphicMethod(MethodBinding originalPolymorphicMethod, TypeBinding[] parameters) { +public PolymorphicMethodBinding createPolymorphicMethod(MethodBinding originalPolymorphicMethod, TypeBinding[] parameters, Scope scope) { // cached info is array of already created polymorphic methods for this type String key = new String(originalPolymorphicMethod.selector); PolymorphicMethodBinding[] cachedInfo = (PolymorphicMethodBinding[]) this.uniquePolymorphicMethodBindings.get(key); @@ -1206,7 +1228,17 @@ if (parameterTypeBinding.id == TypeIds.T_null) { parametersTypeBinding[i] = getType(JAVA_LANG_VOID, javaBaseModule()); } else { - parametersTypeBinding[i] = parameterTypeBinding.erasure(); + if (parameterTypeBinding.isPolyType()) { + PolyTypeBinding ptb = (PolyTypeBinding) parameterTypeBinding; + if (scope instanceof BlockScope && ptb.expression.resolvedType == null) { + ptb.expression.setExpectedType(scope.getJavaLangObject()); + parametersTypeBinding[i] = ptb.expression.resolveType((BlockScope) scope); + } else { + parametersTypeBinding[i] = ptb.expression.resolvedType; + } + } else { + parametersTypeBinding[i] = parameterTypeBinding.erasure(); + } } } boolean needToGrow = false; @@ -1509,8 +1541,19 @@ this.globalOptions.useNullTypeAnnotations = Boolean.FALSE; if (!this.globalOptions.isAnnotationBasedNullAnalysisEnabled || this.globalOptions.originalSourceLevel < ClassFileConstants.JDK1_8) return; - ReferenceBinding nullable = this.nullableAnnotation != null ? this.nullableAnnotation.getAnnotationType() : getType(this.getNullableAnnotationName(), this.UnNamedModule); //FIXME(SHMOD) module for null annotations?? - ReferenceBinding nonNull = this.nonNullAnnotation != null ? this.nonNullAnnotation.getAnnotationType() : getType(this.getNonNullAnnotationName(), this.UnNamedModule); + ReferenceBinding nullable; + ReferenceBinding nonNull; + boolean origMayTolerateMissingType = this.mayTolerateMissingType; + this.mayTolerateMissingType = true; + try { + nullable = this.nullableAnnotation != null ? this.nullableAnnotation.getAnnotationType() + : getType(this.getNullableAnnotationName(), this.UnNamedModule); // FIXME(SHMOD) module for null + // annotations?? + nonNull = this.nonNullAnnotation != null ? this.nonNullAnnotation.getAnnotationType() + : getType(this.getNonNullAnnotationName(), this.UnNamedModule); + } finally { + this.mayTolerateMissingType = origMayTolerateMissingType; + } if (nullable == null && nonNull == null) return; if (nullable == null || nonNull == null) diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MemberTypeBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MemberTypeBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MemberTypeBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MemberTypeBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -38,6 +41,7 @@ * NOTE: This method should only be used during/after code gen. */ +@Override public char[] constantPoolName() /* java/lang/Object */ { if (this.constantPoolName != null) @@ -50,6 +54,7 @@ return this.constantPoolName = CharOperation.concat(enclosingType().constantPoolName(), this.sourceName, '$'); } +@Override public TypeBinding clone(TypeBinding outerType) { MemberTypeBinding copy = new MemberTypeBinding(this); copy.enclosingType = (SourceTypeBinding) outerType; @@ -59,6 +64,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.Binding#initializeDeprecatedAnnotationTagBits() */ +@Override public void initializeDeprecatedAnnotationTagBits() { if (!isPrototype()) { this.prototype.initializeDeprecatedAnnotationTagBits(); @@ -79,6 +85,7 @@ } } } +@Override public String toString() { if (this.hasTypeAnnotations()) { return annotatedDebugName(); @@ -86,6 +93,7 @@ return "Member type : " + new String(sourceName()) + " " + super.toString(); //$NON-NLS-2$ //$NON-NLS-1$ } } +@Override public ModuleBinding module() { return this.enclosingType.module(); } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -38,6 +41,7 @@ import org.eclipse.jdt.internal.compiler.ClassFile; import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; +import org.eclipse.jdt.internal.compiler.ast.Annotation; import org.eclipse.jdt.internal.compiler.ast.Argument; import org.eclipse.jdt.internal.compiler.ast.LambdaExpression; import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration; @@ -430,6 +434,7 @@ * declaringUniqueKey dot selector genericSignature * p.X { void bar(X t) } --> Lp/X;.bar(LX;)V */ +@Override public char[] computeUniqueKey(boolean isLeaf) { // declaring class char[] declaringKey = this.declaringClass.computeUniqueKey(false/*not a leaf*/); @@ -494,13 +499,18 @@ /** * After method verifier has finished, fill in missing @NonNull specification from the applicable default. + * @param needToApplyParameterNonNullDefault + * @param needToApplyReturnNonNullDefault */ -protected void fillInDefaultNonNullness(AbstractMethodDeclaration sourceMethod) { +protected void fillInDefaultNonNullness(AbstractMethodDeclaration sourceMethod, boolean needToApplyReturnNonNullDefault, ParameterNonNullDefaultProvider needToApplyParameterNonNullDefault) { if (this.parameterNonNullness == null) this.parameterNonNullness = new Boolean[this.parameters.length]; boolean added = false; int length = this.parameterNonNullness.length; for (int i = 0; i < length; i++) { + if(!needToApplyParameterNonNullDefault.hasNonNullDefaultForParam(i)) { + continue; + } if (this.parameters[i].isBaseType()) continue; if (this.parameterNonNullness[i] == null) { @@ -515,6 +525,8 @@ } if (added) this.tagBits |= TagBits.HasParameterAnnotations; + if(!needToApplyReturnNonNullDefault) + return; if ( this.returnType != null && !this.returnType.isBaseType() && (this.tagBits & TagBits.AnnotationNullMASK) == 0) @@ -531,10 +543,13 @@ if(original == null) { return; } - if (hasNonNullDefaultFor(DefaultLocationParameter, true, sourceMethod)) { + ParameterNonNullDefaultProvider hasNonNullDefaultForParameter = hasNonNullDefaultForParameter(sourceMethod); + if (hasNonNullDefaultForParameter.hasAnyNonNullDefault()) { boolean added = false; int length = this.parameters.length; for (int i = 0; i < length; i++) { + if (!hasNonNullDefaultForParameter.hasNonNullDefaultForParam(i)) + continue; TypeBinding parameter = this.parameters[i]; if (!original.parameters[i].acceptsNonNullDefault()) continue; @@ -554,7 +569,7 @@ if (added) this.tagBits |= TagBits.HasParameterAnnotations; } - if (original.returnType != null && hasNonNullDefaultFor(DefaultLocationReturnType, true, sourceMethod) && original.returnType.acceptsNonNullDefault()) { + if (original.returnType != null && hasNonNullDefaultForReturnType(sourceMethod) && original.returnType.acceptsNonNullDefault()) { if ((this.returnType.tagBits & TagBits.AnnotationNullMASK) == 0) { this.returnType = env.createAnnotatedType(this.returnType, new AnnotationBinding[]{env.getNonNullAnnotation()}); } else if (sourceMethod instanceof MethodDeclaration && (this.returnType.tagBits & TagBits.AnnotationNonNull) != 0 @@ -630,6 +645,7 @@ return this.modifiers & (ExtraCompilerModifiers.AccJustFlag | ExtraCompilerModifiers.AccDefaultMethod); } +@Override public AnnotationBinding[] getAnnotations() { MethodBinding originalMethod = original(); return originalMethod.declaringClass.retrieveAnnotations(originalMethod); @@ -640,6 +656,7 @@ * lazily resolving corresponding annotation nodes, in case of forward references. * @see org.eclipse.jdt.internal.compiler.lookup.Binding#getAnnotationTagBits() */ +@Override public long getAnnotationTagBits() { MethodBinding originalMethod = original(); if ((originalMethod.tagBits & TagBits.AnnotationResolved) == 0 && originalMethod.declaringClass instanceof SourceTypeBinding) { @@ -651,20 +668,11 @@ ASTNode.resolveAnnotations(methodDecl.scope, methodDecl.annotations, originalMethod); CompilerOptions options = scope.compilerOptions(); if (options.isAnnotationBasedNullAnalysisEnabled) { - boolean usesNullTypeAnnotations = scope.environment().usesNullTypeAnnotations(); - long nullDefaultBits = usesNullTypeAnnotations ? this.defaultNullness - : this.tagBits & (TagBits.AnnotationNonNullByDefault|TagBits.AnnotationNullUnspecifiedByDefault); + long nullDefaultBits = this.defaultNullness; if (nullDefaultBits != 0 && this.declaringClass instanceof SourceTypeBinding) { - if (usesNullTypeAnnotations) { - Binding target = scope.checkRedundantDefaultNullness(this.defaultNullness, typeDecl.declarationSourceStart); - if (target != null) { - methodDecl.scope.problemReporter().nullDefaultAnnotationIsRedundant(methodDecl, methodDecl.annotations, target); - } - } else { - SourceTypeBinding declaringSourceType = (SourceTypeBinding) this.declaringClass; - if (declaringSourceType.checkRedundantNullnessDefaultOne(methodDecl, methodDecl.annotations, nullDefaultBits, usesNullTypeAnnotations)) { - declaringSourceType.checkRedundantNullnessDefaultRecurse(methodDecl, methodDecl.annotations, nullDefaultBits, usesNullTypeAnnotations); - } + Binding target = scope.checkRedundantDefaultNullness(this.defaultNullness, typeDecl.declarationSourceStart); + if (target != null) { + methodDecl.scope.problemReporter().nullDefaultAnnotationIsRedundant(methodDecl, methodDecl.annotations, target); } } } @@ -932,6 +940,7 @@ return (this.modifiers & (ClassFileConstants.AccDeprecated | ExtraCompilerModifiers.AccDeprecatedImplicitly)) != 0; } +@Override public final int kind() { return Binding.METHOD; } @@ -957,6 +966,7 @@ return this; } +@Override public char[] readableName() /* foo(int, Thread) */ { StringBuffer buffer = new StringBuffer(this.parameters.length + 1 * 20); if (isConstructor()) @@ -981,6 +991,7 @@ public void setTypeAnnotations(AnnotationBinding[] annotations) { this.typeAnnotations = annotations; } +@Override public void setAnnotations(AnnotationBinding[] annotations, boolean forceStore) { this.declaringClass.storeAnnotations(this, annotations, forceStore); } @@ -1012,6 +1023,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.Binding#shortReadableName() */ +@Override public char[] shortReadableName() { StringBuffer buffer = new StringBuffer(this.parameters.length + 1 * 20); if (isConstructor()) @@ -1270,6 +1282,7 @@ public MethodBinding tiebreakMethod() { return this; } +@Override public String toString() { StringBuffer output = new StringBuffer(10); if ((this.modifiers & ExtraCompilerModifiers.AccUnresolved) != 0) { @@ -1311,19 +1324,86 @@ return this.typeVariables; } //pre: null annotation analysis is enabled -public boolean hasNonNullDefaultFor(int location, boolean useTypeAnnotations, AbstractMethodDeclaration srcMethod) { - if ((this.modifiers & ExtraCompilerModifiers.AccIsDefaultConstructor) != 0) - return false; - if (useTypeAnnotations) { - if (this.defaultNullness != 0) - return (this.defaultNullness & location) != 0; +public boolean hasNonNullDefaultForReturnType(AbstractMethodDeclaration srcMethod) { + return hasNonNullDefaultFor(Binding.DefaultLocationReturnType, srcMethod, srcMethod == null ? -1 : srcMethod.declarationSourceStart); +} + +static int getNonNullByDefaultValue(AnnotationBinding annotation) { + ElementValuePair[] elementValuePairs = annotation.getElementValuePairs(); + if (elementValuePairs == null || elementValuePairs.length == 0 ) { + // no argument: apply default default + ReferenceBinding annotationType = annotation.getAnnotationType(); + if (annotationType == null) return 0; + MethodBinding[] annotationMethods = annotationType.methods(); + if (annotationMethods != null && annotationMethods.length == 1) { + Object value = annotationMethods[0].getDefaultValue(); + return Annotation.nullLocationBitsFromAnnotationValue(value); + } + return DefaultLocationsForTrueValue; // custom unconfigurable NNBD + } else if (elementValuePairs.length > 0) { + // evaluate the contained EnumConstantSignatures: + int nullness = 0; + for (int i = 0; i < elementValuePairs.length; i++) + nullness |= Annotation.nullLocationBitsFromAnnotationValue(elementValuePairs[i].getValue()); + return nullness; } else { - if ((this.tagBits & TagBits.AnnotationNonNullByDefault) != 0) - return true; - if ((this.tagBits & TagBits.AnnotationNullUnspecifiedByDefault) != 0) - return false; + // empty argument: cancel all defaults from enclosing scopes + return NULL_UNSPECIFIED_BY_DEFAULT; } - return this.declaringClass.hasNonNullDefaultFor(location, useTypeAnnotations, srcMethod == null ? -1 : srcMethod.declarationSourceStart); +} + + +//pre: null annotation analysis is enabled +public ParameterNonNullDefaultProvider hasNonNullDefaultForParameter(AbstractMethodDeclaration srcMethod) { + int len = this.parameters.length; + boolean[] result = new boolean[len]; + boolean trueFound = false; + boolean falseFound = false; + for (int i = 0; i < len; i++) { + int start = srcMethod == null || srcMethod.arguments == null || srcMethod.arguments.length == 0 ? -1 + : srcMethod.arguments[i].declarationSourceStart; + int nonNullByDefaultValue = srcMethod != null && start >= 0 + ? srcMethod.scope.localNonNullByDefaultValue(start) + : 0; + if (nonNullByDefaultValue == 0) { + AnnotationBinding[][] parameterAnnotations = getParameterAnnotations(); + if (parameterAnnotations != null) { + AnnotationBinding[] annotationBindings = parameterAnnotations[i]; + for (AnnotationBinding annotationBinding : annotationBindings) { + ReferenceBinding annotationType = annotationBinding.getAnnotationType(); + if (!annotationType.hasNullBit(TypeIds.BitNonNullByDefaultAnnotation)) { + continue; + } + nonNullByDefaultValue |= getNonNullByDefaultValue(annotationBinding); + } + } + } + boolean b; + if (nonNullByDefaultValue != 0) { + // parameter specific NNBD found + b = (nonNullByDefaultValue & Binding.DefaultLocationParameter) != 0; + } else { + b = hasNonNullDefaultFor(Binding.DefaultLocationParameter, srcMethod, start); + } + if (b) { + trueFound = true; + } else { + falseFound = true; + } + result[i] = b; + } + if (trueFound && falseFound) { + return new ParameterNonNullDefaultProvider.MixedProvider(result); + } + return trueFound ? ParameterNonNullDefaultProvider.TRUE_PROVIDER : ParameterNonNullDefaultProvider.FALSE_PROVIDER; + } +//pre: null annotation analysis is enabled +private boolean hasNonNullDefaultFor(int location, AbstractMethodDeclaration srcMethod, int start) { + if ((this.modifiers & ExtraCompilerModifiers.AccIsDefaultConstructor) != 0) + return false; + if (this.defaultNullness != 0) + return (this.defaultNullness & location) != 0; + return this.declaringClass.hasNonNullDefaultFor(location, start); } public boolean redeclaresPublicObjectMethod(Scope scope) { diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -75,6 +78,7 @@ this.lastVisibleFieldID = lastVisibleFieldID; } +@Override String basicToString(int tab) { String newLine = "\n"; //$NON-NLS-1$ for (int i = tab; --i >= 0;) @@ -436,6 +440,7 @@ } } */ +@Override public FieldBinding findField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite, boolean needResolve) { FieldBinding field = super.findField(receiverType, fieldName, invocationSite, needResolve); @@ -485,6 +490,7 @@ return (this.referenceContext instanceof TypeDeclaration); } +@Override public boolean isLambdaScope() { return this.referenceContext instanceof LambdaExpression; } @@ -501,6 +507,7 @@ * (unit, type or method) in case the problem handler decides it is necessary * to abort. */ +@Override public ProblemReporter problemReporter() { ProblemReporter problemReporter = referenceCompilationUnit().problemReporter; problemReporter.referenceContext = this.referenceContext; @@ -586,11 +593,13 @@ * Answer the reference type of this scope. * It is the nearest enclosing type of this scope. */ +@Override public TypeDeclaration referenceType() { ClassScope scope = enclosingClassScope(); return scope == null ? null : scope.referenceContext; } +@Override void resolveTypeParameter(TypeParameter typeParameter) { typeParameter.resolve(this); } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -55,6 +58,7 @@ } // Given `overridingMethod' which overrides `inheritedMethod' answer whether some subclass method that // differs in erasure from overridingMethod could override `inheritedMethod' +@Override protected boolean canOverridingMethodDifferInErasure(MethodBinding overridingMethod, MethodBinding inheritedMethod) { if (overridingMethod.areParameterErasuresEqual(inheritedMethod)) return false; // no further change in signature is possible due to parameterization. @@ -62,16 +66,19 @@ return false; // no parameterization is happening anyways. return true; } +@Override boolean canSkipInheritedMethods() { if (this.type.superclass() != null) if (this.type.superclass().isAbstract() || this.type.superclass().isParameterizedType()) return false; return this.type.superInterfaces() == Binding.NO_SUPERINTERFACES; } +@Override boolean canSkipInheritedMethods(MethodBinding one, MethodBinding two) { return two == null // already know one is not null || (TypeBinding.equalsEquals(one.declaringClass, two.declaringClass) && !one.declaringClass.isParameterizedType()); } +@Override void checkConcreteInheritedMethod(MethodBinding concreteMethod, MethodBinding[] abstractMethods) { super.checkConcreteInheritedMethod(concreteMethod, abstractMethods); boolean analyseNullAnnotations = this.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled; @@ -79,9 +86,8 @@ AbstractMethodDeclaration srcMethod = null; if (analyseNullAnnotations && this.type.equals(concreteMethod.declaringClass)) // is currentMethod from the current type? srcMethod = concreteMethod.sourceMethod(); - boolean useTypeAnnotations = this.environment.usesNullTypeAnnotations(); - boolean hasReturnNonNullDefault = analyseNullAnnotations && concreteMethod.hasNonNullDefaultFor(Binding.DefaultLocationReturnType, useTypeAnnotations, srcMethod); - boolean hasParameterNonNullDefault = analyseNullAnnotations && concreteMethod.hasNonNullDefaultFor(Binding.DefaultLocationParameter, useTypeAnnotations, srcMethod); + boolean hasReturnNonNullDefault = analyseNullAnnotations && concreteMethod.hasNonNullDefaultForReturnType(srcMethod); + ParameterNonNullDefaultProvider hasParameterNonNullDefault = analyseNullAnnotations ? concreteMethod.hasNonNullDefaultForParameter(srcMethod): ParameterNonNullDefaultProvider.FALSE_PROVIDER; for (int i = 0, l = abstractMethods.length; i < l; i++) { MethodBinding abstractMethod = abstractMethods[i]; @@ -108,6 +114,7 @@ } } } +@Override void checkForBridgeMethod(MethodBinding currentMethod, MethodBinding inheritedMethod, MethodBinding[] allInheritedMethods) { if (currentMethod.isVarargs() != inheritedMethod.isVarargs()) problemReporter(currentMethod).varargsConflict(currentMethod, inheritedMethod, this.type); @@ -269,6 +276,7 @@ detectInheritedNameClash(inheritedMethod.original(), otherInheritedMethod.original()); } // 8.4.8.4 +@Override void checkInheritedMethods(MethodBinding[] methods, int length, boolean[] isOverridden, boolean[] isInherited) { boolean continueInvestigation = true; MethodBinding concreteMethod = null; @@ -367,6 +375,7 @@ } return ok; } +@Override boolean checkInheritedReturnTypes(MethodBinding method, MethodBinding otherMethod) { if (areReturnTypesCompatible(method, otherMethod)) return true; @@ -385,6 +394,7 @@ return false; } +@Override void checkAgainstInheritedMethods(MethodBinding currentMethod, MethodBinding[] methods, int length, MethodBinding[] allInheritedMethods) { super.checkAgainstInheritedMethods(currentMethod, methods, length, allInheritedMethods); @@ -396,20 +406,20 @@ AbstractMethodDeclaration srcMethod = null; if (this.type.equals(currentMethod.declaringClass)) // is currentMethod from the current type? srcMethod = currentMethod.sourceMethod(); - boolean useTypeAnnotations = this.environment.usesNullTypeAnnotations(); - boolean hasReturnNonNullDefault = currentMethod.hasNonNullDefaultFor(Binding.DefaultLocationReturnType, useTypeAnnotations, srcMethod); - boolean hasParameterNonNullDefault = currentMethod.hasNonNullDefaultFor(Binding.DefaultLocationParameter, useTypeAnnotations, srcMethod); + boolean hasReturnNonNullDefault = currentMethod.hasNonNullDefaultForReturnType(srcMethod); + ParameterNonNullDefaultProvider hasParameterNonNullDefault = currentMethod.hasNonNullDefaultForParameter(srcMethod); for (int i = length; --i >= 0;) if (!currentMethod.isStatic() && !methods[i].isStatic()) checkNullSpecInheritance(currentMethod, srcMethod, hasReturnNonNullDefault, hasParameterNonNullDefault, true, methods[i], methods, this.type.scope, null); } } +@Override void checkNullSpecInheritance(MethodBinding currentMethod, AbstractMethodDeclaration srcMethod, - boolean hasReturnNonNullDefault, boolean hasParameterNonNullDefault, boolean complain, MethodBinding inheritedMethod, MethodBinding[] allInherited, Scope scope, InheritedNonNullnessInfo[] inheritedNonNullnessInfos) + boolean hasReturnNonNullDefault, ParameterNonNullDefaultProvider hasParameterNonNullDefault, boolean complain, MethodBinding inheritedMethod, MethodBinding[] allInherited, Scope scope, InheritedNonNullnessInfo[] inheritedNonNullnessInfos) { complain &= !currentMethod.isConstructor(); - if (!hasReturnNonNullDefault && !hasParameterNonNullDefault && !complain && !this.environment.globalOptions.inheritNullAnnotations) { + if (!hasReturnNonNullDefault && !hasParameterNonNullDefault.hasAnyNonNullDefault() && !complain && !this.environment.globalOptions.inheritNullAnnotations) { // nothing to be done, take the shortcut currentMethod.tagBits |= TagBits.IsNullnessKnown; return; @@ -467,6 +477,7 @@ } } } +@Override public void reportRawReferences(MethodBinding currentMethod, MethodBinding inheritedMethod) { CompilerOptions compilerOptions = this.type.scope.compilerOptions(); if (compilerOptions.sourceLevel < ClassFileConstants.JDK1_5 // shouldn't whine at all @@ -510,6 +521,7 @@ } } +@Override void checkMethods() { boolean mustImplementAbstractMethods = mustImplementAbstractMethods(); boolean skipInheritedMethods = mustImplementAbstractMethods && canSkipInheritedMethods(); // have a single concrete superclass so only check overridden methods @@ -775,7 +787,7 @@ } else if (match.declaringClass.isClass()) { implementation = match; } - if (interfaceMethod != null && implementation != null && !isAsVisible(implementation, interfaceMethod)) + if (interfaceMethod != null && implementation != null && !implementation.isAbstract() && !isAsVisible(implementation, interfaceMethod)) problemReporter().inheritedMethodReducesVisibility(typeParameter, implementation, new MethodBinding [] {interfaceMethod}); if (areReturnTypesCompatible(first, match)) continue; @@ -856,6 +868,7 @@ // one has type variables and substituteTwo did not pass bounds check in computeSubstituteMethod() return one.typeVariables != Binding.NO_TYPE_VARIABLES && !(substituteTwo instanceof ParameterizedGenericMethodBinding); } +@Override SimpleSet findSuperinterfaceCollisions(ReferenceBinding superclass, ReferenceBinding[] superInterfaces) { ReferenceBinding[] interfacesToVisit = null; int nextPosition = 0; @@ -950,6 +963,7 @@ } } // caveat: returns false if a method is implemented, but with a return type that is incompatible with that of the interface method +@Override boolean isInterfaceMethodImplemented(MethodBinding inheritedMethod, MethodBinding existingMethod, ReferenceBinding superType) { if (inheritedMethod.original() != inheritedMethod && existingMethod.declaringClass.isInterface()) return false; // must hold onto ParameterizedMethod to see if a bridge method is necessary @@ -962,6 +976,7 @@ && !existingMethod.declaringClass.isInterface() && areReturnTypesCompatible(existingMethod, inheritedMethod)); // may have to report incompatible return type } +@Override public boolean isMethodSubsignature(MethodBinding method, MethodBinding inheritedMethod) { if (!org.eclipse.jdt.core.compiler.CharOperation.equals(method.selector, inheritedMethod.selector)) return false; @@ -991,6 +1006,7 @@ } return false; } +@Override boolean reportIncompatibleReturnTypeError(MethodBinding currentMethod, MethodBinding inheritedMethod) { if (isUnsafeReturnTypeOverride(currentMethod, inheritedMethod)) { problemReporter(currentMethod).unsafeReturnTypeOverride(currentMethod, inheritedMethod, this.type); @@ -998,6 +1014,7 @@ } return super.reportIncompatibleReturnTypeError(currentMethod, inheritedMethod); } +@Override void verify() { if (this.type.isAnnotationType()) this.type.detectAnnotationCycle(); diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -1025,6 +1028,7 @@ } } +@Override public String toString() { StringBuffer buffer = new StringBuffer(10); buffer.append("MethodVerifier for type: "); //$NON-NLS-1$ diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2015 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -41,6 +44,7 @@ this.methods = Binding.NO_METHODS; } +@Override public TypeBinding clone(TypeBinding outerType) { return this; // shouldn't get here. } @@ -48,6 +52,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#collectMissingTypes(java.util.List) */ +@Override public List collectMissingTypes(List missingTypes) { if (missingTypes == null) { missingTypes = new ArrayList<>(5); @@ -62,6 +67,7 @@ * Missing binary type will answer false to #isValidBinding() * @see org.eclipse.jdt.internal.compiler.lookup.Binding#problemId() */ +@Override public int problemId() { return ProblemReasons.NotFound; } @@ -75,10 +81,12 @@ this.superclass = missingSuperclass; } +@Override public void setTypeAnnotations(AnnotationBinding[] annotations, boolean evalNullAnnotations) { return; // reject misguided attempts. } +@Override public String toString() { return "[MISSING:" + new String(CharOperation.concatWith(this.compoundName, '.')) + "]"; //$NON-NLS-1$ //$NON-NLS-2$ } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2016, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2016, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -15,9 +18,12 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.function.Supplier; +import java.util.stream.Collectors; import java.util.stream.Stream; import org.eclipse.jdt.core.compiler.CharOperation; @@ -25,6 +31,7 @@ import org.eclipse.jdt.internal.compiler.env.IModuleAwareNameEnvironment; import org.eclipse.jdt.internal.compiler.env.IUpdatableModule; import org.eclipse.jdt.internal.compiler.util.HashtableOfPackage; +import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable; import org.eclipse.jdt.internal.compiler.util.SimpleSetOfCharArray; /** @@ -60,9 +67,11 @@ UnNamedModule(LookupEnvironment env) { super(env); } + @Override public ModuleBinding[] getAllRequiredModules() { return Binding.NO_MODULES; } + @Override public boolean canAccess(PackageBinding pkg) { ModuleBinding mod = pkg.enclosingModule; if (mod != null && mod != this) @@ -105,12 +114,14 @@ private SimpleSetOfCharArray packageNames; public int modifiers; public LookupEnvironment environment; - public int tagBits; + public long tagBits; + public int defaultNullness = NO_NULL_DEFAULT; ModuleBinding[] requiredModules = null; boolean isAuto = false; private boolean[] isComplete = new boolean[UpdateKind.values().length]; private Set transitiveRequires; boolean isPackageLookupActive = false; // to prevent cyclic lookup caused by synthetic reads edges on behalf of auto-modules. + SimpleLookupTable storedAnnotations = null; /** * Packages declared in this module (indexed by qualified name). @@ -405,6 +416,7 @@ } /** Answer the name of this module. The unnamed module is identified by {@link #UNNAMED}. */ + @Override public char[] name() { return this.moduleName; } @@ -478,7 +490,7 @@ binding = this.environment.getPackage0(name); if (binding != null) return binding; - binding = getVisiblePackage(null, name); + binding = getVisiblePackage(null, name, true); // remember: if (binding != null) { this.environment.knownPackages.put(name, binding); @@ -500,10 +512,13 @@ PackageBinding binding = new PackageBinding(subPkgCompoundName, parent, this.environment, this); // remember this.declaredPackages.put(fullFlatName, binding); + if (parent == null) { + this.environment.knownPackages.put(name, binding); + } return binding; } // Given parent is visible in this module, see if there is sub package named name visible in this module - PackageBinding getVisiblePackage(PackageBinding parent, char[] name) { + PackageBinding getVisiblePackage(PackageBinding parent, char[] name, boolean considerRequiredModules) { // check caches: char[][] parentName = parent == null ? CharOperation.NO_CHAR_CHAR : parent.compoundName; char[][] subPkgCompoundName = CharOperation.arrayConcat(parentName, name); @@ -523,19 +538,34 @@ } PackageBinding binding = null; + char[][] declaringModuleNames = null; + boolean packageMayBeIncomplete = !considerRequiredModules; if (this.environment.useModuleSystem) { IModuleAwareNameEnvironment moduleEnv = (IModuleAwareNameEnvironment) this.environment.nameEnvironment; - char[][] declaringModuleNames = moduleEnv.getModulesDeclaringPackage(parentName, name, nameForLookup()); + declaringModuleNames = moduleEnv.getUniqueModulesDeclaringPackage(parentName, name, nameForLookup()); if (declaringModuleNames != null) { - if (!this.isUnnamed() && CharOperation.containsEqual(declaringModuleNames, this.moduleName)) { + if (CharOperation.containsEqual(declaringModuleNames, this.moduleName)) { // declared here, not yet known, so create it now: binding = new PackageBinding(subPkgCompoundName, parent, this.environment, this); - } else { + } else if (considerRequiredModules) { // visible but foreign (when current is unnamed or auto): for (char[] declaringModuleName : declaringModuleNames) { ModuleBinding declaringModule = this.environment.root.getModule(declaringModuleName); - if (declaringModule != null && !declaringModule.isPackageLookupActive) - binding = SplitPackageBinding.combine(declaringModule.getDeclaredPackage(parentName, name), binding, this); + if (declaringModule != null) { + if (declaringModule.isPackageLookupActive) { + packageMayBeIncomplete = true; + } else { + PackageBinding declaredPackage = declaringModule.getDeclaredPackage(parentName, name); + if (declaredPackage != null) { + // don't add foreign package to 'parent' (below), but to its own parent: + if (declaredPackage.parent != null) + declaredPackage.parent.addPackage(declaredPackage, declaringModule, true); + parent = null; + // + binding = SplitPackageBinding.combine(declaredPackage, binding, this); + } + } + } } } } @@ -545,15 +575,18 @@ } // enrich with split-siblings from visible modules: - if (!isUnnamed()) { - binding = combineWithPackagesFromRequired(binding, subPkgCompoundName); + if (considerRequiredModules) { + binding = combineWithPackagesFromOtherRelevantModules(binding, subPkgCompoundName, declaringModuleNames); } - if (binding == null || !binding.isValidBinding()) + if (binding == null || !binding.isValidBinding()) { + if (parent != null && !packageMayBeIncomplete) // don't remember package that may still lack some siblings + parent.knownPackages.put(name, binding == null ? LookupEnvironment.TheNotFoundPackage : binding); return null; + } // remember if (parentName.length == 0) binding.environment.knownPackages.put(name, binding); - else + else if (parent != null) binding = parent.addPackage(binding, this, false); return addPackage(binding, false); } @@ -567,6 +600,9 @@ *

*/ public PackageBinding getVisiblePackage(char[][] qualifiedPackageName) { + return getVisiblePackage(qualifiedPackageName, true); + } + PackageBinding getVisiblePackage(char[][] qualifiedPackageName, boolean considerRequiredModules) { if (qualifiedPackageName == null || qualifiedPackageName.length == 0) { return this.environment.defaultPackage; } @@ -577,7 +613,7 @@ // check each sub package for (int i = 1; i < qualifiedPackageName.length; i++) { - PackageBinding binding = getVisiblePackage(parent, qualifiedPackageName[i]); + PackageBinding binding = getVisiblePackage(parent, qualifiedPackageName[i], considerRequiredModules); if (binding == null || binding == LookupEnvironment.TheNotFoundPackage) { return null; } @@ -598,12 +634,12 @@ // Returns a package binding if there exists such a package in the context of this module and it is observable // A package is observable if it is declared in this module or it is exported by some required module if (parentPackageName == null || parentPackageName.length == 0) { - return getVisiblePackage(null, packageName); + return getVisiblePackage(null, packageName, true); } PackageBinding binding = null; PackageBinding parent = getVisiblePackage(parentPackageName); if (parent != null && parent != LookupEnvironment.TheNotFoundPackage) { - binding = getVisiblePackage(parent, packageName); + binding = getVisiblePackage(parent, packageName, true); } if (binding != null) return addPackage(binding, false); @@ -624,38 +660,55 @@ if (packageBinding.isDeclaredIn(this)) { char[] packageName = packageBinding.readableName(); if (checkForSplit && this.environment.useModuleSystem) { + char[][] declaringModuleNames = null; if (isUnnamed()) { IModuleAwareNameEnvironment moduleEnv = (IModuleAwareNameEnvironment) this.environment.nameEnvironment; - char[][] declaringModuleNames = moduleEnv.getModulesDeclaringPackage(null, packageName, ANY); - if (declaringModuleNames != null) { - for (int i = 0; i < declaringModuleNames.length; i++) { - ModuleBinding otherModule = this.environment.getModule(declaringModuleNames[i]); - if (otherModule != null && !otherModule.isPackageLookupActive) - packageBinding = SplitPackageBinding.combine(otherModule.getVisiblePackage(packageBinding.compoundName), packageBinding, this); - } - } - } else { - packageBinding = combineWithPackagesFromRequired(packageBinding, packageBinding.compoundName); + declaringModuleNames = moduleEnv.getUniqueModulesDeclaringPackage(null, packageName, ANY); } + packageBinding = combineWithPackagesFromOtherRelevantModules(packageBinding, packageBinding.compoundName, declaringModuleNames); } this.declaredPackages.put(packageName, packageBinding); + if (packageBinding.parent == null) { + this.environment.knownPackages.put(packageName, packageBinding); + } } return packageBinding; } - private PackageBinding combineWithPackagesFromRequired(PackageBinding currentBinding, char[][] compoundName) { + private PackageBinding combineWithPackagesFromOtherRelevantModules(PackageBinding currentBinding, char[][] compoundName, char[][] declaringModuleNames) { boolean save = this.isPackageLookupActive; this.isPackageLookupActive = true; try { - for (ModuleBinding moduleBinding : getAllRequiredModules()) - if (!moduleBinding.isPackageLookupActive) - currentBinding = SplitPackageBinding.combine(moduleBinding.getVisiblePackage(compoundName), currentBinding, this); + char[] singleName = compoundName[compoundName.length-1]; + PackageBinding parent = currentBinding != null ? currentBinding.parent : null; + for (ModuleBinding moduleBinding : otherRelevantModules(declaringModuleNames)) { + if (!moduleBinding.isPackageLookupActive) { + PackageBinding nextBinding = parent != null + ? moduleBinding.getVisiblePackage(parent, singleName, false) + : moduleBinding.getVisiblePackage(compoundName, false); + currentBinding = SplitPackageBinding.combine(nextBinding, currentBinding, this); + } + } return currentBinding; } finally { this.isPackageLookupActive = save; } } + List otherRelevantModules(char[][] declaringModuleNames) { + if (isUnnamed() && declaringModuleNames != null) { + // unnamed module reads all named modules, + // so all modules declaring the given package are relevant: + return Arrays.stream(declaringModuleNames) + .filter(modName -> modName != UNNAMED) + .map(modName -> this.environment.getModule(modName)) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + } else { + return Arrays.asList(getAllRequiredModules()); + } + } + /** * Check if the given package is accessible by this module. True when the package is declared in * this module or exported by some required module to this module. @@ -694,6 +747,7 @@ return this.moduleName; } + @Override public String toString() { StringBuffer buffer = new StringBuffer(30); if (isOpen()) @@ -806,7 +860,9 @@ return (this.modifiers & ClassFileConstants.ACC_OPEN) != 0; } public boolean isDeprecated() { - // TODO(SHMOD) implement deprecation for modules + return (this.tagBits & TagBits.AnnotationDeprecated) != 0; + } + public boolean hasUnstableAutoName() { return false; } public boolean isTransitivelyRequired(ModuleBinding otherModule) { @@ -817,4 +873,60 @@ } return this.transitiveRequires.contains(otherModule); } + + public int getDefaultNullness() { + getAnnotationTagBits(); // ensure annotations are initialized + return this.defaultNullness; + } + SimpleLookupTable storedAnnotations(boolean forceInitialize, boolean forceStore) { + + if (forceInitialize && this.storedAnnotations == null) { + if (!this.environment.globalOptions.storeAnnotations && !forceStore) + return null; // not supported during this compile + this.storedAnnotations = new SimpleLookupTable(3); + } + return this.storedAnnotations; + } + public AnnotationHolder retrieveAnnotationHolder(Binding binding, boolean forceInitialization) { + SimpleLookupTable store = storedAnnotations(forceInitialization, false); + return store == null ? null : (AnnotationHolder) store.get(binding); + } + + AnnotationBinding[] retrieveAnnotations(Binding binding) { + AnnotationHolder holder = retrieveAnnotationHolder(binding, true); + return holder == null ? Binding.NO_ANNOTATIONS : holder.getAnnotations(); + } + + @Override + public void setAnnotations(AnnotationBinding[] annotations, boolean forceStore) { + storeAnnotations(this, annotations, forceStore); + } + void storeAnnotationHolder(Binding binding, AnnotationHolder holder) { + if (holder == null) { + SimpleLookupTable store = storedAnnotations(false, false); + if (store != null) + store.removeKey(binding); + } else { + SimpleLookupTable store = storedAnnotations(true, false); + if (store != null) + store.put(binding, holder); + } + } + + void storeAnnotations(Binding binding, AnnotationBinding[] annotations, boolean forceStore) { + AnnotationHolder holder = null; + if (annotations == null || annotations.length == 0) { + SimpleLookupTable store = storedAnnotations(false, forceStore); + if (store != null) + holder = (AnnotationHolder) store.get(binding); + if (holder == null) return; // nothing to delete + } else { + SimpleLookupTable store = storedAnnotations(true, forceStore); + if (store == null) return; // not supported + holder = (AnnotationHolder) store.get(binding); + if (holder == null) + holder = new AnnotationHolder(); + } + storeAnnotationHolder(binding, holder.setAnnotations(annotations)); + } } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MostSpecificExceptionMethodBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MostSpecificExceptionMethodBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MostSpecificExceptionMethodBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MostSpecificExceptionMethodBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2014 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -34,6 +37,7 @@ this.defaultNullness = originalMethod.defaultNullness; } + @Override public MethodBinding original() { return this.originalMethod.original(); } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/NestedTypeBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/NestedTypeBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/NestedTypeBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/NestedTypeBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2014 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -15,9 +18,6 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.lookup; -import org.eclipse.jdt.internal.compiler.ast.ASTNode; -import org.eclipse.jdt.internal.compiler.ast.Annotation; - public abstract class NestedTypeBinding extends SourceTypeBinding { public SourceTypeBinding enclosingType; @@ -126,20 +126,9 @@ return synthLocal; } -protected void checkRedundantNullnessDefaultRecurse(ASTNode location, Annotation[] annotations, long nullBits, boolean useNullTypeAnnotations) { - if (!isPrototype()) throw new IllegalStateException(); - ReferenceBinding currentType = this.enclosingType; - do { - if (!((SourceTypeBinding)currentType).checkRedundantNullnessDefaultOne(location, annotations, nullBits, useNullTypeAnnotations)) { - return; - } - currentType = currentType.enclosingType(); - } while (currentType instanceof SourceTypeBinding); - super.checkRedundantNullnessDefaultRecurse(location, annotations, nullBits, useNullTypeAnnotations); -} - /* Answer the receiver's enclosing type... null if the receiver is a top level type. */ +@Override public ReferenceBinding enclosingType() { return this.enclosingType; } @@ -147,6 +136,7 @@ /** * @return the enclosingInstancesSlotSize */ +@Override public int getEnclosingInstancesSlotSize() { if (!isPrototype()) throw new IllegalStateException(); return this.enclosingInstances == null ? 0 : this.enclosingInstances.length; @@ -155,6 +145,7 @@ /** * @return the outerLocalVariablesSlotSize */ +@Override public int getOuterLocalVariablesSlotSize() { if (!isPrototype()) throw new IllegalStateException(); if (this.outerLocalVariablesSlotSize < 0) { @@ -235,6 +226,7 @@ return this.enclosingInstances; // is null if no enclosing instances are required } +@Override public ReferenceBinding[] syntheticEnclosingInstanceTypes() { if (!isPrototype()) throw new IllegalStateException(); if (this.enclosingTypes == UNINITIALIZED_REFERENCE_TYPES) { @@ -251,6 +243,7 @@ return this.enclosingTypes; } +@Override public SyntheticArgumentBinding[] syntheticOuterLocalVariables() { if (!isPrototype()) throw new IllegalStateException(); return this.outerLocalVariables; // is null if no outer locals are required diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/NullTypeBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/NullTypeBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/NullTypeBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/NullTypeBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2013, 2014 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -19,14 +22,17 @@ super(TypeIds.T_null, TypeConstants.NULL, new char[] { 'N' }); // N stands for null even if it is never internally used); } + @Override public TypeBinding clone(TypeBinding enclosingType) { return this; // enforce solitude. } + @Override public void setTypeAnnotations(AnnotationBinding[] annotations, boolean evalNullAnnotations) { return; // reject misguided attempt. } + @Override public TypeBinding unannotated() { return this; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -15,6 +18,7 @@ package org.eclipse.jdt.internal.compiler.lookup; import java.util.ArrayList; +import java.util.function.Predicate; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.env.IModuleAwareNameEnvironment; @@ -35,7 +39,7 @@ // code representing the default that has been defined for this package (using @NonNullByDefault) // one of Binding.{NO_NULL_DEFAULT,NULL_UNSPECIFIED_BY_DEFAULT,NONNULL_BY_DEFAULT} - protected int defaultNullness = NO_NULL_DEFAULT; + private int defaultNullness = NO_NULL_DEFAULT; public ModuleBinding enclosingModule; @@ -130,6 +134,7 @@ * slash separated name * org.eclipse.jdt.core --> org/eclipse/jdt/core */ +@Override public char[] computeUniqueKey(boolean isLeaf) { return CharOperation.concatWith(this.compoundName, '/'); } @@ -298,13 +303,35 @@ } return (this.tagBits & TagBits.AnnotationDeprecated) != 0; } +public int getDefaultNullness() { + if (this.defaultNullness == NO_NULL_DEFAULT) + return this.enclosingModule.getDefaultNullness(); + return this.defaultNullness; +} +public void setDefaultNullness(int nullness) { + this.defaultNullness = nullness; +} +/** + * Find a binding (either this package or its enclosing ModuleBinding) + * where 'defaultNullness' matches the given predicate. + */ +public Binding findDefaultNullnessTarget(Predicate predicate) { + if (predicate.test(this.defaultNullness)) + return this; + if (this.defaultNullness == NO_NULL_DEFAULT) + if (predicate.test(this.enclosingModule.getDefaultNullness())) + return this.enclosingModule; + return null; +} /* API * Answer the receiver's binding type from Binding.BindingID. */ +@Override public final int kind() { return Binding.PACKAGE; } +@Override public int problemId() { if ((this.tagBits & TagBits.HasMissingType) != 0) return ProblemReasons.NotFound; @@ -356,9 +383,11 @@ } } +@Override public char[] readableName() /*java.lang*/ { return CharOperation.concatWith(this.compoundName, '.'); } +@Override public String toString() { String str; if (this.compoundName == CharOperation.NO_CHAR_CHAR) { @@ -383,9 +412,13 @@ */ public boolean isExported() { if (this.isExported == null) { - this.enclosingModule.getExports(); // ensure resolved and completed - if (this.isExported == null) - this.isExported = Boolean.FALSE; + if (this.enclosingModule.isAuto) { + this.isExported = Boolean.TRUE; + } else { + this.enclosingModule.getExports(); // ensure resolved and completed + if (this.isExported == null) + this.isExported = Boolean.FALSE; + } } return this.isExported == Boolean.TRUE; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedFieldBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedFieldBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedFieldBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedFieldBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -42,6 +45,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.VariableBinding#constant() */ +@Override public Constant constant() { return this.originalField.constant(); } @@ -49,6 +53,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.FieldBinding#original() */ +@Override public FieldBinding original() { return this.originalField.original(); } @@ -56,6 +61,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.VariableBinding#constant() */ +@Override public void setConstant(Constant constant) { this.originalField.setConstant(constant); } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -50,6 +53,7 @@ public boolean isRaw; // set to true for method behaving as raw for substitution purpose private MethodBinding tiebreakMethod; public boolean inferredWithUncheckedConversion; + public TypeBinding targetType; // used to distinguish different PGMB created for different target types (needed because inference contexts are remembered per PGMB) /** * Perform inference of generic method type parameters and/or expected type @@ -273,7 +277,7 @@ // assemble the solution etc: TypeBinding[] solutions = infCtx18.getSolutions(typeVariables, invocationSite, result); if (solutions != null) { - methodSubstitute = scope.environment().createParameterizedGenericMethod(originalMethod, solutions, infCtx18.usesUncheckedConversion, hasReturnProblem); + methodSubstitute = scope.environment().createParameterizedGenericMethod(originalMethod, solutions, infCtx18.usesUncheckedConversion, hasReturnProblem, expectedType); if (invocationSite instanceof Invocation && allArgumentsAreProper) infCtx18.forwardResults(result, (Invocation) invocationSite, methodSubstitute, expectedType); try { @@ -537,9 +541,10 @@ /** * Create method of parameterized type, substituting original parameters with type arguments. */ - public ParameterizedGenericMethodBinding(MethodBinding originalMethod, TypeBinding[] typeArguments, LookupEnvironment environment, boolean inferredWithUncheckConversion, boolean hasReturnProblem) { + public ParameterizedGenericMethodBinding(MethodBinding originalMethod, TypeBinding[] typeArguments, LookupEnvironment environment, boolean inferredWithUncheckConversion, boolean hasReturnProblem, TypeBinding targetType) { this.environment = environment; this.inferredWithUncheckedConversion = inferredWithUncheckConversion; + this.targetType = targetType; this.modifiers = originalMethod.modifiers; this.selector = originalMethod.selector; this.declaringClass = originalMethod.declaringClass; @@ -616,6 +621,7 @@ * parameterizedDeclaringUniqueKey dot selector originalMethodGenericSignature percent typeArguments * p.X { void bar(T t, U u) { new X().bar(this, "") } } --> Lp/X;.bar(TT;Ljava/lang/String;)V% */ + @Override public char[] computeUniqueKey(boolean isLeaf) { StringBuffer buffer = new StringBuffer(); buffer.append(this.originalMethod.computeUniqueKey(false/*not a leaf*/)); @@ -638,6 +644,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.Substitution#environment() */ + @Override public LookupEnvironment environment() { return this.environment; } @@ -645,6 +652,7 @@ * Returns true if some parameters got substituted. * NOTE: generic method invocation delegates to its declaring method (could be a parameterized one) */ + @Override public boolean hasSubstitutedParameters() { // generic parameterized method can represent either an invocation or a raw generic method if (this.wasInferred) @@ -655,6 +663,7 @@ * Returns true if the return type got substituted. * NOTE: generic method invocation delegates to its declaring method (could be a parameterized one) */ + @Override public boolean hasSubstitutedReturnType() { if (this.inferredReturnType) return this.originalMethod.hasSubstitutedReturnType(); @@ -780,6 +789,7 @@ this.scope = scope; } // With T mapping to I, answer of I, when given T, having eliminated the circularity/self reference. + @Override public TypeBinding substitute(TypeVariableBinding typeVariable) { if (typeVariable.rank >= this.variables.length || TypeBinding.notEquals(this.variables[typeVariable.rank], typeVariable)) { // not kosher, don't touch. return typeVariable; @@ -791,10 +801,12 @@ return this.scope.environment().createWildcard(genericType, typeVariable.rank, null, null, Wildcard.UNBOUND, typeVariable.getTypeAnnotations()); } + @Override public LookupEnvironment environment() { return this.scope.environment(); } + @Override public boolean isRawSubstitution() { return false; } @@ -803,6 +815,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.Substitution#isRawSubstitution() */ + @Override public boolean isRawSubstitution() { return this.isRaw; } @@ -810,6 +823,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.Substitution#substitute(org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding) */ + @Override public TypeBinding substitute(TypeVariableBinding originalVariable) { TypeVariableBinding[] variables = this.originalMethod.typeVariables; int length = variables.length; @@ -823,6 +837,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.MethodBinding#tiebreakMethod() */ + @Override public MethodBinding tiebreakMethod() { if (this.tiebreakMethod == null) this.tiebreakMethod = this.originalMethod.asRawMethod(this.environment); diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -69,12 +72,15 @@ // need to substitute old var refs with new ones (double substitution: declaringClass + new type variables) substitution = new Substitution() { + @Override public LookupEnvironment environment() { return parameterizedDeclaringClass.environment; } + @Override public boolean isRawSubstitution() { return !isStatic && parameterizedDeclaringClass.isRawSubstitution(); } + @Override public TypeBinding substitute(TypeVariableBinding typeVariable) { // check this variable can be substituted given copied variables if (typeVariable.rank < length && TypeBinding.equalsEquals(originalVariables[typeVariable.rank], typeVariable)) { @@ -209,12 +215,15 @@ // need to substitute old var refs with new ones (double substitution: declaringClass + new type variables) substitution = new Substitution() { + @Override public LookupEnvironment environment() { return environment; } + @Override public boolean isRawSubstitution() { return false; } + @Override public TypeBinding substitute(TypeVariableBinding typeVariable) { // check this variable can be substituted given copied variables if (typeVariable.rank < length && TypeBinding.equalsEquals(originalVariables[typeVariable.rank], typeVariable)) { @@ -327,6 +336,7 @@ /** * Returns true if some parameters got substituted. */ + @Override public boolean hasSubstitutedParameters() { return this.parameters != this.originalMethod.parameters; } @@ -334,6 +344,7 @@ /** * Returns true if the return type got substituted. */ + @Override public boolean hasSubstitutedReturnType() { return this.returnType != this.originalMethod.returnType; //$IDENTITY-COMPARISON$ } @@ -341,11 +352,13 @@ /** * Returns the original method (as opposed to parameterized instances) */ + @Override public MethodBinding original() { return this.originalMethod.original(); } + @Override public MethodBinding shallowOriginal() { return this.originalMethod; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2005, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2005, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -39,6 +42,8 @@ * Bug 435805 - [1.8][compiler][null] Java 8 compiler does not recognize declaration style null annotations * Bug 456508 - Unexpected RHS PolyTypeBinding for: * Bug 390064 - [compiler][resource] Resource leak warning missing when extending parameterized class + * Jesper S Møller - Contributions for bug 381345 : [1.8] Take care of the Java 8 major version + * Bug 527554 - [18.3] Compiler support for JEP 286 Local-Variable Type *******************************************************************************/ package org.eclipse.jdt.internal.compiler.lookup; @@ -76,7 +81,7 @@ public ParameterizedTypeBinding(ReferenceBinding type, TypeBinding[] arguments, ReferenceBinding enclosingType, LookupEnvironment environment){ this.environment = environment; this.enclosingType = enclosingType; // never unresolved, never lazy per construction - if (type.isStatic() && arguments == null && !(this instanceof RawTypeBinding)) + if (!type.hasEnclosingInstanceContext() && arguments == null && !(this instanceof RawTypeBinding)) throw new IllegalStateException(); initialize(type, arguments); if (type instanceof UnresolvedReferenceBinding) @@ -99,10 +104,12 @@ * May return an UnresolvedReferenceBinding. * @see ParameterizedTypeBinding#genericType() */ + @Override public ReferenceBinding actualType() { return this.type; } + @Override public boolean isParameterizedType() { return true; } @@ -131,6 +138,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#canBeInstantiated() */ + @Override public boolean canBeInstantiated() { return ((this.tagBits & TagBits.HasDirectWildcard) == 0) && super.canBeInstantiated(); // cannot instantiate param type with wildcard arguments } @@ -139,6 +147,7 @@ * Perform capture conversion for a parameterized type with wildcard arguments * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#capture(Scope,int, int) */ + @Override public ParameterizedTypeBinding capture(Scope scope, int start, int end) { if ((this.tagBits & TagBits.HasDirectWildcard) == 0) return this; @@ -184,6 +193,7 @@ * Perform capture deconversion for a parameterized type with captured wildcard arguments * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#uncapture(Scope) */ + @Override public TypeBinding uncapture(Scope scope) { if ((this.tagBits & TagBits.HasCapturedWildcard) == 0) return this; @@ -200,6 +210,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#collectMissingTypes(java.util.List) */ + @Override public List collectMissingTypes(List missingTypes) { if ((this.tagBits & TagBits.HasMissingType) != 0) { if (this.enclosingType != null) { @@ -223,6 +234,7 @@ * A = F corresponds to: F.collectSubstitutes(..., A, ..., CONSTRAINT_EQUAL (0)) * A >> F corresponds to: F.collectSubstitutes(..., A, ..., CONSTRAINT_SUPER (2)) */ + @Override public void collectSubstitutes(Scope scope, TypeBinding actualType, InferenceContext inferenceContext, int constraint) { if ((this.tagBits & TagBits.HasTypeVariable) == 0) { TypeBinding actualEquivalent = actualType.findSuperTypeOriginatingFrom(this.type); @@ -325,10 +337,12 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#computeId() */ + @Override public void computeId() { this.id = TypeIds.NoId; } + @Override public char[] computeUniqueKey(boolean isLeaf) { StringBuffer sig = new StringBuffer(10); ReferenceBinding enclosing; @@ -377,10 +391,12 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#constantPoolName() */ + @Override public char[] constantPoolName() { return this.type.constantPoolName(); // erasure } + @Override public TypeBinding clone(TypeBinding outerType) { return new ParameterizedTypeBinding(this.type, this.arguments, (ReferenceBinding) outerType, this.environment); } @@ -391,6 +407,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#debugName() */ + @Override public String debugName() { if (this.hasTypeAnnotations()) return annotatedDebugName(); @@ -411,6 +428,7 @@ return nameBuffer.toString(); } + @Override public String annotatedDebugName() { StringBuffer nameBuffer = new StringBuffer(super.annotatedDebugName()); if (this.arguments != null && this.arguments.length > 0) { @@ -427,6 +445,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#enclosingType() */ + @Override public ReferenceBinding enclosingType() { return this.enclosingType; } @@ -434,6 +453,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.Substitution#environment() */ + @Override public LookupEnvironment environment() { return this.environment; } @@ -441,12 +461,122 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#erasure() */ - public TypeBinding erasure() { + @Override + public TypeBinding erasure() { return this.type.erasure(); // erasure } + /* (non-Javadoc) + * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#upwardsProjection(org.eclipse.jdt.internal.compiler.lookup.Scope, org.eclipse.jdt.internal.compiler.lookup.TypeBinding[]) + */ + @Override + public ReferenceBinding upwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { + TypeBinding[] typeVariables = this.arguments; + if (typeVariables == null) return this; // How would that be possible? + + TypeBinding[] a_i_primes = new TypeBinding[typeVariables.length]; + for (int i = 0, length = typeVariables.length; i < length; i++) { + TypeBinding a_i = typeVariables[i]; + + // If Ai does not mention any restricted type variable, then Ai' = Ai. + int typeVariableKind = a_i.kind(); + if (! a_i.mentionsAny(mentionedTypeVariables, -1)) { + a_i_primes[i] = a_i; + } else if (typeVariableKind != Binding.WILDCARD_TYPE) { + // If Ai is a type that mentions a restricted type variable, then Ai' is a wildcard. + // Let U be the upward projection of Ai. There are three cases: + TypeBinding u = a_i.upwardsProjection(scope, mentionedTypeVariables); + TypeVariableBinding[] g_vars = this.type.typeVariables(); + if (g_vars == null || g_vars.length == 0) return this; // Careful - could be a MissingTypeBinding here + TypeBinding b_i = g_vars[i].upperBound(); + + // If U is not Object, + // and if either + // * the declared bound of the ith parameter of G, Bi, mentions a type parameter of G, or + // * Bi is not a subtype of U, + // then Ai' is an upper-bounded wildcard, ? extends U. + if (u.id != TypeIds.T_JavaLangObject + && (b_i.mentionsAny(typeVariables, -1) || !b_i.isSubtypeOf(u, false))) { + a_i_primes[i] = this.environment().createWildcard(genericType(), i, u, null, Wildcard.EXTENDS); + } else { + TypeBinding l = a_i.downwardsProjection(scope, mentionedTypeVariables); + // Otherwise, if the downward projection of Ai is L, + // then Ai' is a lower-bounded wildcard, ? super L. + if (l != null) { + a_i_primes[i] = this.environment().createWildcard(genericType(), i, l, null, Wildcard.SUPER); + } else { + // Otherwise, the downward projection of Ai is undefined and Ai' is an unbounded wildcard, ?. + a_i_primes[i] = this.environment().createWildcard(genericType(), i, null, null, Wildcard.UNBOUND); + } + } + } else { + WildcardBinding wildcard = (WildcardBinding)a_i; + if (wildcard.boundKind() == Wildcard.EXTENDS) { + // If Ai is an upper-bounded wildcard that mentions a restricted type variable, + // then let U be the upward projection of the wildcard bound. + TypeBinding u = wildcard.bound().upwardsProjection(scope, mentionedTypeVariables); + // Ai' is a wildcard ? extends U. + a_i_primes[i] = this.environment().createWildcard(null, 0, u, null, Wildcard.EXTENDS); + } else if (wildcard.boundKind() == Wildcard.SUPER) { + // If Ai is a lower-bounded wildcard that mentions a restricted type variable, + TypeBinding l = wildcard.bound().downwardsProjection(scope, mentionedTypeVariables); + if (l != null) { + // then if the downward projection of the wildcard bound is L, then Ai' is a wildcard ? super L; + a_i_primes[i] = this.environment().createWildcard(null, 0, l, null, Wildcard.SUPER); + } else { + // if the downward projection of the wildcard bound is undefined, then Ai' is an unbounded wildcard, ?. + a_i_primes[i] = this.environment().createWildcard(null, 0, null, null, Wildcard.UNBOUND); + } + } + } + } + return this.environment.createParameterizedType(this.type, a_i_primes, this.enclosingType); + } + @Override + public ReferenceBinding downwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { + TypeBinding[] typeVariables = this.arguments; + if (typeVariables == null) return this; // How would that be possible? + + TypeBinding[] a_i_primes = new TypeBinding[typeVariables.length]; + for (int i = 0, length = typeVariables.length; i < length; i++) { + TypeBinding a_i = typeVariables[i]; + + // If Ai does not mention any restricted type variable, then Ai' = Ai. + int typeVariableKind = a_i.kind(); + if (! a_i.mentionsAny(mentionedTypeVariables, -1)) { + a_i_primes[i] = a_i; + } else if (typeVariableKind != Binding.WILDCARD_TYPE) { + return null; + } else { + WildcardBinding wildcard = (WildcardBinding)a_i; + if (wildcard.boundKind() == Wildcard.EXTENDS) { + // Ai is an upper-bounded wildcard that mentions a restricted type variable, + TypeBinding u = wildcard.bound().downwardsProjection(scope, mentionedTypeVariables); + // then if the downward projection of the wildcard bound is U, then Ai' is a wildcard ? extends U; + if (u != null) { + // Ai' is a wildcard ? extends U. + a_i_primes[i] = this.environment().createWildcard(null, 0, u, null, Wildcard.EXTENDS); + } else { + // if the downward projection of the wildcard bound is undefined, then Ai' is undefined. + return null; + } + } else if (wildcard.boundKind() == Wildcard.SUPER) { + // If Ai is a lower-bounded wildcard that mentions a restricted type variable, + // then let L be the upward projection of the wildcard bound. + TypeBinding l = wildcard.bound().upwardsProjection(scope, mentionedTypeVariables); + // Ai' is a wildcard ? super L. + a_i_primes[i] = this.environment().createWildcard(null, 0, l, null, Wildcard.SUPER); + } else { + return null; + } + } + } + return this.environment.createParameterizedType(this.type, a_i_primes, this.enclosingType); + } + /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#fieldCount() */ + @Override public int fieldCount() { return this.type.fieldCount(); // same as erasure (lazy) } @@ -454,6 +584,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#fields() */ + @Override public FieldBinding[] fields() { if ((this.tagBits & TagBits.AreFieldsComplete) != 0) return this.fields; @@ -490,6 +621,7 @@ * Ltype; * LY; */ + @Override public char[] genericTypeSignature() { if (this.genericTypeSignature == null) { if ((this.modifiers & ExtraCompilerModifiers.AccGenericSignature) == 0) { @@ -529,10 +661,12 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#getAnnotationTagBits() */ + @Override public long getAnnotationTagBits() { return this.type.getAnnotationTagBits(); } + @Override public int getEnclosingInstancesSlotSize() { return genericType().getEnclosingInstancesSlotSize(); } @@ -540,6 +674,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#getExactConstructor(TypeBinding[]) */ + @Override public MethodBinding getExactConstructor(TypeBinding[] argumentTypes) { int argCount = argumentTypes.length; MethodBinding match = null; @@ -579,6 +714,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#getExactMethod(char[], TypeBinding[],CompilationUnitScope) */ + @Override public MethodBinding getExactMethod(char[] selector, TypeBinding[] argumentTypes, CompilationUnitScope refScope) { // sender from refScope calls recordTypeReference(this) int argCount = argumentTypes.length; @@ -643,6 +779,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#getField(char[], boolean) */ + @Override public FieldBinding getField(char[] fieldName, boolean needResolve) { fields(); // ensure fields have been initialized... must create all at once unlike methods return ReferenceBinding.binarySearch(fieldName, this.fields); @@ -651,6 +788,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#getMemberType(char[]) */ + @Override public ReferenceBinding getMemberType(char[] typeName) { memberTypes(); // ensure memberTypes have been initialized... must create all at once unlike methods int typeLength = typeName.length; @@ -665,6 +803,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#getMethods(char[]) */ + @Override public MethodBinding[] getMethods(char[] selector) { if (this.methods != null) { long range; @@ -717,14 +856,17 @@ } } + @Override public int getOuterLocalVariablesSlotSize() { return genericType().getOuterLocalVariablesSlotSize(); } + @Override public boolean hasMemberTypes() { return this.type.hasMemberTypes(); } + @Override public boolean hasTypeBit(int bit) { TypeBinding erasure = erasure(); if (erasure instanceof ReferenceBinding) @@ -735,6 +877,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#implementsMethod(MethodBinding) */ + @Override public boolean implementsMethod(MethodBinding method) { return this.type.implementsMethod(method); // erasure } @@ -780,8 +923,7 @@ } } this.tagBits |= someType.tagBits & (TagBits.IsLocalType| TagBits.IsMemberType | TagBits.IsNestedType | TagBits.ContainsNestedTypeReferences - | TagBits.HasMissingType | TagBits.AnnotationNullMASK - | TagBits.AnnotationNonNullByDefault | TagBits.AnnotationNullUnspecifiedByDefault | TagBits.HasCapturedWildcard); + | TagBits.HasMissingType | TagBits.AnnotationNullMASK | TagBits.HasCapturedWildcard); this.tagBits &= ~(TagBits.AreFieldsComplete|TagBits.AreMethodsComplete); } @@ -789,17 +931,17 @@ // do nothing for true parameterized types (only for raw types) } + @Override void initializeForStaticImports() { this.type.initializeForStaticImports(); } - /** - * Returns true if parameterized type AND not of the form List - */ + @Override public boolean isBoundParameterizedType() { return (this.tagBits & TagBits.IsBoundParameterizedType) != 0; } + @Override public boolean isEquivalentTo(TypeBinding otherType) { if (equalsEquals(this, otherType)) return true; @@ -857,10 +999,12 @@ return false; } + @Override public boolean isHierarchyConnected() { return this.superclass != null && this.superInterfaces != null; } + @Override public boolean isProperType(boolean admitCapture18) { if (this.arguments != null) { for (int i = 0; i < this.arguments.length; i++) @@ -870,6 +1014,7 @@ return super.isProperType(admitCapture18); } + @Override TypeBinding substituteInferenceVariable(InferenceVariable var, TypeBinding substituteType) { if (this.arguments != null) { TypeBinding[] newArgs = null; @@ -892,10 +1037,12 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.Substitution#isRawSubstitution() */ + @Override public boolean isRawSubstitution() { return isRawType(); } + @Override public TypeBinding unannotated() { return this.hasTypeAnnotations() ? this.environment.getUnannotatedType(this) : this; } @@ -909,6 +1056,7 @@ return this.environment.createParameterizedType(unannotatedGenericType, this.arguments, this.enclosingType, newAnnotations); } + @Override public int kind() { return PARAMETERIZED_TYPE; } @@ -916,6 +1064,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#memberTypes() */ + @Override public ReferenceBinding[] memberTypes() { if (this.memberTypes == null) { try { @@ -939,6 +1088,7 @@ return this.memberTypes; } + @Override public boolean mentionsAny(TypeBinding[] parameters, int idx) { if (super.mentionsAny(parameters, idx)) return true; @@ -952,6 +1102,7 @@ return false; } + @Override void collectInferenceVariables(Set variables) { if (this.arguments != null) { int len = this.arguments.length; @@ -965,6 +1116,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#methods() */ + @Override public MethodBinding[] methods() { if ((this.tagBits & TagBits.AreMethodsComplete) != 0) return this.methods; @@ -996,12 +1148,14 @@ * * @see org.eclipse.jdt.internal.compiler.lookup.Binding#problemId() */ + @Override public int problemId() { return this.type.problemId(); } /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#qualifiedPackageName() */ + @Override public char[] qualifiedPackageName() { return this.type.qualifiedPackageName(); } @@ -1009,6 +1163,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#qualifiedSourceName() */ + @Override public char[] qualifiedSourceName() { return this.type.qualifiedSourceName(); } @@ -1016,9 +1171,11 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.Binding#readableName() */ + @Override public char[] readableName() { return readableName(true); } + @Override public char[] readableName(boolean showGenerics) { StringBuffer nameBuffer = new StringBuffer(10); if (isMemberType()) { @@ -1092,9 +1249,11 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.Binding#shortReadableName() */ + @Override public char[] shortReadableName() { return shortReadableName(true); } + @Override public char[] shortReadableName(boolean showGenerics) { StringBuffer nameBuffer = new StringBuffer(10); if (isMemberType()) { @@ -1121,12 +1280,14 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#nullAnnotatedReadableName(CompilerOptions,boolean) */ + @Override public char[] nullAnnotatedReadableName(CompilerOptions options, boolean shortNames) { if (shortNames) return nullAnnotatedShortReadableName(options); return nullAnnotatedReadableName(options); } + @Override char[] nullAnnotatedReadableName(CompilerOptions options) { StringBuffer nameBuffer = new StringBuffer(10); if (isMemberType()) { @@ -1165,6 +1326,7 @@ return readableName; } + @Override char[] nullAnnotatedShortReadableName(CompilerOptions options) { StringBuffer nameBuffer = new StringBuffer(10); if (isMemberType()) { @@ -1197,6 +1359,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#signature() */ + @Override public char[] signature() { if (this.signature == null) { this.signature = this.type.signature(); // erasure @@ -1207,6 +1370,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#sourceName() */ + @Override public char[] sourceName() { return this.type.sourceName(); } @@ -1214,6 +1378,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.Substitution#substitute(org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding) */ + @Override public TypeBinding substitute(TypeVariableBinding originalVariable) { ParameterizedTypeBinding currentType = this; @@ -1246,6 +1411,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#superclass() */ + @Override public ReferenceBinding superclass() { if (this.superclass == null) { // note: Object cannot be generic @@ -1262,6 +1428,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#superInterfaces() */ + @Override public ReferenceBinding[] superInterfaces() { if (this.superInterfaces == null) { if (this.type.isHierarchyBeingConnected()) @@ -1278,6 +1445,7 @@ return this.superInterfaces; } + @Override public void swapUnresolved(UnresolvedReferenceBinding unresolvedType, ReferenceBinding resolvedType, LookupEnvironment env) { boolean update = false; if (this.type == unresolvedType) { //$IDENTITY-COMPARISON$ @@ -1303,6 +1471,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#syntheticEnclosingInstanceTypes() */ + @Override public ReferenceBinding[] syntheticEnclosingInstanceTypes() { return genericType().syntheticEnclosingInstanceTypes(); } @@ -1310,6 +1479,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#syntheticOuterLocalVariables() */ + @Override public SyntheticArgumentBinding[] syntheticOuterLocalVariables() { return genericType().syntheticOuterLocalVariables(); } @@ -1317,6 +1487,7 @@ /** * @see java.lang.Object#toString() */ + @Override public String toString() { if (this.hasTypeAnnotations()) { return annotatedDebugName(); @@ -1396,6 +1567,7 @@ } + @Override public TypeVariableBinding[] typeVariables() { if (this.arguments == null) { // retain original type variables if not substituted (member type of parameterized type) @@ -1404,10 +1576,12 @@ return Binding.NO_TYPE_VARIABLES; } + @Override public TypeBinding[] typeArguments() { return this.arguments; } + @Override public FieldBinding[] unResolvedFields() { return this.fields; } @@ -1432,6 +1606,7 @@ } return super.getInterfaceAbstractContracts(scope, replaceWildcards, filterDefaultMethods); } + @Override public MethodBinding getSingleAbstractMethod(final Scope scope, boolean replaceWildcards) { return getSingleAbstractMethod(scope, replaceWildcards, -1, -1 /* do not capture */); } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterNonNullDefaultProvider.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterNonNullDefaultProvider.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterNonNullDefaultProvider.java 1970-01-01 00:00:00.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterNonNullDefaultProvider.java 2018-12-06 10:38:58.000000000 +0000 @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2018 Till Brychcy and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Till Brychcy - initial API and implementation + *******************************************************************************/ + +package org.eclipse.jdt.internal.compiler.lookup; + +interface ParameterNonNullDefaultProvider { + public boolean hasAnyNonNullDefault(); + public boolean hasNonNullDefaultForParam(int i); + + public static final ParameterNonNullDefaultProvider FALSE_PROVIDER = new ParameterNonNullDefaultProvider() { + @Override + public boolean hasNonNullDefaultForParam(int i) { + return false; + } + + @Override + public boolean hasAnyNonNullDefault() { + return false; + } + }; + public static final ParameterNonNullDefaultProvider TRUE_PROVIDER = new ParameterNonNullDefaultProvider() { + @Override + public boolean hasNonNullDefaultForParam(int i) { + return true; + } + + @Override + public boolean hasAnyNonNullDefault() { + return true; + } + }; + public static class MixedProvider implements ParameterNonNullDefaultProvider { + private final boolean[] result; + + public MixedProvider(boolean[] result) { + this.result = result; + } + + @Override + public boolean hasNonNullDefaultForParam(int i) { + return this.result[i]; + } + + @Override + public boolean hasAnyNonNullDefault() { + return true; + } + } +} \ No newline at end of file diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PolymorphicMethodBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PolymorphicMethodBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PolymorphicMethodBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PolymorphicMethodBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2011 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -41,10 +44,12 @@ this.tagBits = polymorphicMethod.tagBits; } + @Override public MethodBinding original() { return this.polymorphicMethod; } + @Override public boolean isPolymorphic() { return true; } @@ -77,6 +82,7 @@ /* * Even if polymorphic methods are varargs method, we don't want them to be treated as varargs method */ + @Override public boolean isVarargs() { return false; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PolyParameterizedGenericMethodBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PolyParameterizedGenericMethodBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PolyParameterizedGenericMethodBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PolyParameterizedGenericMethodBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2014, 2015 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -14,10 +17,11 @@ private ParameterizedGenericMethodBinding wrappedBinding; public PolyParameterizedGenericMethodBinding(ParameterizedGenericMethodBinding applicableMethod) { - super(applicableMethod.originalMethod, applicableMethod.typeArguments, applicableMethod.environment, applicableMethod.inferredWithUncheckedConversion, false); + super(applicableMethod.originalMethod, applicableMethod.typeArguments, applicableMethod.environment, applicableMethod.inferredWithUncheckedConversion, false, applicableMethod.targetType); this.wrappedBinding = applicableMethod; } + @Override public boolean equals(Object other) { if (other instanceof PolyParameterizedGenericMethodBinding) { PolyParameterizedGenericMethodBinding ppgmb = (PolyParameterizedGenericMethodBinding)other; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PolyTypeBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PolyTypeBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PolyTypeBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PolyTypeBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2013, 2014 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -25,14 +28,17 @@ this.expression = expression; } + @Override public char[] constantPoolName() { throw new UnsupportedOperationException(); // should never reach code generation } + @Override public PackageBinding getPackage() { throw new UnsupportedOperationException(); // nobody should be asking this question. } + @Override public boolean isCompatibleWith(TypeBinding left, Scope scope) { return this.vanillaCompatibilty ? this.expression.isCompatibleWith(left, scope) : this.expression.isBoxingCompatibleWith(left, scope); } @@ -52,32 +58,39 @@ return this.expression.isFunctionalType(); } + @Override public char[] qualifiedSourceName() { return readableName(); } + @Override public char[] sourceName() { return readableName(); } + @Override public char[] readableName() { return this.expression.printExpression(0, new StringBuffer()).toString().toCharArray(); } + @Override public char[] shortReadableName() { return this.expression instanceof LambdaExpression ? ((LambdaExpression) this.expression).printExpression(0, new StringBuffer(), true).toString().toCharArray() : readableName(); } + @Override public boolean sIsMoreSpecific(TypeBinding s, TypeBinding t, Scope scope) { return this.expression.sIsMoreSpecific(s, t, scope); } + @Override public String toString() { StringBuffer buffer = new StringBuffer("PolyTypeBinding for: "); //$NON-NLS-1$ return this.expression.printExpression(0, buffer).toString(); } + @Override public int kind() { return Binding.POLY_TYPE; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -38,6 +41,7 @@ * Answer the receiver's binding type from Binding.BindingID. */ +@Override public final int kind() { return VARIABLE | TYPE; } @@ -46,9 +50,11 @@ * NoError if the receiver is a valid binding. */ +@Override public final int problemId() { return this.problemId; } +@Override public char[] readableName() { return this.name; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemFieldBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemFieldBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemFieldBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemFieldBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -30,6 +33,7 @@ * NoError if the receiver is a valid binding. */ +@Override public final int problemId() { return this.problemId; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -38,7 +41,7 @@ if (closestMatch != null && problemReason != ProblemReasons.Ambiguous) { this.declaringClass = closestMatch.declaringClass; this.returnType = closestMatch.returnType; - if (problemReason == ProblemReasons.InvocationTypeInferenceFailure) { + if (problemReason == ProblemReasons.InvocationTypeInferenceFailure || problemReason == ProblemReasons.ContradictoryNullAnnotations) { this.thrownExceptions = closestMatch.thrownExceptions; this.typeVariables = closestMatch.typeVariables; this.modifiers = closestMatch.modifiers; @@ -84,6 +87,7 @@ * Answer the problem id associated with the receiver. * NoError if the receiver is a valid binding. */ +@Override public final int problemId() { return this.problemReason; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemPackageBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemPackageBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemPackageBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemPackageBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -26,6 +29,7 @@ * NoError if the receiver is a valid binding. */ +@Override public final int problemId() { return this.problemId; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2014 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -28,12 +31,14 @@ this.problemReason = problemReason; } +@Override public TypeBinding clone(TypeBinding enclosingType) { throw new IllegalStateException(); // shouldn't get here. } /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#closestMatch() */ +@Override public TypeBinding closestMatch() { return this.closestMatch; } @@ -45,6 +50,7 @@ return this.closestMatch; } +@Override public boolean hasTypeBit(int bit) { if (this.closestMatch != null) return this.closestMatch.hasTypeBit(bit); @@ -55,6 +61,7 @@ * Answer the problem id associated with the receiver. * NoError if the receiver is a valid binding. */ +@Override public int problemId() { return this.problemReason; } @@ -81,20 +88,24 @@ return "unknown"; //$NON-NLS-1$ } +@Override public void setTypeAnnotations(AnnotationBinding[] annotations, boolean evalNullAnnotations) { return; // reject misguided attempts. } /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#shortReadableName() */ +@Override public char[] shortReadableName() { return readableName(); } +@Override public char[] sourceName() { return this.compoundName.length == 0 ? null : this.compoundName[this.compoundName.length - 1]; // last segment of [java][util][Map$Entry] } +@Override public String toString() { StringBuffer buffer = new StringBuffer(10); buffer.append("ProblemType:[compoundName="); //$NON-NLS-1$ diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -57,15 +60,16 @@ } } } - if (enclosingType == null || (enclosingType.modifiers & ExtraCompilerModifiers.AccGenericSignature) == 0) { + if (enclosingType == null || !this.hasEnclosingInstanceContext() || (enclosingType.modifiers & ExtraCompilerModifiers.AccGenericSignature) == 0) { this.modifiers &= ~ExtraCompilerModifiers.AccGenericSignature; // only need signature if enclosing needs one } } + @Override public char[] computeUniqueKey(boolean isLeaf) { StringBuffer sig = new StringBuffer(10); if (isMemberType() && (enclosingType().isParameterizedType() || enclosingType().isRawType())) { - if (isStatic()) { + if (!hasEnclosingInstanceContext()) { char[] typeSig = enclosingType().signature(); // don't consider generics from enclosing of static member sig.append(typeSig, 0, typeSig.length-1); // copy all but trailing semicolon sig.append('$'); // for consistency with keys prior to https://bugs.eclipse.org/460491 @@ -89,6 +93,7 @@ return uniqueKey; } + @Override public TypeBinding clone(TypeBinding outerType) { return new RawTypeBinding(this.actualType(), (ReferenceBinding) outerType, this.environment); } @@ -105,6 +110,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding#createParameterizedMethod(org.eclipse.jdt.internal.compiler.lookup.MethodBinding) */ + @Override public ParameterizedMethodBinding createParameterizedMethod(MethodBinding originalMethod) { if (originalMethod.typeVariables == Binding.NO_TYPE_VARIABLES || originalMethod.isStatic()) { return super.createParameterizedMethod(originalMethod); @@ -112,10 +118,12 @@ return this.environment.createParameterizedGenericMethod(originalMethod, this); } + @Override public boolean isParameterizedType() { return false; } + @Override public int kind() { return RAW_TYPE; } @@ -123,6 +131,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#debugName() */ + @Override public String debugName() { if (this.hasTypeAnnotations()) return annotatedDebugName(); @@ -130,6 +139,7 @@ nameBuffer.append(actualType().sourceName()).append("#RAW"); //$NON-NLS-1$ return nameBuffer.toString(); } + @Override public String annotatedDebugName() { StringBuffer buffer = new StringBuffer(super.annotatedDebugName()); buffer.append("#RAW"); //$NON-NLS-1$ @@ -139,13 +149,14 @@ * Ltype; * LY; */ + @Override public char[] genericTypeSignature() { if (this.genericTypeSignature == null) { if ((this.modifiers & ExtraCompilerModifiers.AccGenericSignature) == 0) { this.genericTypeSignature = genericType().signature(); } else { StringBuffer sig = new StringBuffer(10); - if (isMemberType()) { + if (isMemberType() && hasEnclosingInstanceContext()) { ReferenceBinding enclosing = enclosingType(); char[] typeSig = enclosing.genericTypeSignature(); sig.append(typeSig, 0, typeSig.length-1);// copy all but trailing semicolon @@ -168,7 +179,8 @@ return this.genericTypeSignature; } - public boolean isEquivalentTo(TypeBinding otherType) { + @Override + public boolean isEquivalentTo(TypeBinding otherType) { if (equalsEquals(this, otherType) || equalsEquals(erasure(), otherType)) return true; if (otherType == null) @@ -187,7 +199,8 @@ return false; } - public boolean isProvablyDistinct(TypeBinding otherType) { + @Override + public boolean isProvablyDistinct(TypeBinding otherType) { if (TypeBinding.equalsEquals(this, otherType) || TypeBinding.equalsEquals(erasure(), otherType)) // https://bugs.eclipse.org/bugs/show_bug.cgi?id=329588 return false; if (otherType == null) @@ -201,12 +214,21 @@ } return true; } + @Override + public boolean isSubtypeOf(TypeBinding right, boolean simulatingBugJDK8026527) { + if (simulatingBugJDK8026527) { + right = this.environment.convertToRawType(right.erasure(), false); + } + return super.isSubtypeOf(right, simulatingBugJDK8026527); + } - public boolean isProperType(boolean admitCapture18) { + @Override + public boolean isProperType(boolean admitCapture18) { TypeBinding actualType = actualType(); return actualType != null && actualType.isProperType(admitCapture18); } + @Override protected void initializeArguments() { TypeVariableBinding[] typeVariables = genericType().typeVariables(); int length = typeVariables.length; @@ -234,6 +256,7 @@ return this; } + @Override public MethodBinding getSingleAbstractMethod(Scope scope, boolean replaceWildcards) { int index = replaceWildcards ? 0 : 1; if (this.singleAbstractMethod != null) { @@ -258,16 +281,18 @@ } return this.singleAbstractMethod[index]; } + @Override public boolean mentionsAny(TypeBinding[] parameters, int idx) { return false; } /** * @see org.eclipse.jdt.internal.compiler.lookup.Binding#readableName() */ + @Override public char[] readableName(boolean showGenerics) /*java.lang.Object, p.X */ { char[] readableName; if (isMemberType()) { - readableName = CharOperation.concat(enclosingType().readableName(showGenerics && !isStatic()), this.sourceName, '.'); + readableName = CharOperation.concat(enclosingType().readableName(showGenerics && hasEnclosingInstanceContext()), this.sourceName, '.'); } else { readableName = CharOperation.concatWith(actualType().compoundName, '.'); } @@ -277,17 +302,29 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.Binding#shortReadableName() */ + @Override public char[] shortReadableName(boolean showGenerics) /*Object*/ { char[] shortReadableName; if (isMemberType()) { - shortReadableName = CharOperation.concat(enclosingType().shortReadableName(showGenerics && !isStatic()), this.sourceName, '.'); + shortReadableName = CharOperation.concat(enclosingType().shortReadableName(showGenerics && hasEnclosingInstanceContext()), this.sourceName, '.'); } else { shortReadableName = actualType().sourceName; } return shortReadableName; } + @Override void collectInferenceVariables(Set variables) { // nothing to collect for a raw type. } + + @Override + public ReferenceBinding upwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { + return this; + } + + @Override + public ReferenceBinding downwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { + return this; + } } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReductionResult.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReductionResult.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReductionResult.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReductionResult.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2013 GK Software AG. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - initial API and implementation @@ -18,12 +21,16 @@ protected static final ConstraintTypeFormula TRUE = new ConstraintTypeFormula() { /* empty body just to make abstract class instantiable */ + @Override public Object reduce(InferenceContext18 context) { return this; } + @Override public String toString() { return "TRUE"; } //$NON-NLS-1$ }; protected static final ConstraintTypeFormula FALSE = new ConstraintTypeFormula() { /* empty body just to make abstract class instantiable */ + @Override public Object reduce(InferenceContext18 context) { return this; } + @Override public String toString() { return "FALSE"; } //$NON-NLS-1$ }; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -39,6 +42,7 @@ * Jesper S Moller - Contributions for * bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression * bug 412153 - [1.8][compiler] Check validity of annotations which may be repeatable + * bug 527554 - [18.3] Compiler support for JEP 286 Local-Variable Type * Ulrich Grave - Contributions for * bug 386692 - Missing "unused" warning on "autowired" fields *******************************************************************************/ @@ -85,10 +89,12 @@ public static final ReferenceBinding LUB_GENERIC = new ReferenceBinding() { /* used for lub computation */ { this.id = TypeIds.T_undefined; } + @Override public boolean hasTypeBit(int bit) { return false; } }; private static final Comparator FIELD_COMPARATOR = new Comparator() { + @Override public int compare(FieldBinding o1, FieldBinding o2) { char[] n1 = o1.name; char[] n2 = o2.name; @@ -96,6 +102,7 @@ } }; private static final Comparator METHOD_COMPARATOR = new Comparator() { + @Override public int compare(MethodBinding o1, MethodBinding o2) { MethodBinding m1 = o1; MethodBinding m2 = o2; @@ -242,6 +249,7 @@ /** * Answer true if the receiver can be instantiated */ +@Override public boolean canBeInstantiated() { return (this.modifiers & (ClassFileConstants.AccAbstract | ClassFileConstants.AccInterface | ClassFileConstants.AccEnum | ClassFileConstants.AccAnnotation)) == 0; } @@ -345,6 +353,7 @@ /** * Answer true if the receiver is visible to the type provided by the scope. */ +@Override public boolean canBeSeenBy(Scope scope) { if (isPublic()) return true; @@ -400,7 +409,7 @@ public char[] computeGenericTypeSignature(TypeVariableBinding[] typeVariables) { - boolean isMemberOfGeneric = isMemberType() && !isStatic() && (enclosingType().modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0; + boolean isMemberOfGeneric = isMemberType() && hasEnclosingInstanceContext() && (enclosingType().modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0; if (typeVariables == Binding.NO_TYPE_VARIABLES && !isMemberOfGeneric) { return signature(); } @@ -902,6 +911,7 @@ /** * p.X {} -> Lp/X; */ +@Override public char[] computeUniqueKey(boolean isLeaf) { if (!isLeaf) return signature(); return genericTypeSignature(); @@ -912,15 +922,18 @@ * * NOTE: This method should only be used during/after code gen. */ +@Override public char[] constantPoolName() /* java/lang/Object */ { if (this.constantPoolName != null) return this.constantPoolName; return this.constantPoolName = CharOperation.concatWith(this.compoundName, '/'); } +@Override public String debugName() { return (this.compoundName != null) ? this.hasTypeAnnotations() ? annotatedDebugName() : new String(readableName()) : "UNNAMED TYPE"; //$NON-NLS-1$ } +@Override public int depth() { int depth = 0; ReferenceBinding current = this; @@ -988,6 +1001,7 @@ /** * @return the JSR 175 annotations for this type. */ +@Override public AnnotationBinding[] getAnnotations() { return retrieveAnnotations(this); } @@ -995,6 +1009,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.Binding#getAnnotationTagBits() */ +@Override public long getAnnotationTagBits() { return this.tagBits; } @@ -1032,6 +1047,7 @@ return null; } +@Override public MethodBinding[] getMethods(char[] selector) { return Binding.NO_METHODS; } @@ -1049,6 +1065,7 @@ return 0; } +@Override public PackageBinding getPackage() { return this.fPackage; } @@ -1061,6 +1078,7 @@ return null; } +@Override public int hashCode() { // ensure ReferenceBindings hash to the same position as UnresolvedReferenceBindings so they can be replaced without rehashing // ALL ReferenceBindings are unique when created so equals() is the same as == @@ -1137,33 +1155,24 @@ * for 1.8 check if the default is applicable to the given kind of location. */ // pre: null annotation analysis is enabled -boolean hasNonNullDefaultFor(int location, boolean useTypeAnnotations, int sourceStart) { +boolean hasNonNullDefaultFor(int location, int sourceStart) { // Note, STB overrides for correctly handling local types ReferenceBinding currentType = this; while (currentType != null) { - if (useTypeAnnotations) { - int nullDefault = ((ReferenceBinding)currentType.original()).getNullDefault(); - if (nullDefault != 0) - return (nullDefault & location) != 0; - } else { - if ((currentType.tagBits & TagBits.AnnotationNonNullByDefault) != 0) - return true; - if ((currentType.tagBits & TagBits.AnnotationNullUnspecifiedByDefault) != 0) - return false; - } + int nullDefault = ((ReferenceBinding)currentType.original()).getNullDefault(); + if (nullDefault != 0) + return (nullDefault & location) != 0; currentType = currentType.enclosingType(); } // package - if (useTypeAnnotations) - return (this.getPackage().defaultNullness & location) != 0; - else - return this.getPackage().defaultNullness == NONNULL_BY_DEFAULT; + return (this.getPackage().getDefaultNullness() & location) != 0; } int getNullDefault() { return 0; } +@Override public boolean acceptsNonNullDefault() { return true; } @@ -1256,6 +1265,7 @@ return (this.modifiers & ClassFileConstants.AccAbstract) != 0; } +@Override public boolean isAnnotationType() { return (this.modifiers & ClassFileConstants.AccAnnotation) != 0; } @@ -1264,10 +1274,29 @@ return (this.tagBits & TagBits.IsBinaryBinding) != 0; } +@Override public boolean isClass() { return (this.modifiers & (ClassFileConstants.AccInterface | ClassFileConstants.AccAnnotation | ClassFileConstants.AccEnum)) == 0; } +private static SourceTypeBinding getSourceTypeBinding(ReferenceBinding ref) { + if (ref instanceof SourceTypeBinding) + return (SourceTypeBinding) ref; + if (ref instanceof ParameterizedTypeBinding) { + ParameterizedTypeBinding ptb = (ParameterizedTypeBinding) ref; + return ptb.type instanceof SourceTypeBinding ? (SourceTypeBinding) ptb.type : null; + } + return null; +} +public boolean isNestmateOf(ReferenceBinding other) { + SourceTypeBinding s1 = getSourceTypeBinding(this); + SourceTypeBinding s2 = getSourceTypeBinding(other); + if (s1 == null || s2 == null) return false; + + return s1.isNestmateOf(s2); +} + +@Override public boolean isProperType(boolean admitCapture18) { ReferenceBinding outer = enclosingType(); if (outer != null && !outer.isProperType(admitCapture18)) @@ -1280,6 +1309,7 @@ * In addition to improving performance, caching also ensures there is no infinite regression * since per nature, the compatibility check is recursive through parameterized type arguments (122775) */ +@Override public boolean isCompatibleWith(TypeBinding otherType, /*@Nullable*/ Scope captureScope) { if (equalsEquals(otherType, this)) return true; @@ -1356,6 +1386,7 @@ case Binding.TYPE : case Binding.PARAMETERIZED_TYPE : case Binding.RAW_TYPE : + case Binding.INTERSECTION_TYPE18 : switch (kind()) { case Binding.GENERIC_TYPE : case Binding.PARAMETERIZED_TYPE : @@ -1365,6 +1396,14 @@ // above if same erasure } ReferenceBinding otherReferenceType = (ReferenceBinding) otherType; + if (otherReferenceType.isIntersectionType18()) { + ReferenceBinding[] intersectingTypes = ((IntersectionTypeBinding18)otherReferenceType).intersectingTypes; + for (ReferenceBinding binding : intersectingTypes) { + if (!isCompatibleWith(binding)) + return false; + } + return true; + } if (otherReferenceType.isInterface()) { // could be annotation type if (implementsInterface(otherReferenceType, true)) return true; @@ -1385,7 +1424,8 @@ } } -public boolean isSubtypeOf(TypeBinding other) { +@Override +public boolean isSubtypeOf(TypeBinding other, boolean simulatingBugJDK8026527) { if (isSubTypeOfRTL(other)) return true; // TODO: if this has wildcards, perform capture before the next call: @@ -1418,13 +1458,13 @@ if (other instanceof CaptureBinding) { // for this one kind we must first unwrap the rhs: TypeBinding lower = ((CaptureBinding) other).lowerBound; - return (lower != null && isSubtypeOf(lower)); + return (lower != null && isSubtypeOf(lower, false)); } if (other instanceof ReferenceBinding) { TypeBinding[] intersecting = ((ReferenceBinding) other).getIntersectingTypes(); if (intersecting != null) { for (int i = 0; i < intersecting.length; i++) { - if (!isSubtypeOf(intersecting[i])) + if (!isSubtypeOf(intersecting[i], false)) return false; } return true; @@ -1447,6 +1487,7 @@ return (this.modifiers & ClassFileConstants.AccDeprecated) != 0; } +@Override public boolean isEnum() { return (this.modifiers & ClassFileConstants.AccEnum) != 0; } @@ -1479,11 +1520,13 @@ return true; } +@Override public boolean isInterface() { // consider strict interfaces and annotation types return (this.modifiers & ClassFileConstants.AccInterface) != 0; } +@Override public boolean isFunctionalInterface(Scope scope) { MethodBinding method; return isInterface() && (method = getSingleAbstractMethod(scope, true)) != null && method.isValidBinding(); @@ -1527,6 +1570,7 @@ /** * Answer true if the receiver is a static member type (or toplevel) */ +@Override public final boolean isStatic() { return (this.modifiers & (ClassFileConstants.AccStatic | ClassFileConstants.AccInterface)) != 0 || (this.tagBits & TagBits.IsNestedType) == 0; } @@ -1552,6 +1596,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#isThrowable() */ +@Override public boolean isThrowable() { ReferenceBinding current = this; do { @@ -1574,6 +1619,7 @@ * type (i.e. Throwable or Exception). * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#isUncheckedException(boolean) */ +@Override public boolean isUncheckedException(boolean includeSupertype) { switch (this.id) { case TypeIds.T_JavaLangError : @@ -1639,6 +1685,7 @@ * In the case of member types, as the qualified name from its top level type. * For example, for a member type N defined inside M & A: "A.M.N". */ +@Override public char[] qualifiedSourceName() { if (isMemberType()) return CharOperation.concat(enclosingType().qualifiedSourceName(), sourceName(), '.'); @@ -1650,13 +1697,14 @@ * * NOTE: This method should only be used during/after code gen. */ +@Override public char[] readableName() /*java.lang.Object, p.X */ { return readableName(true); } public char[] readableName(boolean showGenerics) /*java.lang.Object, p.X */ { char[] readableName; if (isMemberType()) { - readableName = CharOperation.concat(enclosingType().readableName(showGenerics && !isStatic()), this.sourceName, '.'); + readableName = CharOperation.concat(enclosingType().readableName(showGenerics && hasEnclosingInstanceContext()), this.sourceName, '.'); } else { readableName = CharOperation.concatWith(this.compoundName, '.'); } @@ -1711,6 +1759,7 @@ return holder == null ? Binding.NO_ANNOTATIONS : holder.getAnnotations(); } +@Override public void setAnnotations(AnnotationBinding[] annotations, boolean forceStore) { storeAnnotations(this, annotations, forceStore); } @@ -1724,6 +1773,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#nullAnnotatedReadableName(CompilerOptions,boolean) */ +@Override public char[] nullAnnotatedReadableName(CompilerOptions options, boolean shortNames) { if (shortNames) return nullAnnotatedShortReadableName(options); @@ -1798,13 +1848,14 @@ return shortReadableName; } +@Override public char[] shortReadableName() /*Object*/ { return shortReadableName(true); } public char[] shortReadableName(boolean showGenerics) /*Object*/ { char[] shortReadableName; if (isMemberType()) { - shortReadableName = CharOperation.concat(enclosingType().shortReadableName(showGenerics && !isStatic()), this.sourceName, '.'); + shortReadableName = CharOperation.concat(enclosingType().shortReadableName(showGenerics && hasEnclosingInstanceContext()), this.sourceName, '.'); } else { shortReadableName = this.sourceName; } @@ -1826,6 +1877,7 @@ return shortReadableName; } +@Override public char[] signature() /* Ljava/lang/Object; */ { if (this.signature != null) return this.signature; @@ -1833,10 +1885,33 @@ return this.signature = CharOperation.concat('L', constantPoolName(), ';'); } +@Override public char[] sourceName() { return this.sourceName; } +/** + * Perform an upwards type projection as per JLS 4.10.5 + * @param scope Relevant scope for evaluating type projection + * @param mentionedTypeVariables Filter for mentioned type variabled + * @returns Upwards type projection of 'this', or null if downwards projection is undefined +*/ +@Override +public ReferenceBinding upwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { + return this; +} + +/** + * Perform a downwards type projection as per JLS 4.10.5 + * @param scope Relevant scope for evaluating type projection + * @param mentionedTypeVariables Filter for mentioned type variabled + * @returns Downwards type projection of 'this', or null if downwards projection is undefined +*/ +@Override +public ReferenceBinding downwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { + return this; +} + void storeAnnotationHolder(Binding binding, AnnotationHolder holder) { if (holder == null) { SimpleLookupTable store = storedAnnotations(false, false); @@ -1870,10 +1945,12 @@ return null; // overrride if interested in storing annotations for the receiver, its fields and methods } +@Override public ReferenceBinding superclass() { return null; } +@Override public ReferenceBinding[] superInterfaces() { return Binding.NO_SUPERINTERFACES; } @@ -1948,8 +2025,12 @@ protected int applyCloseableInterfaceWhitelists() { switch (this.compoundName.length) { case 4: - if (CharOperation.equals(this.compoundName, TypeConstants.RESOURCE_FREE_CLOSEABLE_STREAM)) - return TypeIds.BitResourceFreeCloseable; + for (int i=0; i<2; i++) + if (!CharOperation.equals(this.compoundName[i], TypeConstants.JAVA_UTIL_STREAM[i])) + return 0; + for (char[] streamName : TypeConstants.RESOURCE_FREE_CLOSEABLE_J_U_STREAMS) + if (CharOperation.equals(this.compoundName[3], streamName)) + return TypeIds.BitResourceFreeCloseable; break; } return 0; @@ -2042,6 +2123,7 @@ } return contracts; } +@Override public MethodBinding getSingleAbstractMethod(Scope scope, boolean replaceWildcards) { int index = replaceWildcards ? 0 : 1; @@ -2196,9 +2278,9 @@ // when invoked during type inference we only want to check inconsistency among real types: if (current.isTypeVariable() || current.isWildcard() || !current.isProperType(true)) continue; - if (mostSpecific.isSubtypeOf(current)) + if (mostSpecific.isSubtypeOf(current, false)) continue; - else if (current.isSubtypeOf(mostSpecific)) + else if (current.isSubtypeOf(mostSpecific, false)) mostSpecific = current; else return false; @@ -2210,4 +2292,13 @@ return this.fPackage.enclosingModule; return null; } + +public boolean hasEnclosingInstanceContext() { + if (isMemberType() && !isStatic()) + return true; + MethodBinding enclosingMethod = enclosingMethod(); + if (enclosingMethod != null) + return !enclosingMethod.isStatic(); + return false; +} } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -59,6 +62,7 @@ package org.eclipse.jdt.internal.compiler.lookup; import java.util.*; +import java.util.function.Function; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ast.*; @@ -108,18 +112,34 @@ public Scope parent; private static class NullDefaultRange { - final int value; - final Annotation annotation; final int start, end; - final Binding target; + int value; + private Annotation[] annotations; + Binding target; NullDefaultRange(int value, Annotation annotation, int start, int end, Binding target) { - this.value = value; - this.annotation = annotation; this.start = start; this.end = end; + this.value = value; + this.annotations = new Annotation[] { annotation }; this.target = target; } + + boolean contains(Annotation annotation) { + for (Annotation annotation2 : this.annotations) { + if (annotation2 == annotation) + return true; + } + return false; + } + + void merge(int nextValue, Annotation nextAnnotation, Binding nextTarget) { + int len = this.annotations.length; + System.arraycopy(this.annotations, 0, this.annotations = new Annotation[len + 1], 0, len); + this.annotations[len] = nextAnnotation; + this.target = nextTarget; + this.value |= nextValue; + } } private /* @Nullable */ ArrayList nullDefaultRanges; @@ -332,6 +352,7 @@ // 5.1.10 public static ReferenceBinding[] greaterLowerBound(ReferenceBinding[] types) { if (types == null) return null; + types = filterValidTypes(types, ReferenceBinding[]::new); int length = types.length; if (length == 0) return null; ReferenceBinding[] result = types; @@ -370,6 +391,7 @@ // 5.1.10 public static TypeBinding[] greaterLowerBound(TypeBinding[] types, /*@Nullable*/ Scope scope, LookupEnvironment environment) { if (types == null) return null; + types = filterValidTypes(types, TypeBinding[]::new); int length = types.length; if (length == 0) return null; TypeBinding[] result = types; @@ -444,6 +466,20 @@ return trimmedResult; } + static T[] filterValidTypes(T[] allTypes, Function ctor) { + T[] valid = ctor.apply(allTypes.length); + int count = 0; + for (int i = 0; i < allTypes.length; i++) { + if (allTypes[i].isValidBinding()) + valid[count++] = allTypes[i]; + } + if (count == allTypes.length) + return allTypes; + if (count == 0 && allTypes.length > 0) + return Arrays.copyOf(allTypes, 1); // if all are invalid pick the first as a placeholder to prevent general glb failure + return Arrays.copyOf(valid, count); + } + static boolean isMalformedPair(TypeBinding t1, TypeBinding t2, Scope scope) { // not spec-ed in JLS, but per email communication (2017-09-13) it should be switch (t1.kind()) { @@ -542,7 +578,7 @@ ParameterizedTypeBinding originalParameterizedType = (ParameterizedTypeBinding) originalType; ReferenceBinding originalEnclosing = originalType.enclosingType(); ReferenceBinding substitutedEnclosing = originalEnclosing; - if (originalEnclosing != null && !originalType.isStatic()) { + if (originalEnclosing != null && originalParameterizedType.hasEnclosingInstanceContext()) { substitutedEnclosing = (ReferenceBinding) substitute(substitution, originalEnclosing); if (isMemberTypeOfRaw(originalType, substitutedEnclosing)) return originalParameterizedType.environment.createRawType( @@ -623,7 +659,7 @@ } // treat as if parameterized with its type variables (non generic type gets 'null' arguments) - if (substitutedEnclosing != originalEnclosing && !originalType.isStatic()) { //$IDENTITY-COMPARISON$ + if (substitutedEnclosing != originalEnclosing && originalReferenceType.hasEnclosingInstanceContext()) { //$IDENTITY-COMPARISON$ return substitution.isRawSubstitution() ? substitution.environment().createRawType(originalReferenceType, substitutedEnclosing, originalType.getTypeAnnotations()) : substitution.environment().createParameterizedType(originalReferenceType, null, substitutedEnclosing, originalType.getTypeAnnotations()); @@ -715,7 +751,7 @@ } while (scope != null); return (CompilationUnitScope) lastScope; } - public final ModuleBinding module() { + public ModuleBinding module() { return environment().module; } public boolean isLambdaScope() { @@ -736,6 +772,10 @@ return false; } + public boolean isModuleScope() { + return false; + } + /** * Finds the most specific compiler options */ @@ -827,7 +867,7 @@ if ((parameterCompatibilityLevel(method, arguments, tiebreakingVarargsMethods)) > NOT_COMPATIBLE) { if ((method.tagBits & TagBits.AnnotationPolymorphicSignature) != 0) { // generate polymorphic method - return this.environment().createPolymorphicMethod(method, arguments); + return this.environment().createPolymorphicMethod(method, arguments, this); } return method; } @@ -1098,6 +1138,15 @@ return null; // may answer null if no type around } + public final ClassScope enclosingTopMostClassScope() { + Scope scope = this; + while (scope != null) { + Scope t = scope.parent; + if (t instanceof CompilationUnitScope) break; + scope = t; + } + return scope instanceof ClassScope ? ((ClassScope) scope) : null; + } public final MethodScope enclosingMethodScope() { Scope scope = this; while ((scope = scope.parent) != null) { @@ -1307,7 +1356,7 @@ exactMethod = computeCompatibleMethod(exactMethod, argumentTypes, invocationSite); } else if ((exactMethod.tagBits & TagBits.AnnotationPolymorphicSignature) != 0) { // generate polymorphic method - return this.environment().createPolymorphicMethod(exactMethod, argumentTypes); + return this.environment().createPolymorphicMethod(exactMethod, argumentTypes, this); } return exactMethod; } @@ -1516,9 +1565,11 @@ ReferenceBinding sourceType = currentType.isParameterizedType() ? ((ParameterizedTypeBinding) currentType).genericType() : currentType; - if (sourceType.isHierarchyBeingConnected()) - return null; // looking for an undefined member type in its own superclass ref - ((SourceTypeBinding) sourceType).scope.connectTypeHierarchy(); + if (sourceType instanceof SourceTypeBinding) { // could be TypeVariableBinding + if (sourceType.isHierarchyBeingConnected()) + return null; // looking for an undefined member type in its own superclass ref + ((SourceTypeBinding) sourceType).scope.connectTypeHierarchy(); + } itsInterfaces = currentType.superInterfaces(); } if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) { @@ -2099,7 +2150,7 @@ if (TypeBinding.equalsEquals(receiverType, fieldBinding.declaringClass) || compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4) { // found a valid field in the 'immediate' scope (i.e. not inherited) // OR in 1.4 mode (inherited shadows enclosing) - if (foundField == null) { + if (foundField == null || foundField.problemId() == ProblemReasons.NotVisible) { if (depth > 0){ invocationSite.setDepth(depth); invocationSite.setActualReceiverType(receiverType); @@ -3652,11 +3703,19 @@ MethodScope methodScope = methodScope(); if (!methodScope.isInsideInitializer()){ // check method modifiers to see if deprecated - ReferenceContext referenceContext = methodScope.referenceContext; - MethodBinding context = referenceContext instanceof AbstractMethodDeclaration ? - ((AbstractMethodDeclaration)referenceContext).binding : ((LambdaExpression)referenceContext).binding; - if (context != null && context.isViewedAsDeprecated()) - return true; + ReferenceContext referenceContext = methodScope.referenceContext(); + if (referenceContext instanceof AbstractMethodDeclaration) { + MethodBinding context = ((AbstractMethodDeclaration) referenceContext).binding; + if (context != null && context.isViewedAsDeprecated()) + return true; + } else if (referenceContext instanceof LambdaExpression) { + MethodBinding context = ((LambdaExpression) referenceContext).binding; + if (context != null && context.isViewedAsDeprecated()) + return true; + } else if (referenceContext instanceof ModuleDeclaration) { + ModuleBinding context = ((ModuleDeclaration) referenceContext).binding; + return context != null && context.isDeprecated(); + } } else if (methodScope.initializedField != null && methodScope.initializedField.isViewedAsDeprecated()) { // inside field declaration ? check field modifier to see if deprecated return true; @@ -3956,7 +4015,18 @@ otherBounds[rank++] = mec; } } - TypeBinding intersectionType = environment().createWildcard(null, 0, firstBound, otherBounds, Wildcard.EXTENDS); // pass common null annotations by synthesized annotation bindings. + TypeBinding intersectionType; + if (environment().globalOptions.complianceLevel < ClassFileConstants.JDK1_8) { + intersectionType = environment().createWildcard(null, 0, firstBound, otherBounds, Wildcard.EXTENDS); + } else { + // It _should_ be safe to assume only ReferenceBindings at this point, because + // - base types are rejected in minimalErasedCandidates + // - arrays are peeled, different dims are rejected above ("not all types have same dimension") + ReferenceBinding[] intersectingTypes = new ReferenceBinding[otherBounds.length+1]; + intersectingTypes[0] = (ReferenceBinding) firstBound; + System.arraycopy(otherBounds, 0, intersectingTypes, 1, otherBounds.length); + intersectionType = environment().createIntersectionType18(intersectingTypes); + } return commonDim == 0 ? intersectionType : environment().createArrayType(intersectionType, commonDim); } @@ -4398,7 +4468,7 @@ if (levelj == VARARGS_COMPATIBLE && levelk == VARARGS_COMPATIBLE) { TypeBinding s = InferenceContext18.getParameter(mbjParameters, argumentTypes.length, true); TypeBinding t = InferenceContext18.getParameter(mbkParameters, argumentTypes.length, true); - if (TypeBinding.notEquals(s, t) && t.isSubtypeOf(s)) + if (TypeBinding.notEquals(s, t) && t.isSubtypeOf(s, false)) continue nextJ; } } @@ -4421,20 +4491,35 @@ // JLS7 implementation InvocationSite tieBreakInvocationSite = new InvocationSite() { + @Override public TypeBinding[] genericTypeArguments() { return null; } // ignore genericTypeArgs + @Override public boolean isSuperAccess() { return invocationSite.isSuperAccess(); } + @Override public boolean isTypeAccess() { return invocationSite.isTypeAccess(); } + @Override public void setActualReceiverType(ReferenceBinding actualReceiverType) { /* ignore */} + @Override public void setDepth(int depth) { /* ignore */} + @Override public void setFieldIndex(int depth) { /* ignore */} + @Override public int sourceStart() { return invocationSite.sourceStart(); } + @Override public int sourceEnd() { return invocationSite.sourceStart(); } + @Override public TypeBinding invocationTargetType() { return invocationSite.invocationTargetType(); } + @Override public boolean receiverIsImplicitThis() { return invocationSite.receiverIsImplicitThis();} + @Override public InferenceContext18 freshInferenceContext(Scope scope) { return null; /* no inference when ignoring genericTypeArgs */ } + @Override public ExpressionContext getExpressionContext() { return ExpressionContext.VANILLA_CONTEXT; } + @Override public boolean isQualifiedSuper() { return invocationSite.isQualifiedSuper(); } + @Override public boolean checkingPotentialCompatibility() { return false; } + @Override public void acceptPotentiallyCompatibleMethods(MethodBinding[] methods) {/* ignore */} }; int count = 0; @@ -4997,12 +5082,15 @@ } final Scope scope = this; Substitution substitution = new Substitution() { + @Override public LookupEnvironment environment() { return scope.environment(); } + @Override public boolean isRawSubstitution() { return false; } + @Override public TypeBinding substitute(TypeVariableBinding typeVariable) { TypeBinding retVal = (TypeBinding) map.get(typeVariable.unannotated()); return retVal == null ? typeVariable : typeVariable.hasTypeAnnotations() ? environment().createAnnotatedType(retVal, typeVariable.getTypeAnnotations()) : retVal; @@ -5072,7 +5160,7 @@ } public boolean validateNullAnnotation(long tagBits, TypeReference typeRef, Annotation[] annotations) { - if (typeRef == null) + if (typeRef == null || typeRef.resolvedType == null) return true; TypeBinding type = typeRef.resolvedType; @@ -5115,12 +5203,14 @@ this.nullDefaultRanges=new ArrayList<>(3); } for (NullDefaultRange nullDefaultRange : this.nullDefaultRanges) { - if (nullDefaultRange.annotation == annotation - && nullDefaultRange.start== scopeStart - && nullDefaultRange.end==scopeEnd - && nullDefaultRange.value==value) { - // annotation data already recorded - return false; + if (nullDefaultRange.start== scopeStart && nullDefaultRange.end==scopeEnd) { + if (nullDefaultRange.contains(annotation)) { + // annotation data already recorded + return false; + } else { + nullDefaultRange.merge(value, annotation, target); + return true; + } } } this.nullDefaultRanges.add(new NullDefaultRange(value, annotation, scopeStart, scopeEnd, target)); @@ -5155,7 +5245,7 @@ /* * helper for hasDefaultNullnessFor(..) which inspects only ranges recorded within this scope. */ - final protected int localNonNullByDefaultValue(int start) { + public final int localNonNullByDefaultValue(int start) { NullDefaultRange nullDefaultRange = nullDefaultRangeForPosition(start); return nullDefaultRange != null ? nullDefaultRange.value : 0; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SignatureWrapper.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SignatureWrapper.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SignatureWrapper.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SignatureWrapper.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -191,6 +194,7 @@ public char[] tail() { return CharOperation.subarray(this.signature, this.start, this.signature.length); } + @Override public String toString() { if (this.start >= 0 && this.start <= this.signature.length) { return new String(CharOperation.subarray(this.signature, 0, this.start)) + " ^ " //$NON-NLS-1$ diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceModuleBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceModuleBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceModuleBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceModuleBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2017 GK Software AG, and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2017, 2018 GK Software AG, and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - initial API and implementation @@ -18,13 +21,11 @@ import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.ModuleDeclaration; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable; public class SourceModuleBinding extends ModuleBinding { final public CompilationUnitScope scope; // TODO(SHMOD): consider cleanup at end of compile - private SimpleLookupTable storedAnnotations = null; /** * Construct a named module from source. @@ -42,8 +43,6 @@ public void setRequires(ModuleBinding[] requires, ModuleBinding[] requiresTransitive) { // TODO(SHMOD): it's a bit awkward that we may get called after applyModuleUpdates() has already worked. ModuleBinding javaBase = this.environment.javaBaseModule(); - if (javaBase.isUnnamed()) // happens when no java.base can be found in the name environment. - javaBase = null; this.requires = merge(this.requires, requires, javaBase, ModuleBinding[]::new); this.requiresTransitive = merge(this.requiresTransitive, requiresTransitive, null, ModuleBinding[]::new); } @@ -52,6 +51,32 @@ this.uses = merge(this.uses, uses, null, TypeBinding[]::new); } + @Override + public TypeBinding[] getUses() { + resolveTypes(); + return super.getUses(); + } + + @Override + public TypeBinding[] getServices() { + resolveTypes(); + return super.getServices(); + } + + @Override + public TypeBinding[] getImplementations(TypeBinding binding) { + resolveTypes(); + return super.getImplementations(binding); + } + + private void resolveTypes() { + if (this.scope != null) { + ModuleDeclaration ast = this.scope.referenceCompilationUnit().moduleDeclaration; + if (ast != null) + ast.resolveTypeDirectives(this.scope); + } + } + public void setServices(TypeBinding[] services) { this.services = merge(this.services, services, null, TypeBinding[]::new); } @@ -93,8 +118,12 @@ this.scope.referenceContext.moduleDeclaration.resolveModuleDirectives(this.scope); return super.getAllRequiredModules(); } + @Override public long getAnnotationTagBits() { - //TODO: This code is untested as we don't yet get a scope in ModuleBinding + ensureAnnotationsResolved(); + return this.tagBits; + } + protected void ensureAnnotationsResolved() { if ((this.tagBits & TagBits.AnnotationResolved) == 0 && this.scope != null) { ModuleDeclaration module = this.scope.referenceContext.moduleDeclaration; ASTNode.resolveAnnotations(module.scope, module.annotations, this); @@ -104,62 +133,21 @@ } this.tagBits |= TagBits.AnnotationResolved; } - return this.tagBits; } + @Override public AnnotationBinding[] getAnnotations() { + ensureAnnotationsResolved(); return retrieveAnnotations(this); } - public AnnotationHolder retrieveAnnotationHolder(Binding binding, boolean forceInitialization) { - SimpleLookupTable store = storedAnnotations(forceInitialization, false); - return store == null ? null : (AnnotationHolder) store.get(binding); - } - - AnnotationBinding[] retrieveAnnotations(Binding binding) { - AnnotationHolder holder = retrieveAnnotationHolder(binding, true); - return holder == null ? Binding.NO_ANNOTATIONS : holder.getAnnotations(); - } - - public void setAnnotations(AnnotationBinding[] annotations, boolean forceStore) { - storeAnnotations(this, annotations, forceStore); - } - void storeAnnotationHolder(Binding binding, AnnotationHolder holder) { - if (holder == null) { - SimpleLookupTable store = storedAnnotations(false, false); - if (store != null) - store.removeKey(binding); - } else { - SimpleLookupTable store = storedAnnotations(true, false); - if (store != null) - store.put(binding, holder); - } - } - - void storeAnnotations(Binding binding, AnnotationBinding[] annotations, boolean forceStore) { - AnnotationHolder holder = null; - if (annotations == null || annotations.length == 0) { - SimpleLookupTable store = storedAnnotations(false, forceStore); - if (store != null) - holder = (AnnotationHolder) store.get(binding); - if (holder == null) return; // nothing to delete - } else { - SimpleLookupTable store = storedAnnotations(true, forceStore); - if (store == null) return; // not supported - holder = (AnnotationHolder) store.get(binding); - if (holder == null) - holder = new AnnotationHolder(); - } - storeAnnotationHolder(binding, holder.setAnnotations(annotations)); - } + @Override SimpleLookupTable storedAnnotations(boolean forceInitialize, boolean forceStore) { - if (forceInitialize && this.storedAnnotations == null && this.scope != null) { // scope null when no annotation cached, and type got processed fully (159631) - this.scope.referenceCompilationUnit().compilationResult.hasAnnotations = true; - final CompilerOptions globalOptions = this.scope.environment().globalOptions; - if (!globalOptions.storeAnnotations && !forceStore) - return null; // not supported during this compile - this.storedAnnotations = new SimpleLookupTable(3); + if (this.scope != null) { // scope null when no annotation cached, and module got processed fully (159631) + SimpleLookupTable annotationTable = super.storedAnnotations(forceInitialize, forceStore); + if (annotationTable != null) + this.scope.referenceCompilationUnit().compilationResult.hasAnnotations = true; + return annotationTable; } - return this.storedAnnotations; + return null; } - } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -50,7 +53,10 @@ import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy; @@ -110,6 +116,9 @@ public ExternalAnnotationProvider externalAnnotationProvider; + private SourceTypeBinding nestHost; + public HashSet nestMembers; + public SourceTypeBinding(char[][] compoundName, PackageBinding fPackage, ClassScope scope) { this.compoundName = compoundName; this.fPackage = fPackage; @@ -829,6 +838,7 @@ return this.prototype.areMethodsInitialized(); return this.methods != Binding.UNINITIALIZED_METHODS; } +@Override public int kind() { if (!isPrototype()) return this.prototype.kind(); @@ -836,10 +846,12 @@ return Binding.TYPE; } +@Override public TypeBinding clone(TypeBinding immaterial) { return new SourceTypeBinding(this); } +@Override public char[] computeUniqueKey(boolean isLeaf) { if (!isPrototype()) return this.prototype.computeUniqueKey(); @@ -909,6 +921,7 @@ ((SourceTypeBinding) this.memberTypes[i]).internalFaultInTypeForFieldsAndMethods(); } // NOTE: the type of each field of a source type is resolved when needed +@Override public FieldBinding[] fields() { if (!isPrototype()) { @@ -963,6 +976,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#genericTypeSignature() */ +@Override public char[] genericTypeSignature() { if (!isPrototype()) return this.prototype.genericTypeSignature(); @@ -1012,6 +1026,7 @@ * declaration binding. * @see org.eclipse.jdt.internal.compiler.lookup.Binding#getAnnotationTagBits() */ +@Override public long getAnnotationTagBits() { if (!isPrototype()) return this.prototype.getAnnotationTagBits(); @@ -1048,6 +1063,7 @@ return result; } // NOTE: the return type, arg & exception types of each method of a source type are resolved when needed +@Override public MethodBinding getExactConstructor(TypeBinding[] argumentTypes) { if (!isPrototype()) return this.prototype.getExactConstructor(argumentTypes); @@ -1098,6 +1114,7 @@ //NOTE: the return type, arg & exception types of each method of a source type are resolved when needed //searches up the hierarchy as long as no potential (but not exact) match was found. +@Override public MethodBinding getExactMethod(char[] selector, TypeBinding[] argumentTypes, CompilationUnitScope refScope) { if (!isPrototype()) return this.prototype.getExactMethod(selector, argumentTypes, refScope); @@ -1186,6 +1203,7 @@ } //NOTE: the type of a field of a source type is resolved when needed +@Override public FieldBinding getField(char[] fieldName, boolean needResolve) { if (!isPrototype()) @@ -1231,6 +1249,7 @@ } // NOTE: the return type, arg & exception types of each method of a source type are resolved when needed +@Override public MethodBinding[] getMethods(char[] selector) { if (!isPrototype()) return this.prototype.getMethods(selector); @@ -1342,6 +1361,7 @@ return accessors[1]; } +@Override public boolean hasTypeBit(int bit) { if (!isPrototype()) { return this.prototype.hasTypeBit(bit); @@ -1353,6 +1373,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.Binding#initializeDeprecatedAnnotationTagBits() */ +@Override public void initializeDeprecatedAnnotationTagBits() { if (!isPrototype()) { this.prototype.initializeDeprecatedAnnotationTagBits(); @@ -1376,6 +1397,7 @@ // ensure the receiver knows its hierarchy & fields/methods so static imports can be resolved correctly // see bug 230026 +@Override void initializeForStaticImports() { if (!isPrototype()) { this.prototype.initializeForStaticImports(); @@ -1389,6 +1411,7 @@ this.scope.buildMethods(); } +@Override int getNullDefault() { if (!isPrototype()) { @@ -1410,6 +1433,7 @@ * Returns true if a type is identical to another one, * or for generic types, true if compared to its raw type. */ +@Override public boolean isEquivalentTo(TypeBinding otherType) { if (!isPrototype()) return this.prototype.isEquivalentTo(otherType); @@ -1455,24 +1479,29 @@ } return false; } +@Override public boolean isGenericType() { if (!isPrototype()) return this.prototype.isGenericType(); return this.typeVariables != Binding.NO_TYPE_VARIABLES; } +@Override public boolean isHierarchyConnected() { if (!isPrototype()) return this.prototype.isHierarchyConnected(); return (this.tagBits & TagBits.EndHierarchyCheck) != 0; } +@Override public boolean isRepeatableAnnotationType() { if (!isPrototype()) throw new IllegalStateException(); return this.containerAnnotationType != null; } +@Override public boolean isTaggedRepeatable() { // tagged but not necessarily repeatable. see isRepeatableAnnotationType. return (this.tagBits & TagBits.AnnotationRepeatable) != 0; } +@Override public boolean canBeSeenBy(Scope sco) { SourceTypeBinding invocationType = sco.enclosingSourceType(); if (TypeBinding.equalsEquals(invocationType, this)) @@ -1480,6 +1509,7 @@ return ((this.environment.canTypeBeAccessed(this, sco)) && super.canBeSeenBy(sco)); } +@Override public ReferenceBinding[] memberTypes() { if (!isPrototype()) { if ((this.tagBits & TagBits.HasUnresolvedMemberTypes) == 0) @@ -1495,6 +1525,7 @@ return this.memberTypes; } +@Override public boolean hasMemberTypes() { if (!isPrototype()) return this.prototype.hasMemberTypes(); @@ -1502,6 +1533,7 @@ } // NOTE: the return type, arg & exception types of each method of a source type are resolved when needed +@Override public MethodBinding[] methods() { if (!isPrototype()) { @@ -1727,6 +1759,7 @@ return this.methods; } +@Override public TypeBinding prototype() { return this.prototype; } @@ -1735,6 +1768,7 @@ return this == this.prototype; //$IDENTITY-COMPARISON$ } +@Override public ReferenceBinding containerAnnotationType() { if (!isPrototype()) throw new IllegalStateException(); @@ -1820,7 +1854,7 @@ // enum constants neither have a type declaration nor can they be null field.tagBits |= TagBits.AnnotationNonNull; } else { - if (hasNonNullDefaultFor(DefaultLocationField, this.environment.usesNullTypeAnnotations(), fieldDecl.sourceStart)) { + if (hasNonNullDefaultFor(DefaultLocationField, fieldDecl.sourceStart)) { field.fillInDefaultNonNullness(fieldDecl, initializationScope); } // validate null annotation: @@ -1942,6 +1976,7 @@ arg.type.bits |= ASTNode.IgnoreRawTypeCheck; } try { + ASTNode.handleNonNullByDefault(methodDecl.scope, arg.annotations, arg); parameterType = arg.type.resolveType(methodDecl.scope, true /* check bounds*/); } finally { if (deferRawTypeCheck) { @@ -2137,80 +2172,49 @@ boolean isInDefaultPkg = (pkg.compoundName == CharOperation.NO_CHAR_CHAR); if (!isPackageInfo) { boolean isInNullnessAnnotationPackage = this.scope.environment().isNullnessAnnotationPackage(pkg); - if (pkg.defaultNullness == NO_NULL_DEFAULT && !isInDefaultPkg && !isInNullnessAnnotationPackage && !(this instanceof NestedTypeBinding)) { + if (pkg.getDefaultNullness() == NO_NULL_DEFAULT && !isInDefaultPkg && !isInNullnessAnnotationPackage && !(this instanceof NestedTypeBinding)) { ReferenceBinding packageInfo = pkg.getType(TypeConstants.PACKAGE_INFO_NAME, this.module); if (packageInfo == null) { // no pkgInfo - complain this.scope.problemReporter().missingNonNullByDefaultAnnotation(this.scope.referenceContext); - pkg.defaultNullness = NULL_UNSPECIFIED_BY_DEFAULT; + pkg.setDefaultNullness(NULL_UNSPECIFIED_BY_DEFAULT); } else { // if pkgInfo has no default annot. - complain - if (packageInfo instanceof SourceTypeBinding - && (packageInfo.tagBits & TagBits.EndHierarchyCheck) == 0) { - CompilationUnitScope pkgCUS = ((SourceTypeBinding) packageInfo).scope.compilationUnitScope(); - boolean current = pkgCUS.connectingHierarchy; - pkgCUS.connectingHierarchy = true; - try { - packageInfo.getAnnotationTagBits(); - } finally { - pkgCUS.connectingHierarchy = current; - } - } else { + if (packageInfo instanceof SourceTypeBinding + && (packageInfo.tagBits & TagBits.EndHierarchyCheck) == 0) { + CompilationUnitScope pkgCUS = ((SourceTypeBinding) packageInfo).scope.compilationUnitScope(); + boolean current = pkgCUS.connectingHierarchy; + pkgCUS.connectingHierarchy = true; + try { packageInfo.getAnnotationTagBits(); + } finally { + pkgCUS.connectingHierarchy = current; } + } else { + packageInfo.getAnnotationTagBits(); } + } } } this.nullnessDefaultInitialized = 1; - boolean usesNullTypeAnnotations = this.scope.environment().usesNullTypeAnnotations(); - if (usesNullTypeAnnotations) { - if (this.defaultNullness != 0) { - if (isPackageInfo) { - pkg.defaultNullness = this.defaultNullness; + if (this.defaultNullness != 0) { + TypeDeclaration typeDecl = this.scope.referenceContext; + if (isPackageInfo) { + if (pkg.enclosingModule.getDefaultNullness() == this.defaultNullness) { + this.scope.problemReporter().nullDefaultAnnotationIsRedundant(typeDecl, typeDecl.annotations, pkg.enclosingModule); } else { - TypeDeclaration typeDecl = this.scope.referenceContext; - Binding target = this.scope.parent.checkRedundantDefaultNullness(this.defaultNullness, typeDecl.declarationSourceStart); - if(target != null) { - this.scope.problemReporter().nullDefaultAnnotationIsRedundant(typeDecl, typeDecl.annotations, target); - } + pkg.setDefaultNullness(this.defaultNullness); } - } else if (isPackageInfo || (isInDefaultPkg && !(this instanceof NestedTypeBinding))) { - this.scope.problemReporter().missingNonNullByDefaultAnnotation(this.scope.referenceContext); - if (!isInDefaultPkg) - pkg.defaultNullness = NULL_UNSPECIFIED_BY_DEFAULT; - } - } else { - // transfer nullness info from tagBits to this.defaultNullness - long annotationTagBits = this.tagBits; - int newDefaultNullness = NO_NULL_DEFAULT; - if ((annotationTagBits & TagBits.AnnotationNullUnspecifiedByDefault) != 0) { - newDefaultNullness = NULL_UNSPECIFIED_BY_DEFAULT; - } else if ((annotationTagBits & TagBits.AnnotationNonNullByDefault) != 0) { - newDefaultNullness = NONNULL_BY_DEFAULT; - } else if (this.defaultNullness != 0) { - // NNBD with argument while NN & NU are SE5 annotations, revert to old default & encoding. - if (this.defaultNullness == NULL_UNSPECIFIED_BY_DEFAULT) { - annotationTagBits = TagBits.AnnotationNullUnspecifiedByDefault; - newDefaultNullness = NULL_UNSPECIFIED_BY_DEFAULT; - } else { - annotationTagBits = TagBits.AnnotationNonNullByDefault; - newDefaultNullness = NONNULL_BY_DEFAULT; + } else { + Binding target = this.scope.parent.checkRedundantDefaultNullness(this.defaultNullness, typeDecl.declarationSourceStart); + if(target != null) { + this.scope.problemReporter().nullDefaultAnnotationIsRedundant(typeDecl, typeDecl.annotations, target); } } - if (newDefaultNullness != NO_NULL_DEFAULT) { - if (isPackageInfo) { - pkg.defaultNullness = newDefaultNullness; - } else { - this.defaultNullness = newDefaultNullness; - TypeDeclaration typeDecl = this.scope.referenceContext; - long nullDefaultBits = annotationTagBits & (TagBits.AnnotationNullUnspecifiedByDefault|TagBits.AnnotationNonNullByDefault); - checkRedundantNullnessDefaultRecurse(typeDecl, typeDecl.annotations, nullDefaultBits, false); - } - } else if (isPackageInfo || (isInDefaultPkg && !(this instanceof NestedTypeBinding))) { - this.scope.problemReporter().missingNonNullByDefaultAnnotation(this.scope.referenceContext); - if (!isInDefaultPkg) - pkg.defaultNullness = NULL_UNSPECIFIED_BY_DEFAULT; - } + } else if (isPackageInfo || (isInDefaultPkg && !(this instanceof NestedTypeBinding))) { + this.scope.problemReporter().missingNonNullByDefaultAnnotation(this.scope.referenceContext); + if (!isInDefaultPkg) + pkg.setDefaultNullness(NULL_UNSPECIFIED_BY_DEFAULT); } maybeMarkTypeParametersNonNull(); } @@ -2229,105 +2233,21 @@ } } -/** - * Recursively check if the given annotations are redundant with equal annotations at an enclosing level. - * @param location fallback location to report the warning against (if we can't blame a specific annotation) - * @param annotations search these for the annotation that should be blamed in warning messages - * @param nullBits when using declaration annotations these are the annotationTagBits, for type annotations the bitvector from {@link Binding#NullnessDefaultMASK} - * @param useNullTypeAnnotations toggles the interpretation of 'nullBits' - * - * @pre null annotation analysis is enabled - */ -protected void checkRedundantNullnessDefaultRecurse(ASTNode location, Annotation[] annotations, long nullBits, boolean useNullTypeAnnotations) { - - if (!isPrototype()) throw new IllegalStateException(); - - if (this.fPackage.defaultNullness != NO_NULL_DEFAULT) { - boolean isRedundant = useNullTypeAnnotations - ? this.fPackage.defaultNullness == nullBits - : (this.fPackage.defaultNullness == NONNULL_BY_DEFAULT - && ((nullBits & TagBits.AnnotationNonNullByDefault) != 0)); - if (isRedundant) { - this.scope.problemReporter().nullDefaultAnnotationIsRedundant(location, annotations, this.fPackage); - } - return; - } -} - -// return: should caller continue searching? -protected boolean checkRedundantNullnessDefaultOne(ASTNode location, Annotation[] annotations, long nullBits, boolean useNullTypeAnnotations) { - - if (!isPrototype()) throw new IllegalStateException(); - - int thisDefault = getNullDefault(); - if (thisDefault != NO_NULL_DEFAULT) { - boolean isRedundant = useNullTypeAnnotations - ? thisDefault == nullBits - : (nullBits & TagBits.AnnotationNonNullByDefault) != 0; - if (isRedundant) { - this.scope.problemReporter().nullDefaultAnnotationIsRedundant(location, annotations, this); - } - return false; // different default means inner default is not redundant -> we're done - } - return true; -} - @Override -boolean hasNonNullDefaultFor(int location, boolean useTypeAnnotations, int sourceStart) { +boolean hasNonNullDefaultFor(int location, int sourceStart) { if (!isPrototype()) throw new IllegalStateException(); - // 1.8: - if (useTypeAnnotations) { - if (this.scope == null) { - return (this.defaultNullness & location) != 0; - } - Scope skope = this.scope.referenceContext.initializerScope; // for @NNBD on a field - if (skope == null) - skope = this.scope; - return skope.hasDefaultNullnessFor(location, sourceStart); - } - - // find the applicable default inside->out: - - SourceTypeBinding currentType = null; - Scope currentScope = this.scope; - while (currentScope != null) { - switch (currentScope.kind) { - case Scope.METHOD_SCOPE: - AbstractMethodDeclaration referenceMethod = ((MethodScope)currentScope).referenceMethod(); - if (referenceMethod != null && referenceMethod.binding != null) { - long methodTagBits = referenceMethod.binding.tagBits; - if ((methodTagBits & TagBits.AnnotationNonNullByDefault) != 0) - return true; - if ((methodTagBits & TagBits.AnnotationNullUnspecifiedByDefault) != 0) - return false; - } - break; - case Scope.CLASS_SCOPE: - currentType = ((ClassScope)currentScope).referenceContext.binding; - if (currentType != null) { - int foundDefaultNullness = currentType.getNullDefault(); - if ((foundDefaultNullness & NullnessDefaultMASK) > NULL_UNSPECIFIED_BY_DEFAULT) { - return true; - } - if (foundDefaultNullness != NO_NULL_DEFAULT) { - return foundDefaultNullness == NONNULL_BY_DEFAULT; - } - } - break; - } - currentScope = currentScope.parent; - } - - // package - if (currentType != null) { - return currentType.getPackage().defaultNullness == NONNULL_BY_DEFAULT; + if (this.scope == null) { + return (this.defaultNullness & location) != 0; } - - return false; + Scope skope = this.scope.referenceContext.initializerScope; // for @NNBD on a field + if (skope == null) + skope = this.scope; + return skope.hasDefaultNullnessFor(location, sourceStart); } +@Override public AnnotationHolder retrieveAnnotationHolder(Binding binding, boolean forceInitialization) { if (!isPrototype()) return this.prototype.retrieveAnnotationHolder(binding, forceInitialization); @@ -2336,11 +2256,13 @@ return super.retrieveAnnotationHolder(binding, false); } +@Override public void setContainerAnnotationType(ReferenceBinding value) { if (!isPrototype()) throw new IllegalStateException(); this.containerAnnotationType = value; } +@Override public void tagAsHavingDefectiveContainerType() { if (!isPrototype()) throw new IllegalStateException(); if (this.containerAnnotationType != null && this.containerAnnotationType.isValidBinding()) @@ -2457,6 +2379,7 @@ return this.scope.referenceContext.sourceStart; } +@Override SimpleLookupTable storedAnnotations(boolean forceInitialize, boolean forceStore) { if (!isPrototype()) return this.prototype.storedAnnotations(forceInitialize, forceStore); @@ -2471,12 +2394,14 @@ return this.storedAnnotations; } +@Override public ReferenceBinding superclass() { if (!isPrototype()) return this.superclass = this.prototype.superclass(); return this.superclass; } +@Override public ReferenceBinding[] superInterfaces() { if (!isPrototype()) return this.superInterfaces = this.prototype.superInterfaces(); @@ -2548,6 +2473,7 @@ } return bindings; } +@Override public String toString() { if (this.hasTypeAnnotations()) { return annotatedDebugName(); @@ -2643,6 +2569,7 @@ buffer.append("\n\n"); //$NON-NLS-1$ return buffer.toString(); } +@Override public TypeVariableBinding[] typeVariables() { if (!isPrototype()) return this.typeVariables = this.prototype.typeVariables(); @@ -2658,6 +2585,7 @@ ((SourceTypeBinding) this.memberTypes[i]).verifyMethods(verifier); } +@Override public TypeBinding unannotated() { return this.prototype; } @@ -2672,6 +2600,7 @@ return this.prototype; } +@Override public FieldBinding[] unResolvedFields() { if (!isPrototype()) return this.prototype.unResolvedFields(); @@ -2696,9 +2625,48 @@ if (this.superclass instanceof SourceTypeBinding) // should always be true because private super type can only be accessed in same CU ((SourceTypeBinding) this.superclass).tagIndirectlyAccessibleMembers(); } +@Override public ModuleBinding module() { if (!isPrototype()) return this.prototype.module; return this.module; } + +public SourceTypeBinding getNestHost() { + return this.nestHost; } + +public void setNestHost(SourceTypeBinding nestHost) { + this.nestHost = nestHost; +} + +public boolean isNestmateOf(SourceTypeBinding other) { + + CompilerOptions options = this.scope.compilerOptions(); + if (options.targetJDK < ClassFileConstants.JDK11 || + options.complianceLevel < ClassFileConstants.JDK11) + return false; // default false if level less than 11 + + SourceTypeBinding otherHost = other.getNestHost(); + return TypeBinding.equalsEquals(this, other) || + TypeBinding.equalsEquals(this.nestHost == null ? this : this.nestHost, + otherHost == null ? other : otherHost); +} +public void addNestMember(SourceTypeBinding member) { + if (this.nestMembers == null) { + this.nestMembers = new HashSet<>(); + } + this.nestMembers.add(member); +} +public List getNestMembers() { + if (this.nestMembers == null) + return null; + List list = this.nestMembers + .stream() + .map(s -> new String(s.constantPoolName())) + .sorted() + .collect(Collectors.toList()); + return list; +} + +} \ No newline at end of file diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeCollisionException.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeCollisionException.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeCollisionException.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeCollisionException.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SplitPackageBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SplitPackageBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SplitPackageBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SplitPackageBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2017 GK Software AG, and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2017 GK Software SE, and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - initial API and implementation @@ -109,7 +112,7 @@ ModuleBinding moduleBinding = incarnation.enclosingModule; if (moduleBinding == module) continue; - PackageBinding next = moduleBinding.getVisiblePackage(incarnation, name); // TODO(SHMOD): reduce split-package work during this invocation? + PackageBinding next = moduleBinding.getVisiblePackage(incarnation, name, false); childPackage = combine(next, childPackage, primaryModule); } return childPackage; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Substitution.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Substitution.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Substitution.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Substitution.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -16,6 +19,30 @@ public interface Substitution { /** + * Don't substitute any type variables. + * Enables the use of {@link Scope.Substitutor} for other purposes. + */ + public static class NullSubstitution implements Substitution { + LookupEnvironment environment; + + public NullSubstitution(LookupEnvironment environment) { + this.environment = environment; + } + @Override + public TypeBinding substitute(TypeVariableBinding typeVariable) { + return typeVariable; + } + @Override + public boolean isRawSubstitution() { + return false; + } + @Override + public LookupEnvironment environment() { + return this.environment; + } + } + + /** * Returns the type substitute for a given type variable, or itself * if no substitution got performed. */ diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticArgumentBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticArgumentBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticArgumentBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticArgumentBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticFactoryMethodBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticFactoryMethodBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticFactoryMethodBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticFactoryMethodBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2014, 2016 GK Software AG. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2014, 2017 GK Software AG. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - initial API and implementation @@ -35,15 +38,16 @@ /** Apply the given type arguments on the (declaring class of the) actual constructor being represented by this factory method and if method type arguments is not empty materialize the parameterized generic constructor + * @param targetType */ - public ParameterizedMethodBinding applyTypeArgumentsOnConstructor(TypeBinding[] typeArguments, TypeBinding[] constructorTypeArguments, boolean inferredWithUncheckedConversion) { + public ParameterizedMethodBinding applyTypeArgumentsOnConstructor(TypeBinding[] typeArguments, TypeBinding[] constructorTypeArguments, boolean inferredWithUncheckedConversion, TypeBinding targetType) { ReferenceBinding parameterizedType = typeArguments == null ? this.environment.createRawType(this.declaringClass, this.enclosingType) : this.environment.createParameterizedType(this.declaringClass, typeArguments, this.enclosingType); for (MethodBinding parameterizedMethod : parameterizedType.methods()) { if (parameterizedMethod.original() == this.staticFactoryFor) return (constructorTypeArguments.length > 0 || inferredWithUncheckedConversion) - ? this.environment.createParameterizedGenericMethod(parameterizedMethod, constructorTypeArguments, inferredWithUncheckedConversion, false) + ? this.environment.createParameterizedGenericMethod(parameterizedMethod, constructorTypeArguments, inferredWithUncheckedConversion, false, targetType) : (ParameterizedMethodBinding) parameterizedMethod; if (parameterizedMethod instanceof ProblemMethodBinding) { MethodBinding closestMatch = ((ProblemMethodBinding)parameterizedMethod).closestMatch; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticFieldBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticFieldBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticFieldBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticFieldBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -16,6 +19,8 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.lookup; +import java.util.stream.Stream; + import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; @@ -383,6 +388,9 @@ this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved) | (lambda.binding.tagBits & TagBits.HasParameterAnnotations); this.returnType = lambda.binding.returnType; this.parameters = lambda.binding.parameters; + TypeVariableBinding[] vars = Stream.of(this.parameters).filter(param -> param.isTypeVariable()).toArray(TypeVariableBinding[]::new); + if (vars != null && vars.length > 0) + this.typeVariables = vars; this.thrownExceptions = lambda.binding.thrownExceptions; this.purpose = SyntheticMethodBinding.LambdaMethod; SyntheticMethodBinding[] knownAccessMethods = declaringClass.syntheticMethods(); @@ -586,6 +594,7 @@ return this.purpose == SyntheticMethodBinding.ConstructorAccess; } + @Override public LambdaExpression sourceLambda() { return this.lambda; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -39,9 +42,6 @@ long HasUncheckedTypeArgumentForBoundCheck = ASTNode.Bit9; // local variable - long NotInitialized = ASTNode.Bit9; - - // local variable long ForcedToBeRawType = ASTNode.Bit10; // set when method has argument(s) that couldn't be resolved @@ -146,8 +146,10 @@ /** @since 3.8 null annotation for MethodBinding or LocalVariableBinding (argument): */ long AnnotationNonNull = ASTNode.Bit57L; /** @since 3.8 null-default annotation for PackageBinding or TypeBinding or MethodBinding: */ + @Deprecated long AnnotationNonNullByDefault = ASTNode.Bit58L; /** @since 3.8 canceling null-default annotation for PackageBinding or TypeBinding or MethodBinding: */ + @Deprecated long AnnotationNullUnspecifiedByDefault = ASTNode.Bit59L; /** From Java 8 */ long AnnotationFunctionalInterface = ASTNode.Bit60L; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,10 +1,13 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ * + * SPDX-License-Identifier: EPL-2.0 + * * Contributors: * IBM Corporation - initial API and implementation * Stephen Herrmann - Contributions for @@ -30,6 +33,8 @@ * Bug 446434 - [1.8][null] Enable interned captures also when analysing null type annotations * Jesper S Moller - Contributions for * bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression + * bug 527554 - [18.3] Compiler support for JEP 286 Local-Variable Type + * *******************************************************************************/ package org.eclipse.jdt.internal.compiler.lookup; @@ -60,7 +65,9 @@ // jsr 308 public static final ReferenceBinding TYPE_USE_BINDING = new ReferenceBinding() { /* used for type annotation resolution. */ { this.id = TypeIds.T_undefined; } + @Override public int kind() { return Binding.TYPE_USE; } + @Override public boolean hasTypeBit(int bit) { return false; } }; @@ -271,6 +278,26 @@ } /** + * Perform an upwards type projection as per JLS 4.10.5 + * @param scope Relevant scope for evaluating type projection + * @param mentionedTypeVariables Filter for mentioned type variabled + * @returns Upwards type projection of 'this', or null if downwards projection is undefined +*/ +public TypeBinding upwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { + return this; +} + +/** + * Perform a downwards type projection as per JLS 4.10.5 + * @param scope Relevant scope for evaluating type projection + * @param mentionedTypeVariables Filter for mentioned type variabled + * @returns Downwards type projection of 'this', or null if downwards projection is undefined +*/ +public TypeBinding downwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { + return this; +} + +/** * Find supertype which originates from a given well-known type, or null if not found * (using id avoids triggering the load of well-known type: 73740) * NOTE: only works for erasures of well-known types, as random other types may share @@ -516,6 +543,20 @@ } } return this; // only occur if passed null declaringClass for arraylength + case Binding.INTERSECTION_TYPE18: + ReferenceBinding[] intersectingTypes = ((IntersectionTypeBinding18) this).getIntersectingTypes(); + ReferenceBinding constantPoolType = intersectingTypes[0]; + if (constantPoolType.id == TypeIds.T_JavaLangObject && intersectingTypes.length > 1) + constantPoolType = intersectingTypes[1]; + if (constantPoolType.erasure().findSuperTypeOriginatingFrom(declaringClass) != null) { + return this; // no need for alternate receiver type + } + for (ReferenceBinding superBinding : intersectingTypes) { + if (superBinding.findSuperTypeOriginatingFrom(declaringClass) != null) { + return superBinding.getErasureCompatibleType(declaringClass); + } + } + return this; // should only occur if passed null declaringClass for arraylength default : return this; } @@ -1408,6 +1449,7 @@ /* API * Answer the receiver's binding type from Binding.BindingID. */ +@Override public int kind() { return Binding.TYPE; } @@ -1587,6 +1629,10 @@ return false; if (that.id != TypeIds.NoId && that.id == other.id) return true; + if (that instanceof LocalTypeBinding && other instanceof LocalTypeBinding) { + // while a lambda is being resolved, consider a local type as equal to its variant from another lambda copy + return ((LocalTypeBinding) that).sourceStart == ((LocalTypeBinding) other).sourceStart; + } return false; } @@ -1633,7 +1679,7 @@ return s.isCompatibleWith(t, scope) && !s.needsUncheckedConversion(t); } -public boolean isSubtypeOf(TypeBinding right) { +public boolean isSubtypeOf(TypeBinding right, boolean simulatingBugJDK8026527) { return isCompatibleWith(right); } @@ -1658,7 +1704,7 @@ } /** * Call this before descending into type details to prevent infinite recursion. - * @return true if a recursion has already been started. + * @return true if a recursion was not already started. */ public boolean enterRecursiveFunction() { return true; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBindingVisitor.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBindingVisitor.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBindingVisitor.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBindingVisitor.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2013, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBound.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBound.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBound.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBound.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2013, 2015 GK Software AG and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2013, 2018 GK Software AG and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - initial API and implementation @@ -11,7 +14,6 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.lookup; -import org.eclipse.jdt.core.compiler.CharOperation; /** * Implementation of 18.1.3 in JLS8 @@ -38,7 +40,7 @@ TypeBound(InferenceVariable inferenceVariable, TypeBinding typeBinding, int relation, boolean isSoft) { this.left = inferenceVariable; - this.right = safeType(typeBinding); + this.right = typeBinding; if (((inferenceVariable.tagBits | this.right.tagBits) & TagBits.AnnotationNullMASK) != 0) { if ((inferenceVariable.tagBits & TagBits.AnnotationNullMASK) == (this.right.tagBits & TagBits.AnnotationNullMASK)) { // strip off identical nullness on both sides: @@ -58,30 +60,18 @@ this.relation = relation; this.isSoft = isSoft; } - - private TypeBinding safeType(TypeBinding type) { - if (type != null && type.isLocalType()) { - MethodBinding enclosingMethod = ((LocalTypeBinding) type.original()).enclosingMethod; - if (enclosingMethod != null && CharOperation.prefixEquals(TypeConstants.ANONYMOUS_METHOD, enclosingMethod.selector)) { - // don't use local class inside lambda: lambda is copied, type will be re-created and thus is unmatchable - if (type.superclass().id == TypeIds.T_JavaLangObject && type.superInterfaces().length > 0) - return type.superInterfaces()[0]; - return type.superclass(); - } - } - return type; - } - /** distinguish bounds from dependencies. */ boolean isBound() { return this.right.isProperType(true); } + @Override public int hashCode() { return this.left.hashCode() + this.right.hashCode() + this.relation; } + @Override public boolean equals(Object obj) { if (obj instanceof TypeBound) { TypeBound other = (TypeBound) obj; @@ -91,6 +81,7 @@ } // debugging: + @Override public String toString() { boolean isBound = this.right.isProperType(true); StringBuffer buf = new StringBuffer(); diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -21,6 +24,7 @@ * Jesper S Moller - Contributions for * Bug 405066 - [1.8][compiler][codegen] Implement code generation infrastructure for JSR335 * Bug 412153 - [1.8][compiler] Check validity of annotations which may be repeatable + * bug 527554 - [18.3] Compiler support for JEP 286 Local-Variable Type * Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for * Bug 405104 - [1.8][compiler][codegen] Implement support for serializeable lambdas * Ulrich Grave - Contributions for @@ -104,6 +108,9 @@ char[] LAMBDA_TYPE = "".toCharArray(); //$NON-NLS-1$ char[] UPPER_MODULE = "MODULE".toCharArray(); //$NON-NLS-1$ + // JEP 286 + char[] VAR = "var".toCharArray(); //$NON-NLS-1$ + // jsr308 char[] TYPE_USE_TARGET = "TYPE_USE".toCharArray(); //$NON-NLS-1$ char[] TYPE_PARAMETER_TARGET = "TYPE_PARAMETER".toCharArray(); //$NON-NLS-1$ @@ -293,8 +300,12 @@ "CharArrayWriter".toCharArray(), //$NON-NLS-1$ "StringBufferInputStream".toCharArray(), //$NON-NLS-1$ }; - char[][] RESOURCE_FREE_CLOSEABLE_STREAM = new char[][] { - JAVA, UTIL, "stream".toCharArray(), "Stream".toCharArray() //$NON-NLS-1$ //$NON-NLS-2$ + char[][] JAVA_UTIL_STREAM = { JAVA, UTIL, "stream".toCharArray() }; //$NON-NLS-1$ + char[][] RESOURCE_FREE_CLOSEABLE_J_U_STREAMS = { + "Stream".toCharArray(), //$NON-NLS-1$ + "DoubleStream".toCharArray(), //$NON-NLS-1$ + "LongStream".toCharArray(), //$NON-NLS-1$ + "IntStream".toCharArray() //$NON-NLS-1$ }; // different assertion utilities: @@ -477,4 +488,5 @@ // java.base module name char[] JAVA_BASE = "java.base".toCharArray(); //$NON-NLS-1$ String META_INF_MANIFEST_MF = "META-INF/MANIFEST.MF"; //$NON-NLS-1$ + String AUTOMATIC_MODULE_NAME = "Automatic-Module-Name"; //$NON-NLS-1$ } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2015 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2013, 2015 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2013, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -105,6 +108,7 @@ } } } + @Override public boolean equals(Object other) { PTBKey that = (PTBKey) other; // homogeneous container. return this.type == that.type && this.enclosingType == that.enclosingType && Util.effectivelyEqual(this.arguments, that.arguments); //$IDENTITY-COMPARISON$ @@ -115,6 +119,7 @@ } return b.hashCode(); } + @Override public int hashCode() { final int prime=31; int hashCode = 1 + hash(this.type) + (this.enclosingType != null ? hash(this.enclosingType) : 0); @@ -335,6 +340,9 @@ they may and we need to materialize the unannotated versions and work on them. */ public RawTypeBinding getRawType(ReferenceBinding genericType, ReferenceBinding enclosingType) { + if (!genericType.hasEnclosingInstanceContext() && enclosingType != null) { + enclosingType = (ReferenceBinding) enclosingType.original(); + } ReferenceBinding unannotatedGenericType = (ReferenceBinding) getUnannotatedType(genericType); ReferenceBinding unannotatedEnclosingType = enclosingType == null ? null : (ReferenceBinding) getUnannotatedType(enclosingType); @@ -382,7 +390,7 @@ } TypeBinding unannotatedBound = bound == null ? null : getUnannotatedType(bound); - boolean useDerivedTypesOfBound = unannotatedBound instanceof TypeVariableBinding || unannotatedBound instanceof ParameterizedTypeBinding; + boolean useDerivedTypesOfBound = unannotatedBound instanceof TypeVariableBinding || (unannotatedBound instanceof ParameterizedTypeBinding && !(unannotatedBound instanceof RawTypeBinding)); TypeBinding[] derivedTypes = this.types[useDerivedTypesOfBound ? unannotatedBound.id :unannotatedGenericType.id]; // by construction, cachedInfo != null now. int i, length = derivedTypes.length; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,10 +1,13 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ * + * SPDX-License-Identifier: EPL-2.0 + * * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann - Contributions for @@ -34,6 +37,8 @@ * Bug 456487 - [1.8][null] @Nullable type variant of @NonNull-constrained type parameter causes grief * Bug 462790 - [null] NPE in Expression.computeConversion() * Bug 456532 - [1.8][null] ReferenceBinding.appendNullAnnotation() includes phantom annotations in error messages + * Jesper S Møller - Contributions for bug 381345 : [1.8] Take care of the Java 8 major version + * Bug 527554 - [18.3] Compiler support for JEP 286 Local-Variable Type *******************************************************************************/ package org.eclipse.jdt.internal.compiler.lookup; @@ -315,6 +320,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#canBeInstantiated() */ + @Override public boolean canBeInstantiated() { return false; } @@ -326,6 +332,7 @@ * A = F corresponds to: F.collectSubstitutes(..., A, ..., CONSTRAINT_EQUAL (0)) * A >> F corresponds to: F.collectSubstitutes(..., A, ..., CONSTRAINT_SUPER (2)) */ + @Override public void collectSubstitutes(Scope scope, TypeBinding actualType, InferenceContext inferenceContext, int constraint) { // only infer for type params of the generic method @@ -366,6 +373,7 @@ * p.X { ... } --> Lp/X;:TT; * p.X { void foo() {...} } --> Lp/X;.foo()V:TT; */ + @Override public char[] computeUniqueKey(boolean isLeaf) { StringBuffer buffer = new StringBuffer(); Binding declaring = this.declaringElement; @@ -393,6 +401,7 @@ buffer.getChars(0, length, uniqueKey, 0); return uniqueKey; } + @Override public char[] constantPoolName() { /* java/lang/Object */ if (this.firstBound != null) { return this.firstBound.constantPoolName(); @@ -400,9 +409,11 @@ return this.superclass.constantPoolName(); // java/lang/Object } + @Override public TypeBinding clone(TypeBinding enclosingType) { return new TypeVariableBinding(this); } + @Override public String annotatedDebugName() { StringBuffer buffer = new StringBuffer(10); buffer.append(super.annotatedDebugName()); @@ -432,11 +443,13 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#debugName() */ + @Override public String debugName() { if (this.hasTypeAnnotations()) return super.annotatedDebugName(); return new String(this.sourceName); } + @Override public TypeBinding erasure() { if (this.firstBound != null) { return this.firstBound.erasure(); @@ -467,6 +480,7 @@ * T::Ljava/util/Map;:Ljava/io/Serializable; * T:LY */ + @Override public char[] genericTypeSignature() { if (this.genericTypeSignature != null) return this.genericTypeSignature; return this.genericTypeSignature = CharOperation.concat('T', this.sourceName, ';'); @@ -501,6 +515,7 @@ return true; } + @Override public boolean hasTypeBit(int bit) { if (this.typeBits == TypeIds.BitUninitialized) { // initialize from bounds @@ -528,6 +543,7 @@ return false; } + @Override public boolean isHierarchyConnected() { return (this.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0; } @@ -558,16 +574,16 @@ } @Override - public boolean isSubtypeOf(TypeBinding other) { + public boolean isSubtypeOf(TypeBinding other, boolean simulatingBugJDK8026527) { if (isSubTypeOfRTL(other)) return true; - if (this.firstBound != null && this.firstBound.isSubtypeOf(other)) + if (this.firstBound != null && this.firstBound.isSubtypeOf(other, simulatingBugJDK8026527)) return true; - if (this.superclass != null && this.superclass.isSubtypeOf(other)) + if (this.superclass != null && this.superclass.isSubtypeOf(other, simulatingBugJDK8026527)) return true; if (this.superInterfaces != null) for (int i = 0, l = this.superInterfaces.length; i < l; i++) - if (this.superInterfaces[i].isSubtypeOf(other)) + if (this.superInterfaces[i].isSubtypeOf(other, false)) return true; return other.id == TypeIds.T_JavaLangObject; } @@ -586,7 +602,21 @@ public void exitRecursiveFunction() { this.inRecursiveFunction = false; } + + // to prevent infinite recursion when inspecting recursive generics: + boolean inRecursiveProjectionFunction = false; + public boolean enterRecursiveProjectionFunction() { + if (this.inRecursiveProjectionFunction) + return false; + this.inRecursiveProjectionFunction = true; + return true; + } + public void exitRecursiveProjectionFunction() { + this.inRecursiveProjectionFunction = false; + } + + @Override public boolean isProperType(boolean admitCapture18) { // handle recursive calls: if (this.inRecursiveFunction) // be optimistic, since this node is not an inference variable @@ -608,6 +638,7 @@ } } + @Override TypeBinding substituteInferenceVariable(InferenceVariable var, TypeBinding substituteType) { if (this.inRecursiveFunction) return this; this.inRecursiveFunction = true; @@ -652,6 +683,7 @@ /** * Returns true if the type was declared as a type variable */ + @Override public boolean isTypeVariable() { return true; } @@ -677,10 +709,12 @@ // return this; // } + @Override public int kind() { return Binding.TYPE_PARAMETER; } + @Override public boolean mentionsAny(TypeBinding[] parameters, int idx) { if (this.inRecursiveFunction) return false; // nothing seen @@ -701,6 +735,7 @@ } } + @Override void collectInferenceVariables(Set variables) { if (this.inRecursiveFunction) return; // nothing seen @@ -734,7 +769,8 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#readableName() */ - public char[] readableName() { + @Override + public char[] readableName() { return this.sourceName; } ReferenceBinding resolve() { @@ -794,6 +830,7 @@ return this; } + @Override public void setTypeAnnotations(AnnotationBinding[] annotations, boolean evalNullAnnotations) { if (getClass() == TypeVariableBinding.class) { // TVB only: if the declaration itself carries type annotations, @@ -808,13 +845,16 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#shortReadableName() */ - public char[] shortReadableName() { + @Override + public char[] shortReadableName() { return readableName(); } + @Override public ReferenceBinding superclass() { return this.superclass; } + @Override public ReferenceBinding[] superInterfaces() { return this.superInterfaces; } @@ -822,6 +862,7 @@ /** * @see java.lang.Object#toString() */ + @Override public String toString() { if (this.hasTypeAnnotations()) return annotatedDebugName(); @@ -877,6 +918,7 @@ return readableName; } + @Override protected void appendNullAnnotation(StringBuffer nameBuffer, CompilerOptions options) { int oldSize = nameBuffer.length(); super.appendNullAnnotation(nameBuffer, options); @@ -898,6 +940,7 @@ } } + @Override public TypeBinding unannotated() { return this.hasTypeAnnotations() ? this.environment.getUnannotatedType(this) : this; } @@ -1064,6 +1107,7 @@ return (currentNullBits & ~declarationNullBits) != 0; } + @Override public boolean acceptsNonNullDefault() { return false; } @@ -1091,4 +1135,15 @@ && this.environment.globalOptions.pessimisticNullAnalysisForFreeTypeVariablesEnabled && (this.tagBits & TagBits.AnnotationNullMASK) == 0; } + + @Override + public ReferenceBinding upwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { + return this; + } + + @Override + public ReferenceBinding downwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) { + return this; + } + } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedAnnotationBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedAnnotationBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedAnnotationBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedAnnotationBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -19,6 +22,7 @@ this.env = env; } +@Override public void resolve() { // in place resolution. if (this.typeUnresolved) { // the type is resolved when requested boolean wasToleratingMissingTypeProcessingAnnotations = this.env.mayTolerateMissingType; @@ -32,11 +36,13 @@ this.typeUnresolved = false; } } +@Override public ReferenceBinding getAnnotationType() { resolve(); return this.type; } +@Override public ElementValuePair[] getElementValuePairs() { if (this.env != null) { if (this.typeUnresolved) { @@ -55,6 +61,13 @@ pair.setValue(((UnresolvedReferenceBinding) value). resolve(this.env, false)); // no parameterized types in annotation values + } else if (value instanceof Object[]) { + Object[] values = (Object[]) value; + for (int j = 0; j < values.length; j++) { + if (values[j] instanceof UnresolvedReferenceBinding) { + values[j] = ((UnresolvedReferenceBinding) values[j]).resolve(this.env, false); + } + } } // do nothing for UnresolvedAnnotationBinding-s, since their // content is only accessed through get* methods } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -39,6 +42,7 @@ this.prototype = prototype.prototype; } +@Override public TypeBinding clone(TypeBinding outerType) { if (this.resolvedType != null) return this.resolvedType.clone(outerType); @@ -62,23 +66,28 @@ this.wrappers[length] = wrapper; } } +@Override public boolean isUnresolvedType() { return true; } +@Override public String debugName() { return toString(); } +@Override public int depth() { // we don't yet have our enclosing types wired, but we know the nesting depth from our compoundName: // (NOTE: this an upper bound, because class names may contain '$') int last = this.compoundName.length-1; return CharOperation.occurencesOf('$', this.compoundName[last], 1); // leading '$' must be part of the class name, so start at 1. } +@Override public boolean hasTypeBit(int bit) { // shouldn't happen since we are not called before analyseCode(), but play safe: return false; } +@Override public TypeBinding prototype() { return this.prototype; } @@ -139,6 +148,7 @@ this.wrappers[i].swapUnresolved(this, targetType, environment); } +@Override public void swapUnresolved(UnresolvedReferenceBinding unresolvedType, ReferenceBinding unannotatedType, LookupEnvironment environment) { if (this.resolvedType != null) return; ReferenceBinding annotatedType = (ReferenceBinding) unannotatedType.clone(null); @@ -151,6 +161,7 @@ this.wrappers[i].swapUnresolved(this, annotatedType, environment); } +@Override public String toString() { if (this.hasTypeAnnotations()) return super.annotatedDebugName() + "(unresolved)"; //$NON-NLS-1$ diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2015 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -49,6 +52,7 @@ return constant(); } + @Override public abstract AnnotationBinding[] getAnnotations(); public final boolean isBlankFinal(){ @@ -81,12 +85,14 @@ && (this.type.tagBits & TagBits.AnnotationNullable) != 0); } + @Override public char[] readableName() { return this.name; } public void setConstant(Constant constant) { this.constant = constant; } + @Override public String toString() { StringBuffer output = new StringBuffer(10); ASTNode.printModifiers(this.modifiers, output); diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/VoidTypeBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/VoidTypeBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/VoidTypeBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/VoidTypeBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2013, 2014 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -19,14 +22,17 @@ super(TypeIds.T_void, TypeConstants.VOID, new char[] { 'V' }); } + @Override public TypeBinding clone(TypeBinding enclosingType) { return this; // enforce solitude. } + @Override public void setTypeAnnotations(AnnotationBinding[] annotations, boolean evalNullAnnotations) { return; // reject misguided attempt. } + @Override public TypeBinding unannotated() { return this; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2005, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -68,10 +71,12 @@ this.typeBits = TypeIds.BitUninitialized; } + @Override TypeBinding bound() { return this.bound; } + @Override int boundKind() { return this.boundKind; } @@ -209,14 +214,17 @@ } + @Override public ReferenceBinding actualType() { return this.genericType; } + @Override TypeBinding[] additionalBounds() { return this.otherBounds; } + @Override public int kind() { return this.otherBounds == null ? Binding.WILDCARD_TYPE : Binding.INTERSECTION_TYPE; } @@ -243,6 +251,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#canBeInstantiated() */ + @Override public boolean canBeInstantiated() { // cannot be asked per construction return false; @@ -251,6 +260,7 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#collectMissingTypes(java.util.List) */ + @Override public List collectMissingTypes(List missingTypes) { if ((this.tagBits & TagBits.HasMissingType) != 0) { missingTypes = this.bound.collectMissingTypes(missingTypes); @@ -266,6 +276,7 @@ * A = F corresponds to: F.collectSubstitutes(..., A, ..., CONSTRAINT_EQUAL (0)) * A >> F corresponds to: F.collectSubstitutes(..., A, ..., CONSTRAINT_SUPER (2)) */ + @Override public void collectSubstitutes(Scope scope, TypeBinding actualType, InferenceContext inferenceContext, int constraint) { if ((this.tagBits & TagBits.HasTypeVariable) == 0) return; @@ -506,6 +517,7 @@ * genericTypeKey {rank}*|+|- [boundKey] * p.X { X ... } --> Lp/X;{0}* */ + @Override public char[] computeUniqueKey(boolean isLeaf) { char[] genericTypeKey = this.genericType.computeUniqueKey(false/*not a leaf*/); char[] wildCardKey; @@ -530,14 +542,17 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#constantPoolName() */ + @Override public char[] constantPoolName() { return erasure().constantPoolName(); } + @Override public TypeBinding clone(TypeBinding immaterial) { return new WildcardBinding(this.genericType, this.rank, this.bound, this.otherBounds, this.boundKind, this.environment); } + @Override public String annotatedDebugName() { StringBuffer buffer = new StringBuffer(16); AnnotationBinding [] annotations = getTypeAnnotations(); @@ -563,14 +578,13 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#debugName() */ + @Override public String debugName() { return toString(); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#erasure() - */ - public TypeBinding erasure() { + @Override + public TypeBinding erasure() { if (this.otherBounds == null) { if (this.boundKind == Wildcard.EXTENDS) return this.bound.erasure(); @@ -585,10 +599,8 @@ : this.bound.erasure(); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#signature() - */ - public char[] genericTypeSignature() { + @Override + public char[] genericTypeSignature() { if (this.genericSignature == null) { switch (this.boundKind) { case Wildcard.UNBOUND : @@ -604,10 +616,12 @@ return this.genericSignature; } + @Override public int hashCode() { return this.genericType.hashCode(); } + @Override public boolean hasTypeBit(int bit) { if (this.typeBits == TypeIds.BitUninitialized) { // initialize from upper bounds @@ -644,7 +658,8 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#isSuperclassOf(org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding) */ - public boolean isSuperclassOf(ReferenceBinding otherType) { + @Override + public boolean isSuperclassOf(ReferenceBinding otherType) { if (this.boundKind == Wildcard.SUPER) { if (this.bound instanceof ReferenceBinding) { return ((ReferenceBinding) this.bound).isSuperclassOf(otherType); @@ -655,10 +670,8 @@ return false; } - /** - * Returns true if the current type denotes an intersection type: Number & Comparable - */ - public boolean isIntersectionType() { + @Override + public boolean isIntersectionType() { return this.otherBounds != null; } @@ -679,6 +692,7 @@ return null; } + @Override public boolean isHierarchyConnected() { return this.superclass != null && this.superInterfaces != null; } @@ -698,6 +712,7 @@ this.inRecursiveFunction = false; } + @Override public boolean isProperType(boolean admitCapture18) { if (this.inRecursiveFunction) return true; @@ -717,6 +732,7 @@ } } + @Override TypeBinding substituteInferenceVariable(InferenceVariable var, TypeBinding substituteType) { boolean haveSubstitution = false; TypeBinding currentBound = this.bound; @@ -748,28 +764,23 @@ return this; } - /** - * Returns true if the type is a wildcard - */ + @Override public boolean isUnboundWildcard() { return this.boundKind == Wildcard.UNBOUND; } - /** - * Returns true if the type is a wildcard - */ + @Override public boolean isWildcard() { return true; } + @Override int rank() { return this.rank; } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.lookup.Binding#readableName() - */ - public char[] readableName() { + @Override + public char[] readableName() { switch (this.boundKind) { case Wildcard.UNBOUND : return TypeConstants.WILDCARD_NAME; @@ -790,7 +801,8 @@ } } - public char[] nullAnnotatedReadableName(CompilerOptions options, boolean shortNames) { + @Override + public char[] nullAnnotatedReadableName(CompilerOptions options, boolean shortNames) { StringBuffer buffer = new StringBuffer(10); appendNullAnnotation(buffer, options); switch (this.boundKind) { @@ -848,10 +860,8 @@ return this; } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.lookup.Binding#shortReadableName() - */ - public char[] shortReadableName() { + @Override + public char[] shortReadableName() { switch (this.boundKind) { case Wildcard.UNBOUND : return TypeConstants.WILDCARD_NAME; @@ -875,7 +885,8 @@ /** * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#signature() */ - public char[] signature() { + @Override + public char[] signature() { // should not be called directly on a wildcard; signature should only be asked on // original methods or type erasures (which cannot denote wildcards at first level) if (this.signature == null) { @@ -889,10 +900,8 @@ return this.signature; } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#sourceName() - */ - public char[] sourceName() { + @Override + public char[] sourceName() { switch (this.boundKind) { case Wildcard.UNBOUND : return TypeConstants.WILDCARD_NAME; @@ -903,10 +912,8 @@ } } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding#superclass() - */ - public ReferenceBinding superclass() { + @Override + public ReferenceBinding superclass() { if (this.superclass == null) { TypeBinding superType = null; if (this.boundKind == Wildcard.EXTENDS && !this.bound.isInterface()) { @@ -923,10 +930,8 @@ return this.superclass; } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#superInterfaces() - */ - public ReferenceBinding[] superInterfaces() { + @Override + public ReferenceBinding[] superInterfaces() { if (this.superInterfaces == null) { if (typeVariable() != null) { this.superInterfaces = this.typeVariable.superInterfaces(); @@ -954,6 +959,7 @@ return this.superInterfaces; } + @Override public void swapUnresolved(UnresolvedReferenceBinding unresolvedType, ReferenceBinding resolvedType, LookupEnvironment env) { boolean affected = false; if (this.genericType == unresolvedType) { //$IDENTITY-COMPARISON$ @@ -979,6 +985,7 @@ /** * @see java.lang.Object#toString() */ + @Override public String toString() { if (this.hasTypeAnnotations()) return annotatedDebugName(); @@ -1009,6 +1016,7 @@ return this.typeVariable; } + @Override public TypeBinding unannotated() { return this.hasTypeAnnotations() ? this.environment.getUnannotatedType(this) : this; } @@ -1061,6 +1069,7 @@ return false; } + @Override public boolean acceptsNonNullDefault() { return false; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ ############################################################################### # Copyright (c) 2000, 2016 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 +# +# This program and the accompanying materials +# are made available under the terms of the Eclipse Public License 2.0 # which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html +# https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 # # Contributors: # IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -1613,6 +1616,7 @@ return null; } + @Override public String toString() { StringBuffer buffer = new StringBuffer(); int startPos = this.scanner.currentPosition clear the flag this.tagWaitingForDescription = NO_TAG_VALUE; @@ -814,6 +815,7 @@ /* * Push a throws type ref in ast node stack. */ + @Override protected boolean pushThrowName(Object typeRef) { if (this.astLengthPtr == -1) { // First push pushOnAstStack(null, true); @@ -840,9 +842,7 @@ return true; } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.AbstractCommentParser#refreshInlineTagPosition(int) - */ + @Override protected void refreshInlineTagPosition(int previousPosition) { // Signal tag missing description if necessary @@ -855,10 +855,12 @@ /* * Refresh return statement */ + @Override protected void refreshReturnStatement() { ((JavadocReturnStatement) this.returnStatement).bits &= ~ASTNode.Empty; } + @Override public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("check javadoc: ").append(this.checkDocComment).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -870,6 +872,7 @@ /* * Fill associated comment fields with ast nodes information stored in stack. */ + @Override protected void updateDocComment() { // Complain when tag is missing a description @@ -924,12 +927,12 @@ for (int i=0; i<=this.astLengthPtr; i++) { sizes[i%ORDERED_TAGS_NUMBER] += this.astLengthStack[i]; } - this.docComment.seeReferences = new Expression[sizes[SEE_TAG_EXPECTED_ORDER]]; - this.docComment.exceptionReferences = new TypeReference[sizes[THROWS_TAG_EXPECTED_ORDER]]; + this.docComment.seeReferences = sizes[SEE_TAG_EXPECTED_ORDER] > 0 ? new Expression[sizes[SEE_TAG_EXPECTED_ORDER]] : NO_EXPRESSION; + this.docComment.exceptionReferences = sizes[THROWS_TAG_EXPECTED_ORDER] > 0 ? new TypeReference[sizes[THROWS_TAG_EXPECTED_ORDER]] : NO_TYPE_REFERENCE; int paramRefPtr = sizes[PARAM_TAG_EXPECTED_ORDER]; - this.docComment.paramReferences = new JavadocSingleNameReference[paramRefPtr]; + this.docComment.paramReferences = paramRefPtr > 0 ? new JavadocSingleNameReference[paramRefPtr] : NO_SINGLE_NAME_REFERENCE; int paramTypeParamPtr = sizes[PARAM_TAG_EXPECTED_ORDER]; - this.docComment.paramTypeParameters = new JavadocSingleTypeReference[paramTypeParamPtr]; + this.docComment.paramTypeParameters = paramTypeParamPtr > 0 ? new JavadocSingleTypeReference[paramTypeParamPtr] : NO_SINGLE_TYPE_REFERENCE; // Store nodes in arrays while (this.astLengthPtr >= 0) { diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -150,6 +153,10 @@ // since 1.8 {}, // since 9 + {}, + // since 10 + {}, + // since 11 {} }; public static final char[][][] INLINE_TAGS = { @@ -172,6 +179,10 @@ // since 1.8 {}, // since 9 + {}, + // since 10 + {}, + // since 11 {} }; public final static int INLINE_TAGS_LENGTH = INLINE_TAGS.length; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/NLSTag.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/NLSTag.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/NLSTag.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/NLSTag.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -24,6 +27,7 @@ this.index = index; } + @Override public String toString() { return "NLSTag(" + this.start + "," + this.end + "," + this.lineNumber + ")"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$ } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2014 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -19,7 +22,8 @@ * bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression * bug 399695 - [1.8][compiler] [1.8][compiler] migrate parser to other syntax for default methods * bug 384567 - [1.5][compiler] Compiler accepts illegal modifiers on package declaration - * bug 393192 - Incomplete type hierarchy with > 10 annotations + * bug 393192 - Incomplete type hierarchy with > 10 annotations + * bug 527554 - [18.3] Compiler support for JEP 286 Local-Variable Type * Andy Clement - Contributions for * Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work) * Bug 409250 - [1.8][compiler] Various loose ends in 308 code generation @@ -54,6 +58,7 @@ import org.eclipse.jdt.internal.compiler.lookup.ClassScope; import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; import org.eclipse.jdt.internal.compiler.lookup.MethodScope; +import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; import org.eclipse.jdt.internal.compiler.lookup.TypeIds; import org.eclipse.jdt.internal.compiler.parser.diagnose.DiagnoseParser; import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; @@ -206,6 +211,8 @@ compliance = ClassFileConstants.JDK1_7; } else if("1.8".equals(token)) { //$NON-NLS-1$ compliance = ClassFileConstants.JDK1_8; + } else if("9".equals(token)) { //$NON-NLS-1$ + compliance = ClassFileConstants.JDK9; } else if("recovery".equals(token)) { //$NON-NLS-1$ compliance = ClassFileConstants.JDK_DEFERRED; } @@ -807,6 +814,10 @@ public static int tAction(int state, int sym) { return term_action[term_check[base_action[state]+sym] == sym ? base_action[state] + sym : base_action[state]]; } + /** Overridable hook, to allow CompletionParser to synthesize a few trailing tokens at (faked) EOF. */ + protected int actFromTokenOrSynthetic(int previousAct) { + return tAction(previousAct, this.currentToken); + } protected int astLengthPtr; protected int[] astLengthStack; @@ -3508,6 +3519,7 @@ final int annotationsLength = annotations.length; System.arraycopy(annotations, 0, declaration.annotations = new Annotation[annotationsLength], 0, annotationsLength); } + declaration.bits |= ASTNode.IsAdditionalDeclarator; } declaration.type = extendedDimensions == 0 ? type : augmentTypeWithAdditionalDimensions(type, extendedDimensions, annotationsOnExtendedDimensions, false); @@ -8713,6 +8725,9 @@ } else { referenceExpression.initialize(this.compilationUnit.compilationResult, getUnspecifiedReference(), typeArguments, selector, sourceEnd); } + if (CharOperation.equals(selector, TypeConstants.INIT) && referenceExpression.lhs instanceof NameReference) { + referenceExpression.lhs.bits &= ~Binding.VARIABLE; + } consumeReferenceExpression(referenceExpression); } protected void consumeReferenceExpressionPrimaryForm() { @@ -11340,12 +11355,7 @@ do { try { this.scanner.lookBack[0] = this.scanner.lookBack[1] = TokenNameNotAToken; // stay clear of the voodoo in the present method - this.nextIgnoredToken = this.scanner.getNextToken(); - if(this.scanner.currentPosition == this.scanner.startPosition){ - this.scanner.currentPosition++; // on fake completion identifier - this.nextIgnoredToken = -1; - } - + this.nextIgnoredToken = this.scanner.getNextNotFakedToken(); } catch(InvalidInputException e){ pos = this.scanner.currentPosition; } finally { @@ -11485,6 +11495,7 @@ this.astLengthStack[--this.astLengthPtr]++; } +@Override public boolean atConflictScenario(int token) { /* Answer true if the parser is at a configuration where the scanner must look ahead and help disambiguate between (a) '<' as an operator and '<' as the @@ -11555,7 +11566,7 @@ stackLength); } this.stack[this.stateStackTop] = act; - this.unstackedAct = act = tAction(act, this.currentToken); + this.unstackedAct = act = actFromTokenOrSynthetic(act); if (act == ERROR_ACTION || this.restartRecovery) { if (DEBUG_AUTOMATON) { if (this.restartRecovery) { @@ -12104,16 +12115,19 @@ // collect all body declaration inside the compilation unit except the default constructor final List bodyDeclarations = new ArrayList(); ASTVisitor visitor = new ASTVisitor() { + @Override public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) { if (!methodDeclaration.isDefaultConstructor()) { bodyDeclarations.add(methodDeclaration); } return false; } + @Override public boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope) { bodyDeclarations.add(fieldDeclaration); return false; } + @Override public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope scope) { bodyDeclarations.add(memberTypeDeclaration); return false; @@ -12554,9 +12568,11 @@ TypeDeclaration[] types = new TypeDeclaration[0]; int typePtr = -1; + @Override public void endVisit(ConstructorDeclaration constructorDeclaration, ClassScope scope) { endVisitMethod(constructorDeclaration, scope); } + @Override public void endVisit(Initializer initializer, MethodScope scope) { if (initializer.block == null) return; TypeDeclaration[] foundTypes = null; @@ -12583,6 +12599,7 @@ foundTypes[i].traverse(this.typeVisitor, scope); } } + @Override public void endVisit(MethodDeclaration methodDeclaration, ClassScope scope) { endVisitMethod(methodDeclaration, scope); } @@ -12611,15 +12628,18 @@ foundTypes[i].traverse(this.typeVisitor, scope); } } + @Override public boolean visit(ConstructorDeclaration constructorDeclaration, ClassScope scope) { this.typePtr = -1; return true; } + @Override public boolean visit(Initializer initializer, MethodScope scope) { this.typePtr = -1; if (initializer.block == null) return false; return true; } + @Override public boolean visit(MethodDeclaration methodDeclaration,ClassScope scope) { this.typePtr = -1; return true; @@ -12632,9 +12652,11 @@ this.types[this.typePtr] = typeDeclaration; return false; } + @Override public boolean visit(TypeDeclaration typeDeclaration, BlockScope scope) { return this.visit(typeDeclaration); } + @Override public boolean visit(TypeDeclaration typeDeclaration, ClassScope scope) { return this.visit(typeDeclaration); } @@ -12645,27 +12667,32 @@ TypeDeclaration[] types = new TypeDeclaration[0]; int typePtr = -1; + @Override public void endVisit(TypeDeclaration typeDeclaration, BlockScope scope) { endVisitType(); } + @Override public void endVisit(TypeDeclaration typeDeclaration, ClassScope scope) { endVisitType(); } private void endVisitType() { this.typePtr--; } + @Override public boolean visit(ConstructorDeclaration constructorDeclaration, ClassScope scope) { if(constructorDeclaration.isDefaultConstructor()) return false; constructorDeclaration.traverse(this.methodVisitor, scope); return false; } + @Override public boolean visit(Initializer initializer, MethodScope scope) { if (initializer.block == null) return false; this.methodVisitor.enclosingType = this.types[this.typePtr]; initializer.traverse(this.methodVisitor, scope); return false; } + @Override public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) { methodDeclaration.traverse(this.methodVisitor, scope); return false; @@ -12678,9 +12705,11 @@ this.types[this.typePtr] = typeDeclaration; return true; } + @Override public boolean visit(TypeDeclaration typeDeclaration, BlockScope scope) { return this.visit(typeDeclaration); } + @Override public boolean visit(TypeDeclaration typeDeclaration, ClassScope scope) { return this.visit(typeDeclaration); } @@ -12994,6 +13023,7 @@ if(enabled) this.options.performMethodsFullRecovery = true; this.options.performStatementsRecovery = enabled; } +@Override public String toString() { diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredAnnotation.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredAnnotation.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredAnnotation.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredAnnotation.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -42,6 +45,7 @@ this.sourceStart = sourceStart; } + @Override public RecoveredElement add(TypeDeclaration typeDeclaration, int bracketBalanceValue) { if (this.annotation == null && (typeDeclaration.bits & ASTNode.IsAnonymousType) != 0){ // ignore anonymous type in annotations when annotation isn't fully recovered @@ -50,6 +54,7 @@ return super.add(typeDeclaration, bracketBalanceValue); } + @Override public RecoveredElement addAnnotationName(int identPtr, int identLengthPtr, int annotationStart, int bracketBalanceValue) { RecoveredAnnotation element = new RecoveredAnnotation(identPtr, identLengthPtr, annotationStart, this, bracketBalanceValue); @@ -64,6 +69,7 @@ return this; } + @Override public void updateFromParserState() { Parser parser = parser(); @@ -180,10 +186,12 @@ } } + @Override public ASTNode parseTree() { return this.annotation; } + @Override public void resetPendingModifiers() { if (this.parent != null) this.parent.resetPendingModifiers(); } @@ -192,6 +200,7 @@ this.kind = kind; } + @Override public int sourceEnd() { if (this.annotation == null) { Parser parser = parser(); @@ -204,6 +213,7 @@ return this.annotation.declarationSourceEnd; } + @Override public String toString(int tab) { if (this.annotation != null) { return tabString(tab) + "Recovered annotation:\n" + this.annotation.print(tab + 1, new StringBuffer(10)); //$NON-NLS-1$ @@ -216,6 +226,7 @@ return this.annotation; } + @Override public RecoveredElement updateOnClosingBrace(int braceStart, int braceEnd){ if (this.bracketBalance > 0){ // was an member value array initializer this.bracketBalance--; @@ -227,6 +238,7 @@ return this; } + @Override public void updateParseTree() { updatedAnnotationReference(); } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2015 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 *Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -18,6 +21,7 @@ import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.Block; import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; +import org.eclipse.jdt.internal.compiler.ast.ForeachStatement; import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration; import org.eclipse.jdt.internal.compiler.ast.Statement; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; @@ -44,6 +48,7 @@ this.preserveContent = parser().methodRecoveryActivated || parser().statementRecoveryActivated; } +@Override public RecoveredElement add(AbstractMethodDeclaration methodDeclaration, int bracketBalanceValue) { if (this.parent != null && this.parent instanceof RecoveredMethod) { RecoveredMethod enclosingRecoveredMethod = (RecoveredMethod) this.parent; @@ -58,6 +63,7 @@ /* * Record a nested block declaration */ +@Override public RecoveredElement add(Block nestedBlockDeclaration, int bracketBalanceValue) { resetPendingModifiers(); @@ -85,6 +91,7 @@ /* * Record a local declaration */ +@Override public RecoveredElement add(LocalDeclaration localDeclaration, int bracketBalanceValue) { return this.add(localDeclaration, bracketBalanceValue, false); } @@ -144,6 +151,7 @@ /* * Record a statement declaration */ +@Override public RecoveredElement add(Statement stmt, int bracketBalanceValue) { return this.add(stmt, bracketBalanceValue, false); } @@ -165,12 +173,20 @@ RecoveredStatement element = new RecoveredStatement(stmt, this, bracketBalanceValue); attach(element); - if (stmt.sourceEnd == 0) return element; + if (!isEndKnown(stmt)) return element; return this; } +boolean isEndKnown(Statement stmt) { + if (stmt instanceof ForeachStatement) { + if (((ForeachStatement) stmt).action == null) + return false; + } + return stmt.sourceEnd != 0; +} /* * Addition of a type to an initializer (act like inside method body) */ +@Override public RecoveredElement add(TypeDeclaration typeDeclaration, int bracketBalanceValue) { return this.add(typeDeclaration, bracketBalanceValue, false); } @@ -201,6 +217,7 @@ if (typeDeclaration.declarationSourceEnd == 0) return element; return this; } +@Override public RecoveredElement addAnnotationName(int identifierPtr, int identifierLengthPtr, int annotationStart, int bracketBalanceValue) { if (this.pendingAnnotations == null) { this.pendingAnnotations = new RecoveredAnnotation[5]; @@ -222,6 +239,7 @@ return element; } +@Override public void addModifier(int flag, int modifiersSourceStart) { this.pendingModifiers |= flag; @@ -258,15 +276,18 @@ /* * Answer the associated parsed structure */ +@Override public ASTNode parseTree(){ return this.blockDeclaration; } +@Override public void resetPendingModifiers() { this.pendingAnnotations = null; this.pendingAnnotationCount = 0; this.pendingModifiers = 0; this.pendingModifersSourceStart = -1; } +@Override public String toString(int tab) { StringBuffer result = new StringBuffer(tabString(tab)); result.append("Recovered block:\n"); //$NON-NLS-1$ @@ -382,6 +403,7 @@ /* * Rebuild a statement from the nested structure which is in scope */ +@Override public Statement updatedStatement(int depth, Set knownTypes){ return updatedBlock(depth, knownTypes); @@ -390,6 +412,7 @@ * A closing brace got consumed, might have closed the current element, * in which case both the currentElement is exited */ +@Override public RecoveredElement updateOnClosingBrace(int braceStart, int braceEnd){ if ((--this.bracketBalance <= 0) && (this.parent != null)){ this.updateSourceEndIfNecessary(braceStart, braceEnd); @@ -411,6 +434,7 @@ * An opening brace got consumed, might be the expected opening one of the current element, * in which case the bodyStart is updated. */ +@Override public RecoveredElement updateOnOpeningBrace(int braceStart, int braceEnd){ // create a nested block @@ -421,6 +445,7 @@ /* * Final update the corresponding parse node */ +@Override public void updateParseTree(){ updatedBlock(0, new HashSet()); @@ -428,6 +453,7 @@ /* * Record a field declaration */ +@Override public RecoveredElement add(FieldDeclaration fieldDeclaration, int bracketBalanceValue) { resetPendingModifiers(); diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredElement.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredElement.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredElement.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredElement.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -282,6 +285,10 @@ public int sourceEnd(){ return 0; } +public int getLastStart() { + ASTNode parseTree = parseTree(); + return parseTree == null ? -1 : parseTree.sourceStart; +} protected String tabString(int tab) { StringBuffer result = new StringBuffer(); for (int i = tab; i > 0; i--) { @@ -299,6 +306,7 @@ } return current; } +@Override public String toString() { return toString(0); } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredExport.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredExport.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredExport.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredExport.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -51,15 +54,18 @@ /* * Answer the associated parsed structure */ + @Override public ASTNode parseTree(){ return this.exportReference; } /* * Answer the very source end of the corresponding parse node */ + @Override public int sourceEnd(){ return this.exportReference.declarationSourceEnd; } + @Override public String toString(int tab) { return tabString(tab) + "Recovered export: " + this.exportReference.toString(); //$NON-NLS-1$ } @@ -78,12 +84,14 @@ } return this.exportReference; } + @Override public void updateParseTree(){ updatedExportReference(); } /* * Update the declarationSourceEnd of the corresponding parse node */ + @Override public void updateSourceEndIfNecessary(int bodyStart, int bodyEnd){ if (this.exportReference.declarationSourceEnd == 0) { this.exportReference.declarationSourceEnd = bodyEnd; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredExportsStatement.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredExportsStatement.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredExportsStatement.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredExportsStatement.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -18,6 +21,7 @@ public RecoveredExportsStatement(ExportsStatement exportsStatement, RecoveredElement parent, int bracketBalance) { super(exportsStatement, parent, bracketBalance); } + @Override public String toString(int tab) { return tabString(tab) + "Recovered exports stmt: " + super.toString(); //$NON-NLS-1$ } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -53,6 +56,7 @@ /* * Record a local declaration */ +@Override public RecoveredElement add(LocalDeclaration localDeclaration, int bracketBalanceValue) { if (this.lambdaNestLevel > 0) // current element is really the lambda which is recovered in full elsewhere. return this; @@ -61,6 +65,7 @@ /* * Record a field declaration */ +@Override public RecoveredElement add(FieldDeclaration addedfieldDeclaration, int bracketBalanceValue) { /* default behavior is to delegate recording to parent if any */ @@ -82,6 +87,7 @@ * Record an expression statement if field is expecting an initialization expression, * used for completion inside field initializers. */ +@Override public RecoveredElement add(Statement statement, int bracketBalanceValue) { if (this.alreadyCompletedFieldInitialization || !(statement instanceof Expression)) { @@ -108,6 +114,7 @@ * and the type is an anonymous type. * Used for completion inside field initializers. */ +@Override public RecoveredElement add(TypeDeclaration typeDeclaration, int bracketBalanceValue) { if (this.alreadyCompletedFieldInitialization @@ -161,15 +168,18 @@ /* * Answer the associated parsed structure */ +@Override public ASTNode parseTree(){ return this.fieldDeclaration; } /* * Answer the very source end of the corresponding parse node */ +@Override public int sourceEnd(){ return this.fieldDeclaration.declarationSourceEnd; } +@Override public String toString(int tab){ StringBuffer buffer = new StringBuffer(tabString(tab)); buffer.append("Recovered field:\n"); //$NON-NLS-1$ @@ -281,6 +291,7 @@ * * Fields have no associated braces, thus if matches, then update parent. */ +@Override public RecoveredElement updateOnClosingBrace(int braceStart, int braceEnd){ if (this.bracketBalance > 0){ // was an array initializer this.bracketBalance--; @@ -307,6 +318,7 @@ * An opening brace got consumed, might be the expected opening one of the current element, * in which case the bodyStart is updated. */ +@Override public RecoveredElement updateOnOpeningBrace(int braceStart, int braceEnd){ if (this.fieldDeclaration.declarationSourceEnd == 0) { if (this.fieldDeclaration.type instanceof ArrayTypeReference || this.fieldDeclaration.type instanceof ArrayQualifiedTypeReference) { @@ -330,12 +342,14 @@ this.updateSourceEndIfNecessary(braceStart - 1, braceEnd - 1); return this.parent.updateOnOpeningBrace(braceStart, braceEnd); } +@Override public void updateParseTree(){ updatedFieldDeclaration(0, new HashSet()); } /* * Update the declarationSourceEnd of the corresponding parse node */ +@Override public void updateSourceEndIfNecessary(int bodyStart, int bodyEnd){ if (this.fieldDeclaration.declarationSourceEnd == 0) { this.fieldDeclaration.declarationSourceEnd = bodyEnd; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredImport.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredImport.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredImport.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredImport.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -26,15 +29,18 @@ /* * Answer the associated parsed structure */ +@Override public ASTNode parseTree(){ return this.importReference; } /* * Answer the very source end of the corresponding parse node */ +@Override public int sourceEnd(){ return this.importReference.declarationSourceEnd; } +@Override public String toString(int tab) { return tabString(tab) + "Recovered import: " + this.importReference.toString(); //$NON-NLS-1$ } @@ -42,12 +48,14 @@ return this.importReference; } +@Override public void updateParseTree(){ updatedImportReference(); } /* * Update the declarationSourceEnd of the corresponding parse node */ +@Override public void updateSourceEndIfNecessary(int bodyStart, int bodyEnd){ if (this.importReference.declarationSourceEnd == 0) { this.importReference.declarationSourceEnd = bodyEnd; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredInitializer.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredInitializer.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredInitializer.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredInitializer.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -45,6 +48,7 @@ /* * Record a nested block declaration */ +@Override public RecoveredElement add(Block nestedBlockDeclaration, int bracketBalanceValue) { /* default behavior is to delegate recording to parent if any, @@ -72,6 +76,7 @@ /* * Record a field declaration (act like inside method body) */ +@Override public RecoveredElement add(FieldDeclaration newFieldDeclaration, int bracketBalanceValue) { resetPendingModifiers(); @@ -101,6 +106,7 @@ /* * Record a local declaration - regular method should have been created a block body */ +@Override public RecoveredElement add(LocalDeclaration localDeclaration, int bracketBalanceValue) { /* do not consider a type starting passed the type end (if set) @@ -136,6 +142,7 @@ /* * Record a statement - regular method should have been created a block body */ +@Override public RecoveredElement add(Statement statement, int bracketBalanceValue) { /* do not consider a statement starting passed the initializer end (if set) @@ -162,6 +169,7 @@ return element.add(statement, bracketBalanceValue); } +@Override public RecoveredElement add(TypeDeclaration typeDeclaration, int bracketBalanceValue) { /* do not consider a type starting passed the type end (if set) @@ -219,6 +227,7 @@ } return element; } +@Override public RecoveredElement addAnnotationName(int identifierPtr, int identifierLengthPtr, int annotationStart, int bracketBalanceValue) { if (this.pendingAnnotations == null) { this.pendingAnnotations = new RecoveredAnnotation[5]; @@ -240,6 +249,7 @@ return element; } +@Override public void addModifier(int flag, int modifiersSourceStart) { this.pendingModifiers |= flag; @@ -247,12 +257,14 @@ this.pendingModifersSourceStart = modifiersSourceStart; } } +@Override public void resetPendingModifiers() { this.pendingAnnotations = null; this.pendingAnnotationCount = 0; this.pendingModifiers = 0; this.pendingModifersSourceStart = -1; } +@Override public String toString(int tab) { StringBuffer result = new StringBuffer(tabString(tab)); result.append("Recovered initializer:\n"); //$NON-NLS-1$ @@ -269,6 +281,7 @@ } return result.toString(); } +@Override public FieldDeclaration updatedFieldDeclaration(int depth, Set knownTypes){ if (this.initializerBody != null){ @@ -294,6 +307,7 @@ * A closing brace got consumed, might have closed the current element, * in which case both the currentElement is exited */ +@Override public RecoveredElement updateOnClosingBrace(int braceStart, int braceEnd){ if ((--this.bracketBalance <= 0) && (this.parent != null)){ this.updateSourceEndIfNecessary(braceStart, braceEnd); @@ -305,6 +319,7 @@ * An opening brace got consumed, might be the expected opening one of the current element, * in which case the bodyStart is updated. */ +@Override public RecoveredElement updateOnOpeningBrace(int braceStart, int braceEnd){ this.bracketBalance++; return this; // request to restart @@ -312,6 +327,7 @@ /* * Update the declarationSourceEnd of the corresponding parse node */ +@Override public void updateSourceEndIfNecessary(int braceStart, int braceEnd){ if (this.fieldDeclaration.declarationSourceEnd == 0) { Initializer initializer = (Initializer)this.fieldDeclaration; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -42,6 +45,7 @@ /* * Record an expression statement if local variable is expecting an initialization expression. */ +@Override public RecoveredElement add(Statement stmt, int bracketBalanceValue) { if (this.alreadyCompletedLocalInitialization || !(stmt instanceof Expression)) { @@ -80,18 +84,22 @@ /* * Answer the associated parsed structure */ +@Override public ASTNode parseTree(){ return this.localDeclaration; } /* * Answer the very source end of the corresponding parse node */ +@Override public int sourceEnd(){ return this.localDeclaration.declarationSourceEnd; } +@Override public String toString(int tab) { return tabString(tab) + "Recovered local variable:\n" + this.localDeclaration.print(tab + 1, new StringBuffer(10)); //$NON-NLS-1$ } +@Override public Statement updatedStatement(int depth, Set knownTypes){ /* update annotations */ if (this.modifiers != 0) { @@ -125,6 +133,7 @@ * * Fields have no associated braces, thus if matches, then update parent. */ +@Override public RecoveredElement updateOnClosingBrace(int braceStart, int braceEnd){ if (this.bracketBalance > 0){ // was an array initializer this.bracketBalance--; @@ -140,6 +149,7 @@ * An opening brace got consumed, might be the expected opening one of the current element, * in which case the bodyStart is updated. */ +@Override public RecoveredElement updateOnOpeningBrace(int braceStart, int braceEnd){ if (this.localDeclaration.declarationSourceEnd == 0 && (this.localDeclaration.type instanceof ArrayTypeReference || this.localDeclaration.type instanceof ArrayQualifiedTypeReference) @@ -151,12 +161,14 @@ this.updateSourceEndIfNecessary(braceStart - 1, braceEnd - 1); return this.parent.updateOnOpeningBrace(braceStart, braceEnd); } +@Override public void updateParseTree(){ updatedStatement(0, new HashSet()); } /* * Update the declarationSourceEnd of the corresponding parse node */ +@Override public void updateSourceEndIfNecessary(int bodyStart, int bodyEnd){ if (this.localDeclaration.declarationSourceEnd == 0) { this.localDeclaration.declarationSourceEnd = bodyEnd; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -72,6 +75,7 @@ /* * Record a nested block declaration */ +@Override public RecoveredElement add(Block nestedBlockDeclaration, int bracketBalanceValue) { return this.add(nestedBlockDeclaration, bracketBalanceValue, false); } @@ -107,6 +111,7 @@ /* * Record a field declaration */ +@Override public RecoveredElement add(FieldDeclaration fieldDeclaration, int bracketBalanceValue) { resetPendingModifiers(); @@ -147,6 +152,7 @@ /* * Record a local declaration - regular method should have been created a block body */ +@Override public RecoveredElement add(LocalDeclaration localDeclaration, int bracketBalanceValue) { resetPendingModifiers(); @@ -194,6 +200,7 @@ /* * Record a statement - regular method should have been created a block body */ +@Override public RecoveredElement add(Statement statement, int bracketBalanceValue) { resetPendingModifiers(); @@ -222,6 +229,7 @@ } return this.methodBody.add(statement, bracketBalanceValue, true); } +@Override public RecoveredElement add(TypeDeclaration typeDeclaration, int bracketBalanceValue) { /* do not consider a type starting passed the type end (if set) @@ -297,9 +305,11 @@ /* * Answer the associated parsed structure */ +@Override public ASTNode parseTree(){ return this.methodDeclaration; } +@Override public void resetPendingModifiers() { this.pendingAnnotations = null; this.pendingAnnotationCount = 0; @@ -309,9 +319,11 @@ /* * Answer the very source end of the corresponding parse node */ +@Override public int sourceEnd(){ return this.methodDeclaration.declarationSourceEnd; } +@Override public String toString(int tab) { StringBuffer result = new StringBuffer(tabString(tab)); result.append("Recovered method:\n"); //$NON-NLS-1$ @@ -337,6 +349,7 @@ /* * Update the bodyStart of the corresponding parse node */ +@Override public void updateBodyStart(int bodyStart){ this.foundOpeningBrace = true; this.methodDeclaration.bodyStart = bodyStart; @@ -416,6 +429,7 @@ * Update the corresponding parse node from parser state which * is about to disappear because of restarting recovery */ +@Override public void updateFromParserState(){ // if parent is null then recovery already occured in diet parser. if(bodyStartsAtHeaderEnd() && this.parent != null){ @@ -537,6 +551,7 @@ } } } +@Override public RecoveredElement updateOnClosingBrace(int braceStart, int braceEnd){ if(this.methodDeclaration.isAnnotationMethod()) { this.updateSourceEndIfNecessary(braceStart, braceEnd); @@ -560,6 +575,7 @@ * An opening brace got consumed, might be the expected opening one of the current element, * in which case the bodyStart is updated. */ +@Override public RecoveredElement updateOnOpeningBrace(int braceStart, int braceEnd){ /* in case the opening brace is close enough to the signature */ @@ -579,12 +595,14 @@ } return super.updateOnOpeningBrace(braceStart, braceEnd); } +@Override public void updateParseTree(){ updatedMethodDeclaration(0, new HashSet()); } /* * Update the declarationSourceEnd of the corresponding parse node */ +@Override public void updateSourceEndIfNecessary(int braceStart, int braceEnd){ if (this.methodDeclaration.declarationSourceEnd == 0) { if(parser().rBraceSuccessorStart >= braceEnd) { @@ -596,6 +614,7 @@ } } } +@Override public RecoveredElement addAnnotationName(int identifierPtr, int identifierLengthPtr, int annotationStart, int bracketBalanceValue) { if (this.pendingAnnotations == null) { this.pendingAnnotations = new RecoveredAnnotation[5]; @@ -617,6 +636,7 @@ return element; } +@Override public void addModifier(int flag, int modifiersSourceStart) { this.pendingModifiers |= flag; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredModule.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredModule.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredModule.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredModule.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2016, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -38,6 +41,7 @@ super(parent, bracketBalance); this.moduleDeclaration = moduleDeclaration; } + @Override public RecoveredElement add(ModuleStatement moduleStatement, int bracketBalanceValue) { // TODO: can't we do away with all these additions except for ProvidesStatement - to check @@ -160,6 +164,7 @@ RecoveredUsesStatement element = new RecoveredUsesStatement(usesStatement, this, bracketBalanceValue); this.uses[this.usesCount++] = element; } + @Override public String toString(int tab) { StringBuffer result = new StringBuffer(tabString(tab)); result.append("Recovered module:\n"); //$NON-NLS-1$ @@ -277,6 +282,7 @@ mod.servicesCount = actualCount; } } + @Override public void updateParseTree(){ updatedModuleDeclaration(); } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredModuleReference.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredModuleReference.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredModuleReference.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredModuleReference.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -24,15 +27,18 @@ /* * Answer the associated parsed structure */ +@Override public ASTNode parseTree(){ return this.moduleReference; } /* * Answer the very source end of the corresponding parse node */ +@Override public int sourceEnd(){ return this.moduleReference.sourceEnd; } +@Override public String toString(int tab) { return tabString(tab) + "Recovered ModuleReference: " + this.moduleReference.toString(); //$NON-NLS-1$ } @@ -40,6 +46,7 @@ return this.moduleReference; } +@Override public void updateParseTree(){ updatedModuleReference(); } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredModuleStatement.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredModuleStatement.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredModuleStatement.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredModuleStatement.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -25,27 +28,32 @@ /* * Answer the associated parsed structure */ + @Override public ASTNode parseTree(){ return this.moduleStatement; } /* * Answer the very source end of the corresponding parse node */ + @Override public int sourceEnd(){ return this.moduleStatement.declarationSourceEnd; } + @Override public String toString(int tab) { return this.moduleStatement.toString(); } protected ModuleStatement updatedModuleStatement(){ return this.moduleStatement; } + @Override public void updateParseTree(){ updatedModuleStatement(); } /* * Update the declarationSourceEnd of the corresponding parse node */ + @Override public void updateSourceEndIfNecessary(int bodyStart, int bodyEnd){ if (this.moduleStatement.declarationSourceEnd == 0) { this.moduleStatement.declarationSourceEnd = bodyEnd; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredOpensStatement.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredOpensStatement.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredOpensStatement.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredOpensStatement.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -18,6 +21,7 @@ public RecoveredOpensStatement(OpensStatement opensStatement, RecoveredElement parent, int bracketBalance) { super(opensStatement, parent, bracketBalance); } + @Override public String toString(int tab) { return tabString(tab) + "Recovered opens stmt: " + super.toString(); //$NON-NLS-1$ } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredPackageVisibilityStatement.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredPackageVisibilityStatement.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredPackageVisibilityStatement.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredPackageVisibilityStatement.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -25,6 +28,7 @@ public RecoveredPackageVisibilityStatement(PackageVisibilityStatement pvs, RecoveredElement parent, int bracketBalance) { super(pvs, parent, bracketBalance); } + @Override public RecoveredElement add(ImportReference pkgRef1, int bracketBalance1) { this.pkgRef = new RecoveredImport(pkgRef1, this, bracketBalance1); return this; @@ -48,6 +52,7 @@ return this; } + @Override public String toString(int tab) { return super.toString(); } @@ -70,6 +75,7 @@ } return pvs; } + @Override public void updateParseTree(){ updatedPackageVisibilityStatement(); } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredProvidesStatement.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredProvidesStatement.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredProvidesStatement.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredProvidesStatement.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -26,6 +29,7 @@ return this; } + @Override public String toString(int tab) { return tabString(tab) + "Recovered Provides: " + super.toString(); //$NON-NLS-1$ } @@ -36,6 +40,7 @@ } return providesStatement; } + @Override public void updateParseTree(){ updatedProvidesStatement(); } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredRequiresStatement.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredRequiresStatement.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredRequiresStatement.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredRequiresStatement.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -18,6 +21,7 @@ public RecoveredRequiresStatement(RequiresStatement requiresStatement, RecoveredElement parent, int bracketBalance) { super(requiresStatement, parent, bracketBalance); } + @Override public String toString(int tab) { return tabString(tab) + "Recovered requires: " + super.toString(); //$NON-NLS-1$ } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredStatement.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredStatement.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredStatement.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredStatement.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2015 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -17,12 +20,15 @@ import java.util.Set; import org.eclipse.jdt.internal.compiler.ast.ASTNode; +import org.eclipse.jdt.internal.compiler.ast.Block; +import org.eclipse.jdt.internal.compiler.ast.ForeachStatement; import org.eclipse.jdt.internal.compiler.ast.Statement; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; public class RecoveredStatement extends RecoveredElement { public Statement statement; + RecoveredBlock nestedBlock; public RecoveredStatement(Statement statement, RecoveredElement parent, int bracketBalance){ super(parent, bracketBalance); @@ -32,31 +38,41 @@ /* * Answer the associated parsed structure */ +@Override public ASTNode parseTree() { return this.statement; } /* * Answer the very source end of the corresponding parse node */ +@Override public int sourceEnd(){ return this.statement.sourceEnd; } +@Override public String toString(int tab){ return tabString(tab) + "Recovered statement:\n" + this.statement.print(tab + 1, new StringBuffer(10)); //$NON-NLS-1$ } public Statement updatedStatement(int depth, Set knownTypes){ + if (this.nestedBlock != null) { + this.nestedBlock.updatedStatement(depth, knownTypes); + // block has already been assigned in its parent statement + } return this.statement; } +@Override public void updateParseTree(){ updatedStatement(0, new HashSet()); } /* * Update the declarationSourceEnd of the corresponding parse node */ +@Override public void updateSourceEndIfNecessary(int bodyStart, int bodyEnd){ if (this.statement.sourceEnd == 0) this.statement.sourceEnd = bodyEnd; } +@Override public RecoveredElement updateOnClosingBrace(int braceStart, int braceEnd){ if ((--this.bracketBalance <= 0) && (this.parent != null)){ this.updateSourceEndIfNecessary(braceStart, braceEnd); @@ -64,4 +80,34 @@ } return this; } +@Override +public RecoveredElement add(Block nestedBlockDeclaration, int bracketBalanceValue) { + if (this.statement instanceof ForeachStatement) { + ForeachStatement foreach = (ForeachStatement) this.statement; + + // see RecoveredBlock.add(Block, int): + resetPendingModifiers(); + + /* do not consider a nested block starting passed the block end (if set) + it must be belonging to an enclosing block */ + if (foreach.sourceEnd != 0 + && foreach.action != null // if action is unassigned then foreach.sourceEnd is not yet the real end. + && nestedBlockDeclaration.sourceStart > foreach.sourceEnd) { + return this.parent.add(nestedBlockDeclaration, bracketBalanceValue); + } + foreach.action = nestedBlockDeclaration; + + RecoveredBlock element = new RecoveredBlock(nestedBlockDeclaration, this, bracketBalanceValue); + + if(parser().statementRecoveryActivated) { + addBlockStatement(element); + } + this.nestedBlock = element; + + if (nestedBlockDeclaration.sourceEnd == 0) return element; + return this; + } else { + return super.add(nestedBlockDeclaration, bracketBalanceValue); + } +} } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -82,6 +85,7 @@ this.preserveContent = parser().methodRecoveryActivated || parser().statementRecoveryActivated; } +@Override public RecoveredElement add(AbstractMethodDeclaration methodDeclaration, int bracketBalanceValue) { /* do not consider a method starting passed the type end (if set) @@ -135,6 +139,7 @@ if (methodDeclaration.declarationSourceEnd == 0) return element; return this; } +@Override public RecoveredElement add(Block nestedBlockDeclaration,int bracketBalanceValue) { this.pendingTypeParameters = null; resetPendingModifiers(); @@ -145,6 +150,7 @@ } return this.add(new Initializer(nestedBlockDeclaration, mods), bracketBalanceValue); } +@Override public RecoveredElement add(FieldDeclaration fieldDeclaration, int bracketBalanceValue) { this.pendingTypeParameters = null; @@ -203,6 +209,7 @@ if (fieldDeclaration.declarationSourceEnd == 0) return element; return this; } +@Override public RecoveredElement add(TypeDeclaration memberTypeDeclaration, int bracketBalanceValue) { this.pendingTypeParameters = null; @@ -273,6 +280,7 @@ this.pendingTypeParameters = parameters; this.pendingTypeParametersStart = startPos; } +@Override public RecoveredElement addAnnotationName(int identifierPtr, int identifierLengthPtr, int annotationStart, int bracketBalanceValue) { if (this.pendingAnnotations == null) { this.pendingAnnotations = new RecoveredAnnotation[5]; @@ -294,6 +302,7 @@ return element; } +@Override public void addModifier(int flag, int modifiersSourceStart) { this.pendingModifiers |= flag; @@ -350,6 +359,7 @@ /* * Answer the enclosing type node, or null if none */ +@Override public RecoveredType enclosingType(){ RecoveredElement current = this.parent; while (current != null){ @@ -386,15 +396,44 @@ return lastMemberEnd; } +@Override +public int getLastStart() { + int lastMemberStart = this.typeDeclaration.bodyStart; + + if (this.fieldCount > 0) { + FieldDeclaration lastField = this.fields[this.fieldCount - 1].fieldDeclaration; + if (lastMemberStart < lastField.declarationSourceStart && lastField.declarationSourceStart != 0) { + lastMemberStart = lastField.declarationSourceStart; + } + } + + if (this.methodCount > 0) { + AbstractMethodDeclaration lastMethod = this.methods[this.methodCount - 1].methodDeclaration; + if (lastMemberStart < lastMethod.declarationSourceStart && lastMethod.declarationSourceStart != 0) { + lastMemberStart = lastMethod.declarationSourceStart; + } + } + + if (this.memberTypeCount > 0) { + TypeDeclaration lastType = this.memberTypes[this.memberTypeCount - 1].typeDeclaration; + if (lastMemberStart < lastType.declarationSourceStart && lastType.declarationSourceStart != 0) { + lastMemberStart = lastType.declarationSourceStart; + } + } + + return lastMemberStart; +} public char[] name(){ return this.typeDeclaration.name; } /* * Answer the associated parsed structure */ +@Override public ASTNode parseTree(){ return this.typeDeclaration; } +@Override public void resetPendingModifiers() { this.pendingAnnotations = null; this.pendingAnnotationCount = 0; @@ -404,9 +443,11 @@ /* * Answer the very source end of the corresponding parse node */ +@Override public int sourceEnd(){ return this.typeDeclaration.declarationSourceEnd; } +@Override public String toString(int tab) { StringBuffer result = new StringBuffer(tabString(tab)); result.append("Recovered type:\n"); //$NON-NLS-1$ @@ -444,10 +485,12 @@ /* * Update the bodyStart of the corresponding parse node */ +@Override public void updateBodyStart(int bodyStart){ this.foundOpeningBrace = true; this.typeDeclaration.bodyStart = bodyStart; } +@Override public Statement updatedStatement(int depth, Set knownTypes){ // ignore closed anonymous type @@ -669,6 +712,7 @@ * Update the corresponding parse node from parser state which * is about to disappear because of restarting recovery */ +@Override public void updateFromParserState(){ // anymous type and enum constant doesn't need to be updated @@ -726,6 +770,7 @@ * A closing brace got consumed, might have closed the current element, * in which case both the currentElement is exited */ +@Override public RecoveredElement updateOnClosingBrace(int braceStart, int braceEnd){ if ((--this.bracketBalance <= 0) && (this.parent != null)){ this.updateSourceEndIfNecessary(braceStart, braceEnd); @@ -738,6 +783,7 @@ * An opening brace got consumed, might be the expected opening one of the current element, * in which case the bodyStart is updated. */ +@Override public RecoveredElement updateOnOpeningBrace(int braceStart, int braceEnd){ /* in case the opening brace is not close enough to the signature, ignore it */ if (this.bracketBalance == 0){ @@ -777,12 +823,14 @@ } return super.updateOnOpeningBrace(braceStart, braceEnd); } +@Override public void updateParseTree(){ updatedTypeDeclaration(0, new HashSet()); } /* * Update the declarationSourceEnd of the corresponding parse node */ +@Override public void updateSourceEndIfNecessary(int start, int end){ if (this.typeDeclaration.declarationSourceEnd == 0){ this.bodyEnd = 0; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredTypeReference.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredTypeReference.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredTypeReference.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredTypeReference.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -25,6 +28,7 @@ /* * Answer the associated parsed structure */ + @Override public ASTNode parseTree(){ return this.typeReference; } @@ -34,12 +38,14 @@ /* * Answer the very source end of the corresponding parse node */ + @Override public String toString(int tab) { return tabString(tab) + "Recovered typereference: " + this.typeReference.toString(); //$NON-NLS-1$ } public TypeReference updatedImportReference(){ return this.typeReference; } + @Override public void updateParseTree(){ updatedImportReference(); } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -46,6 +49,7 @@ super(null, bracketBalance, parser); this.unitDeclaration = unitDeclaration; } +@Override public RecoveredElement addAnnotationName(int identifierPtr, int identifierLengthPtr, int annotationStart, int bracketBalanceValue) { if (this.pendingAnnotations == null) { this.pendingAnnotations = new RecoveredAnnotation[5]; @@ -67,6 +71,7 @@ return element; } +@Override public void addModifier(int flag, int modifiersSourceStart) { this.pendingModifiers |= flag; @@ -77,6 +82,7 @@ /* * Record a method declaration: should be attached to last type */ +@Override public RecoveredElement add(AbstractMethodDeclaration methodDeclaration, int bracketBalanceValue) { /* attach it to last type - if any */ @@ -115,6 +121,7 @@ /* * Record a field declaration: should be attached to last type */ +@Override public RecoveredElement add(FieldDeclaration fieldDeclaration, int bracketBalanceValue) { /* attach it to last type - if any */ @@ -134,6 +141,7 @@ return this.module != null ? this.module.add(exportReference, bracketBalanceValue) : null; } +@Override public RecoveredElement add(ImportReference importReference, int bracketBalanceValue) { resetPendingModifiers(); @@ -157,10 +165,12 @@ if (importReference.declarationSourceEnd == 0) return element; return this; } +@Override public RecoveredElement add(ModuleDeclaration moduleDeclaration, int bracketBalanceValue){ this.module = new RecoveredModule(moduleDeclaration, this, bracketBalanceValue); return this.module; } +@Override public RecoveredElement add(TypeDeclaration typeDeclaration, int bracketBalanceValue) { if ((typeDeclaration.bits & ASTNode.IsAnonymousType) != 0){ @@ -209,9 +219,11 @@ /* * Answer the associated parsed structure */ +@Override public ASTNode parseTree(){ return this.unitDeclaration; } +@Override public void resetPendingModifiers() { this.pendingAnnotations = null; this.pendingAnnotationCount = 0; @@ -221,9 +233,23 @@ /* * Answer the very source end of the corresponding parse node */ +@Override public int sourceEnd(){ return this.unitDeclaration.sourceEnd; } +@Override +public int getLastStart() { + int lastTypeStart = -1; + + if (this.typeCount > 0) { + TypeDeclaration lastType = this.types[this.typeCount - 1].typeDeclaration; + if (lastTypeStart < lastType.declarationSourceStart && lastType.declarationSourceStart != 0) { + lastTypeStart = lastType.declarationSourceStart; + } + } + return lastTypeStart; +} +@Override public String toString(int tab) { StringBuffer result = new StringBuffer(tabString(tab)); result.append("Recovered unit: [\n"); //$NON-NLS-1$ @@ -291,12 +317,14 @@ } return this.unitDeclaration; } +@Override public void updateParseTree(){ updatedCompilationUnitDeclaration(); } /* * Update the sourceEnd of the corresponding parse node */ +@Override public void updateSourceEndIfNecessary(int bodyStart, int bodyEnd){ if (this.unitDeclaration.sourceEnd == 0) this.unitDeclaration.sourceEnd = bodyEnd; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUsesStatement.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUsesStatement.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUsesStatement.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUsesStatement.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -18,12 +21,14 @@ public RecoveredUsesStatement(UsesStatement usesStatement, RecoveredElement parent, int bracketBalance) { super(usesStatement, parent, bracketBalance); } + @Override public String toString(int tab) { return tabString(tab) + "Recovered Uses: " + super.toString(); //$NON-NLS-1$ } public UsesStatement updatedUsesStatement(){ return (UsesStatement)this.moduleStatement; } + @Override public void updateParseTree(){ updatedUsesStatement(); } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveryScannerData.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveryScannerData.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveryScannerData.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveryScannerData.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2006, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveryScanner.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveryScanner.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveryScanner.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveryScanner.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2006, 2014 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -147,6 +150,7 @@ this.data.removedTokenUsed[this.data.removedTokensPtr] = false; } + @Override protected int getNextToken0() throws InvalidInputException { if(this.pendingTokensPtr > -1) { int pendingToken = this.pendingTokens[this.pendingTokensPtr--]; @@ -221,16 +225,19 @@ return currentToken; } + @Override public char[] getCurrentIdentifierSource() { if(this.fakeTokenSource != null) return this.fakeTokenSource; return super.getCurrentIdentifierSource(); } + @Override public char[] getCurrentTokenSourceString() { if(this.fakeTokenSource != null) return this.fakeTokenSource; return super.getCurrentTokenSourceString(); } + @Override public char[] getCurrentTokenSource() { if(this.fakeTokenSource != null) return this.fakeTokenSource; return super.getCurrentTokenSource(); diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2005, 2015 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2005, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -43,6 +46,7 @@ private static long[][][] Tables7; private static long[][][] Tables8; private static long[][][] Tables9; + private static long[][][] Tables11; public final static int MAX_OBVIOUS = 128; public final static int[] OBVIOUS_IDENT_CHAR_NATURES = new int[MAX_OBVIOUS]; @@ -144,95 +148,84 @@ static void initializeTable19() { Tables9 = initializeTables("unicode8"); //$NON-NLS-1$ } +static void initializeTableJava11() { + Tables11 = initializeTables("unicode10"); //$NON-NLS-1$ +} static long[][][] initializeTables(String unicode_path) { long[][][] tempTable = new long[2][][]; tempTable[START_INDEX] = new long[3][]; tempTable[PART_INDEX] = new long[4][]; - try { - DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/start0.rsc"))); //$NON-NLS-1$ + try (DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/start0.rsc")))) { //$NON-NLS-1$ long[] readValues = new long[1024]; for (int i = 0; i < 1024; i++) { readValues[i] = inputStream.readLong(); } - inputStream.close(); tempTable[START_INDEX][0] = readValues; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } - try { - DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/start1.rsc"))); //$NON-NLS-1$ + try (DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/start1.rsc")))) { //$NON-NLS-1$ long[] readValues = new long[1024]; for (int i = 0; i < 1024; i++) { readValues[i] = inputStream.readLong(); } - inputStream.close(); tempTable[START_INDEX][1] = readValues; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } - try { - DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/start2.rsc"))); //$NON-NLS-1$ + try (DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/start2.rsc")))) { //$NON-NLS-1$ long[] readValues = new long[1024]; for (int i = 0; i < 1024; i++) { readValues[i] = inputStream.readLong(); } - inputStream.close(); tempTable[START_INDEX][2] = readValues; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } - try { - DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/part0.rsc"))); //$NON-NLS-1$ + try (DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/part0.rsc")))) { //$NON-NLS-1$ long[] readValues = new long[1024]; for (int i = 0; i < 1024; i++) { readValues[i] = inputStream.readLong(); } - inputStream.close(); tempTable[PART_INDEX][0] = readValues; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } - try { - DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/part1.rsc"))); //$NON-NLS-1$ + try (DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/part1.rsc")))) { //$NON-NLS-1$ long[] readValues = new long[1024]; for (int i = 0; i < 1024; i++) { readValues[i] = inputStream.readLong(); } - inputStream.close(); tempTable[PART_INDEX][1] = readValues; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } - try { - DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/part2.rsc"))); //$NON-NLS-1$ + try (DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/part2.rsc")))) { //$NON-NLS-1$ long[] readValues = new long[1024]; for (int i = 0; i < 1024; i++) { readValues[i] = inputStream.readLong(); } - inputStream.close(); tempTable[PART_INDEX][2] = readValues; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } - try { - DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/part14.rsc"))); //$NON-NLS-1$ + try (DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/part14.rsc")))) { //$NON-NLS-1$ long[] readValues = new long[1024]; for (int i = 0; i < 1024; i++) { readValues[i] = inputStream.readLong(); } - inputStream.close(); tempTable[PART_INDEX][3] = readValues; } catch (FileNotFoundException e) { e.printStackTrace(); @@ -260,68 +253,50 @@ } return isJavaIdentifierPart(complianceLevel, (int) c); } +private static boolean isJavaIdentifierPart0(int codePoint, long[][][] tables) { + switch((codePoint & 0x1F0000) >> 16) { + case 0 : + return isBitSet(tables[PART_INDEX][0], codePoint & 0xFFFF); + case 1 : + return isBitSet(tables[PART_INDEX][1], codePoint & 0xFFFF); + case 2 : + return isBitSet(tables[PART_INDEX][2], codePoint & 0xFFFF); + case 14 : + return isBitSet(tables[PART_INDEX][3], codePoint & 0xFFFF); + } + return false; +} public static boolean isJavaIdentifierPart(long complianceLevel, int codePoint) { if (complianceLevel <= ClassFileConstants.JDK1_6) { if (Tables == null) { initializeTable(); } - switch((codePoint & 0x1F0000) >> 16) { - case 0 : - return isBitSet(Tables[PART_INDEX][0], codePoint & 0xFFFF); - case 1 : - return isBitSet(Tables[PART_INDEX][1], codePoint & 0xFFFF); - case 2 : - return isBitSet(Tables[PART_INDEX][2], codePoint & 0xFFFF); - case 14 : - return isBitSet(Tables[PART_INDEX][3], codePoint & 0xFFFF); - } + return isJavaIdentifierPart0(codePoint, Tables); } else if (complianceLevel <= ClassFileConstants.JDK1_7) { // java 7 supports Unicode 6 if (Tables7 == null) { initializeTable17(); } - switch((codePoint & 0x1F0000) >> 16) { - case 0 : - return isBitSet(Tables7[PART_INDEX][0], codePoint & 0xFFFF); - case 1 : - return isBitSet(Tables7[PART_INDEX][1], codePoint & 0xFFFF); - case 2 : - return isBitSet(Tables7[PART_INDEX][2], codePoint & 0xFFFF); - case 14 : - return isBitSet(Tables7[PART_INDEX][3], codePoint & 0xFFFF); - } + return isJavaIdentifierPart0(codePoint, Tables7); } else if (complianceLevel <= ClassFileConstants.JDK1_8) { // java 8 supports Unicode 6.2 if (Tables8 == null) { initializeTable18(); } - switch((codePoint & 0x1F0000) >> 16) { - case 0 : - return isBitSet(Tables8[PART_INDEX][0], codePoint & 0xFFFF); - case 1 : - return isBitSet(Tables8[PART_INDEX][1], codePoint & 0xFFFF); - case 2 : - return isBitSet(Tables8[PART_INDEX][2], codePoint & 0xFFFF); - case 14 : - return isBitSet(Tables8[PART_INDEX][3], codePoint & 0xFFFF); - } - } else { - // java 9 supports Unicode 8 + return isJavaIdentifierPart0(codePoint, Tables8); + } else if (complianceLevel <= ClassFileConstants.JDK10) { + // java 9/10 supports Unicode 8 if (Tables9 == null) { initializeTable19(); } - switch((codePoint & 0x1F0000) >> 16) { - case 0 : - return isBitSet(Tables9[PART_INDEX][0], codePoint & 0xFFFF); - case 1 : - return isBitSet(Tables9[PART_INDEX][1], codePoint & 0xFFFF); - case 2 : - return isBitSet(Tables9[PART_INDEX][2], codePoint & 0xFFFF); - case 14 : - return isBitSet(Tables9[PART_INDEX][3], codePoint & 0xFFFF); + return isJavaIdentifierPart0(codePoint, Tables9); + } else { + // java 11 supports Unicode 10 + if (Tables11 == null) { + initializeTableJava11(); } + return isJavaIdentifierPart0(codePoint, Tables11); } - return false; } public static boolean isJavaIdentifierPart(long complianceLevel, char high, char low) { return isJavaIdentifierPart(complianceLevel, toCodePoint(high, low)); @@ -341,60 +316,48 @@ public static boolean isJavaIdentifierStart(long complianceLevel, char high, char low) { return isJavaIdentifierStart(complianceLevel, toCodePoint(high, low)); } +private static boolean isJavaIdentifierStart0(int codePoint, long[][][] tables) { + switch((codePoint & 0x1F0000) >> 16) { + case 0 : + return isBitSet(tables[START_INDEX][0], codePoint & 0xFFFF); + case 1 : + return isBitSet(tables[START_INDEX][1], codePoint & 0xFFFF); + case 2 : + return isBitSet(tables[START_INDEX][2], codePoint & 0xFFFF); + } + return false; +} public static boolean isJavaIdentifierStart(long complianceLevel, int codePoint) { if (complianceLevel <= ClassFileConstants.JDK1_6) { if (Tables == null) { initializeTable(); } - switch((codePoint & 0x1F0000) >> 16) { - case 0 : - return isBitSet(Tables[START_INDEX][0], codePoint & 0xFFFF); - case 1 : - return isBitSet(Tables[START_INDEX][1], codePoint & 0xFFFF); - case 2 : - return isBitSet(Tables[START_INDEX][2], codePoint & 0xFFFF); - } + return isJavaIdentifierStart0(codePoint, Tables); } else if (complianceLevel <= ClassFileConstants.JDK1_7) { // java 7 supports Unicode 6 if (Tables7 == null) { initializeTable17(); } - switch((codePoint & 0x1F0000) >> 16) { - case 0 : - return isBitSet(Tables7[START_INDEX][0], codePoint & 0xFFFF); - case 1 : - return isBitSet(Tables7[START_INDEX][1], codePoint & 0xFFFF); - case 2 : - return isBitSet(Tables7[START_INDEX][2], codePoint & 0xFFFF); - } + return isJavaIdentifierStart0(codePoint, Tables7); } else if (complianceLevel <= ClassFileConstants.JDK1_8) { - // java 7 supports Unicode 6 + // java 8 supports Unicode 6.2 if (Tables8 == null) { initializeTable18(); } - switch((codePoint & 0x1F0000) >> 16) { - case 0 : - return isBitSet(Tables8[START_INDEX][0], codePoint & 0xFFFF); - case 1 : - return isBitSet(Tables8[START_INDEX][1], codePoint & 0xFFFF); - case 2 : - return isBitSet(Tables8[START_INDEX][2], codePoint & 0xFFFF); - } - } else { - // java 9 supports Unicode 7 + return isJavaIdentifierStart0(codePoint, Tables8); + } else if (complianceLevel <= ClassFileConstants.JDK10) { + // java 9/10 supports Unicode 8 if (Tables9 == null) { initializeTable19(); } - switch((codePoint & 0x1F0000) >> 16) { - case 0 : - return isBitSet(Tables9[START_INDEX][0], codePoint & 0xFFFF); - case 1 : - return isBitSet(Tables9[START_INDEX][1], codePoint & 0xFFFF); - case 2 : - return isBitSet(Tables9[START_INDEX][2], codePoint & 0xFFFF); + return isJavaIdentifierStart0(codePoint, Tables9); + } else { + // java 11 supports Unicode 10 + if (Tables11 == null) { + initializeTableJava11(); } + return isJavaIdentifierStart0(codePoint, Tables11); } - return false; } private static int toCodePoint(char high, char low) { return (high - Scanner.HIGH_SURROGATE_MIN_VALUE) * 0x400 + (low - Scanner.LOW_SURROGATE_MIN_VALUE) + 0x10000; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -81,7 +84,7 @@ public int[] commentStarts = new int[COMMENT_ARRAYS_SIZE]; public int[] commentTagStarts = new int[COMMENT_ARRAYS_SIZE]; public int commentPtr = -1; // no comment test with commentPtr value -1 - protected int lastCommentLinePosition = -1; + public int lastCommentLinePosition = -1; // task tag support public char[][] foundTaskTags = null; @@ -209,7 +212,7 @@ newEntry6 = 0; public boolean insideRecovery = false; int lookBack[] = new int[2]; // fall back to spring forward. - int nextToken = TokenNameNotAToken; // allows for one token push back, only the most recent token can be reliably ungotten. + protected int nextToken = TokenNameNotAToken; // allows for one token push back, only the most recent token can be reliably ungotten. private VanguardScanner vanguardScanner; private VanguardParser vanguardParser; ConflictedParser activeParser = null; @@ -2727,7 +2730,7 @@ if ((this.linePtr >= 0) && (this.lineEnds[this.linePtr] >= separatorPos)) return; int length = this.lineEnds.length; if (++this.linePtr >= length) - System.arraycopy(this.lineEnds, 0, this.lineEnds = new int[length + INCREMENT], 0, length); + System.arraycopy(this.lineEnds, 0, this.lineEnds = new int[2*length + INCREMENT], 0, length); this.lineEnds[this.linePtr] = separatorPos; // look-ahead for merged cr+lf try { @@ -2753,7 +2756,7 @@ if ((this.linePtr >= 0) && (this.lineEnds[this.linePtr] >= separatorPos)) return; int length = this.lineEnds.length; if (++this.linePtr >= length) - System.arraycopy(this.lineEnds, 0, this.lineEnds = new int[length + INCREMENT], 0, length); + System.arraycopy(this.lineEnds, 0, this.lineEnds = new int[2*length + INCREMENT], 0, length); this.lineEnds[this.linePtr] = separatorPos; } this.wasAcr = false; @@ -4061,6 +4064,7 @@ public final void setSource(CompilationResult compilationResult) { setSource(null, compilationResult); } +@Override public String toString() { if (this.startPosition == this.eofPosition) return "EOF\n\n" + new String(this.source); //$NON-NLS-1$ @@ -4429,6 +4433,7 @@ super (false /*comment*/, false /*whitespace*/, false /*nls*/, sourceLevel, complianceLevel, null/*taskTag*/, null/*taskPriorities*/, false /*taskCaseSensitive*/); } + @Override public int getNextToken() throws InvalidInputException { int token; if (this.nextToken != TokenNameNotAToken) { @@ -4604,6 +4609,7 @@ return FAILURE; } } + @Override public String toString() { return "\n\n\n----------------Scanner--------------\n" + this.scanner.toString(); //$NON-NLS-1$; } @@ -4620,6 +4626,7 @@ this.reportOnlyOneSyntaxError = false; } + @Override public void initializeScanner(){ this.scanner = new Scanner( false /*comment*/, @@ -4641,6 +4648,7 @@ this.scanner.setActiveParser(this); } + @Override public boolean isParsingModuleDeclaration() { return true; } @@ -4650,6 +4658,7 @@ this.scanner.resetTo(0, begin); goForCompilationUnit(); Goal goal = new Goal(TokenNamePLUS_PLUS, null, 0) { + @Override boolean hasBeenReached(int act, int token) { return token == TokenNameEOF; } @@ -4936,4 +4945,9 @@ } } } + +/** Overridable hook, to allow CompletionScanner to hide a faked identifier token. */ +protected int getNextNotFakedToken() throws InvalidInputException { + return getNextToken(); +} } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * * Contributors: Binary files /tmp/tmpCpEVOs/qHgB92XTMb/ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part0.rsc and /tmp/tmpCpEVOs/K2B7lLLRB9/ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part0.rsc differ Binary files /tmp/tmpCpEVOs/qHgB92XTMb/ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part14.rsc and /tmp/tmpCpEVOs/K2B7lLLRB9/ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part14.rsc differ Binary files /tmp/tmpCpEVOs/qHgB92XTMb/ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part1.rsc and /tmp/tmpCpEVOs/K2B7lLLRB9/ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part1.rsc differ diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part2.rsc ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part2.rsc --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part2.rsc 1970-01-01 00:00:00.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part2.rsc 2018-12-06 10:38:58.000000000 +0000 @@ -0,0 +1 @@ +ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ?ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ?ÿÿÿ \ No newline at end of file Binary files /tmp/tmpCpEVOs/qHgB92XTMb/ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start0.rsc and /tmp/tmpCpEVOs/K2B7lLLRB9/ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start0.rsc differ Binary files /tmp/tmpCpEVOs/qHgB92XTMb/ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start1.rsc and /tmp/tmpCpEVOs/K2B7lLLRB9/ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start1.rsc differ diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start2.rsc ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start2.rsc --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start2.rsc 1970-01-01 00:00:00.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start2.rsc 2018-12-06 10:38:58.000000000 +0000 @@ -0,0 +1 @@ +ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ?ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ?ÿÿÿ \ No newline at end of file diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortCompilation.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortCompilation.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortCompilation.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortCompilation.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -55,6 +58,7 @@ this.isSilent = isSilent; this.silentException = silentException; } + @Override public String getMessage() { String message = super.getMessage(); StringBuffer buffer = new StringBuffer(message == null ? Util.EMPTY_STRING : message); diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortCompilationUnit.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortCompilationUnit.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortCompilationUnit.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortCompilationUnit.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortMethod.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortMethod.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortMethod.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortMethod.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortType.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortType.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortType.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortType.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/DefaultProblemFactory.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/DefaultProblemFactory.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/DefaultProblemFactory.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/DefaultProblemFactory.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -62,6 +65,7 @@ * @param lineNumber int * @return CategorizedProblem */ +@Override public CategorizedProblem createProblem( char[] originatingFileName, int problemId, @@ -84,6 +88,7 @@ lineNumber, columnNumber); } +@Override public CategorizedProblem createProblem( char[] originatingFileName, int problemId, @@ -113,6 +118,7 @@ * Answer the locale used to retrieve the error messages * @return java.util.Locale */ +@Override public Locale getLocale() { return this.locale; } @@ -128,9 +134,11 @@ this.messageTemplates = loadMessageTemplates(locale); } } +@Override public final String getLocalizedMessage(int id, String[] problemArguments) { return getLocalizedMessage(id, 0, problemArguments); } +@Override public final String getLocalizedMessage(int id, int elaborationId, String[] problemArguments) { String rawMessage = (String) this.messageTemplates.get(keyFromID(id & IProblem.IgnoreCategoriesMask)); if (rawMessage == null) { @@ -194,8 +202,7 @@ } } - // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=120410 - return new String(output.toString()); + return output.toString(); } /** * @param problem CategorizedProblem diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/DefaultProblem.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/DefaultProblem.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/DefaultProblem.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/DefaultProblem.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -22,7 +25,7 @@ private int endPosition; private int line; public int column; - private int severity; + public int severity; private String[] arguments; private String message; @@ -53,6 +56,9 @@ this.line = line; this.column = column; } +public void reportError() { + // Do nothing by default +} public String errorReportSource(char[] unitSource) { //extra from the source the innacurate token @@ -107,16 +113,15 @@ } return errorBuffer.toString(); } -/** - * Answer back the original arguments recorded into the problem. - * @return java.lang.String[] - */ + +@Override public String[] getArguments() { return this.arguments; } /** * @see org.eclipse.jdt.core.compiler.CategorizedProblem#getCategoryID() */ +@Override public int getCategoryID() { return ProblemReporter.getProblemCategory(this.severity, this.id); } @@ -126,6 +131,7 @@ * @see org.eclipse.jdt.core.compiler.IProblem#getID() * @return int */ +@Override public int getID() { return this.id; } @@ -180,32 +186,24 @@ * Returns the marker type associated to this problem. * @see org.eclipse.jdt.core.compiler.CategorizedProblem#getMarkerType() */ +@Override public String getMarkerType() { return this.id == IProblem.Task ? MARKER_TYPE_TASK : MARKER_TYPE_PROBLEM; } -/** - * Answer a localized, human-readable message string which describes the problem. - * @return java.lang.String - */ +@Override public String getMessage() { return this.message; } -/** - * Answer the file name in which the problem was found. - * @return char[] - */ +@Override public char[] getOriginatingFileName() { return this.fileName; } -/** - * Answer the end position of the problem (inclusive), or -1 if unknown. - * @return int - */ +@Override public int getSourceEnd() { return this.endPosition; } @@ -216,17 +214,13 @@ public int getSourceColumnNumber() { return this.column; } -/** - * Answer the line number in source where the problem begins. - * @return int - */ + +@Override public int getSourceLineNumber() { return this.line; } -/** - * Answer the start position of the problem (inclusive), or -1 if unknown. - * @return int - */ + +@Override public int getSourceStart() { return this.startPosition; } @@ -235,6 +229,7 @@ * Helper method: checks the severity to see if the Error bit is set. * @return boolean */ +@Override public boolean isError() { return (this.severity & ProblemSeverities.Error) != 0; } @@ -243,10 +238,12 @@ * Helper method: checks the severity to see if the Error bit is not set. * @return boolean */ +@Override public boolean isWarning() { return (this.severity & ProblemSeverities.Error) == 0 && (this.severity & ProblemSeverities.Info) == 0; } +@Override public boolean isInfo() { return (this.severity & ProblemSeverities.Info) != 0; } @@ -255,35 +252,23 @@ this.fileName = fileName; } -/** - * Set the end position of the problem (inclusive), or -1 if unknown. - * - * Used for shifting problem positions. - * @param sourceEnd the new value of the sourceEnd of the receiver - */ +@Override public void setSourceEnd(int sourceEnd) { this.endPosition = sourceEnd; } -/** - * Set the line number in source where the problem begins. - * @param lineNumber the new value of the line number of the receiver - */ +@Override public void setSourceLineNumber(int lineNumber) { this.line = lineNumber; } -/** - * Set the start position of the problem (inclusive), or -1 if unknown. - * - * Used for shifting problem positions. - * @param sourceStart the new value of the source start position of the receiver - */ +@Override public void setSourceStart(int sourceStart) { this.startPosition = sourceStart; } +@Override public String toString() { String s = "Pb(" + (this.id & IProblem.IgnoreCategoriesMask) + ") "; //$NON-NLS-1$ //$NON-NLS-2$ if (this.message != null) { diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,13 @@ ############################################################################### # Copyright (c) 2000, 2018 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 +# +# This program and the accompanying materials +# are made available under the terms of the Eclipse Public License 2.0 # which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html +# https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# # # Contributors: # IBM Corporation - initial API and implementation @@ -48,6 +52,7 @@ # Bug 412153 - [1.8][compiler] Check validity of annotations which may be repeatable # Bug 412151 - [1.8][compiler] Check repeating annotation's collection type # Bug 419209 - [1.8] Repeating container annotations should be rejected in the presence of annotation it contains +# Bug 527554 - [18.3] Compiler support for JEP 286 Local-Variable Type ############################################################################### 0 = {0} 1 = super cannot be used in java.lang.Object @@ -809,6 +814,8 @@ 940 = Conflict between inherited null annotations ''@{0}'' declared in {1} versus ''@{2}'' declared in {3} 941 = Redundant null check: The field {0} cannot be null at this location (ignoring concurrency) 942 = Null comparison always yields false: The field {0} cannot be null at this location (ignoring concurrency) +943 = Nullness default is redundant with a default specified for the enclosing module {0} + 951 = Potential null pointer access: array element may be null 952 = Potential null pointer access: this expression has a ''@{0}'' type @@ -922,6 +929,15 @@ 1413 = The field {0}.{1} has been deprecated since version {2} and marked for removal 1414 = The method {0} overrides a method from {1} that has been deprecated since version {2} and marked for removal +1425 = The package {0} is deprecated +1426 = The package {0} is deprecated since version {1} +1427 = The package {0} has been deprecated and marked for removal +1428 = The package {0} has been deprecated since version {1} and marked for removal +1429 = The module {0} is deprecated +1430 = The module {0} is deprecated since version {1} +1431 = The module {0} has been deprecated and marked for removal +1432 = The module {0} has been deprecated since version {1} and marked for removal + 1450 = The type {0} is not accessible 1451 = The field {1}.{0} is not accessible 1452 = The method {1}({2}) from the type {0} is not accessible @@ -933,6 +949,22 @@ 1458 = The type {0} is not exported from this module 1459 = The type {0} from module {1} may not be accessible to clients due to missing ''requires transitive'' 1460 = Must declare a named package because this compilation unit is associated to the named module ''{0}'' +1461 = Name of automatic module ''{0}'' is unstable, it is derived from the module''s file name. + +# Local-Variable Type Inference +1500 = 'var' is not allowed in a compound declaration +1501 = 'var' is not allowed as an element type of an array +1502 = Declaration using 'var' may not contain references to itself +1503 = Cannot use 'var' on variable without initializer +1504 = Cannot infer type for local variable initialized to 'null' +1505 = Variable initializer is 'void' -- cannot infer variable type +1506 = Array initializer needs an explicit target-type +1507 = Lambda expression needs an explicit target-type +1508 = Method reference needs an explicit target-type +1509 = 'var' is not a valid type name +1510 = 'var' should not be used as an type name, since it is a reserved word from source level 10 on +1511 = 'var' is not allowed here +1512 = 'var' cannot be mixed with non-var parameters ### ELABORATIONS ## Access restrictions diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,10 +1,13 @@ /******************************************************************************* * Copyright (c) 2000, 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ * + * SPDX-License-Identifier: EPL-2.0 + * * Contributors: * IBM Corporation - initial API and implementation * Benjamin Muskalla - Contribution for bug 239066 @@ -69,6 +72,7 @@ * bug 419209 - [1.8] Repeating container annotations should be rejected in the presence of annotation it contains * Bug 429384 - [1.8][null] implement conformance rules for null-annotated lower / upper type bounds * Bug 416182 - [1.8][compiler][null] Contradictory null annotations not rejected + * bug 527554 - [18.3] Compiler support for JEP 286 Local-Variable Type * Ulrich Grave - Contributions for * bug 386692 - Missing "unused" warning on "autowired" fields ********************************************************************************/ @@ -246,11 +250,13 @@ case IProblem.UsingDeprecatedMethod : case IProblem.UsingDeprecatedConstructor : case IProblem.UsingDeprecatedField : + case IProblem.UsingDeprecatedModule : case IProblem.OverridingDeprecatedSinceVersionMethod : case IProblem.UsingDeprecatedSinceVersionType : case IProblem.UsingDeprecatedSinceVersionMethod : case IProblem.UsingDeprecatedSinceVersionConstructor : case IProblem.UsingDeprecatedSinceVersionField : + case IProblem.UsingDeprecatedSinceVersionModule : return CompilerOptions.UsingDeprecatedAPI; case IProblem.OverridingTerminallyDeprecatedMethod : @@ -258,11 +264,13 @@ case IProblem.UsingTerminallyDeprecatedMethod : case IProblem.UsingTerminallyDeprecatedConstructor : case IProblem.UsingTerminallyDeprecatedField : + case IProblem.UsingTerminallyDeprecatedModule : case IProblem.OverridingTerminallyDeprecatedSinceVersionMethod : case IProblem.UsingTerminallyDeprecatedSinceVersionType : case IProblem.UsingTerminallyDeprecatedSinceVersionMethod : case IProblem.UsingTerminallyDeprecatedSinceVersionConstructor : case IProblem.UsingTerminallyDeprecatedSinceVersionField : + case IProblem.UsingTerminallyDeprecatedSinceVersionModule : return CompilerOptions.UsingTerminallyDeprecatedAPI; case IProblem.LocalVariableIsNeverUsed : @@ -396,7 +404,6 @@ return CompilerOptions.VarargsArgumentNeedCast; case IProblem.NullLocalVariableReference: - case IProblem.NullableFieldReference: case IProblem.NullExpressionReference: case IProblem.NullUnboxing: return CompilerOptions.NullReference; @@ -404,6 +411,7 @@ case IProblem.PotentialNullLocalVariableReference: case IProblem.PotentialNullMessageSendReference: case IProblem.ArrayReferencePotentialNullReference: + case IProblem.NullableFieldReference: case IProblem.DereferencingNullableExpression: case IProblem.PotentialNullExpressionReference: case IProblem.PotentialNullUnboxing: @@ -450,6 +458,7 @@ case IProblem.ContradictoryNullAnnotationsOnBound: case IProblem.ContradictoryNullAnnotationsInferred: case IProblem.ContradictoryNullAnnotationsInferredFunctionType: + case IProblem.IllegalParameterNullityRedefinition: return CompilerOptions.NullSpecViolation; case IProblem.NullNotCompatibleToFreeTypeVariable: @@ -478,6 +487,7 @@ return CompilerOptions.NullUncheckedConversion; case IProblem.RedundantNullAnnotation: case IProblem.RedundantNullDefaultAnnotation: + case IProblem.RedundantNullDefaultAnnotationModule: case IProblem.RedundantNullDefaultAnnotationPackage: case IProblem.RedundantNullDefaultAnnotationType: case IProblem.RedundantNullDefaultAnnotationMethod: @@ -650,6 +660,8 @@ case IProblem.NotExportedTypeInAPI: case IProblem.MissingRequiresTransitiveForTypeInAPI: return CompilerOptions.APILeak; + case IProblem.UnstableAutoModuleName: + return CompilerOptions.UnstableAutoModuleName; } return 0; } @@ -712,6 +724,7 @@ case CompilerOptions.UnlikelyCollectionMethodArgumentType : case CompilerOptions.UnlikelyEqualsArgumentType: case CompilerOptions.APILeak: + case CompilerOptions.UnstableAutoModuleName: return CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM; case CompilerOptions.OverriddenPackageDefaultMethod : @@ -1556,6 +1569,7 @@ * when different from Ignore, severity can be coupled with ProblemSeverities.Optional * to indicate that this problem is configurable through options */ +@Override public int computeSeverity(int problemID){ switch (problemID) { @@ -1835,16 +1849,40 @@ nodeSourceEnd(null, location, index)); } } +public void deprecatedModule(ModuleReference moduleReference, ModuleBinding requiredModule) { + String sinceValue = deprecatedSinceValue(() -> requiredModule.getAnnotations()); + boolean isTerminally = (requiredModule.tagBits & TagBits.AnnotationTerminallyDeprecated) != 0; + if (sinceValue != null) { + String[] args = { String.valueOf(requiredModule.name()), sinceValue }; + handle( isTerminally ? IProblem.UsingTerminallyDeprecatedSinceVersionModule : IProblem.UsingDeprecatedSinceVersionModule, + args, + args, + moduleReference.sourceStart, + moduleReference.sourceEnd); + } else { + String[] args = { String.valueOf(requiredModule.name()) }; + handle( isTerminally ? IProblem.UsingTerminallyDeprecatedModule : IProblem.UsingDeprecatedModule, + args, + args, + moduleReference.sourceStart, + moduleReference.sourceEnd); + } +} String deprecatedSinceValue(Supplier annotations) { if (this.options != null && this.options.complianceLevel >= ClassFileConstants.JDK9) { - for (AnnotationBinding annotationBinding : annotations.get()) { - if (annotationBinding.getAnnotationType().id == TypeIds.T_JavaLangDeprecated) { - for (ElementValuePair elementValuePair : annotationBinding.getElementValuePairs()) { - if (CharOperation.equals(elementValuePair.getName(), TypeConstants.SINCE) && elementValuePair.value instanceof StringConstant) - return ((StringConstant) elementValuePair.value).stringValue(); + ReferenceContext contextSave = this.referenceContext; + try { + for (AnnotationBinding annotationBinding : annotations.get()) { + if (annotationBinding.getAnnotationType().id == TypeIds.T_JavaLangDeprecated) { + for (ElementValuePair elementValuePair : annotationBinding.getElementValuePairs()) { + if (CharOperation.equals(elementValuePair.getName(), TypeConstants.SINCE) && elementValuePair.value instanceof StringConstant) + return ((StringConstant) elementValuePair.value).stringValue(); + } + break; } - break; } + } finally { + this.referenceContext = contextSave; } } return null; @@ -8486,8 +8524,8 @@ nodeSourceStart(field, location), nodeSourceEnd(field, location)); } -public void uninitializedLocalVariable(LocalVariableBinding binding, ASTNode location) { - binding.tagBits |= TagBits.NotInitialized; +public void uninitializedLocalVariable(LocalVariableBinding binding, ASTNode location, Scope scope) { + binding.markAsUninitializedIn(scope); String[] arguments = new String[] {new String(binding.readableName())}; this.handle( methodHasMissingSwitchDefault() ? IProblem.UninitializedLocalVariableHintMissingDefault : IProblem.UninitializedLocalVariable, @@ -9334,6 +9372,111 @@ varDecl.sourceStart, varDecl.sourceEnd); } +public void varLocalMultipleDeclarators(AbstractVariableDeclaration varDecl) { + this.handle( + IProblem.VarLocalMultipleDeclarators, + NoArgument, + NoArgument, + varDecl.sourceStart, + varDecl.sourceEnd); +} +public void varLocalCannotBeArray(AbstractVariableDeclaration varDecl) { + this.handle( + IProblem.VarLocalCannotBeArray, + NoArgument, + NoArgument, + varDecl.sourceStart, + varDecl.sourceEnd); +} +public void varLocalReferencesItself(AbstractVariableDeclaration varDecl) { + this.handle( + IProblem.VarLocalReferencesItself, + NoArgument, + NoArgument, + varDecl.sourceStart, + varDecl.sourceEnd); +} +public void varLocalWithoutInitizalier(AbstractVariableDeclaration varDecl) { + this.handle( + IProblem.VarLocalWithoutInitizalier, + NoArgument, + NoArgument, + varDecl.sourceStart, + varDecl.sourceEnd); +} +public void varLocalInitializedToNull(AbstractVariableDeclaration varDecl) { + this.handle( + IProblem.VarLocalInitializedToNull, + NoArgument, + NoArgument, + varDecl.sourceStart, + varDecl.sourceEnd); +} +public void varLocalInitializedToVoid(AbstractVariableDeclaration varDecl) { + this.handle( + IProblem.VarLocalInitializedToVoid, + NoArgument, + NoArgument, + varDecl.sourceStart, + varDecl.sourceEnd); +} +public void varLocalCannotBeArrayInitalizers(AbstractVariableDeclaration varDecl) { + this.handle( + IProblem.VarLocalCannotBeArrayInitalizers, + NoArgument, + NoArgument, + varDecl.sourceStart, + varDecl.sourceEnd); +} +public void varLocalCannotBeLambda(AbstractVariableDeclaration varDecl) { + this.handle( + IProblem.VarLocalCannotBeLambda, + NoArgument, + NoArgument, + varDecl.sourceStart, + varDecl.sourceEnd); +} +public void varLocalCannotBeMethodReference(AbstractVariableDeclaration varDecl) { + this.handle( + IProblem.VarLocalCannotBeMethodReference, + NoArgument, + NoArgument, + varDecl.sourceStart, + varDecl.sourceEnd); +} +public void varIsReservedTypeName(TypeDeclaration decl) { + this.handle( + IProblem.VarIsReserved, + NoArgument, + NoArgument, + decl.sourceStart, + decl.sourceEnd); +} +public void varIsReservedTypeNameInFuture(ASTNode decl) { + this.handle( + IProblem.VarIsReservedInFuture, + NoArgument, + NoArgument, + ProblemSeverities.Warning, + decl.sourceStart, + decl.sourceEnd); +} +public void varIsNotAllowedHere(ASTNode astNode) { + this.handle( + IProblem.VarIsNotAllowedHere, + NoArgument, + NoArgument, + astNode.sourceStart, + astNode.sourceEnd); +} +public void varCannotBeMixedWithNonVarParams(ASTNode astNode) { + this.handle( + IProblem.VarCannotBeMixedWithNonVarParams, + NoArgument, + NoArgument, + astNode.sourceStart, + astNode.sourceEnd); +} public void variableTypeCannotBeVoidArray(AbstractVariableDeclaration varDecl) { this.handle( IProblem.CannotAllocateVoidArray, @@ -9969,7 +10112,9 @@ shortArgs = new String[] { new String(outer.shortReadableName()) }; } int problemId = IProblem.RedundantNullDefaultAnnotation; - if (outer instanceof PackageBinding) { + if (outer instanceof ModuleBinding) { + problemId = IProblem.RedundantNullDefaultAnnotationModule; + } else if (outer instanceof PackageBinding) { problemId = IProblem.RedundantNullDefaultAnnotationPackage; } else if (outer instanceof ReferenceBinding) { problemId = IProblem.RedundantNullDefaultAnnotationType; @@ -10088,7 +10233,8 @@ char[][] annotationNames = (nullAnnotationTagBit == TagBits.AnnotationNonNull) ? this.options.nonNullAnnotationName : this.options.nullableAnnotationName; - String[] args = new String[] { new String(annotationNames[annotationNames.length-1]), new String(type.getLastToken()) }; + String typeName = new String(type.resolvedType.leafComponentType().readableName()); // use the actual name (accounting for 'var') + String[] args = new String[] { new String(annotationNames[annotationNames.length-1]), typeName }; Annotation annotation = findAnnotation(annotations, typeBit); int start = annotation != null ? annotation.sourceStart : type.sourceStart; int end = annotation != null ? annotation.sourceEnd : type.sourceEnd; @@ -10155,7 +10301,7 @@ if (annotations != null) { // should have a @NonNull/@Nullable annotation, search for it: int length = annotations.length; - for (int j=0; j= 0; j--) { if (annotations[j].hasNullBit(typeBit)) { return annotations[j]; } @@ -10220,6 +10366,7 @@ } public void nullityMismatchingTypeAnnotation(Expression expression, TypeBinding providedType, TypeBinding requiredType, NullAnnotationMatching status) { + if (providedType == requiredType) return; //$IDENTITY-COMPARISON$ // try to improve nonnull vs. null: if (providedType.id == TypeIds.T_null || status.nullStatus == FlowInfo.NULL) { nullityMismatchIsNull(expression, requiredType); @@ -10821,8 +10968,16 @@ handle(IProblem.UnnamedPackageInNamedModule, args, args, - ProblemSeverities.Warning, 0, 0); } + +public void autoModuleWithUnstableName(ModuleReference moduleReference) { + String[] args = { new String(moduleReference.moduleName) }; + handle(IProblem.UnstableAutoModuleName, + args, + args, + moduleReference.sourceStart, + moduleReference.sourceEnd); +} } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemSeverities.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemSeverities.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemSeverities.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemSeverities.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ShouldNotImplement.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ShouldNotImplement.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ShouldNotImplement.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ShouldNotImplement.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ProcessTaskManager.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ProcessTaskManager.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ProcessTaskManager.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ProcessTaskManager.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2008, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -108,6 +111,7 @@ return next; } +@Override public void run() { boolean noAnnotations = this.compiler.annotationProcessorManager == null; while (this.processingThread != null) { diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ReadManager.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ReadManager.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ReadManager.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ReadManager.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2008, 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -145,6 +148,7 @@ return unit.getContents(); } +@Override public void run() { try { while (this.readingThreads != null && this.nextFileToRead < this.units.length) { diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/CompoundNameVector.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/CompoundNameVector.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/CompoundNameVector.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/CompoundNameVector.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -61,6 +64,7 @@ this.elements[i] = null; this.size = 0; } +@Override public String toString() { StringBuffer buffer = new StringBuffer(); for (int i = 0; i < this.size; i++) { diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/FloatUtil.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/FloatUtil.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/FloatUtil.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/FloatUtil.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2004, 2011 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/GenericXMLWriter.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/GenericXMLWriter.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/GenericXMLWriter.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/GenericXMLWriter.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -99,6 +102,7 @@ Map.Entry[] entries = new Map.Entry[length]; parameters.entrySet().toArray(entries); Arrays.sort(entries, new Comparator() { + @Override public int compare(Object o1, Object o2) { Map.Entry entry1 = (Map.Entry) o1; Map.Entry entry2 = (Map.Entry) o2; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashSetOfInt.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashSetOfInt.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashSetOfInt.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashSetOfInt.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -35,6 +38,7 @@ this.set = new int[extraRoom]; } + @Override public Object clone() throws CloneNotSupportedException { HashSetOfInt result = (HashSetOfInt) super.clone(); result.elementSize = this.elementSize; @@ -115,6 +119,7 @@ return this.elementSize; } + @Override public String toString() { StringBuffer buffer = new StringBuffer(); int element; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfInteger.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfInteger.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfInteger.java 1970-01-01 00:00:00.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfInteger.java 2018-12-06 10:38:58.000000000 +0000 @@ -0,0 +1,193 @@ +/******************************************************************************* + * Copyright (c) 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.internal.compiler.util; + +/** + * Hashtable for Integer keys. + */ + +public final class HashtableOfInteger { + + // to avoid using Enumerations, walk the individual tables skipping nulls + public Integer keyTable[]; + public Object valueTable[]; + + public int elementSize; // number of elements in the table + int threshold; + + public HashtableOfInteger() { + this(13); + } + + public HashtableOfInteger(int size) { + + this.elementSize = 0; + this.threshold = size; // size represents the expected number of elements + int extraRoom = (int) (size * 1.75f); + if (this.threshold == extraRoom) + extraRoom++; + this.keyTable = new Integer[extraRoom]; + this.valueTable = new Object[extraRoom]; + } + + public void clear() { + for (int i = this.keyTable.length; --i >= 0;) { + this.keyTable[i] = null; + this.valueTable[i] = null; + } + this.elementSize = 0; + } + + @Override + public Object clone() throws CloneNotSupportedException { + HashtableOfInteger result = (HashtableOfInteger) super.clone(); + result.elementSize = this.elementSize; + result.threshold = this.threshold; + + int length = this.keyTable.length; + result.keyTable = new Integer[length]; + System.arraycopy(this.keyTable, 0, result.keyTable, 0, length); + + length = this.valueTable.length; + result.valueTable = new Object[length]; + System.arraycopy(this.valueTable, 0, result.valueTable, 0, length); + return result; + } + + public boolean containsKey(int key) { + Integer intKey = Integer.valueOf(key); + int length = this.keyTable.length, + index = intKey.hashCode() % length; + Integer currentKey; + while ((currentKey = this.keyTable[index]) != null) { + if (currentKey.equals(intKey)) + return true; + if (++index == length) { + index = 0; + } + } + return false; + } + + public Object get(int key) { + Integer intKey = Integer.valueOf(key); + int length = this.keyTable.length, + index = intKey.hashCode() % length; + Integer currentKey; + while ((currentKey = this.keyTable[index]) != null) { + if (currentKey.equals(intKey)) + return this.valueTable[index]; + if (++index == length) { + index = 0; + } + } + return null; + } + + public Object put(int key, Object value) { + Integer intKey = Integer.valueOf(key); + int length = this.keyTable.length, + index = intKey.hashCode() % length; + Integer currentKey; + while ((currentKey = this.keyTable[index]) != null) { + if (currentKey.equals(intKey)) + return this.valueTable[index] = value; + if (++index == length) { + index = 0; + } + } + this.keyTable[index] = intKey; + this.valueTable[index] = value; + + // assumes the threshold is never equal to the size of the table + if (++this.elementSize > this.threshold) + rehash(); + return value; + } + + /** + * Put a value at the index of the given using the local hash code computation. + *

+ * Note that this is an unsafe put as there's no prior verification whether + * the given key already exists in the table or not. + *

+ * @param key The key of the table entry + * @param value The value of the table entry + */ + public void putUnsafely(int key, Object value) { + Integer intKey = Integer.valueOf(key); + int length = this.keyTable.length, + index = intKey.hashCode() % length; + while (this.keyTable[index] != null) { + if (++index == length) { + index = 0; + } + } + this.keyTable[index] = intKey; + this.valueTable[index] = value; + + // assumes the threshold is never equal to the size of the table + if (++this.elementSize > this.threshold) { + rehash(); + } + } + + public Object removeKey(int key) { + Integer intKey = Integer.valueOf(key); + int length = this.keyTable.length, + index = intKey.hashCode() % length; + Integer currentKey; + while ((currentKey = this.keyTable[index]) != null) { + if (currentKey.equals(intKey)) { + Object value = this.valueTable[index]; + this.elementSize--; + this.keyTable[index] = null; + this.valueTable[index] = null; + rehash(); + return value; + } + if (++index == length) { + index = 0; + } + } + return null; + } + + private void rehash() { + + HashtableOfInteger newHashtable = new HashtableOfInteger(this.elementSize * 2); // double the number of expected elements + Integer currentKey; + for (int i = this.keyTable.length; --i >= 0;) + if ((currentKey = this.keyTable[i]) != null) + newHashtable.putUnsafely(currentKey, this.valueTable[i]); + + this.keyTable = newHashtable.keyTable; + this.valueTable = newHashtable.valueTable; + this.threshold = newHashtable.threshold; + } + + public int size() { + return this.elementSize; + } + + @Override + public String toString() { + String s = ""; //$NON-NLS-1$ + Object object; + for (int i = 0, length = this.valueTable.length; i < length; i++) + if ((object = this.valueTable[i]) != null) + s += this.keyTable[i] + " -> " + object.toString() + "\n"; //$NON-NLS-2$ //$NON-NLS-1$ + return s; + } +} diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfInt.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfInt.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfInt.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfInt.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -87,6 +90,7 @@ public int size() { return this.elementSize; } +@Override public String toString() { String s = ""; //$NON-NLS-1$ Object object; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfIntValues.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfIntValues.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfIntValues.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfIntValues.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -41,6 +44,7 @@ this.valueTable = new int[extraRoom]; } + @Override public Object clone() throws CloneNotSupportedException { HashtableOfIntValues result = (HashtableOfIntValues) super.clone(); result.elementSize = this.elementSize; @@ -145,6 +149,7 @@ return this.elementSize; } + @Override public String toString() { String s = ""; //$NON-NLS-1$ char[] key; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfLong.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfLong.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfLong.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfLong.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -90,6 +93,7 @@ public int size() { return this.elementSize; } +@Override public String toString() { String s = ""; //$NON-NLS-1$ Object object; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfModule.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfModule.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfModule.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfModule.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -95,6 +98,7 @@ public int size() { return this.elementSize; } + @Override public String toString() { String s = ""; //$NON-NLS-1$ ModuleBinding pkg; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObject.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObject.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObject.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObject.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -47,6 +50,7 @@ this.elementSize = 0; } + @Override public Object clone() throws CloneNotSupportedException { HashtableOfObject result = (HashtableOfObject) super.clone(); result.elementSize = this.elementSize; @@ -177,6 +181,7 @@ return this.elementSize; } + @Override public String toString() { String s = ""; //$NON-NLS-1$ Object object; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObjectToIntArray.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObjectToIntArray.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObjectToIntArray.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObjectToIntArray.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -37,6 +40,7 @@ this.valueTable = new int[extraRoom][]; } + @Override public Object clone() throws CloneNotSupportedException { HashtableOfObjectToIntArray result = (HashtableOfObjectToIntArray) super.clone(); result.elementSize = this.elementSize; @@ -144,6 +148,7 @@ return this.elementSize; } + @Override public String toString() { StringBuffer buffer = new StringBuffer(); Object key; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObjectToInt.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObjectToInt.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObjectToInt.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObjectToInt.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -37,6 +40,7 @@ this.valueTable = new int[extraRoom]; } + @Override public Object clone() throws CloneNotSupportedException { HashtableOfObjectToInt result = (HashtableOfObjectToInt) super.clone(); result.elementSize = this.elementSize; @@ -144,6 +148,7 @@ return this.elementSize; } + @Override public String toString() { String s = ""; //$NON-NLS-1$ Object key; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfPackage.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfPackage.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfPackage.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfPackage.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -94,6 +97,7 @@ public int size() { return this.elementSize; } +@Override public String toString() { String s = ""; //$NON-NLS-1$ PackageBinding pkg; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfType.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfType.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfType.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfType.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -119,6 +122,7 @@ public int size() { return this.elementSize; } +@Override public String toString() { String s = ""; //$NON-NLS-1$ ReferenceBinding type; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/JRTUtil.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/JRTUtil.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/JRTUtil.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/JRTUtil.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2015, 2017 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -16,6 +19,7 @@ import java.net.URI; import java.net.URL; import java.net.URLClassLoader; +import java.nio.channels.ClosedByInterruptException; import java.nio.file.DirectoryStream; import java.nio.file.FileSystem; import java.nio.file.FileSystems; @@ -31,6 +35,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Predicate; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException; @@ -155,8 +160,8 @@ public static ClassFileReader getClassfile(File jrt, String fileName, IModule module) throws IOException, ClassFormatException { return getJrtSystem(jrt).getClassfile(fileName, module); } - public static ClassFileReader getClassfile(File jrt, String fileName, String module) throws IOException, ClassFormatException { - return getJrtSystem(jrt).getClassfile(fileName, module); + public static ClassFileReader getClassfile(File jrt, String fileName, String module, Predicate moduleNameFilter) throws IOException, ClassFormatException { + return getJrtSystem(jrt).getClassfile(fileName, module, moduleNameFilter); } public static List getModulesDeclaringPackage(File jrt, String qName, String moduleName) { return getJrtSystem(jrt).getModulesDeclaringPackage(qName, moduleName); @@ -165,6 +170,22 @@ public static boolean hasCompilationUnit(File jrt, String qualifiedPackageName, String moduleName) { return getJrtSystem(jrt).hasClassFile(qualifiedPackageName, moduleName); } + /** + * Tries to read all bytes of the file denoted by path, + * returns null if the file could not be found or if the read was interrupted. + * @param path + * @return bytes or null + * @throws IOException any IO exception other than NoSuchFileException + */ + public static byte[] safeReadBytes(Path path) throws IOException { + try { + return Files.readAllBytes(path); + } catch(ClosedByInterruptException e) { + return null; + } catch (NoSuchFileException e) { + return null; + } + } } class JrtFileSystem { private final Map packageToModule = new HashMap(); @@ -197,7 +218,6 @@ JRTUtil.MODULE_TO_LOAD = System.getProperty("modules.to.load"); //$NON-NLS-1$ String javaVersion = System.getProperty("java.version"); //$NON-NLS-1$ if (javaVersion != null && javaVersion.startsWith("1.8")) { //$NON-NLS-1$ - JRTUtil.MODULE_TO_LOAD = System.getProperty("modules.to.load"); //$NON-NLS-1$ URLClassLoader loader = new URLClassLoader(new URL[] { jrtPath }); HashMap env = new HashMap<>(); this.jrtSystem = FileSystems.newFileSystem(JRTUtil.JRT_URI, env, loader); @@ -282,19 +302,17 @@ } return null; } - private ClassFileReader getClassfile(String fileName) throws IOException, ClassFormatException { + private ClassFileReader getClassfile(String fileName, Predicate moduleNameFilter) throws IOException, ClassFormatException { String[] modules = getModules(fileName); byte[] content = null; String module = null; for (String mod : modules) { - try { - content = Files.readAllBytes(this.jrtSystem.getPath(JRTUtil.MODULES_SUBDIR, mod, fileName)); - if (content != null) { - module = mod; - break; - } - } catch(NoSuchFileException e) { + if (moduleNameFilter != null && !moduleNameFilter.test(mod)) continue; + content = JRTUtil.safeReadBytes(this.jrtSystem.getPath(JRTUtil.MODULES_SUBDIR, mod, fileName)); + if (content != null) { + module = mod; + break; } } if (content != null) { @@ -312,31 +330,21 @@ } else { String[] modules = getModules(fileName); for (String mod : modules) { - try { - content = Files.readAllBytes(this.jrtSystem.getPath(JRTUtil.MODULES_SUBDIR, mod, fileName)); - if (content != null) { - break; - } - } catch(NoSuchFileException e) { - continue; + content = JRTUtil.safeReadBytes(this.jrtSystem.getPath(JRTUtil.MODULES_SUBDIR, mod, fileName)); + if (content != null) { + break; } } } return content; } private byte[] getClassfileBytes(String fileName, String module) throws IOException, ClassFormatException { - byte[] content = null; - try { - content = Files.readAllBytes(this.jrtSystem.getPath(JRTUtil.MODULES_SUBDIR, module, fileName)); - } catch(NoSuchFileException e) { - return null; - } - return content; + return JRTUtil.safeReadBytes(this.jrtSystem.getPath(JRTUtil.MODULES_SUBDIR, module, fileName)); } - public ClassFileReader getClassfile(String fileName, String module) throws IOException, ClassFormatException { + public ClassFileReader getClassfile(String fileName, String module, Predicate moduleNameFilter) throws IOException, ClassFormatException { ClassFileReader reader = null; if (module == null) { - reader = getClassfile(fileName); + reader = getClassfile(fileName, moduleNameFilter); } else { byte[] content = getClassfileBytes(fileName, module); if (content != null) { @@ -349,7 +357,7 @@ public ClassFileReader getClassfile(String fileName, IModule module) throws IOException, ClassFormatException { ClassFileReader reader = null; if (module == null) { - reader = getClassfile(fileName); + reader = getClassfile(fileName, (Predicate)null); } else { byte[] content = getClassfileBytes(fileName, new String(module.name())); if (content != null) { diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/ManifestAnalyzer.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/ManifestAnalyzer.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/ManifestAnalyzer.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/ManifestAnalyzer.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Messages.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Messages.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Messages.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Messages.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -40,9 +43,7 @@ } } - /* (non-Javadoc) - * @see java.util.Hashtable#put(java.lang.Object, java.lang.Object) - */ + @Override public synchronized Object put(Object key, Object value) { try { Field field = (Field) this.fields.get(key); diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/ObjectVector.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/ObjectVector.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/ObjectVector.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/ObjectVector.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -127,6 +130,7 @@ return this.size; } + @Override public String toString() { String s = ""; //$NON-NLS-1$ diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleLookupTable.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleLookupTable.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleLookupTable.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleLookupTable.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -37,6 +40,7 @@ this.valueTable = new Object[extraRoom]; } +@Override public Object clone() throws CloneNotSupportedException { SimpleLookupTable result = (SimpleLookupTable) super.clone(); result.elementSize = this.elementSize; @@ -156,6 +160,7 @@ this.threshold = newLookupTable.threshold; } +@Override public String toString() { String s = ""; //$NON-NLS-1$ Object object; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleNameVector.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleNameVector.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleNameVector.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleNameVector.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -86,6 +89,7 @@ return this.size; } + @Override public String toString() { StringBuffer buffer = new StringBuffer(); for (int i = 0; i < this.size; i++) { diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleSet.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleSet.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleSet.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleSet.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -78,6 +81,7 @@ this.elementSize = 0; } +@Override public Object clone() throws CloneNotSupportedException { SimpleSet result = (SimpleSet) super.clone(); result.elementSize = this.elementSize; @@ -130,6 +134,7 @@ this.threshold = newSet.threshold; } +@Override public String toString() { String s = ""; //$NON-NLS-1$ Object object; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleSetOfCharArray.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleSetOfCharArray.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleSetOfCharArray.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleSetOfCharArray.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2006, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -65,6 +68,7 @@ this.elementSize = 0; } +@Override public Object clone() throws CloneNotSupportedException { SimpleSetOfCharArray result = (SimpleSetOfCharArray) super.clone(); result.elementSize = this.elementSize; @@ -132,6 +136,7 @@ this.threshold = newSet.threshold; } +@Override public String toString() { String s = ""; //$NON-NLS-1$ char[] object; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Sorting.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Sorting.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Sorting.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Sorting.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /********************************************************************** * Copyright (c) 2008, 2014 Technical University Berlin, Germany and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Stephan Herrmann - Initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SuffixConstants.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SuffixConstants.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SuffixConstants.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SuffixConstants.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java --- ecj-3.13.3/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -1003,6 +1006,7 @@ public static String toString(Object[] objects) { return toString(objects, new Displayable(){ + @Override public String displayString(Object o) { if (o == null) return "null"; //$NON-NLS-1$ return o.toString(); @@ -1241,7 +1245,7 @@ } List classpaths = new ArrayList<>(); for (String filePath : filePaths) { - FileSystem.Classpath currentClasspath = FileSystem.getClasspath(filePath, null, null, null); + FileSystem.Classpath currentClasspath = FileSystem.getClasspath(filePath, null, null, null, null); if (currentClasspath != null) { classpaths.add(currentClasspath); } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/component.xml ecj-3.16.0/org.eclipse.jdt.core/component.xml --- ecj-3.13.3/org.eclipse.jdt.core/component.xml 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/component.xml 2018-12-06 10:38:58.000000000 +0000 @@ -1,10 +1,13 @@ " + this.value + "]"; //$NON-NLS-3$ //$NON-NLS-1$ //$NON-NLS-2$ } } - + public class Stats { private int[] counters = new int[20]; private long[] timestamps = new long[20]; private int counterIndex = -1; - + private void add(int counter) { for (int i = 0; i <= this.counterIndex; i++) { if (this.counters[i] == counter) @@ -110,6 +116,7 @@ this.counters[this.counterIndex] = counter; this.timestamps[this.counterIndex] = System.currentTimeMillis(); } + private String getAverageAge(long totalTime, int numberOfElements, long currentTime) { if (numberOfElements == 0) return "N/A"; //$NON-NLS-1$ @@ -156,6 +163,7 @@ buffer.append(" seconds"); //$NON-NLS-1$ return buffer.toString(); } + private long getTimestamps(int counter) { for (int i = 0; i <= this.counterIndex; i++) { if (this.counters[i] >= counter) @@ -163,16 +171,17 @@ } return -1; } + public synchronized String printStats() { int numberOfElements = LRUCache.this.currentSpace; if (numberOfElements == 0) { return "No elements in cache"; //$NON-NLS-1$ } StringBuffer buffer = new StringBuffer(); - + buffer.append("Number of elements in cache: "); //$NON-NLS-1$ buffer.append(numberOfElements); - + final int numberOfGroups = 5; int numberOfElementsPerGroup = numberOfElements / numberOfGroups; buffer.append("\n("); //$NON-NLS-1$ @@ -183,7 +192,7 @@ buffer.append("\n\nAverage age:"); //$NON-NLS-1$ int groupNumber = 1; int elementCounter = 0; - LRUCacheEntry entry = LRUCache.this.entryQueueTail; + LRUCacheEntry entry = LRUCache.this.entryQueueTail; long currentTime = System.currentTimeMillis(); long accumulatedTime = 0; while (entry != null) { @@ -211,9 +220,10 @@ buffer.append(numberOfGroups); buffer.append(" (youngest)\t: "); //$NON-NLS-1$ buffer.append(getAverageAge(accumulatedTime, elementCounter, currentTime)); - + return buffer.toString(); } + private void removeCountersOlderThan(int counter) { for (int i = 0; i <= this.counterIndex; i++) { if (this.counters[i] >= counter) { @@ -227,12 +237,15 @@ } } } - public Object getOldestElement() { + + public K getOldestElement() { return LRUCache.this.getOldestElement(); } + public long getOldestTimestamps() { return getTimestamps(getOldestTimestampCounter()); } + public synchronized void snapshot() { removeCountersOlderThan(getOldestTimestampCounter()); add(getNewestTimestampCounter()); @@ -257,50 +270,51 @@ /** * Hash table for fast random access to cache entries */ - protected Hashtable entryTable; + protected Hashtable> entryTable; /** * Start of queue (most recently used entry) */ - protected LRUCacheEntry entryQueue; + protected LRUCacheEntry entryQueue; /** * End of queue (least recently used entry) */ - protected LRUCacheEntry entryQueueTail; + protected LRUCacheEntry entryQueueTail; /** * Default amount of space in the cache */ protected static final int DEFAULT_SPACELIMIT = 100; + /** * Creates a new cache. Size of cache is defined by * DEFAULT_SPACELIMIT. */ public LRUCache() { - this(DEFAULT_SPACELIMIT); } + /** * Creates a new cache. * @param size Size of Cache */ public LRUCache(int size) { - this.timestampCounter = this.currentSpace = 0; this.entryQueue = this.entryQueueTail = null; - this.entryTable = new Hashtable(size); + this.entryTable = new Hashtable<>(size); this.spaceLimit = size; } + /** * Returns a new cache containing the same contents. * * @return New copy of object. */ - public Object clone() { - - LRUCache newCache = newInstance(this.spaceLimit); - LRUCacheEntry qEntry; + @Override + public LRUCache clone() { + LRUCache newCache = newInstance(this.spaceLimit); + LRUCacheEntry qEntry; /* Preserve order of entries by copying from oldest to newest */ qEntry = this.entryQueueTail; @@ -310,60 +324,61 @@ } return newCache; } + public double fillingRatio() { return (this.currentSpace) * 100.0 / this.spaceLimit; } + /** * Flushes all entries from the cache. */ public void flush() { - this.currentSpace = 0; - LRUCacheEntry entry = this.entryQueueTail; // Remember last entry - this.entryTable = new Hashtable(); // Clear it out + LRUCacheEntry entry = this.entryQueueTail; // Remember last entry + this.entryTable = new Hashtable<>(); // Clear it out this.entryQueue = this.entryQueueTail = null; while (entry != null) { // send deletion notifications in LRU order entry = entry.previous; } } + /** * Flushes the given entry from the cache. Does nothing if entry does not * exist in cache. * * @param key Key of object to flush */ - public void flush (Object key) { - - LRUCacheEntry entry; - - entry = (LRUCacheEntry) this.entryTable.get(key); + public void flush (K key) { + LRUCacheEntry entry; + entry = this.entryTable.get(key); /* If entry does not exist, return */ if (entry == null) return; privateRemoveEntry (entry, false); } + /* * Answers the existing key that is equals to the given key. * If the key is not in the cache, returns the given key */ - public Object getKey(Object key) { - LRUCacheEntry entry = (LRUCacheEntry) this.entryTable.get(key); + public K getKey(K key) { + LRUCacheEntry entry = this.entryTable.get(key); if (entry == null) { return key; } return entry.key; } + /** * Answers the value in the cache at the given key. * If the value is not in the cache, returns null * * @param key Hash table key of object to retrieve - * @return Retreived object, or null if object does not exist + * @return Retrieved object, or null if object does not exist */ - public Object get(Object key) { - - LRUCacheEntry entry = (LRUCacheEntry) this.entryTable.get(key); + public V get(K key) { + LRUCacheEntry entry = this.entryTable.get(key); if (entry == null) { return null; } @@ -371,64 +386,72 @@ updateTimestamp (entry); return entry.value; } + /** * Returns the amount of space that is current used in the cache. */ public int getCurrentSpace() { return this.currentSpace; } + /** * Returns the timestamps of the most recently used element in the cache. */ public int getNewestTimestampCounter() { return this.entryQueue == null ? 0 : this.entryQueue.timestamp; } + /** * Returns the timestamps of the least recently used element in the cache. */ public int getOldestTimestampCounter() { return this.entryQueueTail == null ? 0 : this.entryQueueTail.timestamp; } + /** - * Returns the lest recently used element in the cache + * Returns the lest recently used element in the cache, can return {@code null} */ - public Object getOldestElement() { + public K getOldestElement() { return this.entryQueueTail == null ? null : this.entryQueueTail.key; } - + /** * Returns the maximum amount of space available in the cache. */ public int getSpaceLimit() { return this.spaceLimit; } + /** * Returns an Enumeration of the keys currently in the cache. */ - public Enumeration keys() { - + public Enumeration keys() { return this.entryTable.keys(); } + /** * Returns an enumeration that iterates over all the keys and values * currently in the cache. */ - public ICacheEnumeration keysAndValues() { - return new ICacheEnumeration() { + public ICacheEnumeration keysAndValues() { + return new ICacheEnumeration() { - Enumeration values = LRUCache.this.entryTable.elements(); - LRUCacheEntry entry; + Enumeration> values = LRUCache.this.entryTable.elements(); + LRUCacheEntry entry; + @Override public boolean hasMoreElements() { return this.values.hasMoreElements(); } - public Object nextElement() { - this.entry = (LRUCacheEntry) this.values.nextElement(); + @Override + public K nextElement() { + this.entry = this.values.nextElement(); return this.entry.key; } - public Object getValue() { + @Override + public V getValue() { if (this.entry == null) { throw new java.util.NoSuchElementException(); } @@ -436,6 +459,7 @@ } }; } + /** * Ensures there is the specified amount of free space in the receiver, * by removing old entries if necessary. Returns true if the requested space was @@ -465,43 +489,43 @@ } return true; } + /** * Returns a new LRUCache instance */ - protected LRUCache newInstance(int size) { - return new LRUCache(size); + protected LRUCache newInstance(int size) { + return new LRUCache<>(size); } + /** * Answers the value in the cache at the given key. * If the value is not in the cache, returns null * * This function does not modify timestamps. */ - public Object peek(Object key) { - - LRUCacheEntry entry = (LRUCacheEntry) this.entryTable.get(key); + public V peek(K key) { + LRUCacheEntry entry = this.entryTable.get(key); if (entry == null) { return null; } return entry.value; } + /** * Adds an entry for the given key/value/space. */ - protected void privateAdd (Object key, Object value, int space) { - - LRUCacheEntry entry; - - entry = new LRUCacheEntry(key, value, space); + protected void privateAdd (K key, V value, int space) { + LRUCacheEntry entry; + entry = new LRUCacheEntry<>(key, value, space); privateAddEntry (entry, false); } + /** * Adds the given entry from the receiver. * @param shuffle Indicates whether we are just shuffling the queue * (in which case, the entry table is not modified). */ - protected void privateAddEntry (LRUCacheEntry entry, boolean shuffle) { - + protected void privateAddEntry (LRUCacheEntry entry, boolean shuffle) { if (!shuffle) { this.entryTable.put (entry.key, entry); this.currentSpace += entry.space; @@ -520,14 +544,14 @@ this.entryQueue = entry; } + /** * Removes the entry from the entry queue. * @param shuffle indicates whether we are just shuffling the queue * (in which case, the entry table is not modified). */ - protected void privateRemoveEntry (LRUCacheEntry entry, boolean shuffle) { - - LRUCacheEntry previous, next; + protected void privateRemoveEntry (LRUCacheEntry entry, boolean shuffle) { + LRUCacheEntry previous, next; previous = entry.previous; next = entry.next; @@ -551,6 +575,7 @@ next.previous = previous; } } + /** * Sets the value in the cache at the given key. Returns the value. * @@ -558,14 +583,13 @@ * @param value Value of object to add. * @return added value. */ - public Object put(Object key, Object value) { - + public V put(K key, V value) { int newSpace, oldSpace, newTotal; - LRUCacheEntry entry; + LRUCacheEntry entry; /* Check whether there's an entry in the cache */ newSpace = spaceFor(value); - entry = (LRUCacheEntry) this.entryTable.get (key); + entry = this.entryTable.get (key); if (entry != null) { @@ -591,6 +615,7 @@ } return value; } + /** * Removes and returns the value in the cache for the given key. * If the key is not in the cache, returns null. @@ -598,16 +623,16 @@ * @param key Key of object to remove from cache. * @return Value removed from cache. */ - public Object removeKey (Object key) { - - LRUCacheEntry entry = (LRUCacheEntry) this.entryTable.get(key); + public V removeKey (K key) { + LRUCacheEntry entry = this.entryTable.get(key); if (entry == null) { return null; } - Object value = entry.value; + V value = entry.value; privateRemoveEntry (entry, false); return value; } + /** * Sets the maximum amount of space that the cache can store * @@ -619,21 +644,23 @@ } this.spaceLimit = limit; } + /** * Returns the space taken by the given value. */ - protected int spaceFor (Object value) { - + protected int spaceFor (V value) { if (value instanceof ILRUCacheable) { return ((ILRUCacheable) value).getCacheFootprint(); } else { return 1; } } + /** * Returns a String that represents the value of this object. This method * is for debugging purposes only. */ + @Override public String toString() { return toStringFillingRation("LRUCache") + //$NON-NLS-1$ @@ -646,23 +673,11 @@ */ protected String toStringContents() { StringBuffer result = new StringBuffer(); - int length = this.entryTable.size(); - Object[] unsortedKeys = new Object[length]; - String[] unsortedToStrings = new String[length]; - Enumeration e = keys(); - for (int i = 0; i < length; i++) { - Object key = e.nextElement(); - unsortedKeys[i] = key; - unsortedToStrings[i] = - (key instanceof org.eclipse.jdt.internal.core.JavaElement) ? - ((org.eclipse.jdt.internal.core.JavaElement)key).getElementName() : - key.toString(); - } - ToStringSorter sorter = new ToStringSorter(); - sorter.sort(unsortedKeys, unsortedToStrings); - for (int i = 0; i < length; i++) { - String toString = sorter.sortedStrings[i]; - Object value = get(sorter.sortedObjects[i]); + ToStringSorter sorter = new ToStringSorter<>(o -> o instanceof JavaElement ? ((JavaElement) o).getElementName() : o.toString()); + List> sortedObjects = sorter.sort(this.entryTable.keySet()); + for (Pair pair : sortedObjects) { + String toString = pair.string; + V value = get(pair.object); result.append(toString); result.append(" -> "); //$NON-NLS-1$ result.append(value); @@ -685,8 +700,7 @@ * Updates the timestamp for the given entry, ensuring that the queue is * kept in correct order. The entry must exist */ - protected void updateTimestamp (LRUCacheEntry entry) { - + protected void updateTimestamp (LRUCacheEntry entry) { entry.timestamp = this.timestampCounter++; if (this.entryQueue != entry) { privateRemoveEntry (entry, true); diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MementoTokenizer.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MementoTokenizer.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MementoTokenizer.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MementoTokenizer.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2004, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -115,6 +118,8 @@ if (buffer == null) buffer = new StringBuffer(); buffer.append(this.memento, start, this.index - start); start = ++this.index; + if (this.memento[this.index] == JavaElement.JEM_MODULE) + return buffer.toString(); break; case JavaElement.JEM_COUNT: case JavaElement.JEM_JAVAPROJECT: diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -187,6 +190,9 @@ public static String classpath_duplicateEntryExtraAttribute; public static String classpath_deprecated_variable; public static String classpath_invalidExternalAnnotationPath; + public static String classpath_testSourceRequiresSeparateOutputFolder; + public static String classpath_testOutputFolderMustBeSeparateFromMainOutputFolders; + public static String classpath_main_only_project_depends_on_test_only_project; public static String file_notFound; public static String file_badFormat; public static String path_nullPath; @@ -219,7 +225,6 @@ public static String convention_module_nameWithBlanks; public static String convention_module_consecutiveDotsName; public static String convention_module_uppercaseName; - public static String convention_module_terminalDigits; public static String convention_module_javaName; public static String dom_cannotDetail; public static String dom_nullTypeParameter; @@ -273,6 +278,8 @@ public static String disassembler_outer_class_info_name; public static String disassembler_inner_name; public static String disassembler_inner_accessflags; + public static String disassembler_nesthost; + public static String disassembler_nestmembers; public static String disassembler_genericattributeheader; public static String disassembler_signatureattributeheader; public static String disassembler_bootstrapmethodattributesheader; @@ -300,6 +307,7 @@ public static String disassembler_constantpool_methodhandle; public static String disassembler_constantpool_methodtype; public static String disassembler_constantpool_invokedynamic; + public static String disassembler_constantpool_dynamic; public static String disassembler_annotationdefaultheader; public static String disassembler_annotationdefaultvalue; public static String disassembler_annotationenumvalue; @@ -359,6 +367,9 @@ public static String classformat_checkcast; public static String classformat_instanceof; public static String classformat_ldc_w_class; + public static String classformat_ldc_w_methodtype; + public static String classformat_ldc_w_methodhandle; + public static String classformat_ldc_w_dynamic; public static String classformat_ldc_w_float; public static String classformat_ldc_w_integer; public static String classformat_ldc_w_string; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ ############################################################################### -# Copyright (c) 2000, 2017 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 +# Copyright (c) 2000, 2018 IBM Corporation and others. +# +# This program and the accompanying materials +# are made available under the terms of the Eclipse Public License 2.0 # which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html +# https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 # # Contributors: # IBM Corporation - initial API and implementation @@ -183,6 +186,9 @@ classpath_duplicateEntryExtraAttribute = Duplicate extra attribute: ''{0}'' in classpath entry ''{1}'' for project ''{2}'' classpath_deprecated_variable = Classpath variable ''{0}'' in project ''{1}'' is deprecated: {2} classpath_invalidExternalAnnotationPath = Invalid external annotation path: ''{0}'' in project ''{1}'', for classpath entry ''{2}'' +classpath_testSourceRequiresSeparateOutputFolder=Test source folder ''{0}'' in project ''{1}'' must have a separate output folder +classpath_testOutputFolderMustBeSeparateFromMainOutputFolders=Test source folder ''{0}'' in project ''{1}'' must have an output folder that is not also used for main sources +classpath_main_only_project_depends_on_test_only_project=Project has only main sources but depends on project ''{0}'' which has only test sources. ### miscellaneous buffer_closed=Buffer is closed @@ -232,7 +238,6 @@ convention_module_nameWithBlanks = A module name must not start or end with a blank convention_module_consecutiveDotsName = A module name must not contain consecutive dots convention_module_uppercaseName = By convention, module names usually start with a lowercase letter -convention_module_terminalDigits = A module name should avoid terminal digits convention_module_javaName = 'java' is reserved for system modules ### DOM @@ -293,6 +298,8 @@ disassembler_localvariabletableattributeheader = Local variable table: disassembler_localvariabletypetableattributeheader = Local variable type table: disassembler_arraydimensions = [] +disassembler_nesthost = Nest Host: +disassembler_nestmembers = Nest Members: disassembler_innerattributesheader = Inner classes: disassembler_inner_class_info_name = inner class info: disassembler_outer_class_info_name = outer class info: @@ -327,6 +334,7 @@ disassembler_constantpool_methodhandle = constant #{0} method handle: {1} #{2} disassembler_constantpool_methodtype = constant #{0} method type: #{1} {2} disassembler_constantpool_invokedynamic = constant #{0} invoke dynamic: #{1} #{2} {3} {4} +disassembler_constantpool_dynamic = constant #{0} dynamic: #{1} #{2} {3} {4} disassembler_annotationdefaultheader = Annotation Default:\ disassembler_annotationdefaultvalue= {0} (constant type) disassembler_annotationenumvalue = {2}.{3}(enum type #{0}.#{1}) @@ -408,6 +416,9 @@ classformat_anewarray = {0} {2} [{1}] classformat_checkcast = {0} {2} [{1}] classformat_instanceof = {0} {2} [{1}] +classformat_ldc_w_methodtype = {0} [{1}] +classformat_ldc_w_methodhandle = {0} [{1}] +classformat_ldc_w_dynamic = {0} {2} {3} {4} [{1}] classformat_ldc_w_class = {0} [{1}] classformat_ldc_w_float = {0} [{1}] classformat_ldc_w_integer = {0} [{1}] diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -134,6 +137,7 @@ /** * @see IMethodInfo#getAccessFlags() */ + @Override public int getAccessFlags() { return this.accessFlags; } @@ -141,12 +145,14 @@ /** * @see IMethodInfo#getAttributeCount() */ + @Override public int getAttributeCount() { return this.attributesCount; } /** * @see IMethodInfo#getAttributes() */ + @Override public IClassFileAttribute[] getAttributes() { return this.attributes; } @@ -154,6 +160,7 @@ /** * @see IMethodInfo#getCodeAttribute() */ + @Override public ICodeAttribute getCodeAttribute() { return this.codeAttribute; } @@ -161,6 +168,7 @@ /** * @see IMethodInfo#getDescriptor() */ + @Override public char[] getDescriptor() { return this.descriptor; } @@ -168,6 +176,7 @@ /** * @see IMethodInfo#getDescriptorIndex() */ + @Override public int getDescriptorIndex() { return this.descriptorIndex; } @@ -175,6 +184,7 @@ /** * @see IMethodInfo#getExceptionAttribute() */ + @Override public IExceptionAttribute getExceptionAttribute() { return this.exceptionAttribute; } @@ -182,6 +192,7 @@ /** * @see IMethodInfo#getName() */ + @Override public char[] getName() { return this.name; } @@ -189,6 +200,7 @@ /** * @see IMethodInfo#getNameIndex() */ + @Override public int getNameIndex() { return this.nameIndex; } @@ -200,6 +212,7 @@ /** * @see IMethodInfo#isClinit() */ + @Override public boolean isClinit() { return this.name[0] == '<' && this.name.length == 8; // Can only match } @@ -207,6 +220,7 @@ /** * @see IMethodInfo#isConstructor() */ + @Override public boolean isConstructor() { return this.name[0] == '<' && this.name.length == 6; // Can only match } @@ -214,6 +228,7 @@ /** * @see IMethodInfo#isDeprecated() */ + @Override public boolean isDeprecated() { return this.isDeprecated; } @@ -225,6 +240,7 @@ /** * @see IMethodInfo#isSynthetic() */ + @Override public boolean isSynthetic() { return this.isSynthetic; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodParametersAttribute.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodParametersAttribute.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodParametersAttribute.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodParametersAttribute.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2013 Jesper Steen Moeller and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Jesper Steen Moeller - initial API and implementation @@ -60,23 +63,17 @@ } } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.IMethodParametersAttribute#getMethodParameterLength() - */ + @Override public int getMethodParameterLength() { return this.numberOfEntries; } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.IMethodParametersAttribute#getParameterName(int) - */ + @Override public char[] getParameterName(int i) { return this.names[i]; } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.IMethodParametersAttribute#getAccessFlags(int) - */ + @Override public short getAccessFlags(int i) { return this.accessFlags[i]; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModuleAttribute.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModuleAttribute.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModuleAttribute.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModuleAttribute.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModuleMainClassAttribute.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModuleMainClassAttribute.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModuleMainClassAttribute.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModuleMainClassAttribute.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModulePackagesAttribute.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModulePackagesAttribute.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModulePackagesAttribute.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModulePackagesAttribute.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModuleUtil.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModuleUtil.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModuleUtil.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModuleUtil.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2017 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -35,6 +38,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; import org.eclipse.jdt.internal.core.BasicCompilationUnit; import org.eclipse.jdt.internal.core.ClasspathEntry; +import org.eclipse.jdt.internal.core.CompilationGroup; import org.eclipse.jdt.internal.core.builder.NameEnvironment; import org.eclipse.jdt.internal.core.builder.ProblemFactory; @@ -42,7 +46,7 @@ static class ModuleAccumulatorEnvironment extends NameEnvironment { public ModuleAccumulatorEnvironment(IJavaProject javaProject) { - super(javaProject); + super(javaProject, CompilationGroup.MAIN); } Set modules = new HashSet<>(); diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestHostAttribute.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestHostAttribute.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestHostAttribute.java 1970-01-01 00:00:00.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestHostAttribute.java 2018-12-06 10:38:58.000000000 +0000 @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2018 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.internal.core.util; + +import org.eclipse.jdt.core.util.ClassFormatException; +import org.eclipse.jdt.core.util.IConstantPool; +import org.eclipse.jdt.core.util.IConstantPoolConstant; +import org.eclipse.jdt.core.util.IConstantPoolEntry; +import org.eclipse.jdt.core.util.INestHostAttribute; + +public class NestHostAttribute extends ClassFileAttribute implements INestHostAttribute { + + private int hostIndex; + private char[] hostName; + + public NestHostAttribute(byte[] classFileBytes, IConstantPool constantPool, int offset) + throws ClassFormatException { + super(classFileBytes, constantPool, offset); + int index = u2At(classFileBytes, 6, offset); + this.hostIndex = index; + IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(index); + if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Class) { + throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY); + } + this.hostName = constantPoolEntry.getClassInfoName(); + } + + @Override + public char[] getNestHostName() { + return this.hostName; + } + + @Override + public int getNestHostIndex() { + return this.hostIndex; + } + @Override + public String toString() { + return new String(this.hostName); + } +} \ No newline at end of file diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestMembersAttributeEntry.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestMembersAttributeEntry.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestMembersAttributeEntry.java 1970-01-01 00:00:00.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestMembersAttributeEntry.java 2018-12-06 10:38:58.000000000 +0000 @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2018 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.internal.core.util; + +import org.eclipse.jdt.core.util.ClassFormatException; +import org.eclipse.jdt.core.util.IConstantPool; +import org.eclipse.jdt.core.util.IConstantPoolConstant; +import org.eclipse.jdt.core.util.IConstantPoolEntry; +import org.eclipse.jdt.core.util.INestMemberAttributeEntry; + +public class NestMembersAttributeEntry extends ClassFileStruct implements INestMemberAttributeEntry { + + private int memberClassNameIndex; + private char[] memberClassName; + + public NestMembersAttributeEntry(byte[] classFileBytes, IConstantPool constantPool, int offset) + throws ClassFormatException { + this.memberClassNameIndex = u2At(classFileBytes, 0, offset); + if (this.memberClassNameIndex != 0) { + IConstantPoolEntry constantPoolEntry; + constantPoolEntry = constantPool.decodeEntry(this.memberClassNameIndex); + if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Class) { + throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY); + } + this.memberClassName = constantPoolEntry.getClassInfoName(); + } + } + + @Override + public char[] getNestMemberName() { + return this.memberClassName; + } + + @Override + public int getNestMemberIndex() { + return this.memberClassNameIndex; + } + + @Override + public String toString() { + return new String(this.memberClassName); + } +} + diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestMembersAttribute.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestMembersAttribute.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestMembersAttribute.java 1970-01-01 00:00:00.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestMembersAttribute.java 2018-12-06 10:38:58.000000000 +0000 @@ -0,0 +1,64 @@ +/******************************************************************************* + * Copyright (c) 2018 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.internal.core.util; + +import org.eclipse.jdt.core.util.ClassFormatException; +import org.eclipse.jdt.core.util.IConstantPool; +import org.eclipse.jdt.core.util.INestMemberAttributeEntry; +import org.eclipse.jdt.core.util.INestMembersAttribute; + +/** + * Default implementation of INestMembersAttribute. + */ +public class NestMembersAttribute extends ClassFileAttribute implements INestMembersAttribute { + private static final INestMemberAttributeEntry[] NO_ENTRIES = new INestMemberAttributeEntry[0]; + + private int nestMembers; + private INestMemberAttributeEntry[] entries; + + /** + * Constructor for NestMembersAttribute. + * @param classFileBytes + * @param constantPool + * @param offset + * @throws ClassFormatException + */ + public NestMembersAttribute( + byte[] classFileBytes, + IConstantPool constantPool, + int offset) + throws ClassFormatException { + super(classFileBytes, constantPool, offset); + this.nestMembers = u2At(classFileBytes, 6, offset); + final int length = this.nestMembers; + if (length != 0) { + int readOffset = 8; + this.entries = new INestMemberAttributeEntry[length]; + for (int i = 0; i < length; i++) { + this.entries[i] = new NestMembersAttributeEntry(classFileBytes, constantPool, offset + readOffset); + readOffset += 2; + } + } else { + this.entries = NO_ENTRIES; + } + } + + @Override + public int getNumberOfNestMembers() { + return this.nestMembers; + } + + @Override + public INestMemberAttributeEntry[] getNestMemberAttributesEntries() { + return this.entries; + } + +} diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PackageVisibilityInfo.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PackageVisibilityInfo.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PackageVisibilityInfo.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PackageVisibilityInfo.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ParameterAnnotation.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ParameterAnnotation.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ParameterAnnotation.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ParameterAnnotation.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2004, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -57,15 +60,13 @@ int sizeInBytes() { return this.readOffset; } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.IParameterAnnotation#getAnnotations() - */ + + @Override public IAnnotation[] getAnnotations() { return this.annotations; } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.IParameterAnnotation#getAnnotationsNumber() - */ + + @Override public int getAnnotationsNumber() { return this.annotationsNumber; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ProvidesInfo.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ProvidesInfo.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ProvidesInfo.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ProvidesInfo.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -23,6 +26,9 @@ public class PublicScanner implements IScanner, ITerminalSymbols { + @SuppressWarnings("deprecation") + private static final int InternalTokenNameIdentifier = TokenNameIdentifier; + //public int newIdentCount = 0; /* APIs ares @@ -441,9 +447,11 @@ System.arraycopy(this.source, this.startPosition, result, 0, length); return result; } +@Override public int getCurrentTokenEndPosition(){ return this.currentPosition - 1; } +@Override public char[] getCurrentTokenSource() { // Return the token REAL source (aka unicodes are precomputed) @@ -515,6 +523,7 @@ return new String(this.source, this.startPosition + 1, this.currentPosition - this.startPosition - 2); } } +@Override public final char[] getRawTokenSource() { int length = this.currentPosition - this.startPosition; char[] tokenSource = new char[length]; @@ -529,6 +538,7 @@ return sourceEnd; } +@Override public int getCurrentTokenStartPosition(){ return this.startPosition; } @@ -540,6 +550,7 @@ * * In case the given line number is inconsistent, answers -1. */ +@Override public final int getLineEnd(int lineNumber) { if (this.lineEnds == null || this.linePtr == -1) @@ -553,6 +564,7 @@ return this.lineEnds[lineNumber-1]; // next line start one character behind the lineEnd of the previous line } +@Override public final int[] getLineEnds() { //return a bounded copy of this.lineEnds if (this.linePtr == -1) { @@ -576,6 +588,7 @@ * @param lineNumber int * @return int */ +@Override public final int getLineStart(int lineNumber) { if (this.lineEnds == null || this.linePtr == -1) @@ -1115,6 +1128,7 @@ return TokenNameERROR; } } +@Override public int getNextToken() throws InvalidInputException { this.wasAcr = false; if (this.diet) { @@ -1851,6 +1865,7 @@ } return null; } +@Override public char[] getSource(){ return this.source; } @@ -2679,6 +2694,7 @@ * @param begin the given start position * @param end the given end position */ +@Override public void resetTo(int begin, int end) { //reset the scanner to a given position where it may rescan again @@ -2810,13 +2826,13 @@ //have a length which is <= 12...but there are lots of identifier with //only one char.... if ((length = this.currentPosition - this.startPosition) == 1) { - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } data = this.source; index = this.startPosition; } else { if ((length = this.withoutUnicodePtr) == 1) - return TokenNameIdentifier; + return InternalTokenNameIdentifier; data = this.withoutUnicodeBuffer; index = 1; } @@ -2872,13 +2888,13 @@ //have a length which is <= 12...but there are lots of identifier with //only one char.... if ((length = this.currentPosition - this.startPosition) == 1) { - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } data = this.source; index = this.startPosition; } else { if ((length = this.withoutUnicodePtr) == 1) - return TokenNameIdentifier; + return InternalTokenNameIdentifier; data = this.withoutUnicodeBuffer; index = 1; } @@ -2899,7 +2915,7 @@ && (data[++index] == 't')) { return TokenNameabstract; } else { - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } case 6: // assert if ((data[++index] == 's') @@ -2912,13 +2928,13 @@ return TokenNameassert; } else { this.useAssertAsAnIndentifier = true; - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } } else { - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } default: - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } case 'b' : //boolean break byte switch (length) { @@ -2926,7 +2942,7 @@ if ((data[++index] == 'y') && (data[++index] == 't') && (data[++index] == 'e')) return TokenNamebyte; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 5 : if ((data[++index] == 'r') && (data[++index] == 'e') @@ -2934,7 +2950,7 @@ && (data[++index] == 'k')) return TokenNamebreak; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 7 : if ((data[++index] == 'o') && (data[++index] == 'o') @@ -2944,9 +2960,9 @@ && (data[++index] == 'n')) return TokenNameboolean; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; default : - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } case 'c' : //case char catch const class continue @@ -2956,18 +2972,18 @@ if ((data[++index] == 's') && (data[++index] == 'e')) return TokenNamecase; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; else if ((data[index] == 'h') && (data[++index] == 'a') && (data[++index] == 'r')) return TokenNamechar; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 5 : if (data[++index] == 'a') if ((data[++index] == 't') && (data[++index] == 'c') && (data[++index] == 'h')) return TokenNamecatch; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; else if (data[index] == 'l') if ((data[++index] == 'a') @@ -2975,14 +2991,14 @@ && (data[++index] == 's')) return TokenNameclass; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; else if ((data[index] == 'o') && (data[++index] == 'n') && (data[++index] == 's') && (data[++index] == 't')) return TokenNameconst; //const is not used in java ??????? else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 8 : if ((data[++index] == 'o') && (data[++index] == 'n') @@ -2993,9 +3009,9 @@ && (data[++index] == 'e')) return TokenNamecontinue; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; default : - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } case 'd' : //default do double @@ -3004,7 +3020,7 @@ if ((data[++index] == 'o')) return TokenNamedo; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 6 : if ((data[++index] == 'o') && (data[++index] == 'u') @@ -3013,7 +3029,7 @@ && (data[++index] == 'e')) return TokenNamedouble; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 7 : if ((data[++index] == 'e') && (data[++index] == 'f') @@ -3023,9 +3039,9 @@ && (data[++index] == 't')) return TokenNamedefault; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; default : - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } case 'e' : //else extends switch (length) { @@ -3034,7 +3050,7 @@ if ((data[++index] == 's') && (data[++index] == 'e')) { return TokenNameelse; } else { - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } } else if ((data[index] == 'n') && (data[++index] == 'u') @@ -3043,10 +3059,10 @@ return TokenNameenum; } else { this.useEnumAsAnIndentifier = true; - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } } - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 7 : if ((data[++index] == 'x') && (data[++index] == 't') @@ -3056,9 +3072,9 @@ && (data[++index] == 's')) return TokenNameextends; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; default : - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } case 'f' : //final finally float for false @@ -3067,7 +3083,7 @@ if ((data[++index] == 'o') && (data[++index] == 'r')) return TokenNamefor; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 5 : if (data[++index] == 'i') if ((data[++index] == 'n') @@ -3075,7 +3091,7 @@ && (data[++index] == 'l')) { return TokenNamefinal; } else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; else if (data[index] == 'l') if ((data[++index] == 'o') @@ -3083,7 +3099,7 @@ && (data[++index] == 't')) return TokenNamefloat; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; else if ((data[index] == 'a') && (data[++index] == 'l') @@ -3091,7 +3107,7 @@ && (data[++index] == 'e')) return TokenNamefalse; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 7 : if ((data[++index] == 'i') && (data[++index] == 'n') @@ -3101,10 +3117,10 @@ && (data[++index] == 'y')) return TokenNamefinally; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; default : - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } case 'g' : //goto if (length == 4) { @@ -3114,7 +3130,7 @@ return TokenNamegoto; } } //no goto in java are allowed, so why java removes this keyword ??? - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 'i' : //if implements import instanceof int interface switch (length) { @@ -3122,12 +3138,12 @@ if (data[++index] == 'f') return TokenNameif; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 3 : if ((data[++index] == 'n') && (data[++index] == 't')) return TokenNameint; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 6 : if ((data[++index] == 'm') && (data[++index] == 'p') @@ -3136,7 +3152,7 @@ && (data[++index] == 't')) return TokenNameimport; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 9 : if ((data[++index] == 'n') && (data[++index] == 't') @@ -3148,7 +3164,7 @@ && (data[++index] == 'e')) return TokenNameinterface; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 10 : if (data[++index] == 'm') if ((data[++index] == 'p') @@ -3161,7 +3177,7 @@ && (data[++index] == 's')) return TokenNameimplements; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; else if ((data[index] == 'n') && (data[++index] == 's') @@ -3174,10 +3190,10 @@ && (data[++index] == 'f')) return TokenNameinstanceof; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; default : - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } case 'l' : //long @@ -3188,7 +3204,7 @@ return TokenNamelong; } } - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 'n' : //native new null switch (length) { @@ -3196,12 +3212,12 @@ if ((data[++index] == 'e') && (data[++index] == 'w')) return TokenNamenew; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 4 : if ((data[++index] == 'u') && (data[++index] == 'l') && (data[++index] == 'l')) return TokenNamenull; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 6 : if ((data[++index] == 'a') && (data[++index] == 't') @@ -3210,9 +3226,9 @@ && (data[++index] == 'e')) { return TokenNamenative; } else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; default : - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } case 'p' : //package private protected public @@ -3225,7 +3241,7 @@ && (data[++index] == 'c')) { return TokenNamepublic; } else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 7 : if (data[++index] == 'a') if ((data[++index] == 'c') @@ -3235,7 +3251,7 @@ && (data[++index] == 'e')) return TokenNamepackage; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; else if ((data[index] == 'r') && (data[++index] == 'i') @@ -3245,7 +3261,7 @@ && (data[++index] == 'e')) { return TokenNameprivate; } else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 9 : if ((data[++index] == 'r') && (data[++index] == 'o') @@ -3257,10 +3273,10 @@ && (data[++index] == 'd')) { return TokenNameprotected; } else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; default : - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } case 'r' : //return @@ -3273,7 +3289,7 @@ return TokenNamereturn; } } - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 's' : //short static super switch synchronized strictfp switch (length) { @@ -3282,7 +3298,7 @@ if ((data[++index] == 'o') && (data[++index] == 'r') && (data[++index] == 't')) return TokenNameshort; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; else if ((data[index] == 'u') && (data[++index] == 'p') @@ -3290,7 +3306,7 @@ && (data[++index] == 'r')) return TokenNamesuper; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 6 : if (data[++index] == 't') @@ -3300,7 +3316,7 @@ && (data[++index] == 'c')) { return TokenNamestatic; } else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; else if ((data[index] == 'w') && (data[++index] == 'i') @@ -3309,7 +3325,7 @@ && (data[++index] == 'h')) return TokenNameswitch; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 8 : if ((data[++index] == 't') && (data[++index] == 'r') @@ -3320,7 +3336,7 @@ && (data[++index] == 'p')) return TokenNamestrictfp; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 12 : if ((data[++index] == 'y') && (data[++index] == 'n') @@ -3335,9 +3351,9 @@ && (data[++index] == 'd')) { return TokenNamesynchronized; } else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; default : - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } case 't' : //try throw throws transient this true @@ -3346,18 +3362,18 @@ if ((data[++index] == 'r') && (data[++index] == 'y')) return TokenNametry; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 4 : if (data[++index] == 'h') if ((data[++index] == 'i') && (data[++index] == 's')) return TokenNamethis; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; else if ((data[index] == 'r') && (data[++index] == 'u') && (data[++index] == 'e')) return TokenNametrue; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 5 : if ((data[++index] == 'h') && (data[++index] == 'r') @@ -3365,7 +3381,7 @@ && (data[++index] == 'w')) return TokenNamethrow; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 6 : if ((data[++index] == 'h') && (data[++index] == 'r') @@ -3374,7 +3390,7 @@ && (data[++index] == 's')) return TokenNamethrows; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 9 : if ((data[++index] == 'r') && (data[++index] == 'a') @@ -3386,10 +3402,10 @@ && (data[++index] == 't')) { return TokenNametransient; } else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; default : - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } case 'v' : //void volatile @@ -3398,7 +3414,7 @@ if ((data[++index] == 'o') && (data[++index] == 'i') && (data[++index] == 'd')) return TokenNamevoid; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; case 8 : if ((data[++index] == 'o') && (data[++index] == 'l') @@ -3409,10 +3425,10 @@ && (data[++index] == 'e')) { return TokenNamevolatile; } else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; default : - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } case 'w' : //while widefp @@ -3424,17 +3440,17 @@ && (data[++index] == 'e')) return TokenNamewhile; else - return TokenNameIdentifier; + return InternalTokenNameIdentifier; //case 6:if ( (data[++index] =='i') && (data[++index]=='d') && (data[++index]=='e') && (data[++index]=='f')&& (data[++index]=='p')) //return TokenNamewidefp ; //else //return TokenNameIdentifier; default : - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } default : - return TokenNameIdentifier; + return InternalTokenNameIdentifier; } } @@ -3747,9 +3763,11 @@ * @param position int * @return int */ +@Override public final int getLineNumber(int position) { return Util.getLineNumber(position, this.lineEnds, 0, this.linePtr); } +@Override public final void setSource(char[] sourceString){ //the source-buffer is set to sourceString @@ -3791,6 +3809,7 @@ public final void setSource(CompilationResult compilationResult) { setSource(null, compilationResult); } +@Override public String toString() { if (this.startPosition == this.eofPosition) return "EOF\n\n" + new String(this.source); //$NON-NLS-1$ @@ -3822,7 +3841,7 @@ } public String toStringAction(int act) { switch (act) { - case TokenNameIdentifier : + case InternalTokenNameIdentifier : return "Identifier(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ case TokenNameabstract : return "abstract"; //$NON-NLS-1$ diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RecordedParsingInformation.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RecordedParsingInformation.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RecordedParsingInformation.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RecordedParsingInformation.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2002, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ReferenceInfoAdapter.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ReferenceInfoAdapter.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ReferenceInfoAdapter.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ReferenceInfoAdapter.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RequiresInfo.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RequiresInfo.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RequiresInfo.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RequiresInfo.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ResourceCompilationUnit.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ResourceCompilationUnit.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ResourceCompilationUnit.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ResourceCompilationUnit.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -41,6 +44,7 @@ this.mainTypeName = f.substring(start, end).toCharArray(); } + @Override public char[] getContents() { if (this.contents != null) return this.contents; // answer the cached source diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleAnnotationsAttribute.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleAnnotationsAttribute.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleAnnotationsAttribute.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleAnnotationsAttribute.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2004, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -54,15 +57,12 @@ } } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.IRuntimeInvisibleAnnotations#getAnnotations() - */ + @Override public IAnnotation[] getAnnotations() { return this.annotations; } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.IRuntimeInvisibleAnnotations#getAnnotationsNumber() - */ + + @Override public int getAnnotationsNumber() { return this.annotationsNumber; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleParameterAnnotationsAttribute.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleParameterAnnotationsAttribute.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleParameterAnnotationsAttribute.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleParameterAnnotationsAttribute.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2004, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -53,15 +56,13 @@ this.parameterAnnotations = NO_ENTRIES; } } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.IRuntimeInvisibleParameterAnnotations#getAnnotations() - */ + + @Override public IParameterAnnotation[] getParameterAnnotations() { return this.parameterAnnotations; } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.IRuntimeInvisibleParameterAnnotations#getParametersNumber() - */ + + @Override public int getParametersNumber() { return this.parametersNumber; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleTypeAnnotationsAttribute.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleTypeAnnotationsAttribute.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleTypeAnnotationsAttribute.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleTypeAnnotationsAttribute.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -57,15 +60,12 @@ } } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.IRuntimeInvisibleTypeAnnotationsAttribute.getExtendedAnnotations() - */ + @Override public IExtendedAnnotation[] getExtendedAnnotations() { return this.extendedAnnotations; } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.IRuntimeInvisibleTypeAnnotationsAttribute.getExtendedAnnotationsNumber() - */ + + @Override public int getExtendedAnnotationsNumber() { return this.extendedAnnotationsNumber; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleAnnotationsAttribute.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleAnnotationsAttribute.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleAnnotationsAttribute.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleAnnotationsAttribute.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2004, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -53,15 +56,13 @@ this.annotations = NO_ENTRIES; } } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.IRuntimeVisibleAnnotations#getAnnotations() - */ + + @Override public IAnnotation[] getAnnotations() { return this.annotations; } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.IRuntimeVisibleAnnotations#getAnnotationsNumber() - */ + + @Override public int getAnnotationsNumber() { return this.annotationsNumber; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleParameterAnnotationsAttribute.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleParameterAnnotationsAttribute.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleParameterAnnotationsAttribute.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleParameterAnnotationsAttribute.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2004, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -53,15 +56,13 @@ this.parameterAnnotations = NO_ENTRIES; } } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.IRuntimeVisibleParameterAnnotations#getAnnotations() - */ + + @Override public IParameterAnnotation[] getParameterAnnotations() { return this.parameterAnnotations; } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.IRuntimeVisibleParameterAnnotations#getParametersNumber() - */ + + @Override public int getParametersNumber() { return this.parametersNumber; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleTypeAnnotationsAttribute.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleTypeAnnotationsAttribute.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleTypeAnnotationsAttribute.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleTypeAnnotationsAttribute.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2012, 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -54,15 +57,13 @@ this.extendedAnnotations = NO_ENTRIES; } } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.IRuntimeVisibleTypeAnnotationsAttribute.getExtendedAnnotations() - */ + + @Override public IExtendedAnnotation[] getExtendedAnnotations() { return this.extendedAnnotations; } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.IRuntimeVisibleTypeAnnotationsAttribute.getExtendedAnnotationsNumber() - */ + + @Override public int getExtendedAnnotationsNumber() { return this.extendedAnnotationsNumber; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SignatureAttribute.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SignatureAttribute.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SignatureAttribute.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SignatureAttribute.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -34,15 +37,13 @@ } this.signature = constantPoolEntry.getUtf8Value(); } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.ISignatureAttribute#getSignatureIndex() - */ + + @Override public int getSignatureIndex() { return this.signatureIndex; } - /* (non-Javadoc) - * @see org.eclipse.jdt.core.util.ISignatureAttribute#getSignature() - */ + + @Override public char[] getSignature() { return this.signature; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SimpleDocument.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SimpleDocument.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SimpleDocument.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SimpleDocument.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -31,324 +34,238 @@ this.buffer = new StringBuffer(source); } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#getChar(int) - */ + @Override public char getChar(int offset) { return 0; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#getLength() - */ + @Override public int getLength() { return this.buffer.length(); } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#get() - */ + @Override public String get() { return this.buffer.toString(); } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#get(int, int) - */ + @Override public String get(int offset, int length) { return this.buffer.substring(offset, offset + length); } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#set(java.lang.String) - */ + @Override public void set(String text) { // defining interface method } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#replace(int, int, java.lang.String) - */ + @Override public void replace(int offset, int length, String text) { this.buffer.replace(offset, offset + length, text); } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#addDocumentListener(org.eclipse.jface.text.IDocumentListener) - */ + @Override public void addDocumentListener(IDocumentListener listener) { // defining interface method } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#removeDocumentListener(org.eclipse.jface.text.IDocumentListener) - */ + @Override public void removeDocumentListener(IDocumentListener listener) { // defining interface method } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#addPrenotifiedDocumentListener(org.eclipse.jface.text.IDocumentListener) - */ + @Override public void addPrenotifiedDocumentListener(IDocumentListener documentAdapter) { // defining interface method } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#removePrenotifiedDocumentListener(org.eclipse.jface.text.IDocumentListener) - */ + @Override public void removePrenotifiedDocumentListener(IDocumentListener documentAdapter) { // defining interface method } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#addPositionCategory(java.lang.String) - */ + @Override public void addPositionCategory(String category) { // defining interface method } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#removePositionCategory(java.lang.String) - */ + @Override public void removePositionCategory(String category) { // defining interface method } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#getPositionCategories() - */ + @Override public String[] getPositionCategories() { // defining interface method return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#containsPositionCategory(java.lang.String) - */ + @Override public boolean containsPositionCategory(String category) { // defining interface method return false; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#addPosition(org.eclipse.jface.text.Position) - */ + @Override public void addPosition(Position position) { // defining interface method } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#removePosition(org.eclipse.jface.text.Position) - */ + @Override public void removePosition(Position position) { // defining interface method } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#addPosition(java.lang.String, org.eclipse.jface.text.Position) - */ + @Override public void addPosition(String category, Position position) { // defining interface method } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#removePosition(java.lang.String, org.eclipse.jface.text.Position) - */ + @Override public void removePosition(String category, Position position) { // defining interface method } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#getPositions(java.lang.String) - */ + @Override public Position[] getPositions(String category) { // defining interface method return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#containsPosition(java.lang.String, int, int) - */ + @Override public boolean containsPosition(String category, int offset, int length) { // defining interface method return false; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#computeIndexInCategory(java.lang.String, int) - */ + @Override public int computeIndexInCategory(String category, int offset) { // defining interface method return 0; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#addPositionUpdater(org.eclipse.jface.text.IPositionUpdater) - */ + @Override public void addPositionUpdater(IPositionUpdater updater) { // defining interface method } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#removePositionUpdater(org.eclipse.jface.text.IPositionUpdater) - */ + @Override public void removePositionUpdater(IPositionUpdater updater) { // defining interface method } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#insertPositionUpdater(org.eclipse.jface.text.IPositionUpdater, int) - */ + @Override public void insertPositionUpdater(IPositionUpdater updater, int index) { // defining interface method } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#getPositionUpdaters() - */ + @Override public IPositionUpdater[] getPositionUpdaters() { // defining interface method return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#getLegalContentTypes() - */ + @Override public String[] getLegalContentTypes() { // defining interface method return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#getContentType(int) - */ + @Override public String getContentType(int offset) { // defining interface method return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#getPartition(int) - */ + @Override public ITypedRegion getPartition(int offset) { // defining interface method return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#computePartitioning(int, int) - */ + @Override public ITypedRegion[] computePartitioning(int offset, int length) { // defining interface method return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#addDocumentPartitioningListener(org.eclipse.jface.text.IDocumentPartitioningListener) - */ + @Override public void addDocumentPartitioningListener(IDocumentPartitioningListener listener) { // defining interface method } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#removeDocumentPartitioningListener(org.eclipse.jface.text.IDocumentPartitioningListener) - */ + @Override public void removeDocumentPartitioningListener(IDocumentPartitioningListener listener) { // defining interface method } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#setDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner) - */ + @Override public void setDocumentPartitioner(IDocumentPartitioner partitioner) { // defining interface method } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#getDocumentPartitioner() - */ + @Override public IDocumentPartitioner getDocumentPartitioner() { // defining interface method return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#getLineLength(int) - */ + @Override public int getLineLength(int line) { // defining interface method return 0; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#getLineOfOffset(int) - */ + @Override public int getLineOfOffset(int offset) { // defining interface method return 0; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#getLineOffset(int) - */ + @Override public int getLineOffset(int line) { // defining interface method return 0; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#getLineInformation(int) - */ + @Override public IRegion getLineInformation(int line) { // defining interface method return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#getLineInformationOfOffset(int) - */ + @Override public IRegion getLineInformationOfOffset(int offset) { // defining interface method return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#getNumberOfLines() - */ + @Override public int getNumberOfLines() { // defining interface method return 0; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#getNumberOfLines(int, int) - */ + @Override public int getNumberOfLines(int offset, int length) { // defining interface method return 0; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#computeNumberOfLines(java.lang.String) - */ + @Override public int computeNumberOfLines(String text) { // defining interface method return 0; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#getLegalLineDelimiters() - */ + @Override public String[] getLegalLineDelimiters() { // defining interface method return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.IDocument#getLineDelimiter(int) - */ + @Override public String getLineDelimiter(int line) { // defining interface method return null; @@ -358,6 +275,7 @@ * @see org.eclipse.jface.text.IDocument#search(int, java.lang.String, boolean, boolean, boolean) * @deprecated */ + @Override public int search( int startOffset, String findString, diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SimpleWordSet.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SimpleWordSet.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SimpleWordSet.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SimpleWordSet.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SourceFileAttribute.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SourceFileAttribute.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SourceFileAttribute.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SourceFileAttribute.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -49,6 +52,7 @@ /** * @see ISourceAttribute#getSourceFileIndex() */ + @Override public int getSourceFileIndex() { return this.sourceFileIndex; } @@ -56,6 +60,7 @@ /** * @see ISourceAttribute#getSourceFileName() */ + @Override public char[] getSourceFileName() { return this.sourceFileName; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/StackMapAttribute.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/StackMapAttribute.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/StackMapAttribute.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/StackMapAttribute.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -66,10 +69,12 @@ } } + @Override public int getNumberOfEntries() { return this.numberOfEntries; } + @Override public IStackMapFrame[] getStackMapFrame() { return this.frames; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/StackMapFrame.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/StackMapFrame.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/StackMapFrame.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/StackMapFrame.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -149,21 +152,27 @@ int sizeInBytes() { return this.readOffset; } + @Override public int getFrameType() { return this.frameType; } + @Override public IVerificationTypeInfo[] getLocals() { return this.locals; } + @Override public int getNumberOfLocals() { return this.numberOfLocals; } + @Override public int getNumberOfStackItems() { return this.numberOfStackItems; } + @Override public int getOffsetDelta() { return this.offsetDelta; } + @Override public IVerificationTypeInfo[] getStackItems() { return this.stackItems; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/StackMapTableAttribute.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/StackMapTableAttribute.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/StackMapTableAttribute.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/StackMapTableAttribute.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -66,10 +69,12 @@ } } + @Override public int getNumberOfEntries() { return this.numberOfEntries; } + @Override public IStackMapFrame[] getStackMapFrame() { return this.frames; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ToStringSorter.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ToStringSorter.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ToStringSorter.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ToStringSorter.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,75 +1,60 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.jdt.internal.core.util; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.function.Function; + /** * The SortOperation takes a collection of objects and returns * a sorted collection of these objects. The sorting of these * objects is based on their toString(). They are sorted in * alphabetical order. */ -public class ToStringSorter { - Object[] sortedObjects; - String[] sortedStrings; -/** - * Returns true if stringTwo is 'greater than' stringOne - * This is the 'ordering' method of the sort operation. - */ -public boolean compare(String stringOne, String stringTwo) { - return stringOne.compareTo(stringTwo) < 0; -} -/** - * Sort the objects in sorted collection and return that collection. - */ -private void quickSort(int left, int right) { - int originalLeft = left; - int originalRight = right; - int midIndex = left + (right - left) / 2; - String midToString = this.sortedStrings[midIndex]; - - do { - while (compare(this.sortedStrings[left], midToString)) - left++; - while (compare(midToString, this.sortedStrings[right])) - right--; - if (left <= right) { - Object tmp = this.sortedObjects[left]; - this.sortedObjects[left] = this.sortedObjects[right]; - this.sortedObjects[right] = tmp; - String tmpToString = this.sortedStrings[left]; - this.sortedStrings[left] = this.sortedStrings[right]; - this.sortedStrings[right] = tmpToString; - left++; - right--; +public class ToStringSorter { + private final Function toString; + + public ToStringSorter(Function toString) { + this.toString = toString; + } + + static class Pair implements Comparable> { + final T object; + final String string; + public Pair(T k, String s) { + this.object = k; + this.string = s; } - } while (left <= right); - if (originalLeft < right) - quickSort(originalLeft, right); - if (left < originalRight) - quickSort(left, originalRight); -} -/** - * Return a new sorted collection from this unsorted collection. - * Sort using quick sort. - */ -public void sort(Object[] unSortedObjects, String[] unsortedStrings) { - int size = unSortedObjects.length; - this.sortedObjects = new Object[size]; - this.sortedStrings = new String[size]; - - //copy the array so can return a new sorted collection - System.arraycopy(unSortedObjects, 0, this.sortedObjects, 0, size); - System.arraycopy(unsortedStrings, 0, this.sortedStrings, 0, size); - if (size > 1) - quickSort(0, size - 1); -} + @Override + public int compareTo(Pair other) { + return this.string.compareTo(other.string); + } + } + + /** + * Return a new sorted collection from this unsorted collection. + */ + public List> sort(Collection unSorted) { + int size = unSorted.size(); + //copy the list so can return a new sorted collection + List> sortedObjects = new ArrayList<>(size); + unSorted.forEach(k -> sortedObjects.add(new Pair<>(k, this.toString.apply(k)))); + Collections.sort(sortedObjects); + return sortedObjects; + } } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -43,9 +46,10 @@ import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; import org.eclipse.jdt.internal.compiler.ast.AnnotationMethodDeclaration; import org.eclipse.jdt.internal.compiler.ast.Argument; -import org.eclipse.jdt.internal.compiler.ast.UnionTypeReference; +import org.eclipse.jdt.internal.compiler.ast.IntersectionCastTypeReference; import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration; import org.eclipse.jdt.internal.compiler.ast.TypeReference; +import org.eclipse.jdt.internal.compiler.ast.UnionTypeReference; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException; @@ -752,7 +756,7 @@ } private static IClassFile getClassFile(char[] fileName) { - int jarSeparator = CharOperation.lastIndexOf(IDependent.JAR_FILE_ENTRY_SEPARATOR, fileName); + int jarSeparator = CharOperation.indexOf(IDependent.JAR_FILE_ENTRY_SEPARATOR, fileName); int pkgEnd = CharOperation.lastIndexOf('/', fileName); // pkgEnd is exclusive if (pkgEnd == -1) pkgEnd = CharOperation.lastIndexOf(File.separatorChar, fileName); @@ -772,15 +776,23 @@ if (pkgEnd == -1) return null; IPackageFragment pkg = getPackageFragment(slashSeparatedFileName, pkgEnd, -1/*no jar separator for .java files*/); - if (pkg == null) return null; - int start; - ICompilationUnit cu = pkg.getCompilationUnit(new String(slashSeparatedFileName, start = pkgEnd+1, slashSeparatedFileName.length - start)); - if (workingCopyOwner != null) { - ICompilationUnit workingCopy = cu.findWorkingCopy(workingCopyOwner); - if (workingCopy != null) - return workingCopy; + if (pkg != null) { + int start; + ICompilationUnit cu = pkg.getCompilationUnit(new String(slashSeparatedFileName, start = pkgEnd+1, slashSeparatedFileName.length - start)); + if (workingCopyOwner != null) { + ICompilationUnit workingCopy = cu.findWorkingCopy(workingCopyOwner); + if (workingCopy != null) + return workingCopy; + } + return cu; + } + IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot(); + IFile file = wsRoot.getFile(new Path(String.valueOf(fileName))); + if (file.exists()) { + // this approach works if file exists but is not on the project's build path: + return JavaCore.createCompilationUnitFrom(file); } - return cu; + return null; } /** @@ -1485,7 +1497,7 @@ if (referenceBinding.isLocalType() || referenceBinding.isAnonymousType()) { // local or anonymous type if (org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(fileName)) { - int jarSeparator = CharOperation.lastIndexOf(IDependent.JAR_FILE_ENTRY_SEPARATOR, fileName); + int jarSeparator = CharOperation.indexOf(IDependent.JAR_FILE_ENTRY_SEPARATOR, fileName); int pkgEnd = CharOperation.lastIndexOf('/', fileName); // pkgEnd is exclusive if (pkgEnd == -1) pkgEnd = CharOperation.lastIndexOf(File.separatorChar, fileName); @@ -2332,6 +2344,7 @@ IJavaElement[] copy = new IJavaElement[len]; System.arraycopy(elements, 0, copy, 0, len); sort(copy, new Comparer() { + @Override public int compare(Object a, Object b) { return ((JavaElement) a).toStringWithAncestors().compareTo(((JavaElement) b).toStringWithAncestors()); } @@ -2696,14 +2709,13 @@ // special treatment for union type reference UnionTypeReference unionTypeReference = (UnionTypeReference) type; TypeReference[] typeReferences = unionTypeReference.typeReferences; - int length = typeReferences.length; - String[] typeSignatures = new String[length]; - for(int i = 0; i < length; i++) { - char[][] compoundName = typeReferences[i].getParameterizedTypeName(); - char[] typeName = CharOperation.concatWith(compoundName, '.'); - typeSignatures[i] = Signature.createTypeSignature(typeName, false/*don't resolve*/); - } + String[] typeSignatures = typeSignatures(typeReferences); signature = Signature.createIntersectionTypeSignature(typeSignatures); + } else if (type instanceof IntersectionCastTypeReference) { + IntersectionCastTypeReference intersection = (IntersectionCastTypeReference) type; + TypeReference[] typeReferences = intersection.typeReferences; + String[] typeSignatures = typeSignatures(typeReferences); + signature = Signature.createUnionTypeSignature(typeSignatures); } else { char[][] compoundName = type.getParameterizedTypeName(); char[] typeName =CharOperation.concatWith(compoundName, '.'); @@ -2711,7 +2723,17 @@ } return signature; } - + + private static String[] typeSignatures(TypeReference[] types) { + int length = types.length; + String[] typeSignatures = new String[length]; + for(int i = 0; i < length; i++) { + char[][] compoundName = types[i].getParameterizedTypeName(); + char[] typeName = CharOperation.concatWith(compoundName, '.'); + typeSignatures[i] = Signature.createTypeSignature(typeName, false/*don't resolve*/); + } + return typeSignatures; + } /** * Asserts that the given method signature is valid. */ @@ -3323,7 +3345,7 @@ } int length = args.length; for(int i = startingIndex; i< length ; i++){ - args[i] = new String(paramTypeSignatures[i-startingIndex]); + args[i] = paramTypeSignatures[i-startingIndex]; } method = type.getMethod(new String(selector), args); diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/VerificationInfo.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/VerificationInfo.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/VerificationInfo.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/VerificationInfo.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2004, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -50,18 +53,22 @@ } } + @Override public int getTag() { return this.tag; } + @Override public int getOffset() { return this.offset; } + @Override public int getConstantPoolIndex() { return this.constantPoolIndex; } + @Override public char[] getClassTypeName() { return this.classTypeName; } diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/WeakHashSet.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/WeakHashSet.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/WeakHashSet.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/WeakHashSet.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2004, 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -24,6 +27,7 @@ super(referent, queue); this.hashCode = referent.hashCode(); } + @Override public boolean equals(Object obj) { if (!(obj instanceof HashableWeakReference)) return false; Object referent = get(); @@ -31,9 +35,11 @@ if (referent == null) return other == null; return referent.equals(other); } + @Override public int hashCode() { return this.hashCode; } + @Override public String toString() { Object referent = get(); if (referent == null) return "[hashCode=" + this.hashCode + "] "; //$NON-NLS-1$ //$NON-NLS-2$ @@ -200,6 +206,7 @@ return this.elementSize; } + @Override public String toString() { StringBuffer buffer = new StringBuffer("{"); //$NON-NLS-1$ for (int i = 0, length = this.values.length; i < length; i++) { diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/WeakHashSetOfCharArray.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/WeakHashSetOfCharArray.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/WeakHashSetOfCharArray.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/WeakHashSetOfCharArray.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2004, 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -26,6 +29,7 @@ super(referent, queue); this.hashCode = CharOperation.hashCode(referent); } + @Override public boolean equals(Object obj) { if (!(obj instanceof HashableWeakReference)) return false; char[] referent = (char[]) get(); @@ -33,9 +37,11 @@ if (referent == null) return other == null; return CharOperation.equals(referent, other); } + @Override public int hashCode() { return this.hashCode; } + @Override public String toString() { char[] referent = (char[]) get(); if (referent == null) return "[hashCode=" + this.hashCode + "] "; //$NON-NLS-1$ //$NON-NLS-2$ @@ -202,6 +208,7 @@ return this.elementSize; } + @Override public String toString() { StringBuffer buffer = new StringBuffer("{"); //$NON-NLS-1$ for (int i = 0, length = this.values.length; i < length; i++) { diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/VerboseElementCache.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/VerboseElementCache.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/VerboseElementCache.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/VerboseElementCache.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation @@ -13,9 +16,12 @@ import java.text.NumberFormat; import java.util.Date; -public class VerboseElementCache extends ElementCache { +import org.eclipse.jdt.core.IJavaElement; +import org.eclipse.jdt.core.IOpenable; + +public class VerboseElementCache extends ElementCache { - private Object beingAdded; + private K beingAdded; private String name; public VerboseElementCache(int size, String name) { @@ -23,6 +29,7 @@ this.name = name; } + @Override protected boolean makeSpace(int space) { if (this.beingAdded == null) return super.makeSpace(space); String fillingRatio = toStringFillingRation(this.name); @@ -37,7 +44,8 @@ return result; } - public Object put(Object key, Object value) { + @Override + public JavaElementInfo put(K key, JavaElementInfo value) { try { if (this.beingAdded == null) this.beingAdded = key; diff -Nru ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/XMLWriter.java ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/XMLWriter.java --- ecj-3.13.3/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/XMLWriter.java 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/XMLWriter.java 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ /******************************************************************************* * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/.options ecj-3.16.0/org.eclipse.jdt.core/.options --- ecj-3.13.3/org.eclipse.jdt.core/.options 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/.options 2018-12-06 10:38:58.000000000 +0000 @@ -1,5 +1,5 @@ # Turn on debug tracing for org.eclipse.jdt.core plugin -org.eclipse.jdt.core/debug=true +org.eclipse.jdt.core/debug=false # Reports buffer manager activity org.eclipse.jdt.core/debug/buffermanager=false diff -Nru ecj-3.13.3/org.eclipse.jdt.core/plugin.properties ecj-3.16.0/org.eclipse.jdt.core/plugin.properties --- ecj-3.13.3/org.eclipse.jdt.core/plugin.properties 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/plugin.properties 2018-12-06 10:38:58.000000000 +0000 @@ -1,9 +1,12 @@ ############################################################################### # Copyright (c) 2000, 2014 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 +# +# This program and the accompanying materials +# are made available under the terms of the Eclipse Public License 2.0 # which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html +# https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 # # Contributors: # IBM Corporation - initial API and implementation diff -Nru ecj-3.13.3/org.eclipse.jdt.core/plugin.xml ecj-3.16.0/org.eclipse.jdt.core/plugin.xml --- ecj-3.13.3/org.eclipse.jdt.core/plugin.xml 2018-02-15 07:25:55.000000000 +0000 +++ ecj-3.16.0/org.eclipse.jdt.core/plugin.xml 2018-12-06 10:38:58.000000000 +0000 @@ -2,10 +2,13 @@