/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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.
*/
/*
* @test
* @bug 7007432 7006109
* @summary Test generic types well-formedness
* @author mcimadamore
* @library .
* @run main GenericTypeWellFormednessTest
*/
/**
* Check parameterized type well-formedness. This test executes a number of checks
* in order to establish as to whether an instantiation of a generic type conforms
* to the generic class' declared bounds.
*/
static class InstantiableType {
}
return type;
}
}
enum Result {
/* generic type is well-formed w.r.t. declared bounds */
OK(true),
/* generic type is not well-formed w.r.t. declared bounds */
FAIL(false),
/* generic type is not well-formed w.r.t. declared bounds according to the JLS 3rd,
* but javac allows it (spec for generic type well-formedness is overly restrictive)
* See regression test test/tools/generics/wildcards/T5097548.java
*/
IGNORE(false);
boolean value;
}
}
/*is a type in 'rows' a valid instantiation for the generic class in 'col' ? */
//Foo<X>, Foo<X ext Object>, Foo<X ext Number>, Foo<X ext Foo<X>>, Foo<X ext Foo<+X>>, Foo<X ext Foo<-X>>, Foo<X ext Foo<?>>
/*Foo<Object>*/ { T , T , F , F , F , F , F },
/*Foo<Number>*/ { T , T , T , F , F , F , F },
/*Foo<Integer>*/ { T , T , T , F , F , F , F },
/*Foo<Double>*/ { T , T , T , F , F , F , F },
/*Foo<String>*/ { T , T , F , F , F , F , F },
/*Foo<X1>*/ { T , T , F , F , F , F , F },
/*Foo<X2>*/ { T , T , T , F , F , F , F },
/*Foo<X3>*/ { T , T , T , F , F , F , F },
/*Foo<X4>*/ { T , T , T , F , F , F , F },
/*Foo<X5>*/ { T , T , F , F , F , F , F },
/*Foo<X6>*/ { T , T , F , T , T , T , T },
/*Foo<+Object>*/ { T , T , I , I , I , I , I },
/*Foo<+Number>*/ { T , T , T , F , F , F , F },
/*Foo<+Integer>*/{ T , T , T , F , F , F , F },
/*Foo<+Double>*/ { T , T , T , F , F , F , F },
/*Foo<+String>*/ { T , T , F , F , F , F , F },
/*Foo<+X1>*/ { T , T , F , F , F , F , F },
/*Foo<+X2>*/ { T , T , T , F , F , F , F },
/*Foo<+X3>*/ { T , T , T , F , F , F , F },
/*Foo<+X4>*/ { T , T , T , F , F , F , F },
/*Foo<+X5>*/ { T , T , F , F , F , F , F },
/*Foo<+X6>*/ { T , T , F , T , T , I , T },
/*Foo<-Object>*/ { T , T , F , F , F , F , F },
/*Foo<-Number>*/ { T , T , T , F , F , F , F },
/*Foo<-Integer>*/{ T , T , T , F , F , F , F },
/*Foo<-Double>*/ { T , T , T , F , F , F , F },
/*Foo<-String>*/ { T , T , F , F , F , F , F },
/*Foo<-X1>*/ { T , T , I , I , I , I , I },
/*Foo<-X2>*/ { T , T , I , F , F , F , F },
/*Foo<-X3>*/ { T , T , I , F , F , F , F },
/*Foo<-X4>*/ { T , T , I , F , F , F , F },
/*Foo<-X5>*/ { T , T , I , F , F , F , F },
/*Foo<-X6>*/ { T , T , F , T , I , I , T },
/*Foo<?>*/ { T , T , T , T , T , T , T }};
InstantiableType[] basicTypes = {
new InstantiableType(NumberType()),
}
return tvar;
}
};
}
};
}
}
};
}
}
};
}
}
}
};
rows = join(InstantiableType.class, invariantTypes, covariantTypes, contravariantTypes, bivariantTypes);
};
}
void test() {
} else {
ignoredCount++;
}
}
}
}
s.complete();
}
@SuppressWarnings("unchecked")
int totalLength = 0;
}
int idx = 0;
}
return new_arr;
}
new GenericTypeWellFormednessTest().test();
}
}