Merge
This commit is contained in:
commit
bee048a2b7
@ -1293,9 +1293,21 @@ public abstract class Type extends AnnoConstruct implements TypeMirror {
|
||||
@DefinedBy(Api.LANGUAGE_MODEL)
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(elemtype);
|
||||
appendAnnotationsString(sb, true);
|
||||
sb.append("[]");
|
||||
|
||||
// First append root component type
|
||||
Type t = elemtype;
|
||||
while (t.getKind() == TypeKind.ARRAY)
|
||||
t = ((ArrayType) t).getComponentType();
|
||||
sb.append(t);
|
||||
|
||||
// then append @Anno[] @Anno[] ... @Anno[]
|
||||
t = this;
|
||||
do {
|
||||
t.appendAnnotationsString(sb, true);
|
||||
sb.append("[]");
|
||||
t = ((ArrayType) t).getComponentType();
|
||||
} while (t.getKind() == TypeKind.ARRAY);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2015, 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
|
||||
@ -810,7 +810,9 @@ public class Infer {
|
||||
Infer infer = inferenceContext.infer();
|
||||
for (Type b1 : uv.getBounds(InferenceBound.UPPER)) {
|
||||
for (Type b2 : uv.getBounds(InferenceBound.LOWER)) {
|
||||
isSubtype(inferenceContext.asUndetVar(b2), inferenceContext.asUndetVar(b1), warn , infer);
|
||||
if (!isSubtype(inferenceContext.asUndetVar(b2), inferenceContext.asUndetVar(b1), warn , infer)) {
|
||||
infer.reportBoundError(uv, BoundErrorKind.BAD_UPPER_LOWER);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -831,7 +833,9 @@ public class Infer {
|
||||
Infer infer = inferenceContext.infer();
|
||||
for (Type b1 : uv.getBounds(InferenceBound.UPPER)) {
|
||||
for (Type b2 : uv.getBounds(InferenceBound.EQ)) {
|
||||
isSubtype(inferenceContext.asUndetVar(b2), inferenceContext.asUndetVar(b1), warn, infer);
|
||||
if (!isSubtype(inferenceContext.asUndetVar(b2), inferenceContext.asUndetVar(b1), warn, infer)) {
|
||||
infer.reportBoundError(uv, BoundErrorKind.BAD_UPPER_EQUAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -852,7 +856,9 @@ public class Infer {
|
||||
Infer infer = inferenceContext.infer();
|
||||
for (Type b1 : uv.getBounds(InferenceBound.EQ)) {
|
||||
for (Type b2 : uv.getBounds(InferenceBound.LOWER)) {
|
||||
isSubtype(inferenceContext.asUndetVar(b2), inferenceContext.asUndetVar(b1), warn, infer);
|
||||
if (!isSubtype(inferenceContext.asUndetVar(b2), inferenceContext.asUndetVar(b1), warn, infer)) {
|
||||
infer.reportBoundError(uv, BoundErrorKind.BAD_EQUAL_LOWER);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -926,7 +932,9 @@ public class Infer {
|
||||
for (Type b1 : uv.getBounds(InferenceBound.EQ)) {
|
||||
for (Type b2 : uv.getBounds(InferenceBound.EQ)) {
|
||||
if (b1 != b2) {
|
||||
isSameType(inferenceContext.asUndetVar(b2), inferenceContext.asUndetVar(b1), infer);
|
||||
if (!isSameType(inferenceContext.asUndetVar(b2), inferenceContext.asUndetVar(b1), infer)) {
|
||||
infer.reportBoundError(uv, BoundErrorKind.BAD_EQ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1234,6 +1242,46 @@ public class Infer {
|
||||
uv.getBounds(InferenceBound.UPPER));
|
||||
}
|
||||
},
|
||||
/**
|
||||
* The (uninstantiated) inference variable has incompatible equality constraints.
|
||||
*/
|
||||
BAD_EQ() {
|
||||
@Override
|
||||
InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
|
||||
return ex.setMessage("incompatible.eq.bounds", uv.qtype,
|
||||
uv.getBounds(InferenceBound.EQ));
|
||||
}
|
||||
},
|
||||
/**
|
||||
* The (uninstantiated) inference variable has incompatible upper lower bounds.
|
||||
*/
|
||||
BAD_UPPER_LOWER() {
|
||||
@Override
|
||||
InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
|
||||
return ex.setMessage("incompatible.upper.lower.bounds", uv.qtype,
|
||||
uv.getBounds(InferenceBound.UPPER), uv.getBounds(InferenceBound.LOWER));
|
||||
}
|
||||
},
|
||||
/**
|
||||
* The (uninstantiated) inference variable has incompatible upper equal bounds.
|
||||
*/
|
||||
BAD_UPPER_EQUAL() {
|
||||
@Override
|
||||
InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
|
||||
return ex.setMessage("incompatible.upper.eq.bounds", uv.qtype,
|
||||
uv.getBounds(InferenceBound.UPPER), uv.getBounds(InferenceBound.EQ));
|
||||
}
|
||||
},
|
||||
/**
|
||||
* The (uninstantiated) inference variable has incompatible upper equal bounds.
|
||||
*/
|
||||
BAD_EQUAL_LOWER() {
|
||||
@Override
|
||||
InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
|
||||
return ex.setMessage("incompatible.eq.lower.bounds", uv.qtype,
|
||||
uv.getBounds(InferenceBound.EQ), uv.getBounds(InferenceBound.LOWER));
|
||||
}
|
||||
},
|
||||
/**
|
||||
* An equality constraint is not compatible with an upper bound.
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2015, 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
|
||||
@ -222,6 +222,11 @@ public class Main {
|
||||
if (args.isEmpty())
|
||||
return Result.OK;
|
||||
|
||||
// init Depeendencies
|
||||
if (options.isSet("completionDeps")) {
|
||||
Dependencies.GraphDependencies.preRegister(context);
|
||||
}
|
||||
|
||||
// init plugins
|
||||
Set<List<String>> pluginOpts = args.getPluginOpts();
|
||||
if (!pluginOpts.isEmpty()) {
|
||||
@ -229,6 +234,9 @@ public class Main {
|
||||
t.initPlugins(pluginOpts);
|
||||
}
|
||||
|
||||
// init JavaCompiler
|
||||
JavaCompiler comp = JavaCompiler.instance(context);
|
||||
|
||||
// init doclint
|
||||
List<String> docLintOpts = args.getDocLintOpts();
|
||||
if (!docLintOpts.isEmpty()) {
|
||||
@ -236,13 +244,6 @@ public class Main {
|
||||
t.initDocLint(docLintOpts);
|
||||
}
|
||||
|
||||
// init Depeendencies
|
||||
if (options.isSet("completionDeps")) {
|
||||
Dependencies.GraphDependencies.preRegister(context);
|
||||
}
|
||||
|
||||
// init JavaCompiler
|
||||
JavaCompiler comp = JavaCompiler.instance(context);
|
||||
if (options.get(Option.XSTDOUT) != null) {
|
||||
// Stdout reassigned - ask compiler to close it when it is done
|
||||
comp.closeables = comp.closeables.prepend(log.getWriter(WriterKind.NOTICE));
|
||||
|
@ -1961,12 +1961,34 @@ compiler.misc.no.unique.minimal.instance.exists=\
|
||||
compiler.misc.incompatible.upper.bounds=\
|
||||
inference variable {0} has incompatible upper bounds {1}
|
||||
|
||||
# 0: type, 1: list of type
|
||||
compiler.misc.incompatible.eq.bounds=\
|
||||
inference variable {0} has incompatible equality constraints {1}
|
||||
|
||||
# 0: type, 1: list of type, 2: list of type
|
||||
compiler.misc.incompatible.eq.upper.bounds=\
|
||||
inference variable {0} has incompatible bounds\n\
|
||||
equality constraints: {1}\n\
|
||||
upper bounds: {2}
|
||||
|
||||
# 0: type, 1: list of type, 2: list of type
|
||||
compiler.misc.incompatible.upper.lower.bounds=\
|
||||
inference variable {0} has incompatible bounds\n\
|
||||
upper bounds: {1}\n\
|
||||
lower bounds: {2}
|
||||
|
||||
# 0: type, 1: list of type, 2: list of type
|
||||
compiler.misc.incompatible.upper.eq.bounds=\
|
||||
inference variable {0} has incompatible bounds\n\
|
||||
upper bounds: {1}\n\
|
||||
equality constraints: {2}
|
||||
|
||||
# 0: type, 1: list of type, 2: list of type
|
||||
compiler.misc.incompatible.eq.lower.bounds=\
|
||||
inference variable {0} has incompatible bounds\n\
|
||||
equality constraints: {1}\n\
|
||||
lower bounds: {2}
|
||||
|
||||
# 0: type, 1: list of type, 2: list of type
|
||||
compiler.misc.incompatible.eq.lower.bounds=\
|
||||
inference variable {0} has incompatible bounds\n\
|
||||
@ -2572,6 +2594,7 @@ compiler.misc.where.description.captured.1=\
|
||||
compiler.misc.where.description.typevar.1=\
|
||||
where {0} are type-variables:
|
||||
|
||||
# 0: set of type
|
||||
compiler.misc.where.description.intersection.1=\
|
||||
where {0} are intersection types:
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 6722234
|
||||
* @bug 6722234 8078024
|
||||
* @summary javac diagnostics need better integration with the type-system
|
||||
* @author mcimadamore
|
||||
* @compile/fail/ref=T6722234b_1.out -XDrawDiagnostics -XDdiags=simpleNames T6722234b.java
|
||||
|
@ -1,2 +1,2 @@
|
||||
T6722234b.java:16:9: compiler.err.cant.apply.symbol: kindname.method, m, List<T>,List<T>, List<compiler.misc.type.captureof: 1, ? extends T6722234b>,List<compiler.misc.type.captureof: 2, ? extends T6722234b>, kindname.class, T6722234b, (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 2, ? extends T6722234b, compiler.misc.type.captureof: 2, ? extends T6722234b,compiler.misc.type.captureof: 1, ? extends T6722234b)
|
||||
T6722234b.java:16:9: compiler.err.cant.apply.symbol: kindname.method, m, List<T>,List<T>, List<compiler.misc.type.captureof: 1, ? extends T6722234b>,List<compiler.misc.type.captureof: 2, ? extends T6722234b>, kindname.class, T6722234b, (compiler.misc.incompatible.eq.bounds: T, compiler.misc.type.captureof: 2, ? extends T6722234b,compiler.misc.type.captureof: 1, ? extends T6722234b)
|
||||
1 error
|
||||
|
@ -1,4 +1,4 @@
|
||||
T6722234b.java:16:9: compiler.err.cant.apply.symbol: kindname.method, m, List<T>,List<T>, List<compiler.misc.captured.type: 1>,List<compiler.misc.captured.type: 2>, kindname.class, T6722234b, (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.captured.type: 2, compiler.misc.captured.type: 2,compiler.misc.captured.type: 1)
|
||||
T6722234b.java:16:9: compiler.err.cant.apply.symbol: kindname.method, m, List<T>,List<T>, List<compiler.misc.captured.type: 1>,List<compiler.misc.captured.type: 2>, kindname.class, T6722234b, (compiler.misc.incompatible.eq.bounds: T, compiler.misc.captured.type: 2,compiler.misc.captured.type: 1)
|
||||
- compiler.misc.where.description.typevar: T,{(compiler.misc.where.typevar: T, Object, kindname.method, <T>m(List<T>,List<T>))}
|
||||
- compiler.misc.where.description.captured.1: compiler.misc.captured.type: 1,compiler.misc.captured.type: 2,{(compiler.misc.where.captured.1: compiler.misc.captured.type: 1, T6722234b, compiler.misc.type.null, ? extends T6722234b),(compiler.misc.where.captured.1: compiler.misc.captured.type: 2, T6722234b, compiler.misc.type.null, ? extends T6722234b)}
|
||||
1 error
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 6722234
|
||||
* @bug 6722234 8078024
|
||||
* @summary javac diagnostics need better integration with the type-system
|
||||
* @author mcimadamore
|
||||
* @compile/fail/ref=T6722234d_1.out -XDrawDiagnostics -XDdiags=where T6722234d.java
|
||||
|
@ -1,3 +1,3 @@
|
||||
T6722234d.java:18:20: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: compiler.misc.intersection.type: 1, T6722234d.A,java.lang.Object)
|
||||
- compiler.misc.where.description.intersection: compiler.misc.intersection.type: 1,{(compiler.misc.where.intersection: compiler.misc.intersection.type: 1, java.lang.Object,T6722234d.I1,T6722234d.I2)}
|
||||
T6722234d.java:18:20: compiler.err.prob.found.req: (compiler.misc.incompatible.upper.lower.bounds: Z, T6722234d.A,java.lang.Object, T6722234d.B,T6722234d.A)
|
||||
- compiler.misc.where.description.typevar: Z,{(compiler.misc.where.typevar: Z, java.lang.Object, kindname.method, <Z>m(Z,Z))}
|
||||
1 error
|
||||
|
@ -1,3 +1,3 @@
|
||||
T6722234d.java:18:20: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: compiler.misc.intersection.type: 1, T6722234d.A,Object)
|
||||
- compiler.misc.where.description.intersection: compiler.misc.intersection.type: 1,{(compiler.misc.where.intersection: compiler.misc.intersection.type: 1, Object,I1,I2)}
|
||||
T6722234d.java:18:20: compiler.err.prob.found.req: (compiler.misc.incompatible.upper.lower.bounds: Z, T6722234d.A,Object, T6722234d.B,T6722234d.A)
|
||||
- compiler.misc.where.description.typevar: Z,{(compiler.misc.where.typevar: Z, Object, kindname.method, <Z>m(Z,Z))}
|
||||
1 error
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 6799605
|
||||
* @bug 6799605 8078024
|
||||
* @summary Basic/Raw formatters should use type/symbol printer instead of toString()
|
||||
* @author mcimadamore
|
||||
* @compile/fail/ref=T6799605.out -XDrawDiagnostics T6799605.java
|
||||
|
@ -1,4 +1,4 @@
|
||||
T6799605.java:17:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.incompatible.eq.upper.bounds: T, compiler.misc.type.captureof: 1, ?, T6799605<T>)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T))}
|
||||
T6799605.java:18:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 2, ?, compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T))}
|
||||
T6799605.java:19:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,T6799605<compiler.misc.type.captureof: 3, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 3, ?, compiler.misc.type.captureof: 3, ?,compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?))}
|
||||
T6799605.java:18:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.incompatible.eq.bounds: T, compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T))}
|
||||
T6799605.java:19:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,T6799605<compiler.misc.type.captureof: 3, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.incompatible.eq.bounds: T, compiler.misc.type.captureof: 3, ?,compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?))}
|
||||
3 errors
|
||||
|
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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.
|
||||
*/
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
%REPEATABLE%
|
||||
@Retention(RetentionPolicy.%POLICY%)
|
||||
public @interface AnnotationDefault {
|
||||
@ExpectedValues(tag = 'Z', name = "booleanDefault", values = "1")
|
||||
boolean booleanDefault() default true;
|
||||
|
||||
@ExpectedValues(tag = 'C', name = "charDefault", values = "1")
|
||||
char charDefault() default 1;
|
||||
|
||||
@ExpectedValues(tag = 'B', name = "byteDefault", values = "1")
|
||||
byte byteDefault() default 1;
|
||||
|
||||
@ExpectedValues(tag = 'S', name = "shortDefault", values = "1")
|
||||
short shortDefault() default 1;
|
||||
|
||||
@ExpectedValues(tag = 'I', name = "intDefault", values = "1")
|
||||
int intDefault() default 1;
|
||||
|
||||
@ExpectedValues(tag = 'J', name = "longDefault", values = "1")
|
||||
long longDefault() default 1;
|
||||
|
||||
@ExpectedValues(tag = 'F', name = "floatDefault", values = "1.0")
|
||||
float floatDefault() default 1.0f;
|
||||
|
||||
@ExpectedValues(tag = 'D', name = "doubleDefault", values = "1.0")
|
||||
double doubleDefault() default 1.0;
|
||||
|
||||
@ExpectedValues(tag = 's', name = "stringDefault", values = "DEFAULT_VALUE")
|
||||
String stringDefault() default "DEFAULT_VALUE";
|
||||
|
||||
@ExpectedValues(tag = 'e', name = "enumDefault", values = {"LAnnotationDefault$DefaultValues;", "VALUE1"})
|
||||
DefaultValues enumDefault() default DefaultValues.VALUE1;
|
||||
|
||||
@ExpectedValues(tag = 'c', name = "clazzDefault1", values = "V")
|
||||
Class<?> clazzDefault1() default void.class;
|
||||
|
||||
@ExpectedValues(tag = 'c', name = "clazzDefault2", values = "Ljava/lang/Void;")
|
||||
Class<?> clazzDefault2() default Void.class;
|
||||
|
||||
@ExpectedValues(tag = '[', name = "arrayDefault1", values = {"1", "2", "3"})
|
||||
int[] arrayDefault1() default {1, 2, 3};
|
||||
|
||||
@ExpectedValues(tag = '[', name = "arrayDefault2", values = {"DEFAULT_VALUE_1", "DEFAULT_VALUE_2", "DEFAULT_VALUE_3"})
|
||||
String[] arrayDefault2() default {"DEFAULT_VALUE_1", "DEFAULT_VALUE_2", "DEFAULT_VALUE_3"};
|
||||
|
||||
@ExpectedValues(tag = '[', name = "arrayOfEnums", values = {"LAnnotationDefault$DefaultValues;", "VALUE2",
|
||||
"LAnnotationDefault$DefaultValues;", "VALUE3"})
|
||||
DefaultValues[] arrayOfEnums() default {DefaultValues.VALUE2, DefaultValues.VALUE3};
|
||||
|
||||
@ExpectedValues(tag = '[', name = "arrayOfAnno", values = {"LAnnotationDefault$DefaultAnnotation;", "value", "DEFAULT_VALUE1",
|
||||
"LAnnotationDefault$DefaultAnnotation;", "value", "DEFAULT_VALUE2"})
|
||||
DefaultAnnotation[] arrayOfAnno() default {@DefaultAnnotation(value = "DEFAULT_VALUE1"), @DefaultAnnotation(value = "DEFAULT_VALUE2")};
|
||||
|
||||
@ExpectedValues(tag = '@', name = "annoDefault", values = {"LAnnotationDefault$DefaultAnnotation;", "value", "DEFAULT_VALUE"})
|
||||
DefaultAnnotation annoDefault() default @DefaultAnnotation(value = "DEFAULT_VALUE");
|
||||
|
||||
@interface DefaultAnnotation {
|
||||
String value() default "NOT_DEFAULT_VALUE";
|
||||
}
|
||||
|
||||
enum DefaultValues {
|
||||
VALUE1, VALUE2, VALUE3
|
||||
}
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.%POLICY%)
|
||||
@interface Container {
|
||||
AnnotationDefault[] value();
|
||||
}
|
@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8042947
|
||||
* @summary Checking AnnotationDefault attribute.
|
||||
* @library /tools/lib /tools/javac/lib ../lib
|
||||
* @build AnnotationDefaultTest TestBase TestResult InMemoryFileManager ToolBox AnnotationDefaultVerifier
|
||||
* @run main AnnotationDefaultTest
|
||||
*/
|
||||
|
||||
import com.sun.tools.classfile.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.nio.file.Files;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class AnnotationDefaultTest extends TestResult {
|
||||
|
||||
private final static String templateFileName = "AnnotationDefault.java.template";
|
||||
|
||||
private final AnnotationDefaultVerifier verifier;
|
||||
|
||||
public AnnotationDefaultTest() {
|
||||
verifier = new AnnotationDefaultVerifier();
|
||||
}
|
||||
|
||||
private void test(String template, Map<String, String> replacements, boolean hasDefault) {
|
||||
String source = replace(template, replacements);
|
||||
addTestCase(source);
|
||||
try {
|
||||
printf("Testing source:\n%s\n", source);
|
||||
String className = "AnnotationDefault";
|
||||
InMemoryFileManager fileManager = compile(source);
|
||||
|
||||
// Map <method-name, expected-annotation-default-values>
|
||||
Map<String, ExpectedValues> expectedValues =
|
||||
getExpectedValues(forName(className, fileManager));
|
||||
ClassFile classFile = readClassFile(fileManager.getClasses().get(className));
|
||||
|
||||
for (Method method : classFile.methods) {
|
||||
String methodName = method.getName(classFile.constant_pool);
|
||||
printf("Testing method : %s\n", methodName);
|
||||
AnnotationDefault_attribute attr =
|
||||
(AnnotationDefault_attribute) method.attributes
|
||||
.get(Attribute.AnnotationDefault);
|
||||
|
||||
if (hasDefault && !checkNotNull(attr, "Attribute is not null")
|
||||
|| !hasDefault && checkNull(attr, "Attribute is null")) {
|
||||
// stop checking, attr is null
|
||||
continue;
|
||||
}
|
||||
|
||||
checkEquals(countNumberOfAttributes(method.attributes.attrs),
|
||||
1l,
|
||||
"Number of AnnotationDefault attribute");
|
||||
checkEquals(classFile.constant_pool
|
||||
.getUTF8Value(attr.attribute_name_index),
|
||||
"AnnotationDefault", "attribute_name_index");
|
||||
|
||||
ExpectedValues expectedValue = expectedValues.get(methodName);
|
||||
checkEquals((char) attr.default_value.tag, expectedValue.tag(),
|
||||
String.format("check tag : %c %s", expectedValue.tag(), expectedValue.name()));
|
||||
verifier.testElementValue(attr.default_value.tag,
|
||||
this, classFile, attr.default_value,
|
||||
expectedValue.values());
|
||||
verifier.testLength(attr.default_value.tag, this, attr);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
addFailure(e);
|
||||
}
|
||||
}
|
||||
|
||||
private Class<?> forName(String className, InMemoryFileManager fileManager) throws ClassNotFoundException {
|
||||
return fileManager.getClassLoader(null).loadClass(className);
|
||||
}
|
||||
|
||||
private Map<String, ExpectedValues> getExpectedValues(Class<?> clazz) {
|
||||
return Stream.of(clazz.getMethods())
|
||||
.map(method -> method.getAnnotation(ExpectedValues.class))
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toMap(
|
||||
ExpectedValues::name,
|
||||
Function.identity()));
|
||||
}
|
||||
|
||||
private String replace(String template, Map<String, String> replacements) {
|
||||
String ans = template;
|
||||
for (Map.Entry<String, String> replace : replacements.entrySet()) {
|
||||
ans = ans.replaceAll(replace.getKey(), replace.getValue());
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
|
||||
private long countNumberOfAttributes(Attribute[] attrs) {
|
||||
return Stream.of(attrs)
|
||||
.filter(x -> x instanceof AnnotationDefault_attribute)
|
||||
.count();
|
||||
}
|
||||
|
||||
public String getSource(File templateFileName) throws IOException {
|
||||
return Files.lines(templateFileName.toPath())
|
||||
.filter(str -> !str.startsWith("/*") && !str.startsWith(" *"))
|
||||
.collect(Collectors.joining("\n"));
|
||||
}
|
||||
|
||||
public void test() throws TestFailedException {
|
||||
try {
|
||||
String template = getSource(getSourceFile(templateFileName));
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
for (String repeatable : new String[] {"", "@Repeatable(Container.class)"}) {
|
||||
for (RetentionPolicy policy : RetentionPolicy.values()) {
|
||||
final int finalI = i;
|
||||
Map<String, String> replacements = new HashMap<String, String>(){{
|
||||
put("%POLICY%", policy.toString());
|
||||
if (finalI != 0) {
|
||||
put("default.*\n", ";\n");
|
||||
}
|
||||
put("%REPEATABLE%", repeatable);
|
||||
}};
|
||||
test(template, replacements, i == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
addFailure(e);
|
||||
} finally {
|
||||
checkStatus();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws TestFailedException {
|
||||
new AnnotationDefaultTest().test();
|
||||
}
|
||||
}
|
@ -0,0 +1,287 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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.
|
||||
*/
|
||||
|
||||
import com.sun.tools.classfile.Annotation;
|
||||
import com.sun.tools.classfile.AnnotationDefault_attribute;
|
||||
import com.sun.tools.classfile.ClassFile;
|
||||
import com.sun.tools.classfile.ConstantPool;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class AnnotationDefaultVerifier {
|
||||
|
||||
private final Map<Integer, TestElementValue> verifiers;
|
||||
|
||||
public AnnotationDefaultVerifier() {
|
||||
this.verifiers = new HashMap<>();
|
||||
verifiers.put((int) 'B', new TestIntegerElementValue());
|
||||
verifiers.put((int) 'C', new TestIntegerElementValue());
|
||||
verifiers.put((int) 'D', new TestDoubleElementValue());
|
||||
verifiers.put((int) 'F', new TestFloatElementValue());
|
||||
verifiers.put((int) 'I', new TestIntegerElementValue());
|
||||
verifiers.put((int) 'J', new TestLongElementValue());
|
||||
verifiers.put((int) 'S', new TestIntegerElementValue());
|
||||
verifiers.put((int) 'Z', new TestIntegerElementValue());
|
||||
verifiers.put((int) 's', new TestStringElementValue());
|
||||
verifiers.put((int) 'e', new TestEnumElementValue());
|
||||
verifiers.put((int) 'c', new TestClassElementValue());
|
||||
verifiers.put((int) '[', new TestArrayElementValue());
|
||||
verifiers.put((int) '@', new TestAnnotationElementValue());
|
||||
}
|
||||
|
||||
public void testLength(int tag, TestResult testResult, AnnotationDefault_attribute attr) {
|
||||
verifiers.get(tag).testLength(testResult, attr);
|
||||
}
|
||||
|
||||
public void testElementValue(int tag, TestResult testResult, ClassFile classFile,
|
||||
Annotation.element_value element_value, String[] values)
|
||||
throws ConstantPool.UnexpectedEntry, ConstantPool.InvalidIndex {
|
||||
get(tag).testElementValue(testResult, classFile, element_value, values);
|
||||
}
|
||||
|
||||
private TestElementValue get(int tag) {
|
||||
TestElementValue ev = verifiers.get(tag);
|
||||
if (ev == null) {
|
||||
throw new IllegalArgumentException("Unknown tag : " + (char) tag);
|
||||
}
|
||||
return ev;
|
||||
}
|
||||
|
||||
private abstract class TestElementValue {
|
||||
public void testLength(TestResult testCase, AnnotationDefault_attribute attr) {
|
||||
testCase.checkEquals(attr.attribute_length, 1 + attr.default_value.length(),
|
||||
"attribute_length");
|
||||
}
|
||||
|
||||
public String[] getValues(String[] values, int index, int length) {
|
||||
return Arrays.copyOfRange(values, index, index + length);
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public abstract void testElementValue(
|
||||
TestResult testCase,
|
||||
ClassFile classFile,
|
||||
Annotation.element_value element_value,
|
||||
String[] values)
|
||||
throws ConstantPool.InvalidIndex, ConstantPool.UnexpectedEntry;
|
||||
}
|
||||
|
||||
private class TestIntegerElementValue extends TestElementValue {
|
||||
|
||||
@Override
|
||||
public void testElementValue(
|
||||
TestResult testCase,
|
||||
ClassFile classFile,
|
||||
Annotation.element_value element_value,
|
||||
String[] values) throws ConstantPool.InvalidIndex {
|
||||
Annotation.Primitive_element_value ev =
|
||||
(Annotation.Primitive_element_value) element_value;
|
||||
ConstantPool.CONSTANT_Integer_info info =
|
||||
(ConstantPool.CONSTANT_Integer_info)
|
||||
classFile.constant_pool.get(ev.const_value_index);
|
||||
testCase.checkEquals(info.value, Integer.parseInt(values[0]), "const_value_index");
|
||||
}
|
||||
}
|
||||
|
||||
private class TestLongElementValue extends TestElementValue {
|
||||
@Override
|
||||
public void testElementValue(
|
||||
TestResult testCase,
|
||||
ClassFile classFile,
|
||||
Annotation.element_value element_value,
|
||||
String[] values) throws ConstantPool.InvalidIndex {
|
||||
Annotation.Primitive_element_value ev =
|
||||
(Annotation.Primitive_element_value) element_value;
|
||||
ConstantPool.CONSTANT_Long_info info =
|
||||
(ConstantPool.CONSTANT_Long_info)
|
||||
classFile.constant_pool.get(ev.const_value_index);
|
||||
testCase.checkEquals(info.value, Long.parseLong(values[0]), "const_value_index");
|
||||
}
|
||||
}
|
||||
|
||||
private class TestFloatElementValue extends TestElementValue {
|
||||
@Override
|
||||
public void testElementValue(
|
||||
TestResult testCase,
|
||||
ClassFile classFile,
|
||||
Annotation.element_value element_value,
|
||||
String[] values) throws ConstantPool.InvalidIndex {
|
||||
Annotation.Primitive_element_value ev =
|
||||
(Annotation.Primitive_element_value) element_value;
|
||||
ConstantPool.CONSTANT_Float_info info =
|
||||
(ConstantPool.CONSTANT_Float_info)
|
||||
classFile.constant_pool.get(ev.const_value_index);
|
||||
testCase.checkEquals(info.value, Float.parseFloat(values[0]), "const_value_index");
|
||||
}
|
||||
}
|
||||
|
||||
private class TestDoubleElementValue extends TestElementValue {
|
||||
@Override
|
||||
public void testElementValue(
|
||||
TestResult testCase,
|
||||
ClassFile classFile,
|
||||
Annotation.element_value element_value,
|
||||
String[] values) throws ConstantPool.InvalidIndex {
|
||||
Annotation.Primitive_element_value ev =
|
||||
(Annotation.Primitive_element_value) element_value;
|
||||
ConstantPool.CONSTANT_Double_info info =
|
||||
(ConstantPool.CONSTANT_Double_info)
|
||||
classFile.constant_pool.get(ev.const_value_index);
|
||||
testCase.checkEquals(info.value, Double.parseDouble(values[0]), "const_value_index");
|
||||
}
|
||||
}
|
||||
|
||||
private class TestStringElementValue extends TestElementValue {
|
||||
@Override
|
||||
public void testElementValue(
|
||||
TestResult testCase,
|
||||
ClassFile classFile,
|
||||
Annotation.element_value element_value,
|
||||
String[] values) throws ConstantPool.InvalidIndex {
|
||||
Annotation.Primitive_element_value ev =
|
||||
(Annotation.Primitive_element_value) element_value;
|
||||
ConstantPool.CONSTANT_Utf8_info info =
|
||||
(ConstantPool.CONSTANT_Utf8_info)
|
||||
classFile.constant_pool.get(ev.const_value_index);
|
||||
testCase.checkEquals(info.value, values[0], "const_value_index");
|
||||
}
|
||||
}
|
||||
|
||||
private class TestEnumElementValue extends TestElementValue {
|
||||
|
||||
@Override
|
||||
public int getLength() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testElementValue(
|
||||
TestResult testCase,
|
||||
ClassFile classFile,
|
||||
Annotation.element_value element_value,
|
||||
String[] values)
|
||||
throws ConstantPool.InvalidIndex, ConstantPool.UnexpectedEntry {
|
||||
Annotation.Enum_element_value ev = (Annotation.Enum_element_value) element_value;
|
||||
testCase.checkEquals(classFile.constant_pool.getUTF8Info(ev.type_name_index).value,
|
||||
values[0], "type_name_index");
|
||||
testCase.checkEquals(classFile.constant_pool.getUTF8Info(ev.const_name_index).value,
|
||||
values[1], "const_name_index");
|
||||
}
|
||||
}
|
||||
|
||||
private class TestClassElementValue extends TestElementValue {
|
||||
@Override
|
||||
public void testElementValue(
|
||||
TestResult testCase,
|
||||
ClassFile classFile,
|
||||
Annotation.element_value element_value,
|
||||
String[] values)
|
||||
throws ConstantPool.InvalidIndex, ConstantPool.UnexpectedEntry {
|
||||
Annotation.Class_element_value ev = (Annotation.Class_element_value) element_value;
|
||||
testCase.checkEquals(
|
||||
classFile.constant_pool.getUTF8Info(ev.class_info_index).value,
|
||||
values[0], "class_info_index");
|
||||
}
|
||||
}
|
||||
|
||||
private class TestAnnotationElementValue extends TestElementValue {
|
||||
@Override
|
||||
public void testLength(TestResult testCase, AnnotationDefault_attribute attr) {
|
||||
// Suppress, since it is hard to test the length of this kind of element values.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLength() {
|
||||
// Expected that the test uses DefaultAnnotation
|
||||
// tag (1 byte) + annotation_value (2 bytes) which contains const_value
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testElementValue(
|
||||
TestResult testCase,
|
||||
ClassFile classFile,
|
||||
Annotation.element_value element_value,
|
||||
String[] values)
|
||||
throws ConstantPool.InvalidIndex, ConstantPool.UnexpectedEntry {
|
||||
Annotation ev = ((Annotation.Annotation_element_value) element_value)
|
||||
.annotation_value;
|
||||
testCase.checkEquals(
|
||||
classFile.constant_pool.getUTF8Info(ev.type_index).value,
|
||||
values[0],
|
||||
"type_index");
|
||||
for (int i = 0; i < ev.num_element_value_pairs; ++i) {
|
||||
Annotation.element_value_pair pair = ev.element_value_pairs[i];
|
||||
testCase.checkEquals(
|
||||
classFile.constant_pool.getUTF8Info(pair.element_name_index).value,
|
||||
values[2 * i + 1],
|
||||
"element_name_index");
|
||||
TestElementValue testElementValue = verifiers.get(pair.value.tag);
|
||||
testElementValue.testElementValue(
|
||||
testCase,
|
||||
classFile,
|
||||
pair.value,
|
||||
new String[]{values[2 * i + 2]});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class TestArrayElementValue extends TestElementValue {
|
||||
@Override
|
||||
public void testLength(TestResult testCase, AnnotationDefault_attribute attr) {
|
||||
Annotation.Array_element_value ev =
|
||||
(Annotation.Array_element_value) attr.default_value;
|
||||
int sizeOfTag = ev.values[0].tag == 'e' ? 0 : 1;
|
||||
// tag (1 byte) + array header (2 byte) + length of entries
|
||||
testCase.checkEquals(attr.attribute_length, 1 + 2 +
|
||||
(sizeOfTag + ev.length() / ev.num_values) * ev.num_values, "attribute_length");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testElementValue(
|
||||
TestResult testCase,
|
||||
ClassFile classFile,
|
||||
Annotation.element_value element_value,
|
||||
String[] values)
|
||||
throws ConstantPool.InvalidIndex, ConstantPool.UnexpectedEntry {
|
||||
Annotation.Array_element_value ev =
|
||||
(Annotation.Array_element_value) element_value;
|
||||
int index = 0;
|
||||
for (int i = 0; i < ev.num_values; ++i) {
|
||||
TestElementValue testElementValue = verifiers.get(ev.values[i].tag);
|
||||
int length = testElementValue.getLength();
|
||||
testElementValue.testElementValue(
|
||||
testCase,
|
||||
classFile,
|
||||
ev.values[i],
|
||||
testElementValue.getValues(values, index, length));
|
||||
index += length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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.
|
||||
*/
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface ExpectedValues {
|
||||
char tag();
|
||||
String name();
|
||||
String[] values();
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8078389
|
||||
* @summary Make sure there is no interference between completionDeps and doclint
|
||||
* @compile -XDcompletionDeps -Xdoclint DepsAndDocLint.java
|
||||
*/
|
||||
|
||||
public class DepsAndDocLint {
|
||||
}
|
@ -93,7 +93,6 @@ compiler.misc.verbose.retro.with # UNUSED
|
||||
compiler.misc.verbose.retro.with.list # UNUSED
|
||||
compiler.misc.version.not.available # JavaCompiler; implies build error
|
||||
compiler.misc.where.description.captured
|
||||
compiler.misc.where.description.intersection.1
|
||||
compiler.misc.where.typevar.1
|
||||
compiler.misc.wrong.version # ClassReader
|
||||
compiler.warn.annotation.method.not.found # ClassReader
|
||||
@ -115,3 +114,4 @@ compiler.warn.file.from.future # warning for future mod
|
||||
compiler.err.cant.inherit.from.anon # error for subclass of anonymous class
|
||||
compiler.misc.bad.class.file # class file is malformed
|
||||
compiler.misc.bad.const.pool.entry # constant pool entry has wrong type
|
||||
compiler.misc.incompatible.upper.eq.bounds
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2015, 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
|
||||
@ -26,7 +26,7 @@
|
||||
// key: compiler.misc.where.description.typevar
|
||||
// key: compiler.misc.where.typevar
|
||||
// key: compiler.err.cant.apply.symbol
|
||||
// key: compiler.misc.inferred.do.not.conform.to.eq.bounds
|
||||
// key: compiler.misc.incompatible.eq.bounds
|
||||
// key: compiler.misc.captured.type
|
||||
// options: -XDdiags=where,simpleNames
|
||||
// run: simple
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2015, 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
|
||||
@ -26,7 +26,7 @@
|
||||
// key: compiler.misc.where.description.typevar
|
||||
// key: compiler.misc.where.typevar
|
||||
// key: compiler.err.cant.apply.symbol
|
||||
// key: compiler.misc.inferred.do.not.conform.to.eq.bounds
|
||||
// key: compiler.misc.incompatible.eq.bounds
|
||||
// key: compiler.misc.captured.type
|
||||
// key: compiler.misc.type.null
|
||||
// options: -XDdiags=where,simpleNames
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2015, 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
|
||||
@ -21,23 +21,19 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
// key: compiler.misc.where.intersection
|
||||
// key: compiler.misc.where.description.intersection
|
||||
// key: compiler.misc.intersection.type
|
||||
// key: compiler.err.prob.found.req
|
||||
// key: compiler.misc.inferred.do.not.conform.to.upper.bounds
|
||||
// key: compiler.misc.intersection.type
|
||||
// key: compiler.misc.where.description.intersection.1
|
||||
// key: compiler.misc.where.intersection
|
||||
// key: compiler.err.prob.found.req
|
||||
// options: -XDdiags=where
|
||||
// run: simple
|
||||
|
||||
class WhereIntersection {
|
||||
interface I1 {}
|
||||
interface I2 {}
|
||||
class A implements I1, I2 {}
|
||||
class B implements I1, I2 {}
|
||||
class Test {
|
||||
<Z> Z m(Z z1, Z z2) { return null; }
|
||||
void main(){
|
||||
A a = m(new A(), new B());
|
||||
}
|
||||
static <T> T f(T a, T b) {
|
||||
return a;
|
||||
}
|
||||
static Object[] main(int a, float b) {
|
||||
return f(a, b);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2015, 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.
|
||||
*/
|
||||
|
||||
// key: compiler.err.intf.expected.here
|
||||
// key: compiler.misc.inconvertible.types
|
||||
// key: compiler.misc.where.description.typevar
|
||||
// key: compiler.misc.where.typevar
|
||||
// key: compiler.misc.intersection.type
|
||||
// key: compiler.misc.where.description.intersection
|
||||
// key: compiler.misc.where.intersection
|
||||
// key: compiler.err.prob.found.req
|
||||
// options: -XDdiags=where
|
||||
// run: simple
|
||||
|
||||
class WhereIntersection2 {
|
||||
interface I1 {}
|
||||
interface I2 {}
|
||||
class A implements I1, I2 {}
|
||||
class B implements I1, I2 {}
|
||||
class Test {
|
||||
<Z extends A&B> Z m(Z z1, Z z2) { return null; }
|
||||
<T extends I1 & I2> T m2(){
|
||||
return m(new A(), new B());
|
||||
}
|
||||
}
|
||||
}
|
42
langtools/test/tools/javac/diags/examples/WhereTypeVar2.java
Normal file
42
langtools/test/tools/javac/diags/examples/WhereTypeVar2.java
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2015, 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.
|
||||
*/
|
||||
|
||||
// key: compiler.misc.incompatible.upper.lower.bounds
|
||||
// key: compiler.misc.where.description.typevar
|
||||
// key: compiler.misc.where.typevar
|
||||
// key: compiler.err.prob.found.req
|
||||
// options: -XDdiags=where
|
||||
// run: simple
|
||||
|
||||
class WhereTypeVar2 {
|
||||
interface I1 {}
|
||||
interface I2 {}
|
||||
class A implements I1, I2 {}
|
||||
class B implements I1, I2 {}
|
||||
class Test {
|
||||
<Z> Z m(Z z1, Z z2) { return null; }
|
||||
void main(){
|
||||
A a = m(new A(), new B());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 6939620 7020044 8062373
|
||||
* @bug 6939620 7020044 8062373 8078024
|
||||
*
|
||||
* @summary Check that diamond works where LHS is supertype of RHS (1-ary constructor)
|
||||
* @author mcimadamore
|
||||
|
@ -1,3 +1,3 @@
|
||||
Neg07.java:17:27: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg07.Foo), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number)
|
||||
Neg07.java:18:27: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg07.Foo), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number)
|
||||
Neg07.java:17:27: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg07.Foo), (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.String)
|
||||
Neg07.java:18:27: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg07.Foo), (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.String)
|
||||
2 errors
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 4941882
|
||||
* @bug 4941882 8078024
|
||||
* @summary incorrect inference for result of lub(int[], float[])
|
||||
* @compile/fail/ref=T4941882.out -XDrawDiagnostics T4941882.java
|
||||
*/
|
||||
|
@ -1,2 +1,2 @@
|
||||
T4941882.java:13:17: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object&java.io.Serializable&java.lang.Cloneable, java.lang.Object[],java.lang.Object)
|
||||
T4941882.java:13:17: compiler.err.prob.found.req: (compiler.misc.incompatible.upper.lower.bounds: T, java.lang.Object[],java.lang.Object, float[],int[])
|
||||
1 error
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 6315770
|
||||
* @bug 6315770 8078024
|
||||
* @summary javac inference allows creation of strange types: Integer & Runnable
|
||||
* @author Maurizio Cimadamore
|
||||
*
|
||||
|
@ -1,3 +1,3 @@
|
||||
T6315770.java:16:42: compiler.err.prob.found.req: (compiler.misc.incompatible.upper.bounds: T, java.lang.String,java.lang.Integer,java.lang.Runnable)
|
||||
T6315770.java:17:40: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Integer,java.lang.Runnable)
|
||||
T6315770.java:17:40: compiler.err.prob.found.req: (compiler.misc.incompatible.upper.lower.bounds: T, java.lang.Integer,java.lang.Runnable, java.lang.String)
|
||||
2 errors
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 6611449
|
||||
* @bug 6611449 8078024
|
||||
* @summary Internal Error thrown during generic method/constructor invocation
|
||||
* @compile/fail/ref=T6611449.out -XDrawDiagnostics T6611449.java
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
T6611449.java:18:9: compiler.err.cant.apply.symbols: kindname.constructor, T6611449, int,{(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, S)),(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T,T), (compiler.misc.infer.arg.length.mismatch: T))}
|
||||
T6611449.java:19:9: compiler.err.cant.apply.symbols: kindname.constructor, T6611449, int,int,{(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T,T), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, S))}
|
||||
T6611449.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m1, T, int, kindname.class, T6611449<S>, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, S)
|
||||
T6611449.java:21:9: compiler.err.cant.apply.symbol: kindname.method, m2, T,T, int,int, kindname.class, T6611449<S>, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, S)
|
||||
T6611449.java:18:9: compiler.err.cant.apply.symbols: kindname.constructor, T6611449, int,{(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T), (compiler.misc.incompatible.upper.lower.bounds: T, S, java.lang.Integer)),(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T,T), (compiler.misc.infer.arg.length.mismatch: T))}
|
||||
T6611449.java:19:9: compiler.err.cant.apply.symbols: kindname.constructor, T6611449, int,int,{(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T,T), (compiler.misc.incompatible.upper.lower.bounds: T, S, java.lang.Integer))}
|
||||
T6611449.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m1, T, int, kindname.class, T6611449<S>, (compiler.misc.incompatible.upper.lower.bounds: T, S, java.lang.Integer)
|
||||
T6611449.java:21:9: compiler.err.cant.apply.symbol: kindname.method, m2, T,T, int,int, kindname.class, T6611449<S>, (compiler.misc.incompatible.upper.lower.bounds: T, S, java.lang.Integer)
|
||||
4 errors
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 6650759
|
||||
* @bug 6650759 8078024
|
||||
* @summary Inference of formal type parameter (unused in formal parameters) is not performed
|
||||
* @compile/fail/ref=T6650759m.out T6650759m.java -XDrawDiagnostics
|
||||
*/
|
||||
|
@ -1,2 +1,2 @@
|
||||
T6650759m.java:43:36: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Integer,java.lang.Object)
|
||||
T6650759m.java:43:36: compiler.err.prob.found.req: (compiler.misc.incompatible.upper.lower.bounds: Z, java.lang.Integer,java.lang.Object, java.lang.String)
|
||||
1 error
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8030741
|
||||
* @bug 8030741 8078024
|
||||
* @summary Inference: implement eager resolution of return types, consistent with JDK-8028800
|
||||
* @compile/fail/ref=EagerReturnTypeResolutionTestb.out -XDrawDiagnostics EagerReturnTypeResolutionTestb.java
|
||||
* @author Dan Smith
|
||||
|
@ -2,37 +2,37 @@ EagerReturnTypeResolutionTestb.java:42:9: compiler.err.cant.apply.symbol: kindna
|
||||
EagerReturnTypeResolutionTestb.java:43:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ?>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object))
|
||||
EagerReturnTypeResolutionTestb.java:44:29: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
|
||||
EagerReturnTypeResolutionTestb.java:45:26: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
|
||||
EagerReturnTypeResolutionTestb.java:74:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:74:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:75:15: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
|
||||
EagerReturnTypeResolutionTestb.java:77:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object))
|
||||
EagerReturnTypeResolutionTestb.java:78:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:78:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:79:21: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
|
||||
EagerReturnTypeResolutionTestb.java:81:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
|
||||
EagerReturnTypeResolutionTestb.java:82:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:82:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:83:24: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
|
||||
EagerReturnTypeResolutionTestb.java:85:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:85:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:86:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ?>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object))
|
||||
EagerReturnTypeResolutionTestb.java:87:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:87:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:89:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
|
||||
EagerReturnTypeResolutionTestb.java:90:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:91:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:90:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:91:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:92:15: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>,java.lang.Object)
|
||||
EagerReturnTypeResolutionTestb.java:94:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.J<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object))
|
||||
EagerReturnTypeResolutionTestb.java:95:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:95:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:96:21: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>,java.lang.Object)
|
||||
EagerReturnTypeResolutionTestb.java:98:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
|
||||
EagerReturnTypeResolutionTestb.java:99:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:99:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:100:24: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>,java.lang.Object)
|
||||
EagerReturnTypeResolutionTestb.java:102:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:103:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:104:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:105:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>)
|
||||
EagerReturnTypeResolutionTestb.java:102:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:103:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:104:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>)
|
||||
EagerReturnTypeResolutionTestb.java:105:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>)
|
||||
EagerReturnTypeResolutionTestb.java:106:15: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>,java.lang.Object)
|
||||
EagerReturnTypeResolutionTestb.java:108:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object))
|
||||
EagerReturnTypeResolutionTestb.java:109:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>)
|
||||
EagerReturnTypeResolutionTestb.java:109:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>)
|
||||
EagerReturnTypeResolutionTestb.java:110:21: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>,java.lang.Object)
|
||||
EagerReturnTypeResolutionTestb.java:112:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
|
||||
EagerReturnTypeResolutionTestb.java:113:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>)
|
||||
EagerReturnTypeResolutionTestb.java:113:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>)
|
||||
EagerReturnTypeResolutionTestb.java:114:24: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>,java.lang.Object)
|
||||
EagerReturnTypeResolutionTestb.java:174:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , T, long))
|
||||
EagerReturnTypeResolutionTestb.java:175:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , T, long))
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8030741
|
||||
* @bug 8030741 8078024
|
||||
* @summary Inference: implement eager resolution of return types, consistent with JDK-8028800
|
||||
* @compile/fail/ref=PrimitiveTypeBoxingTest.out -XDrawDiagnostics PrimitiveTypeBoxingTest.java
|
||||
*/
|
||||
|
@ -1,3 +1,3 @@
|
||||
PrimitiveTypeBoxingTest.java:19:9: compiler.err.cant.apply.symbol: kindname.method, m1, PrimitiveTypeBoxingTest.F<Z>,Z, @490,int, kindname.class, PrimitiveTypeBoxingTest, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, java.lang.Long,java.lang.Object)
|
||||
PrimitiveTypeBoxingTest.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m2, Z,PrimitiveTypeBoxingTest.F<Z>, int,@559, kindname.class, PrimitiveTypeBoxingTest, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, java.lang.Long,java.lang.Object)
|
||||
PrimitiveTypeBoxingTest.java:19:9: compiler.err.cant.apply.symbol: kindname.method, m1, PrimitiveTypeBoxingTest.F<Z>,Z, @498,int, kindname.class, PrimitiveTypeBoxingTest, (compiler.misc.incompatible.upper.lower.bounds: Z, java.lang.Long,java.lang.Object, java.lang.Integer)
|
||||
PrimitiveTypeBoxingTest.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m2, Z,PrimitiveTypeBoxingTest.F<Z>, int,@567, kindname.class, PrimitiveTypeBoxingTest, (compiler.misc.incompatible.upper.lower.bounds: Z, java.lang.Long,java.lang.Object, java.lang.Integer)
|
||||
2 errors
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 6762569
|
||||
* @bug 6762569 8078024
|
||||
* @summary Javac crashes with AssertionError in Types.containedBy
|
||||
* @compile/fail/ref=T6762569b.out -XDrawDiagnostics T6762569b.java
|
||||
*/
|
||||
|
@ -1,2 +1,2 @@
|
||||
T6762569b.java:13:9: compiler.err.cant.apply.symbol: kindname.method, m, T,java.util.List<? super java.util.List<T>>, java.lang.String,java.util.List<compiler.misc.type.captureof: 1, ? super java.util.List<? extends java.lang.Number>>, kindname.class, T6762569b, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number,java.lang.Object)
|
||||
T6762569b.java:13:9: compiler.err.cant.apply.symbol: kindname.method, m, T,java.util.List<? super java.util.List<T>>, java.lang.String,java.util.List<compiler.misc.type.captureof: 1, ? super java.util.List<? extends java.lang.Number>>, kindname.class, T6762569b, (compiler.misc.incompatible.upper.lower.bounds: T, java.lang.Number,java.lang.Object, java.lang.String)
|
||||
1 error
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8016081 8016178 8069545
|
||||
* @bug 8016081 8016178 8069545 8078024
|
||||
* @summary structural most specific and stuckness
|
||||
* @compile/fail/ref=T8016177g.out -XDrawDiagnostics T8016177g.java
|
||||
*/
|
||||
|
@ -1,3 +1,3 @@
|
||||
T8016177g.java:34:14: compiler.err.cant.apply.symbol: kindname.method, print, java.lang.String, Test.Person, kindname.class, Test, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: Test.Person, java.lang.String,java.lang.Object))
|
||||
T8016177g.java:34:14: compiler.err.cant.apply.symbol: kindname.method, print, java.lang.String, Test.Person, kindname.class, Test, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.upper.lower.bounds: R, java.lang.String,java.lang.Object, Test.Person))
|
||||
T8016177g.java:35:20: compiler.err.cant.apply.symbol: kindname.method, abs, int, java.lang.Double, kindname.class, Test, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , R, int))
|
||||
2 errors
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8003280
|
||||
* @bug 8003280 8078024
|
||||
* @summary Add lambda tests
|
||||
* check that diamond inference is applied when using raw constructor reference qualifier
|
||||
* @compile/fail/ref=MethodReference41.out -XDrawDiagnostics MethodReference41.java
|
||||
|
@ -1,4 +1,4 @@
|
||||
MethodReference41.java:38:11: compiler.err.cant.apply.symbol: kindname.method, m1, MethodReference41.SAM1, @767, kindname.class, MethodReference41, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.String, kindname.class, MethodReference41.Foo<X>, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number))))
|
||||
MethodReference41.java:40:11: compiler.err.cant.apply.symbol: kindname.method, m3, MethodReference41.SAM3, @811, kindname.class, MethodReference41, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.Object, kindname.class, MethodReference41.Foo<X>, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object, java.lang.Number))))
|
||||
MethodReference41.java:38:11: compiler.err.cant.apply.symbol: kindname.method, m1, MethodReference41.SAM1, @775, kindname.class, MethodReference41, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.String, kindname.class, MethodReference41.Foo<X>, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.String))))
|
||||
MethodReference41.java:40:11: compiler.err.cant.apply.symbol: kindname.method, m3, MethodReference41.SAM3, @819, kindname.class, MethodReference41, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.Object, kindname.class, MethodReference41.Foo<X>, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.Object))))
|
||||
MethodReference41.java:41:9: compiler.err.ref.ambiguous: m4, kindname.method, m4(MethodReference41.SAM2), MethodReference41, kindname.method, m4(MethodReference41.SAM3), MethodReference41
|
||||
3 errors
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8003280
|
||||
* @bug 8003280 8078024
|
||||
* @summary Add lambda tests
|
||||
* check that diamond inference is applied when using raw constructor reference qualifier
|
||||
* @compile/fail/ref=MethodReference43.out -XDrawDiagnostics MethodReference43.java
|
||||
|
@ -1,5 +1,5 @@
|
||||
MethodReference43.java:45:11: compiler.err.cant.apply.symbol: kindname.method, m1, MethodReference43.SAM1, @897, kindname.class, MethodReference43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.String, kindname.class, MethodReference43.Foo<X>, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number))))
|
||||
MethodReference43.java:47:11: compiler.err.cant.apply.symbol: kindname.method, m3, MethodReference43.SAM3, @941, kindname.class, MethodReference43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.Object, kindname.class, MethodReference43.Foo<X>, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object, java.lang.Number))))
|
||||
MethodReference43.java:45:11: compiler.err.cant.apply.symbol: kindname.method, m1, MethodReference43.SAM1, @905, kindname.class, MethodReference43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.String, kindname.class, MethodReference43.Foo<X>, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.String))))
|
||||
MethodReference43.java:47:11: compiler.err.cant.apply.symbol: kindname.method, m3, MethodReference43.SAM3, @949, kindname.class, MethodReference43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.Object, kindname.class, MethodReference43.Foo<X>, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.Object))))
|
||||
MethodReference43.java:49:9: compiler.err.ref.ambiguous: m5, kindname.method, m5(MethodReference43.SAM3), MethodReference43, kindname.method, m5(MethodReference43.SAM4), MethodReference43
|
||||
MethodReference43.java:49:11: compiler.err.cant.apply.symbol: kindname.method, m5, MethodReference43.SAM3, @985, kindname.class, MethodReference43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.Object, kindname.class, MethodReference43.Foo<X>, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object, java.lang.Number))))
|
||||
MethodReference43.java:49:11: compiler.err.cant.apply.symbol: kindname.method, m5, MethodReference43.SAM3, @993, kindname.class, MethodReference43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.Object, kindname.class, MethodReference43.Foo<X>, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.Object))))
|
||||
4 errors
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8003280
|
||||
* @bug 8003280 8078024
|
||||
* @summary Add lambda tests
|
||||
* check that generic method reference is inferred when type parameters are omitted
|
||||
* @compile/fail/ref=MethodReference46.out -XDrawDiagnostics MethodReference46.java
|
||||
|
@ -1,4 +1,4 @@
|
||||
MethodReference46.java:40:11: compiler.err.cant.apply.symbol: kindname.method, g1, MethodReference46.SAM1, @809, kindname.class, MethodReference46, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m, X, java.lang.String, kindname.class, MethodReference46, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number))))
|
||||
MethodReference46.java:42:11: compiler.err.cant.apply.symbol: kindname.method, g3, MethodReference46.SAM3, @877, kindname.class, MethodReference46, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m, X, java.lang.Object, kindname.class, MethodReference46, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object, java.lang.Number))))
|
||||
MethodReference46.java:40:11: compiler.err.cant.apply.symbol: kindname.method, g1, MethodReference46.SAM1, @817, kindname.class, MethodReference46, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m, X, java.lang.String, kindname.class, MethodReference46, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.String))))
|
||||
MethodReference46.java:42:11: compiler.err.cant.apply.symbol: kindname.method, g3, MethodReference46.SAM3, @885, kindname.class, MethodReference46, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m, X, java.lang.Object, kindname.class, MethodReference46, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.Object))))
|
||||
MethodReference46.java:43:9: compiler.err.ref.ambiguous: g4, kindname.method, g4(MethodReference46.SAM2), MethodReference46, kindname.method, g4(MethodReference46.SAM3), MethodReference46
|
||||
3 errors
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8004102
|
||||
* @bug 8004102 8078024
|
||||
* @summary Add support for generic functional descriptors
|
||||
* @compile/fail/ref=MethodReference58.out -XDrawDiagnostics MethodReference58.java
|
||||
*/
|
||||
|
@ -1,2 +1,2 @@
|
||||
MethodReference58.java:41:23: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, g, Z, X, kindname.class, MethodReference58, (compiler.misc.inferred.do.not.conform.to.upper.bounds: X, java.lang.Number)))
|
||||
MethodReference58.java:41:23: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, g, Z, X, kindname.class, MethodReference58, (compiler.misc.incompatible.upper.lower.bounds: Z, java.lang.Number, X)))
|
||||
1 error
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8016175
|
||||
* @bug 8016175 8078024
|
||||
* @summary Add bottom-up type-checking support for unambiguous method references
|
||||
* @compile/fail/ref=MethodReference68.out -XDrawDiagnostics MethodReference68.java
|
||||
*/
|
||||
|
@ -1,2 +1,2 @@
|
||||
MethodReference68.java:21:10: compiler.err.cant.apply.symbol: kindname.method, g, MethodReference68.F<Z>,Z[], @493,int, kindname.class, MethodReference68, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, MethodReference68.Foo,java.lang.Object)
|
||||
MethodReference68.java:21:10: compiler.err.cant.apply.symbol: kindname.method, g, MethodReference68.F<Z>,Z[], @501,int, kindname.class, MethodReference68, (compiler.misc.incompatible.upper.lower.bounds: Z, MethodReference68.Foo,java.lang.Object, java.lang.Integer)
|
||||
1 error
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8003280 8029718
|
||||
* @bug 8003280 8029718 8078024
|
||||
* @summary Add lambda tests
|
||||
* check overload resolution and target type inference w.r.t. generic methods
|
||||
* Should always use lambda body structure to disambiguate overload resolution
|
||||
|
@ -1,4 +1,4 @@
|
||||
TargetType02.java:33:14: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, java.lang.String)
|
||||
TargetType02.java:33:14: compiler.err.prob.found.req: (compiler.misc.incompatible.upper.lower.bounds: Z, java.lang.String, java.lang.Integer)
|
||||
TargetType02.java:34:9: compiler.err.ref.ambiguous: call3, kindname.method, <Z>call3(TargetType02.S1<Z>), TargetType02, kindname.method, <Z>call3(TargetType02.S2<Z>), TargetType02
|
||||
TargetType02.java:35:9: compiler.err.ref.ambiguous: call3, kindname.method, <Z>call3(TargetType02.S1<Z>), TargetType02, kindname.method, <Z>call3(TargetType02.S2<Z>), TargetType02
|
||||
TargetType02.java:37:20: compiler.err.ref.ambiguous: call4, kindname.method, <Z>call4(TargetType02.S1<Z>), TargetType02, kindname.method, <Z>call4(TargetType02.S2<Z>), TargetType02
|
||||
|
75
langtools/test/tools/javac/tree/ArrayTypeToString.java
Normal file
75
langtools/test/tools/javac/tree/ArrayTypeToString.java
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8068737
|
||||
* @summary Tests ArrayType.toString with type annotations present
|
||||
* @build ArrayTypeToString
|
||||
* @compile/ref=ArrayTypeToString.out -XDrawDiagnostics -processor ArrayTypeToString -proc:only ArrayTypeToString.java
|
||||
*/
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.processing.AbstractProcessor;
|
||||
import javax.annotation.processing.RoundEnvironment;
|
||||
import javax.annotation.processing.SupportedAnnotationTypes;
|
||||
import javax.annotation.processing.SupportedSourceVersion;
|
||||
import javax.lang.model.SourceVersion;
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.tools.Diagnostic.Kind;
|
||||
|
||||
import com.sun.tools.javac.code.Symbol.VarSymbol;
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@Target({ ElementType.TYPE_USE, ElementType.FIELD })
|
||||
@interface Foo {
|
||||
int value();
|
||||
}
|
||||
|
||||
@SupportedAnnotationTypes("Foo")
|
||||
@SupportedSourceVersion(SourceVersion.RELEASE_9)
|
||||
public class ArrayTypeToString extends AbstractProcessor {
|
||||
|
||||
@Foo(0) String @Foo(1)[] @Foo(2)[] @Foo(3)[] field;
|
||||
|
||||
public boolean process(Set<? extends TypeElement> tes, RoundEnvironment renv) {
|
||||
for (TypeElement te : tes) {
|
||||
for (Element e : renv.getElementsAnnotatedWith(te)) {
|
||||
String s = ((VarSymbol) e).type.toString();
|
||||
|
||||
// Normalize output by removing whitespace
|
||||
s = s.replaceAll("\\s", "");
|
||||
|
||||
// Expected: "@Foo(0)java.lang.String@Foo(3)[]@Foo(2)[]@Foo(1)[]"
|
||||
processingEnv.getMessager().printMessage(Kind.NOTE, s);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
1
langtools/test/tools/javac/tree/ArrayTypeToString.out
Normal file
1
langtools/test/tools/javac/tree/ArrayTypeToString.out
Normal file
@ -0,0 +1 @@
|
||||
- compiler.note.proc.messager: @Foo(0)java.lang.String@Foo(1)[]@Foo(2)[]@Foo(3)[]
|
Loading…
x
Reference in New Issue
Block a user