Model01.java revision 1465:b52a38d4536c
160107Sobrien/*
232822Syokota * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
332822Syokota * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
432822Syokota *
532822Syokota * This code is free software; you can redistribute it and/or modify it
632822Syokota * under the terms of the GNU General Public License version 2 only, as
732822Syokota * published by the Free Software Foundation.
832822Syokota *
932822Syokota * This code is distributed in the hope that it will be useful, but WITHOUT
1032822Syokota * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1137204Ssteve * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1243334Syokota * version 2 for more details (a copy is included in the LICENSE file that
1343334Syokota * accompanied this code).
1443334Syokota *
1543334Syokota * You should have received a copy of the GNU General Public License version
1643334Syokota * 2 along with this work; if not, write to the Free Software Foundation,
1743334Syokota * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1843334Syokota *
1943334Syokota * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2032822Syokota * or visit www.oracle.com if you need additional information or have any
2132822Syokota * questions.
2232822Syokota */
2332822Syokota
2432822Syokota/*
2532822Syokota * @test
2632822Syokota * @bug 8002099
2743334Syokota * @summary Add support for intersection types in cast expression
2832822Syokota * @library /tools/javac/lib
2932822Syokota * @build JavacTestingAbstractProcessor ModelChecker
3032822Syokota * @compile -XDallowIntersectionTypes -processor ModelChecker Model01.java
3132822Syokota */
3237204Ssteve
3337204Ssteveimport javax.lang.model.element.ElementKind;
3432822Syokota
3532822Syokota@Check
3632822Syokotaclass Test {
3732822Syokota
3832822Syokota    interface A {
3932822Syokota        @Member(ElementKind.METHOD)
4032822Syokota        public void m1();
4132822Syokota    }
4232822Syokota
4332822Syokota    interface B {
4432822Syokota        @Member(ElementKind.METHOD)
4543334Syokota        public void m2();
4643334Syokota    }
4732822Syokota
4832822Syokota    void test(){
4937204Ssteve        @IntersectionTypeInfo({"java.lang.Object", "Test.A", "Test.B"})
5043334Syokota        Object o = (A & B)null;
5132822Syokota    }
5232822Syokota}
5332822Syokota