Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8297988: NPE in JavacTypes.getOverriddenMethods from doclint #11535

Closed
wants to merge 1 commit into from

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Dec 6, 2022

There are a few cases where javac parses Java source code, reads some name from the AST, and throws it away. This is used e.g. when validating exports directive in the module-info, if there are no classfiles and no source files used in the current compilation from the given package, javac will peek into the sources in the package, looking at their package clause[1]. The ASTs produced by such parses are thrown away/not part of the upcoming compilation.

But, even parses like this are reported to the TaskListeners, and some of the listeners may expect that the AST is eventually attributed - but it is not, as it was used only to read some name from the source code. Specifically, for DocLint, this may lead to an NPE, but it may cause other issues as well.

The proposal here is to simply avoid sending the "parse" event for parses that are not part of the actual compilation.

[1]

if (findPackageInFile.findPackageNameOf(jfo) == tree.directive.packge.fullname) {


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8297988: NPE in JavacTypes.getOverriddenMethods from doclint

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11535/head:pull/11535
$ git checkout pull/11535

Update a local copy of the PR:
$ git checkout pull/11535
$ git pull https://git.openjdk.org/jdk pull/11535/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11535

View PR using the GUI difftool:
$ git pr show -t 11535

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11535.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 6, 2022

👋 Welcome back jlahoda! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 6, 2022
@openjdk
Copy link

openjdk bot commented Dec 6, 2022

@lahodaj The following label will be automatically applied to this pull request:

  • compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the compiler compiler-dev@openjdk.org label Dec 6, 2022
@mlbridge
Copy link

mlbridge bot commented Dec 6, 2022

Webrevs

@lahodaj
Copy link
Contributor Author

lahodaj commented Dec 8, 2022

Resubmitted as openjdk/jdk20#2 for JDK 20.

@lahodaj lahodaj closed this Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler compiler-dev@openjdk.org rfr Pull request is ready for review
1 participant