RFR: [8218152] javac fails and exits with no error if a bad annotation processor is on the classpath
Andrew John Hughes
gnu.andrew at redhat.com
Wed May 1 15:58:14 UTC 2019
[CCing jdk8u-dev for 8u review]
On 01/05/2019 08:04, Steve Groeger wrote:
> Hi all,
>
> The following issue [1] has been raised and the associated webrev [2] has
> been approved and the code merged into jdk/jdk [3]
> I am now requesting this fix to be back-ported to jdk8u, jdk11u and
> jdk12u.
> The patch imports and works correctly on jdk8u and jdk12u but not quite on
> jdk8u due to difference in the test framework.
> I have created a separate webrev for the jdk8u changes [4].
> I am therefore requesting someone to review these changes and to sponsor
> these updates to jdk8u, jdk11u and jdk12u.
>
> [1] https://bugs.openjdk.java.net/browse/JDK-8218152
> [2] http://cr.openjdk.java.net/~sgroeger/8218152/jdk/webrev.04/
> [3] http://hg.openjdk.java.net/jdk/jdk/rev/d9208a660094
> [4] http://cr.openjdk.java.net/~sgroeger/8218152/jdk8u/webrev.04/
>
> Thanks
> Steve Groeger
> IBM Runtime Technologies
> Hursley, Winchester
> Tel: (44) 1962 816911 Mobex: 279990 Mobile: 07718 517 129
> Fax (44) 1962 816800
> Lotus Notes: Steve Groeger/UK/IBM
> Internet: groeges at uk.ibm.com
>
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number
> 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number
> 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
>
Regarding the 8u webrev, the two additions for hasNext() and next() in
JavacProcessingEnvironment.java seem to have been flipped. Was this
intentional? Comparing patched jdk8u with the jdk/jdk version:
---
src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
2019-05-01 16:50:40.409545256 +0100
+++
../../jdk/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
2019-05-01 03:00
public boolean hasNext() {
try {
- return iterator.hasNext();
+ return internalHasNext();
} catch(ServiceConfigurationError sce) {
- log.error("proc.bad.config.file",
sce.getLocalizedMessage());
+
log.error(Errors.ProcBadConfigFile(sce.getLocalizedMessage()));
throw new Abort(sce);
+ } catch (UnsupportedClassVersionError ucve) {
+
log.error(Errors.ProcCantLoadClass(ucve.getLocalizedMessage()));
+ throw new Abort(ucve);
+ } catch (ClassFormatError cfe) {
+
log.error(Errors.ProcCantLoadClass(cfe.getLocalizedMessage()));
+ throw new Abort(cfe);
} catch (Throwable t) {
- log.error("proc.bad.config.file", t.getLocalizedMessage());
+
log.error(Errors.ProcBadConfigFile(t.getLocalizedMessage()));
throw new Abort(t);
}
}
...
public Processor next() {
try {
- return iterator.next();
+ return internalNext();
} catch (ServiceConfigurationError sce) {
- log.error("proc.bad.config.file",
sce.getLocalizedMessage());
+
log.error(Errors.ProcBadConfigFile(sce.getLocalizedMessage()));
throw new Abort(sce);
- } catch (UnsupportedClassVersionError ucve) {
- log.error("proc.cant.load.class",
ucve.getLocalizedMessage());
- throw new Abort(ucve);
- } catch (ClassFormatError cfe) {
- log.error("proc.cant.load.class",
cfe.getLocalizedMessage());
- throw new Abort(cfe);
} catch (Throwable t) {
- log.error("proc.bad.config.file", t.getLocalizedMessage());
+
log.error(Errors.ProcBadConfigFile(t.getLocalizedMessage()));
throw new Abort(t);
}
}
The test changes look ok and I assume they pass. Long term, we may want
to look at backporting https://bugs.openjdk.java.net/browse/JDK-8050429
to avoid this work for every test.
Thanks,
--
Andrew :)
Senior Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)
PGP Key: ed25519/0xCFDA0F9B35964222 (hkp://keys.gnupg.net)
Fingerprint = 5132 579D D154 0ED2 3E04 C5A0 CFDA 0F9B 3596 4222
https://keybase.io/gnu_andrew
More information about the jdk-updates-dev
mailing list