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

JDK-8310861: Improve location reporting for javac serial lint warnings #14644

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -5048,16 +5048,19 @@ private void checkSerialPersistentFields(JCClassDecl tree, Element e, VarSymbol
if ((spf.flags() & (PRIVATE | STATIC | FINAL)) !=
(PRIVATE | STATIC | FINAL)) {
log.warning(LintCategory.SERIAL,
TreeInfo.diagnosticPositionFor(spf, tree), Warnings.ImproperSPF);
TreeInfo.diagnosticPositionFor(spf, tree),
Warnings.ImproperSPF);
}

if (!types.isSameType(spf.type, OSF_TYPE)) {
log.warning(LintCategory.SERIAL,
TreeInfo.diagnosticPositionFor(spf, tree), Warnings.OSFArraySPF);
TreeInfo.diagnosticPositionFor(spf, tree),
Warnings.OSFArraySPF);
}

if (isExternalizable((Type)(e.asType()))) {
log.warning(LintCategory.SERIAL, tree.pos(),
log.warning(LintCategory.SERIAL,
TreeInfo.diagnosticPositionFor(spf, tree),
Warnings.IneffectualSerialFieldExternalizable);
}

2 changes: 1 addition & 1 deletion test/langtools/tools/javac/warnings/Serial/Extern.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Extern.java:10:1: compiler.warn.externalizable.missing.public.no.arg.ctor
Extern.java:10:1: compiler.warn.ineffectual.serial.field.externalizable
Extern.java:17:46: compiler.warn.ineffectual.serial.field.externalizable
Extern.java:28:18: compiler.warn.ineffectual.serial.method.externalizable: readObject
Extern.java:34:18: compiler.warn.ineffectual.serial.method.externalizable: writeObject
Extern.java:39:18: compiler.warn.ineffectual.serial.method.externalizable: readObjectNoData