test/tools/javac/processing/model/type/NoTypes.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2006, 2010, 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.
--- 1,7 ----
/*
! * Copyright (c) 2006, 2011, 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.
*** 21,31 ****
* questions.
*/
/*
* @test
! * @bug 6418666 6423973 6453386
* @summary Test the NoTypes: VOID, PACKAGE, NONE
* @author Scott Seligman
* @library ../../../lib
* @build JavacTestingAbstractProcessor
* @compile -g NoTypes.java
--- 21,31 ----
* questions.
*/
/*
* @test
! * @bug 6418666 6423973 6453386 7025809
* @summary Test the NoTypes: VOID, PACKAGE, NONE
* @author Scott Seligman
* @library ../../../lib
* @build JavacTestingAbstractProcessor
* @compile -g NoTypes.java
*** 73,83 ****
verifyKind(VOID, types.getNoType(VOID));
verifyKind(NONE, types.getNoType(NONE));
// The return type of a constructor or void method is VOID.
! class Scanner extends ElementScanner7<Void, Void> {
@Override
public Void visitExecutable(ExecutableElement e, Void p) {
verifyKind(VOID, e.getReturnType());
ExecutableType t = (ExecutableType) e.asType();
verifyKind(VOID, t.getReturnType());
--- 73,83 ----
verifyKind(VOID, types.getNoType(VOID));
verifyKind(NONE, types.getNoType(NONE));
// The return type of a constructor or void method is VOID.
! class Scanner extends ElementScanner<Void, Void> {
@Override
public Void visitExecutable(ExecutableElement e, Void p) {
verifyKind(VOID, e.getReturnType());
ExecutableType t = (ExecutableType) e.asType();
verifyKind(VOID, t.getReturnType());
*** 87,101 ****
TypeElement c = elements.getTypeElement("NoTypes.C");
new Scanner().scan(c);
}
/**
! * Verify that a NoType instance is of a particular kind,
! * and that TypeKindVisitor7 properly dispatches on it.
*/
private void verifyKind(TypeKind kind, TypeMirror type) {
! class Vis extends TypeKindVisitor7<TypeKind, Void> {
@Override
public TypeKind visitNoTypeAsVoid(NoType t, Void p) {
return VOID;
}
@Override
--- 87,101 ----
TypeElement c = elements.getTypeElement("NoTypes.C");
new Scanner().scan(c);
}
/**
! * Verify that a NoType instance is of a particular kind, and that
! * the latest TypeKindVisitor properly dispatches on it.
*/
private void verifyKind(TypeKind kind, TypeMirror type) {
! class Vis extends TypeKindVisitor<TypeKind, Void> {
@Override
public TypeKind visitNoTypeAsVoid(NoType t, Void p) {
return VOID;
}
@Override
*** 109,121 ****
}
if (kind != type.getKind() || kind != new Vis().visit(type))
throw new AssertionError();
}
-
// Fodder for the tests
-
interface I {
}
class C {
C() {}
--- 109,119 ----