OpenJDK / bsd-port / jdk9 / langtools
changeset 3875:97a60778fc6a
8171332: NPE in MembersPhase.finishClass
Reviewed-by: mcimadamore
author | vromero |
---|---|
date | Tue, 10 Jan 2017 11:31:59 -0800 |
parents | 6891ece2edae |
children | f94e974fe589 |
files | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java test/tools/javac/T8171332/Buggy.java test/tools/javac/T8171332/Processor.java test/tools/javac/T8171332/Processor.out |
diffstat | 4 files changed, 50 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java Tue Jan 10 13:53:44 2017 +0100 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java Tue Jan 10 11:31:59 2017 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -938,6 +938,7 @@ */ void finishClass(JCClassDecl tree, Env<AttrContext> env) { if ((tree.mods.flags & Flags.ENUM) != 0 && + !tree.sym.type.hasTag(ERROR) && (types.supertype(tree.sym.type).tsym.flags() & Flags.ENUM) == 0) { addEnumMembers(tree, env); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/T8171332/Buggy.java Tue Jan 10 11:31:59 2017 -0800 @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +@Deprecated enum Buggy implements Buggy {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/T8171332/Processor.java Tue Jan 10 11:31:59 2017 -0800 @@ -0,0 +1,21 @@ +/** + * @test /nodynamiccopyright/ + * @bug 8171332 + * @summary 8171332: NPE in MembersPhase.finishClass + * @modules java.compiler + * jdk.compiler + * @build Processor + * @compile/fail/ref=Processor.out -XDrawDiagnostics -processor Processor Buggy.java + */ + +import java.util.Set; +import javax.annotation.processing.*; +import javax.lang.model.element.TypeElement; + +@SupportedAnnotationTypes("*") +public class Processor extends AbstractProcessor { + @Override + public boolean process(Set<? extends TypeElement> set, RoundEnvironment roundEnvironment) { + return false; + } +}