Integrated: 8286573: Remove the unnecessary method Attr#attribTopLevel and its usage

Guoxiong Li gli at openjdk.java.net
Thu May 12 13:09:49 UTC 2022


On Wed, 11 May 2022 08:49:46 GMT, Guoxiong Li <gli at openjdk.org> wrote:

> Hi all,
> 
> The original patch [1] added the method `Attr#attribTopLevel` to validate the annotations of the package. Then the annotation validation was moved to the annotation pipeline [2] and the TopLevel tree node was refactored (added JCPackageDecl) [3]. So now the `Attr#attribTopLevel` is replaced by method `attribPackage` and actually is not used by any code. It is good to remove it.
> 
> And there are only 3 places (shown below) that add the `Env` instance to the `Todo` list which the `Attr` uses as input. They add the `Env` of module, package, class seperately to the todo list . So the `Attr` doesn't need to handle the situation about TopLevel JCCompilationUnit.
> 
> 1. Enter::visitTopLevel  `todo.append(packageEnv)`
> 2. Enter::visitModuleDef `todo.append(moduleEnv)`
> 3. ImportsPhase::runPhase `todo.append(env)`
> 
> Thanks for taking the time to review.
> 
> Best Regards,
> -- Guoxiong
> 
> [1]https://github.com/openjdk/jdk/commit/13d31713dc6ac7134d81abeb11a659df2104d71f
> [2]https://github.com/openjdk/jdk/commit/da21af58f4811285f7050691d51fe32600c0e5f8
> [3]https://github.com/openjdk/jdk/commit/9783b65028eba41796c3e05ebb545b1a722f56b0

This pull request has now been integrated.

Changeset: 36bdd251
Author:    Guoxiong Li <gli at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/36bdd25159ff78425e5f0a1145a814d9edca97ae
Stats:     16 lines in 1 file changed: 0 ins; 16 del; 0 mod

8286573: Remove the unnecessary method Attr#attribTopLevel and its usage

Reviewed-by: vromero

-------------

PR: https://git.openjdk.java.net/jdk/pull/8648


More information about the compiler-dev mailing list