NoSupers.java revision 1465:b52a38d4536c
1230557Sjimharris/*
2230557Sjimharris * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
3230557Sjimharris * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4230557Sjimharris *
5230557Sjimharris * This code is free software; you can redistribute it and/or modify it
6230557Sjimharris * under the terms of the GNU General Public License version 2 only, as
7230557Sjimharris * published by the Free Software Foundation.
8230557Sjimharris *
9230557Sjimharris * This code is distributed in the hope that it will be useful, but WITHOUT
10230557Sjimharris * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11230557Sjimharris * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12230557Sjimharris * version 2 for more details (a copy is included in the LICENSE file that
13230557Sjimharris * accompanied this code).
14230557Sjimharris *
15230557Sjimharris * You should have received a copy of the GNU General Public License version
16230557Sjimharris * 2 along with this work; if not, write to the Free Software Foundation,
17230557Sjimharris * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18230557Sjimharris *
19230557Sjimharris * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20230557Sjimharris * or visit www.oracle.com if you need additional information or have any
21230557Sjimharris * questions.
22230557Sjimharris */
23230557Sjimharris
24230557Sjimharris/*
25230557Sjimharris * @test
26230557Sjimharris * @bug     6346453
27230557Sjimharris * @summary directSupertypes should return empty list if arg has no supertypes
28230557Sjimharris * @author  Scott Seligman
29230557Sjimharris * @library /tools/javac/lib
30230557Sjimharris * @build   JavacTestingAbstractProcessor NoSupers
31230557Sjimharris * @compile -processor NoSupers -proc:only NoSupers.java
32230557Sjimharris */
33230557Sjimharris
34230557Sjimharrisimport java.util.Set;
35230557Sjimharrisimport javax.annotation.processing.*;
36230557Sjimharrisimport javax.lang.model.element.*;
37230557Sjimharrisimport javax.lang.model.type.*;
38230557Sjimharrisimport javax.lang.model.util.*;
39230557Sjimharris
40230557Sjimharrispublic class NoSupers extends JavacTestingAbstractProcessor {
41230557Sjimharris    public boolean process(Set<? extends TypeElement> tes,
42230557Sjimharris                           RoundEnvironment round) {
43230557Sjimharris        if (round.processingOver()) return true;
44230557Sjimharris
45230557Sjimharris        PrimitiveType intType = types.getPrimitiveType(TypeKind.INT);
46230557Sjimharris        if (! types.directSupertypes(intType).isEmpty())
47230557Sjimharris            throw new AssertionError();
48230557Sjimharris        return true;
49230557Sjimharris    }
50230557Sjimharris}
51230557Sjimharris