oracle / nb-javac

nb-javac is the Java compiler plugin used by the Apache NetBeans Java Editor
GNU General Public License v2.0
20 stars 21 forks source link

Fix for Apache NetBeans issue 4950 - repeated NPEs during scanning #7

Closed timboudreau closed 3 years ago

timboudreau commented 3 years ago

Repeated NPEs are thrown during classpath scanning, making the IDE unusable during classpath scanning

See https://issues.apache.org/jira/browse/NETBEANS-4950 for details.

TL/DR: NetBeans reuses the JavacProcessingEnvironment; nulling the set of discovered processors on close severely breaks things.

jglick commented 3 years ago

Is this intended to resolve #4?

timboudreau commented 3 years ago

Yup.

On Thu, Jan 28, 2021 at 5:24 PM Jesse Glick notifications@github.com wrote:

Is this intended to resolve

java.lang.NullPointerException

at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:914)

at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$2500(JavacProcessingEnvironment.java:113)

at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1298)

at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1380)

at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1350)

at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1240)

at com.sun.tools.javac.main.JavaCompiler.lambda$readSourceFile$3(JavaCompiler.java:930)

at com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:330)

at com.sun.tools.javac.code.Symbol.complete(Symbol.java:683)

at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1434)

at com.sun.tools.javac.code.Type$ClassType.complete(Type.java:1164)

at com.sun.tools.javac.code.Type$ClassType.getTypeArguments(Type.java:1085)

at com.sun.tools.javac.code.Type$ClassType.isErroneous(Type.java:1120)

at com.sun.tools.javac.comp.Resolve.findGlobalType(Resolve.java:2258)

at com.sun.tools.javac.comp.Resolve.findType(Resolve.java:2337)

at com.sun.tools.javac.comp.Resolve.findIdentInternal(Resolve.java:2372)

at com.sun.tools.javac.comp.Resolve.findIdent(Resolve.java:2358)

at com.sun.tools.javac.comp.Resolve.resolveIdent(Resolve.java:2632)

at com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:4214)

at …

?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/oracle/nb-javac/pull/7#issuecomment-769439524, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOQE52NOMXSPH4WKOF4QS3S4HP3NANCNFSM4WSUKXWQ .

-- http://timboudreau.com

Akshay-Gupta-19 commented 3 years ago

@timboudreau for us to accept this RP you have to be signed the Oracle Contributor Agreement (OCA), please refer to https://github.com/oracle/nb-javac/blob/master/CONTRIBUTING.md for more details.

entonio commented 3 years ago

If the solution is removing a spurious close() + set null, maybe someone from the core team who knows what this is about could chime in and do the job? (I'm never keen on just deleting code, but if it's there by mistake then delete it.) This needs a solution because the error makes the IDE unusable for lots of gradle projects (at least for me). I know this doesn't happen in 12.0 (but 12.0 has other problems, for me at least). From the description it sounds like the problem is only during classpath scanning, but the thing is that at least for me classpath scanning is continually restarting, so it's permanent

singh-akhilesh commented 3 years ago

Hi Tim, We committed the changes made by Jan Lahoda in the PR https://github.com/oracle/nb-javac/pull/10 . So closing this PR. Thanks