diff options
author | Stephan Herrmann | 2013-05-01 18:08:26 +0000 |
---|---|---|
committer | Stephan Herrmann | 2013-05-01 19:49:15 +0000 |
commit | 63010decdc2159ffc02f4c5de41c7013312d0748 (patch) | |
tree | 52034f5d1c2b997232b7ba03fe281b028a01267c /org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression | |
parent | 0b62c4ba651c88b312a6ac404a598938ab9d8927 (diff) | |
download | org.eclipse.objectteams-63010decdc2159ffc02f4c5de41c7013312d0748.tar.gz org.eclipse.objectteams-63010decdc2159ffc02f4c5de41c7013312d0748.tar.xz org.eclipse.objectteams-63010decdc2159ffc02f4c5de41c7013312d0748.zip |
Update jdt.core and tests to 5138a70372af4817aefdd3da44dfadf7f7557bf3
+ plus some merge-related fixes
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression')
17 files changed, 608 insertions, 336 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java index 138c8fa91..dfccffd46 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -82,156 +82,75 @@ public abstract class AbstractRegressionTest extends AbstractCompilerTest implem static final String LIST_RAW_IMPL_JRE8; static final String ITERABLE_IMPL_JRE8; static final String ITERABLE_RAW_IMPL_JRE8; - static final String ITERABLE_RAW_WITHOUT_IS_EMPTY_IMPL_JRE8; + static final String ITERATOR_IMPL_JRE8; + static final String ITERATOR_RAW_IMPL_JRE8; static final String MAP_IMPL_JRE8; static final String MAP_RAW_IMPL_JRE8; - static final String MAP_STREAM_IMPL_JRE8; - static final String MAP_STREAM_RAW_IMPL_JRE8; static { String javaVersion = System.getProperty("java.specification.version"); IS_JRE_8 = "1.8".equals(javaVersion); if (IS_JRE_8) { // TODO(stephan) accommodate future versions ... - COMPARATOR_IMPL_JRE8 = - " public java.util.Comparator<*> compose(java.util.Comparator<? super *> other) { return null; }\n" + - " public java.util.Comparator<*> reverse() { return null; }\n"; + COMPARATOR_IMPL_JRE8 = // replace '*' with T, '%' with U + " public java.util.Comparator<*> reverseOrder() { return null;}\n" + + " public java.util.Comparator<*> thenComparing(java.util.Comparator<? super *> other) { return null;}\n" + + " public <% extends java.lang.Comparable<? super %>> java.util.Comparator<*> thenComparing(java.util.function.Function<? super *, ? extends %> keyExtractor) { return null;}\n" + + " public java.util.Comparator<*> thenComparing(java.util.function.IntFunction<? super *> keyExtractor) { return null;}\n" + + " public java.util.Comparator<*> thenComparing(java.util.function.LongFunction<? super *> keyExtractor) { return null;}\n" + + " public java.util.Comparator<*> thenComparing(java.util.function.DoubleFunction<? super *> keyExtractor) { return null;}\n"; COMPARATOR_RAW_IMPL_JRE8 = - " public java.util.Comparator compose(java.util.Comparator other) { return null; }\n" + - " public java.util.Comparator reverse() { return null; }\n"; + " public java.util.Comparator reverseOrder() { return null;}\n" + + " public java.util.Comparator thenComparing(java.util.Comparator other) { return null;}\n" + + " public java.util.Comparator thenComparing(java.util.function.Function keyExtractor) { return null;}\n" + + " public java.util.Comparator thenComparing(java.util.function.IntFunction keyExtractor) { return null;}\n" + + " public java.util.Comparator thenComparing(java.util.function.LongFunction keyExtractor) { return null;}\n" + + " public java.util.Comparator thenComparing(java.util.function.DoubleFunction keyExtractor) { return null;}\n"; COLLECTION_IMPL_JRE8 = - " public boolean retainAll(java.util.functions.Predicate<? super *> filter) { return false; }\n" + - " public boolean removeAll(java.util.functions.Predicate<? super *> filter) { return false; }\n" + - " public void addAll(Iterable<? extends *> source) { }\n"; + " public boolean removeAll(java.util.function.Predicate<? super *> filter) { return false;}\n" + + " public java.util.stream.Stream<*> stream() { return null;}\n" + + " public java.util.stream.Stream<*> parallelStream() { return null;}\n"; COLLECTION_RAW_IMPL_JRE8 = - " public @SuppressWarnings(\"rawtypes\") boolean retainAll(java.util.functions.Predicate filter) { return false; }\n" + - " public @SuppressWarnings(\"rawtypes\") boolean removeAll(java.util.functions.Predicate filter) { return false; }\n" + - " public @SuppressWarnings(\"rawtypes\") void addAll(Iterable source) { }\n"; + " public @SuppressWarnings(\"rawtypes\") boolean removeAll(java.util.function.Predicate filter) { return false;}\n" + + " public @SuppressWarnings(\"rawtypes\") java.util.stream.Stream stream() { return null;}\n" + + " public @SuppressWarnings(\"rawtypes\") java.util.stream.Stream parallelStream() { return null;}\n"; LIST_IMPL_JRE8 =// replace '*' with your concrete type argument - " public void sort(java.util.Comparator<? super *> comparator) {}\n" + - " public void parallelSort(java.util.Comparator<? super *> comparator) {}\n"; + " public void sort(java.util.Comparator<? super *> comparator) {}\n" + + " public void parallelSort(java.util.Comparator<? super *> comparator) {}\n" + + " public void replaceAll(java.util.function.UnaryOperator<*> operator) {}\n"; LIST_RAW_IMPL_JRE8 = " public @SuppressWarnings(\"rawtypes\") void sort(java.util.Comparator comparator) {}\n" + - " public @SuppressWarnings(\"rawtypes\") void parallelSort(java.util.Comparator comparator) {}\n"; + " public @SuppressWarnings(\"rawtypes\") void parallelSort(java.util.Comparator comparator) {}\n" + + " public @SuppressWarnings(\"rawtypes\") void replaceAll(java.util.function.UnaryOperator operator) {}\n"; ITERABLE_IMPL_JRE8 = // replace '*' with your concrete type argument - " public boolean isEmpty() { return false; }\n" + - " public long count() { return 0L; }\n" + - " public * getOnly() { return null; }\n" + - " public * getFirst() { return null; }\n" + - " public * getAny() { return null; }\n" + - " public * reduce(* base, java.util.functions.BinaryOperator<*> reducer) { return null; }\n" + - " public <A extends java.util.Fillable<? super *>> A into(A target) { return null; }\n" + - " public void forEach(java.util.functions.Block<? super *> block) {}\n" + - " public Iterable<*> sorted(java.util.Comparator<? super *> comparator) { return null; }\n" + - " public boolean anyMatch(java.util.functions.Predicate<? super *> filter) { return false; }\n" + - " public boolean allMatch(java.util.functions.Predicate<? super *> filter) { return false; }\n" + - " public boolean noneMatch(java.util.functions.Predicate<? super *> filter) { return false; }\n" + - " public Iterable<*> cumulate(java.util.functions.BinaryOperator<*> op) { return null; }\n" + - " public <U> MapStream<*,U> mapped(java.util.functions.Mapper<? super *, ? extends U> mapper) { return null; }\n" + - " public Iterable<*> filter(java.util.functions.Predicate<? super *> predicate) { return null; }\n" + - " public <U> Iterable<U> map(java.util.functions.Mapper<? super *, ? extends U> mapper) { return null; }\n" + - " public double mapReduce(java.util.functions.DoubleMapper<? super *> mapper, double base, java.util.functions.DoubleBinaryOperator reducer) { return 0; }\n" + - " public long mapReduce(java.util.functions.LongMapper<? super *> mapper, long base, java.util.functions.LongBinaryOperator reducer) { return 0; }\n" + - " public int mapReduce(java.util.functions.IntMapper<? super *> mapper, int base, java.util.functions.IntBinaryOperator reducer) { return 0; }\n" + - " public <U> U mapReduce(java.util.functions.Mapper<? super *, ? extends U> mapper, U base, java.util.functions.BinaryOperator<U> reducer) { return null; }\n" + - " public <U> Iterable<U> flatMap(java.util.functions.Mapper<? super *, ? extends Iterable<U>> mapper) { return null; }\n" + - " public <U> MapStream<U, Iterable<*>> groupBy(java.util.functions.Mapper<? super *, ? extends U> mapper) { return null; }\n" + - " public <U> MapStream<U, Iterable<*>> groupByMulti(java.util.functions.Mapper<? super *, ? extends Iterable<U>> mapper) { return null; }\n" + - " public Iterable<*> uniqueElements() { return null; }\n"; + " public void forEach(java.util.function.Block<? super *> block){}\n"; ITERABLE_RAW_IMPL_JRE8 = - " public boolean isEmpty() { return false; }\n" + - " public long count() { return 0L; }\n" + - " public @SuppressWarnings(\"rawtypes\") Object getOnly() { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") Object getFirst() { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") Object getAny() { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") Object reduce(Object base, java.util.functions.BinaryOperator reducer) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") java.util.Fillable into(java.util.Fillable target) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") void forEach(java.util.functions.Block block) {}\n" + - " public @SuppressWarnings(\"rawtypes\") Iterable sorted(java.util.Comparator comparator) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") boolean anyMatch(java.util.functions.Predicate filter) { return false; }\n" + - " public @SuppressWarnings(\"rawtypes\") boolean allMatch(java.util.functions.Predicate filter) { return false; }\n" + - " public @SuppressWarnings(\"rawtypes\") boolean noneMatch(java.util.functions.Predicate filter) { return false; }\n" + - " public @SuppressWarnings(\"rawtypes\") Iterable cumulate(java.util.functions.BinaryOperator op) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") MapStream mapped(java.util.functions.Mapper mapper) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") Iterable filter(java.util.functions.Predicate predicate) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") Iterable map(java.util.functions.Mapper mapper) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") double mapReduce(java.util.functions.DoubleMapper mapper, double base, java.util.functions.DoubleBinaryOperator reducer) { return 0; }\n" + - " public @SuppressWarnings(\"rawtypes\") long mapReduce(java.util.functions.LongMapper mapper, long base, java.util.functions.LongBinaryOperator reducer) { return 0; }\n" + - " public @SuppressWarnings(\"rawtypes\") int mapReduce(java.util.functions.IntMapper mapper, int base, java.util.functions.IntBinaryOperator reducer) { return 0; }\n" + - " public @SuppressWarnings(\"rawtypes\") Object mapReduce(java.util.functions.Mapper mapper, Object base, java.util.functions.BinaryOperator reducer) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") Iterable flatMap(java.util.functions.Mapper mapper) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") MapStream groupBy(java.util.functions.Mapper mapper) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") MapStream groupByMulti(java.util.functions.Mapper mapper) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") Iterable uniqueElements() { return null; }\n"; - ITERABLE_RAW_WITHOUT_IS_EMPTY_IMPL_JRE8 = - " public long count() { return 0L; }\n" + - " public @SuppressWarnings(\"rawtypes\") Object getOnly() { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") Object getFirst() { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") Object getAny() { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") Object reduce(Object base, java.util.functions.BinaryOperator reducer) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") java.util.Fillable into(java.util.Fillable target) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") void forEach(java.util.functions.Block block) {}\n" + - " public @SuppressWarnings(\"rawtypes\") Iterable sorted(java.util.Comparator comparator) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") boolean anyMatch(java.util.functions.Predicate filter) { return false; }\n" + - " public @SuppressWarnings(\"rawtypes\") boolean allMatch(java.util.functions.Predicate filter) { return false; }\n" + - " public @SuppressWarnings(\"rawtypes\") boolean noneMatch(java.util.functions.Predicate filter) { return false; }\n" + - " public @SuppressWarnings(\"rawtypes\") Iterable cumulate(java.util.functions.BinaryOperator op) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") MapStream mapped(java.util.functions.Mapper mapper) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") Iterable filter(java.util.functions.Predicate predicate) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") Iterable map(java.util.functions.Mapper mapper) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") double mapReduce(java.util.functions.DoubleMapper mapper, double base, java.util.functions.DoubleBinaryOperator reducer) { return 0; }\n" + - " public @SuppressWarnings(\"rawtypes\") long mapReduce(java.util.functions.LongMapper mapper, long base, java.util.functions.LongBinaryOperator reducer) { return 0; }\n" + - " public @SuppressWarnings(\"rawtypes\") int mapReduce(java.util.functions.IntMapper mapper, int base, java.util.functions.IntBinaryOperator reducer) { return 0; }\n" + - " public @SuppressWarnings(\"rawtypes\") Object mapReduce(java.util.functions.Mapper mapper, Object base, java.util.functions.BinaryOperator reducer) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") Iterable flatMap(java.util.functions.Mapper mapper) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") MapStream groupBy(java.util.functions.Mapper mapper) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") MapStream groupByMulti(java.util.functions.Mapper mapper) { return null; }\n" + - " public @SuppressWarnings(\"rawtypes\") Iterable uniqueElements() { return null; }\n"; - MAP_IMPL_JRE8 = // '!' stands for 'K,V', '*' for 'K' - " public Iterable<BiValue<!>> asIterable() { return null; }\n" + - " public Iterable<*> inputs() { return null; }\n"; + " public @SuppressWarnings(\"rawtypes\") void forEach(java.util.function.Block block) {}\n"; + ITERATOR_IMPL_JRE8 = // replace '*' with your concrete type argument + " public void forEach(java.util.function.Block<? super *> block){}\n"; + ITERATOR_RAW_IMPL_JRE8 = + " public void forEach(java.util.function.Block block){}\n"; + MAP_IMPL_JRE8 = // '*' for 'K', '%' for 'V' + " public boolean remove(Object key, Object value) { return false;}\n" + + " public void forEach(java.util.function.BiBlock<? super *, ? super %> block) {}\n" + + " public void replaceAll(java.util.function.BiFunction<*, %, %> function) {}\n" + + " public % putIfAbsent(* key, % value) { return null;}\n" + + " public boolean replace(* key, % oldValue, % newValue) { return false;}\n" + + " public % replace(* key, % value) { return null;}\n" + + " public % computeIfAbsent(* key, java.util.function.Function<? super *, ? extends %> mappingFunction) { return null;}\n" + + " public % computeIfPresent(* key, java.util.function.BiFunction<? super *, ? super %, ? extends %> remappingFunction) { return null;}\n" + + " public % compute(* key, java.util.function.BiFunction<? super *, ? super %, ? extends %> remappingFunction) { return null;}\n" + + " public % merge(* key, % value, java.util.function.BiFunction<? super %, ? super %, ? extends %> remappingFunction) { return null;}\n"; MAP_RAW_IMPL_JRE8 = - " public Iterable asIterable() { return null; }\n" + - " public Iterable inputs() { return null; }\n"; - MAP_STREAM_IMPL_JRE8 = // '*' stands for 'K', '%' for 'V' - " public BiValue<*,%> getOnly() { return null; }\n" + - " public <A extends Map<? super *, ? super %>> A into(A destination) { return null; }\n" + - " public void forEach(java.util.functions.BiBlock<? super *, ? super %> block) {}\n" + - " public MapStream<*, Iterable<%>> asMultiStream() { return null; }\n" + - " public <W> MapStream<*, Iterable<W>> mapValuesMulti(final java.util.functions.BiMapper<? super *, ? super %, Iterable<W>> mapper) { return null; }\n" + - " public MapStream<*,%> sorted(java.util.Comparator<? super *> comparator) { return null; }\n" + - " public boolean anyMatch(java.util.functions.BiPredicate<? super *, ? super %> predicate) { return false; }\n" + - " public boolean allMatch(java.util.functions.BiPredicate<? super *, ? super %> predicate) { return false; }\n" + - " public boolean noneMatch(java.util.functions.BiPredicate<? super *, ? super %> predicate) { return false; }\n" + - " public MapStream<*,%> merge(MapStream<*,%> other) { return null; }\n" + - " public MapStream<*,%> filter(final java.util.functions.BiPredicate<? super *, ? super %> predicate) { return null; }\n" + - " public MapStream<%,*> swap() { return null; }\n" + - " public BiValue<*,%> getAny() { return null; }\n" + - " public MapStream<*,%> filterKeys(final java.util.functions.Predicate<*> filter) { return null; }\n" + - " public MapStream<*,%> filterValues(final java.util.functions.Predicate<%> filter) { return null; }\n" + - " public <A extends Map<? super *, C>,C extends Collection<? super %>> A intoMulti(A destination, java.util.functions.Factory<C> factory) { return null; }\n" + - " public <W> MapStream<*,W> mapValues(final java.util.functions.Mapper<%,W> mapper) { return null; }\n" + - " public BiValue<*,%> getFirst() { return null; }\n" + - " public <W> MapStream<*, W> map(final java.util.functions.BiMapper<*, %, W> mapper) { return null; }\n"; - MAP_STREAM_RAW_IMPL_JRE8 = - " public BiValue getOnly() { return null; }\n" + - " public Map into(Map destination) { return null; }\n" + - " public void forEach(java.util.functions.BiBlock block) {}\n" + - " public MapStream asMultiStream() { return null; }\n" + - " public MapStream mapValuesMulti(final java.util.functions.BiMapper mapper) { return null; }\n" + - " public MapStream sorted(java.util.Comparator comparator) { return null; }\n" + - " public boolean anyMatch(java.util.functions.BiPredicate predicate) { return false; }\n" + - " public boolean allMatch(java.util.functions.BiPredicate predicate) { return false; }\n" + - " public boolean noneMatch(java.util.functions.BiPredicate predicate) { return false; }\n" + - " public MapStream merge(MapStream other) { return null; }\n" + - " public MapStream filter(final java.util.functions.BiPredicate predicate) { return null; }\n" + - " public MapStream swap() { return null; }\n" + - " public BiValue getAny() { return null; }\n" + - " public MapStream filterKeys(final java.util.functions.Predicate filter) { return null; }\n" + - " public MapStream filterValues(final java.util.functions.Predicate filter) { return null; }\n" + - " public Map intoMulti(Map destination, java.util.functions.Factory factory) { return null; }\n" + - " public MapStream mapValues(final java.util.functions.Mapper mapper) { return null; }\n" + - " public BiValue getFirst() { return null; }\n" + - " public MapStream map(final java.util.functions.BiMapper mapper) { return null; }\n"; + " public boolean remove(Object key, Object value) { return false;}\n" + + " public @SuppressWarnings(\"rawtypes\") void forEach(java.util.function.BiBlock block) {}\n" + + " public @SuppressWarnings(\"rawtypes\") void replaceAll(java.util.function.BiFunction function) {}\n" + + " public Object putIfAbsent(Object key, Object value) { return null;}\n" + + " public boolean replace(Object key, Object oldValue, Object newValue) { return false;}\n" + + " public Object replace(Object key, Object value) { return null;}\n" + + " public @SuppressWarnings(\"rawtypes\") Object computeIfAbsent(Object key, java.util.function.Function mappingFunction) { return null;}\n" + + " public @SuppressWarnings(\"rawtypes\") Object computeIfPresent(Object key, java.util.function.BiFunction remappingFunction) { return null;}\n" + + " public @SuppressWarnings(\"rawtypes\") Object compute(Object key, java.util.function.BiFunction remappingFunction) { return null;}\n" + + " public @SuppressWarnings(\"rawtypes\") Object merge(Object key, Object value, java.util.function.BiFunction remappingFunction) { return null;}\n"; } else { COMPARATOR_IMPL_JRE8 = ""; COMPARATOR_RAW_IMPL_JRE8 = ""; @@ -241,11 +160,10 @@ public abstract class AbstractRegressionTest extends AbstractCompilerTest implem LIST_RAW_IMPL_JRE8 = ""; ITERABLE_IMPL_JRE8 = ""; ITERABLE_RAW_IMPL_JRE8 = ""; - ITERABLE_RAW_WITHOUT_IS_EMPTY_IMPL_JRE8 = ""; + ITERATOR_IMPL_JRE8 = "\n"; + ITERATOR_RAW_IMPL_JRE8 = "\n"; MAP_IMPL_JRE8 = ""; MAP_RAW_IMPL_JRE8 = ""; - MAP_STREAM_IMPL_JRE8 = ""; - MAP_STREAM_RAW_IMPL_JRE8 = ""; } } String getListRawImplJRE8() { diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java index 0c6446f88..d2c356a71 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java @@ -1,12 +1,18 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann - Contribution for + * bug 388739 - [1.8][compiler] consider default methods when detecting whether a class needs to be declared abstract *******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.regression; @@ -115,7 +121,7 @@ public class AmbiguousMethodTest extends AbstractComparableTest { "1. ERROR in X.java (at line 4)\n" + " static interface I3<E3, E4> extends I1<E3>, I2<E4> {}\n" + " ^^\n" + - "Name clash: The method method(E1) of type X.I1<E1> has the same erasure as method(E2) of type X.I2<E2> but does not override it\n" + + "Name clash: The method method(E2) of type X.I2<E2> has the same erasure as method(E1) of type X.I1<E1> but does not override it\n" + "----------\n"); } } @@ -492,7 +498,7 @@ sure, yet neither overrides the other ); } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=123943 - case 2 - public void test009() { + public void _test009() { this.runConformTest( new String[] { "T.java", @@ -2485,7 +2491,7 @@ public void test047() { "1. ERROR in X.java (at line 1)\n" + " public class X<T extends I & J> {\n" + " ^\n" + - "The return types are incompatible for the inherited methods J.method(), I.method()\n" + + "The return types are incompatible for the inherited methods I.method(), J.method()\n" + "----------\n", // javac options JavacTestOptions.JavacHasABug.JavacBug5061359 /* javac test options */); @@ -2517,7 +2523,7 @@ public void test048() { "1. ERROR in X.java (at line 1)\n" + " public class X<T extends I & J> {\n" + " ^\n" + - "The return types are incompatible for the inherited methods J.method(), I.method()\n" + + "The return types are incompatible for the inherited methods I.method(), J.method()\n" + "----------\n" + "2. ERROR in X.java (at line 3)\n" + " t.method();\n" + @@ -3176,12 +3182,12 @@ public void test070() { "1. ERROR in X.java (at line 3)\n" + " interface C extends B, A {}\n" + " ^\n" + - "The return types are incompatible for the inherited methods A.foo(), B.foo()\n" + + "The return types are incompatible for the inherited methods B.foo(), A.foo()\n" + "----------\n" + "2. ERROR in X.java (at line 4)\n" + " interface D extends A, B {}\n" + " ^\n" + - "The return types are incompatible for the inherited methods B.foo(), A.foo()\n" + + "The return types are incompatible for the inherited methods A.foo(), B.foo()\n" + "----------\n" + "3. ERROR in X.java (at line 8)\n" + " X<? extends B> c_b = c.foo();\n" + @@ -3307,7 +3313,7 @@ public void test073() { "3. ERROR in Y.java (at line 13)\n" + " abstract class Y extends X implements I, J {\n" + " ^\n" + - "The return types are incompatible for the inherited methods J.a(), I.a()\n" + + "The return types are incompatible for the inherited methods I.a(), J.a()\n" + "----------\n" + "4. ERROR in Y.java (at line 20)\n" + " abstract class Y2 extends X implements J, I {\n" + @@ -3322,7 +3328,7 @@ public void test073() { "6. ERROR in Y.java (at line 20)\n" + " abstract class Y2 extends X implements J, I {\n" + " ^^\n" + - "The return types are incompatible for the inherited methods I.a(), J.a()\n" + + "The return types are incompatible for the inherited methods J.a(), I.a()\n" + "----------\n" ); } diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java index c5b0b6ae9..5836c0d23 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java @@ -9939,35 +9939,46 @@ public void testBug366003() { "----------\n" + "8. ERROR in snippet\\Bug366003.java (at line 13)\n" + " org.eclipse.User.User(@NonNull String name, int uid, @Nullable String email)\n" + - " ^^^^\n" + - "Syntax error, insert \")\" to complete MethodDeclaration\n" + + " ^^^^\n" + +//{ObjectTeams: starting from here the OT/J grammar produces different errors: +// different: + "Syntax error, insert \")\" to complete MethodSpecLong\n" + "----------\n" + "9. ERROR in snippet\\Bug366003.java (at line 13)\n" + " org.eclipse.User.User(@NonNull String name, int uid, @Nullable String email)\n" + " ^^^^\n" + - "Syntax error, insert \";\" to complete MethodDeclaration\n" + + "Syntax error, insert \"<-\" to complete CallinBindingLeft\n" + +// "----------\n" + "10. ERROR in snippet\\Bug366003.java (at line 13)\n" + " org.eclipse.User.User(@NonNull String name, int uid, @Nullable String email)\n" + " ^^^^\n" + +// new + "Syntax error, insert \"MethodSpecsLong EmptyParameterMappings\" to complete InvalidCallinBinding\n" + + "----------\n" + +// number changes beyond this point + "11. ERROR in snippet\\Bug366003.java (at line 13)\n" + + " org.eclipse.User.User(@NonNull String name, int uid, @Nullable String email)\n" + + " ^^^^\n" + "Syntax error, insert \"}\" to complete ClassBody\n" + "----------\n" + - "11. ERROR in snippet\\Bug366003.java (at line 13)\n" + + "12. ERROR in snippet\\Bug366003.java (at line 13)\n" + " org.eclipse.User.User(@NonNull String name, int uid, @Nullable String email)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Return type for the method is missing\n" + "----------\n" + - "12. ERROR in snippet\\Bug366003.java (at line 13)\n" + + "13. ERROR in snippet\\Bug366003.java (at line 13)\n" + " org.eclipse.User.User(@NonNull String name, int uid, @Nullable String email)\n" + " ^^^^^^^\n" + "NonNull cannot be resolved to a type\n" + "----------\n" + - "13. ERROR in snippet\\Bug366003.java (at line 13)\n" + + "14. ERROR in snippet\\Bug366003.java (at line 13)\n" + " org.eclipse.User.User(@NonNull String name, int uid, @Nullable String email)\n" + " ^^^^^^^^\n" + "Nullable cannot be resolved to a type\n" + "----------\n" + - "14. ERROR in snippet\\Bug366003.java (at line 13)\n" + + "15. ERROR in snippet\\Bug366003.java (at line 13)\n" + +// SH} " org.eclipse.User.User(@NonNull String name, int uid, @Nullable String email)\n" + " ^\n" + "Syntax error, insert \";\" to complete ConstructorDeclaration\n" + @@ -10026,34 +10037,45 @@ public void testBug366003b() { "7. ERROR in snippet\\Bug366003.java (at line 11)\n" + " org.eclipse.User.User(@NonNull String name, int uid, @Nullable String email)\n" + " ^^^^\n" + - "Syntax error, insert \")\" to complete MethodDeclaration\n" + +//{ObjectTeams: starting from here the OT/J grammar produces different errors: +// different: + "Syntax error, insert \")\" to complete MethodSpecLong\n" + "----------\n" + "8. ERROR in snippet\\Bug366003.java (at line 11)\n" + " org.eclipse.User.User(@NonNull String name, int uid, @Nullable String email)\n" + " ^^^^\n" + - "Syntax error, insert \";\" to complete MethodDeclaration\n" + + "Syntax error, insert \"<-\" to complete CallinBindingLeft\n" + +// "----------\n" + +// new "9. ERROR in snippet\\Bug366003.java (at line 11)\n" + " org.eclipse.User.User(@NonNull String name, int uid, @Nullable String email)\n" + " ^^^^\n" + - "Syntax error, insert \"}\" to complete ClassBody\n" + + "Syntax error, insert \"MethodSpecsLong EmptyParameterMappings\" to complete InvalidCallinBinding\n" + +// number changes beyond this point "----------\n" + "10. ERROR in snippet\\Bug366003.java (at line 11)\n" + " org.eclipse.User.User(@NonNull String name, int uid, @Nullable String email)\n" + + " ^^^^\n" + + "Syntax error, insert \"}\" to complete ClassBody\n" + + "----------\n" + + "11. ERROR in snippet\\Bug366003.java (at line 11)\n" + + " org.eclipse.User.User(@NonNull String name, int uid, @Nullable String email)\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Return type for the method is missing\n" + "----------\n" + - "11. ERROR in snippet\\Bug366003.java (at line 11)\n" + + "12. ERROR in snippet\\Bug366003.java (at line 11)\n" + " org.eclipse.User.User(@NonNull String name, int uid, @Nullable String email)\n" + " ^^^^^^^\n" + "NonNull cannot be resolved to a type\n" + "----------\n" + - "12. ERROR in snippet\\Bug366003.java (at line 11)\n" + + "13. ERROR in snippet\\Bug366003.java (at line 11)\n" + " org.eclipse.User.User(@NonNull String name, int uid, @Nullable String email)\n" + " ^^^^^^^^\n" + "Nullable cannot be resolved to a type\n" + "----------\n" + - "13. ERROR in snippet\\Bug366003.java (at line 11)\n" + + "14. ERROR in snippet\\Bug366003.java (at line 11)\n" + +// SH} " org.eclipse.User.User(@NonNull String name, int uid, @Nullable String email)\n" + " ^\n" + "Syntax error, insert \";\" to complete ConstructorDeclaration\n" + @@ -10079,30 +10101,41 @@ public void testBug366003c() { "----------\n" + "2. ERROR in snippet\\Bug366003.java (at line 5)\n" + " org.User(@Bla String a)\n" + - " ^^^\n" + - "Syntax error, insert \")\" to complete MethodDeclaration\n" + + " ^^^\n" + +//{ObjectTeams: starting from here the OT/J grammar produces different errors: +// different: + "Syntax error, insert \")\" to complete MethodSpecLong\n" + "----------\n" + "3. ERROR in snippet\\Bug366003.java (at line 5)\n" + " org.User(@Bla String a)\n" + " ^^^\n" + - "Syntax error, insert \";\" to complete MethodDeclaration\n" + - "----------\n" + + "Syntax error, insert \"<-\" to complete CallinBindingLeft\n" + +// + "----------\n" + +// new "4. ERROR in snippet\\Bug366003.java (at line 5)\n" + " org.User(@Bla String a)\n" + " ^^^\n" + - "Syntax error, insert \"}\" to complete ClassBody\n" + + "Syntax error, insert \"MethodSpecsLong EmptyParameterMappings\" to complete InvalidCallinBinding\n" + +// number changes beyond this point "----------\n" + "5. ERROR in snippet\\Bug366003.java (at line 5)\n" + " org.User(@Bla String a)\n" + + " ^^^\n" + + "Syntax error, insert \"}\" to complete ClassBody\n" + + "----------\n" + + "6. ERROR in snippet\\Bug366003.java (at line 5)\n" + + " org.User(@Bla String a)\n" + " ^^^^^^^^^^^^^^^^^^^\n" + "Return type for the method is missing\n" + "----------\n" + - "6. ERROR in snippet\\Bug366003.java (at line 5)\n" + + "7. ERROR in snippet\\Bug366003.java (at line 5)\n" + " org.User(@Bla String a)\n" + " ^^^\n" + "Bla cannot be resolved to a type\n" + - "----------\n" + - "7. ERROR in snippet\\Bug366003.java (at line 5)\n" + + "----------\n" + +// SH} + "8. ERROR in snippet\\Bug366003.java (at line 5)\n" + " org.User(@Bla String a)\n" + " ^\n" + "Syntax error, insert \";\" to complete ConstructorDeclaration\n" + diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java index 78a3e3555..acf06fa1d 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2012 IBM Corporation and others. + * Copyright (c) 2006, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -24,7 +24,9 @@ * bug 382347 - [1.8][compiler] Compiler accepts incorrect default method inheritance * bug 388281 - [compiler][null] inheritance of null annotations as an option * bug 392862 - [1.8][compiler][null] Evaluate null annotations on array types - *******************************************************************************/ + * Jesper S Moller - Contributions for + * bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression +*******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.regression; import java.lang.reflect.Field; @@ -541,6 +543,7 @@ public void _test011_problem_categories() { expectedProblemAttributes.put("IllegalQualifiedEnumConstantLabel", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); expectedProblemAttributes.put("IllegalQualifiedParameterizedTypeAllocation", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); expectedProblemAttributes.put("IllegalQualifierForExplicitThis", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); + expectedProblemAttributes.put("IllegalQualifierForExplicitThis2", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); expectedProblemAttributes.put("IllegalReturnNullityRedefinition", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); expectedProblemAttributes.put("IllegalRedefinitionToNonNullParameter", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); expectedProblemAttributes.put("IllegalStaticModifierForMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); @@ -551,6 +554,7 @@ public void _test011_problem_categories() { expectedProblemAttributes.put("IllegalUsageOfQualifiedTypeReference", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); expectedProblemAttributes.put("IllegalUsageOfTypeAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); expectedProblemAttributes.put("IllegalVararg", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); + expectedProblemAttributes.put("IllegalVarargInLambda", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForField", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForMethod", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); @@ -880,6 +884,7 @@ public void _test011_problem_categories() { expectedProblemAttributes.put("SuperfluousSemicolon", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); expectedProblemAttributes.put("SwitchOnEnumNotBelow15", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); expectedProblemAttributes.put("SwitchOnStringsNotBelow17", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); + expectedProblemAttributes.put("TargetTypeNotAFunctionalInterface", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); expectedProblemAttributes.put("Task", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); expectedProblemAttributes.put("ThisInStaticContext", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); expectedProblemAttributes.put("ThisSuperDuringConstructorInvocation", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); @@ -1355,6 +1360,7 @@ public void test012_compiler_problems_tuning() { expectedProblemAttributes.put("IllegalQualifiedEnumConstantLabel", SKIP); expectedProblemAttributes.put("IllegalQualifiedParameterizedTypeAllocation", SKIP); expectedProblemAttributes.put("IllegalQualifierForExplicitThis", SKIP); + expectedProblemAttributes.put("IllegalQualifierForExplicitThis2", SKIP); expectedProblemAttributes.put("IllegalRedefinitionToNonNullParameter", new ProblemAttributes(JavaCore.COMPILER_PB_NULL_SPECIFICATION_VIOLATION)); expectedProblemAttributes.put("IllegalReturnNullityRedefinition", new ProblemAttributes(JavaCore.COMPILER_PB_NULL_SPECIFICATION_VIOLATION)); expectedProblemAttributes.put("IllegalStaticModifierForMemberType", SKIP); @@ -1365,6 +1371,7 @@ public void test012_compiler_problems_tuning() { expectedProblemAttributes.put("IllegalUsageOfQualifiedTypeReference", SKIP); expectedProblemAttributes.put("IllegalUsageOfTypeAnnotations", SKIP); expectedProblemAttributes.put("IllegalVararg", SKIP); + expectedProblemAttributes.put("IllegalVarargInLambda", SKIP); expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForField", SKIP); expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForMemberType", SKIP); expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForMethod", SKIP); @@ -1695,6 +1702,7 @@ public void test012_compiler_problems_tuning() { expectedProblemAttributes.put("SuperfluousSemicolon", new ProblemAttributes(JavaCore.COMPILER_PB_EMPTY_STATEMENT)); expectedProblemAttributes.put("SwitchOnEnumNotBelow15", SKIP); expectedProblemAttributes.put("SwitchOnStringsNotBelow17", SKIP); + expectedProblemAttributes.put("TargetTypeNotAFunctionalInterface", SKIP); expectedProblemAttributes.put("Task", SKIP); expectedProblemAttributes.put("ThisInStaticContext", SKIP); expectedProblemAttributes.put("ThisSuperDuringConstructorInvocation", SKIP); diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/DefaultMethodsTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/DefaultMethodsTest.java index bf2b91302..a41fe887b 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/DefaultMethodsTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/DefaultMethodsTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 GK Software AG and others. + * Copyright (c) 2013 GK Software AG, IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -483,7 +483,7 @@ public class DefaultMethodsTest extends AbstractComparableTest { "----------\n"); } - public void _testDefaultNonclash3() { + public void testDefaultNonclash3() { runNegativeTest( new String[] { "X.java", @@ -573,4 +573,156 @@ public class DefaultMethodsTest extends AbstractComparableTest { }, ""); } + + // JLS 8.1.1.1 abstract Classes + // Default method overrides an abstract method from its super interface + public void testAbstract01() { + runConformTest( + new String[] { + "I2.java", + "public interface I2 {\n" + + " void test();\n" + + "}\n", + "I1.java", + "public interface I1 extends I2 {\n" + + " void test() default {}\n" + + "}\n", + "C.java", + "public class C implements I1 {\n" + + "}\n" + }); + } + + // JLS 8.1.1.1 abstract Classes + // Default method overrides independent abstract method + public void testAbstract02() { + runConformTest( + new String[] { + "I1.java", + "public interface I1 {\n" + + " void test();\n" + + "}\n", + "I2.java", + "public interface I2 {\n" + + " void test() default {}\n" + + "}\n", + "C.java", + "public class C implements I1, I2 {\n" + + "}\n" + }); + } + + // JLS 8.1.1.1 abstract Classes + // Default method overrides independent abstract method + // same as above except for order of implements list + public void testAbstract02a() { + runConformTest( + new String[] { + "I1.java", + "public interface I1 {\n" + + " void test();\n" + + "}\n", + "I2.java", + "public interface I2 {\n" + + " void test() default {}\n" + + "}\n", + "C.java", + "public class C implements I2, I1 {\n" + + "}\n" + }); + } + + // JLS 8.1.1.1 abstract Classes + // Default method overrides an abstract method from its super interface - class implements both + public void testAbstract03() { + runConformTest( + new String[] { + "I1.java", + "public interface I1 {\n" + + " void test();\n" + + "}\n", + "I2.java", + "public interface I2 extends I1 {\n" + + " @Override\n" + + " void test() default {}\n" + + "}\n", + "C.java", + "public class C implements I1, I2 {\n" + + "}\n" + }); + } + + // JLS 8.1.1.1 abstract Classes + // Default method overrides an abstract method from its super interface - class implements both + // same as above except for order of implements list + public void testAbstract03a() { + runConformTest( + new String[] { + "I1.java", + "public interface I1 {\n" + + " void test();\n" + + "}\n", + "I2.java", + "public interface I2 extends I1 {\n" + + " @Override\n" + + " void test() default {}\n" + + "}\n", + "C.java", + "public class C implements I2, I1 {\n" + + "}\n" + }); + } + + // JLS 8.1.1.1 abstract Classes + // default method is not inherited because a more specific abstract method is. + public void testAbstract04() { + runNegativeTest( + new String[] { + "I1.java", + "public interface I1 {\n" + + " void test() default {}\n" + + "}\n", + "I2.java", + "public interface I2 extends I1 {\n" + + " @Override\n" + + " void test();\n" + + "}\n", + "C.java", + "public class C implements I2, I1 {\n" + + "}\n" + }, + "----------\n" + + "1. ERROR in C.java (at line 1)\n" + + " public class C implements I2, I1 {\n" + + " ^\n" + + "The type C must implement the inherited abstract method I2.test()\n" + + "----------\n"); + } + + // JLS 8.1.1.1 abstract Classes + // default method is not inherited because a more specific abstract method is. + // same as above except for order of implements list + public void testAbstract04a() { + runNegativeTest( + new String[] { + "I1.java", + "public interface I1 {\n" + + " void test() default {}\n" + + "}\n", + "I2.java", + "public interface I2 extends I1 {\n" + + " @Override\n" + + " void test();\n" + + "}\n", + "C.java", + "public class C implements I2, I1 {\n" + + "}\n" + }, + "----------\n" + + "1. ERROR in C.java (at line 1)\n" + + " public class C implements I2, I1 {\n" + + " ^\n" + + "The type C must implement the inherited abstract method I2.test()\n" + + "----------\n"); + } } diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java index b6cb60cd9..aa2bf5b8a 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java @@ -5,12 +5,17 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann - Contributions for * Bug 365519 - editorial cleanup after bug 186342 and bug 365387 * Bug 265744 - Enum switch should warn about missing default * Bug 374605 - Unreasonable warning for enum-based switch statements + * bug 388739 - [1.8][compiler] consider default methods when detecting whether a class needs to be declared abstract *******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.regression; @@ -3007,7 +3012,7 @@ public void test095() { // check missing abstract cases from multiple interfaces "1. ERROR in X.java (at line 1)\n" + " public enum X implements I, J { \n" + " ^\n" + - "The type X must implement the inherited abstract method I.foo()\n" + + "The type X must implement the inherited abstract method J.foo()\n" + "----------\n"); this.runNegativeTest( new String[] { diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ForeachStatementTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ForeachStatementTest.java index 575a1134f..e0188b34e 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ForeachStatementTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ForeachStatementTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -1630,6 +1630,7 @@ public void test034() throws Exception { " }\n" + " public void remove() {\n" + " }\n" + + ITERATOR_IMPL_JRE8.replaceAll("\\*", "T") + "}\n" + "class Bar implements Iterable<String> {\n" + " public Iterator<String> iterator() {\n" + @@ -1724,6 +1725,7 @@ public void test035() throws Exception { " }\n" + " public void remove() {\n" + " }\n" + + ITERATOR_IMPL_JRE8.replaceAll("\\*", "T") + "}\n" + "interface IFoo extends Iterable<String> {\n" + "}\n" + @@ -2021,6 +2023,7 @@ public void test039() throws Exception { " System.out.println(\"remove\");\n" + " this.iterator.remove();\n" + " }\n" + + ITERATOR_IMPL_JRE8.replaceAll("\\*", "T") + " }\n" + " \n" + " static Set<Object> initForEach() {\n" + @@ -2117,6 +2120,7 @@ public void test040() throws Exception { " System.out.println(\"remove\");\n" + " this.iterator.remove();\n" + " }\n" + + ITERATOR_IMPL_JRE8.replaceAll("\\*", "T") + " }\n" + " \n" + " static Set<Object> initForEach() {\n" + diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java index 136186eb5..c3005a2ce 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,6 +17,7 @@ * bug 383690 - [compiler] location of error re uninitialized final field should be aligned * bug 388800 - [1.8] adjust tests to 1.8 JRE * bug 388795 - [compiler] detection of name clash depends on order of super interfaces + * bug 388739 - [1.8][compiler] consider default methods when detecting whether a class needs to be declared abstract *******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.regression; @@ -8855,8 +8856,7 @@ public class GenericTypeTest extends AbstractComparableTest { " public Set<Map.Entry<String, V>> entrySet() {\n" + " return this.backingMap.entrySet();\n" + " }\n" + - MAP_STREAM_IMPL_JRE8.replaceAll("\\*", "String").replace('%', 'V') + - MAP_IMPL_JRE8.replaceAll("!", "String,V").replaceAll("\\*", "String")+ + MAP_IMPL_JRE8.replaceAll("\\*", "String").replaceAll("\\%", "V")+ "}\n", }, "----------\n" + @@ -10816,6 +10816,7 @@ public class GenericTypeTest extends AbstractComparableTest { " public boolean hasNext() {return false;}\n" + " public Entry<String, Integer> next() {return null;}\n" + " public void remove() {} \n" + + ITERATOR_IMPL_JRE8.replaceAll("\\*", "Entry<String,Integer>") + " };\n" + " }\n" + " public int size() {return 0;}\n" + @@ -13573,6 +13574,7 @@ public class GenericTypeTest extends AbstractComparableTest { " public boolean hasNext() { return false; }\n" + " public String next() { return null; }\n" + " public void remove() {}\n" + + ITERATOR_IMPL_JRE8.replaceAll("\\*", "String") + "}\n", }, ""); @@ -19910,6 +19912,7 @@ public void test0617() { " }\n" + " public void remove() {\n" + " }\n" + + ITERATOR_IMPL_JRE8.replaceAll("\\*", "U") + " }\n" + " }\n" + "}\n", @@ -24934,7 +24937,7 @@ public void test0779() throws Exception { }, "SUCCESS"); - String constantPoolIdx = IS_JRE_8 ? "149" : "36"; // depends on whether or not stubs for JRE8 default methods are included + String constantPoolIdx = IS_JRE_8 ? "67" : "36"; // depends on whether or not stubs for JRE8 default methods are included String expectedOutput = " // Method descriptor #31 (I)Ljava/lang/Object;\n" + " // Stack: 2, Locals: 2\n" + @@ -25888,6 +25891,7 @@ public void test0809() { " }\n" + " public void remove() {\n" + " }\n" + + ITERATOR_IMPL_JRE8.replaceAll("\\*", "N") + "}\n" + "interface Set3<N extends Node> extends Iterable<N> {\n" + " SetIterator<N> iterator();\n" + @@ -25919,27 +25923,27 @@ public void test0809() { "}\n", }, "----------\n" + - "1. WARNING in X.java (at line 21)\n" + + "1. WARNING in X.java (at line 22)\n" + " void f1(Set1 s) {\n" + " ^^^^\n" + "Set1 is a raw type. References to generic type Set1<N> should be parameterized\n" + "----------\n" + - "2. ERROR in X.java (at line 22)\n" + + "2. ERROR in X.java (at line 23)\n" + " Node n_ = s.iterator().next();\n" + " ^^^^^^^^^^^^^^^^^^^\n" + "Type mismatch: cannot convert from Object to Node\n" + "----------\n" + - "3. ERROR in X.java (at line 25)\n" + + "3. ERROR in X.java (at line 26)\n" + " for (Node n : s) {\n" + " ^\n" + "Type mismatch: cannot convert from element type Object to Node\n" + "----------\n" + - "4. WARNING in X.java (at line 35)\n" + + "4. WARNING in X.java (at line 36)\n" + " void f3(Set3 s) {\n" + " ^^^^\n" + "Set3 is a raw type. References to generic type Set3<N> should be parameterized\n" + "----------\n" + - "5. ERROR in X.java (at line 38)\n" + + "5. ERROR in X.java (at line 39)\n" + " for (Node n : s) {\n" + " ^\n" + "Type mismatch: cannot convert from element type Object to Node\n" + @@ -28044,7 +28048,7 @@ public void test0868() { " \n" + " }" + COLLECTION_RAW_IMPL_JRE8 + - ITERABLE_RAW_WITHOUT_IS_EMPTY_IMPL_JRE8 + + ITERABLE_RAW_IMPL_JRE8 + "}", }, "", @@ -32485,28 +32489,18 @@ public void test0986() { public void test0987() { String expectedOutput = new CompilerOptions(getCompilerOptions()).sourceLevel < ClassFileConstants.JDK1_6 ? "----------\n" + - "1. ERROR in X.java (at line 7)\n" + - " abstract class GLinkElementView<M,CM> extends AbstractLinkView<M> {}\n" + - " ^^^^^^^^^^^^^^^^\n" + - "The return types are incompatible for the inherited methods EditPart.getViewer(), AbstractLinkView<M>.getViewer()\n" + - "----------\n" + - "2. ERROR in X.java (at line 11)\n" + + "1. ERROR in X.java (at line 11)\n" + " public ISheetViewer getViewer() { return null; } \n" + " ^^^^^^^^^^^^\n" + "The return type is incompatible with EditPart.getViewer()\n" + "----------\n" + - "3. ERROR in X.java (at line 11)\n" + + "2. ERROR in X.java (at line 11)\n" + " public ISheetViewer getViewer() { return null; } \n" + " ^^^^^^^^^^^\n" + "The method getViewer() of type AbstractLinkView<M> must override a superclass method\n" + "----------\n" : "----------\n" + - "1. ERROR in X.java (at line 7)\n" + - " abstract class GLinkElementView<M,CM> extends AbstractLinkView<M> {}\n" + - " ^^^^^^^^^^^^^^^^\n" + - "The return types are incompatible for the inherited methods EditPart.getViewer(), AbstractLinkView<M>.getViewer()\n" + - "----------\n" + - "2. ERROR in X.java (at line 11)\n" + + "1. ERROR in X.java (at line 11)\n" + " public ISheetViewer getViewer() { return null; } \n" + " ^^^^^^^^^^^^\n" + "The return type is incompatible with EditPart.getViewer()\n" + @@ -32595,12 +32589,7 @@ public void test0988() { "}", // ================= }, "----------\n" + - "1. ERROR in X.java (at line 7)\n" + - " abstract class GLinkElementView<M,CM> extends AbstractLinkView<M> {}\n" + - " ^^^^^^^^^^^^^^^^\n" + - "The return types are incompatible for the inherited methods EditPart.getViewer(), ILinkViewElement.getViewer(), AbstractLinkView<M>.getViewer()\n" + - "----------\n" + - "2. ERROR in X.java (at line 11)\n" + + "1. ERROR in X.java (at line 11)\n" + " public SheetViewer getViewer() { return null; } \n" + " ^^^^^^^^^^^\n" + "The return type is incompatible with AbstractEditPart.getViewer()\n" + @@ -34442,7 +34431,7 @@ public void test1035() { "public int compare(T obj1, T obj2) {\n" + " return obj1.compareTo(obj2);\n" + "}\n" + - COMPARATOR_IMPL_JRE8.replace('*', 'T') + + COMPARATOR_IMPL_JRE8.replace('*', 'T').replace('%', 'U') + "}\n" + "\n" + "@SuppressWarnings({\"unchecked\", \"rawtypes\"})\n" + @@ -34493,7 +34482,7 @@ public void test1035() { "public int compare(V obj1, V obj2) {\n" + " return 0;\n" + "}\n" + - COMPARATOR_IMPL_JRE8.replace('*', 'V') + + COMPARATOR_IMPL_JRE8.replace('*', 'V').replace('%', 'U') + "}", // ================= }, @@ -42843,7 +42832,7 @@ public void test1239() { "4. ERROR in X.java (at line 13)\n" + " public interface CombinedSubInterface extends SubInterface, OtherSubInterface {}\n" + " ^^^^^^^^^^^^^^^^^^^^\n" + - "The return types are incompatible for the inherited methods X.OtherSubInterface.and(X.SuperInterface), X.SubInterface.and(X.SuperInterface)\n" + + "The return types are incompatible for the inherited methods X.SubInterface.and(X.SuperInterface), X.OtherSubInterface.and(X.SuperInterface)\n" + "----------\n" + "5. WARNING in X.java (at line 15)\n" + " public interface OtherSubInterface extends SuperInterface {\n" + @@ -49757,6 +49746,7 @@ public void test1444() { " public boolean hasNext() {\n" + " return false;\n" + " }\n" + + ITERATOR_RAW_IMPL_JRE8 + " };\n" + " }\n" + " Zork z;\n" + @@ -49788,7 +49778,7 @@ public void test1444() { " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Unnecessary cast from Iterator to Iterator<String>\n" + "----------\n" + - "6. ERROR in X.java (at line 36)\n" + + "6. ERROR in X.java (at line 37)\n" + " Zork z;\n" + " ^^^^\n" + "Zork cannot be resolved to a type\n" + diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GrammarCoverageTests308.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GrammarCoverageTests308.java index a7c87e0ef..1e7bf3717 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GrammarCoverageTests308.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GrammarCoverageTests308.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2012 IBM Corporation and others. + * Copyright (c) 2011, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -1447,7 +1447,13 @@ public class GrammarCoverageTests308 extends AbstractRegressionTest { " i = @Marker W<@Marker Integer>::<@Marker String> new;\n" + " ^\n" + "i cannot be resolved to a variable\n" + - "----------\n"); + "----------\n" + + "2. ERROR in X.java (at line 12)\n" + + " i = @Marker W<@Marker Integer>::<@Marker String> new;\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "The target type of this expression must be a functional interface\n" + + "----------\n" + ); } // CastExpression ::= PushLPAREN Name PushRPAREN InsideCastExpressionLL1 UnaryExpressionNotPlusMinus // CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java index 85d3cddf4..bbb9c35a5 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2012 IBM Corporation and others. + * Copyright (c) 2006, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForClass.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForClass.java index a815e7646..13375e6e7 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForClass.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForClass.java @@ -4,10 +4,6 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * - * This is an implementation of an early-draft specification developed under the Java - * Community Process (JCP) and is made available for testing and evaluation purposes - * only. The code is not compatible with any specification of the JCP. * * Contributors: * IBM Corporation - initial API and implementation @@ -1026,29 +1022,17 @@ public class JavadocTestForClass extends JavadocTest { " int i = 0;\n" + "}\n", }, - IS_JRE_8 ? - "----------\n" + - "1. ERROR in X.java (at line 6)\n" + - " * <li> {@link Entry} </li>\n" + - " ^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" + - "2. ERROR in X.java (at line 9)\n" + - " public interface X extends Map {\n" + - " ^\n" + - "The return types are incompatible for the inherited methods MapStream.values(), Map.values()\n" + - "----------\n" : - "----------\n" + - "1. WARNING in X.java (at line 2)\n"+ - " import java.util.Map.Entry;\n"+ - " ^^^^^^^^^^^^^^^^^^^\n"+ - "The import java.util.Map.Entry is never used\n"+ - "----------\n"+ - "2. ERROR in X.java (at line 6)\n" + - " * <li> {@link Entry} </li>\n" + - " ^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n"); + "----------\n" + + "1. WARNING in X.java (at line 2)\n"+ + " import java.util.Map.Entry;\n"+ + " ^^^^^^^^^^^^^^^^^^^\n"+ + "The import java.util.Map.Entry is never used\n"+ + "----------\n"+ + "2. ERROR in X.java (at line 6)\n" + + " * <li> {@link Entry} </li>\n" + + " ^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n"); return; } runNegativeTest( @@ -1089,24 +1073,12 @@ public class JavadocTestForClass extends JavadocTest { " Entry e = null;\n" + "}\n", }, - !IS_JRE_8 || (IS_JRE_8 && this.complianceLevel >= ClassFileConstants.JDK1_5) ? - "----------\n" + - "1. ERROR in X.java (at line 5)\n" + - " * <li> {@link Entry} </li>\n" + - " ^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n": - "----------\n" + - "1. ERROR in X.java (at line 5)\n" + - " * <li> {@link Entry} </li>\n" + - " ^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" + - "2. ERROR in X.java (at line 8)\n" + - " public interface X extends Map {\n" + - " ^\n" + - "The return types are incompatible for the inherited methods MapStream.values(), Map.values()\n" + - "----------\n"); + "----------\n" + + "1. ERROR in X.java (at line 5)\n" + + " * <li> {@link Entry} </li>\n" + + " ^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n"); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=253750 @@ -1127,29 +1099,17 @@ public class JavadocTestForClass extends JavadocTest { " Entry e = null;\n" + "}\n", }, - IS_JRE_8 ? - "----------\n" + - "1. ERROR in X.java (at line 6)\n" + - " * <li> {@link Entry} </li>\n" + - " ^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n" + - "2. ERROR in X.java (at line 9)\n" + - " public interface X extends Map {\n" + - " ^\n" + - "The return types are incompatible for the inherited methods MapStream.values(), Map.values()\n" + - "----------\n" : - "----------\n" + - "1. WARNING in X.java (at line 2)\n"+ - " import java.util.Map.Entry;\n"+ - " ^^^^^^^^^^^^^^^^^^^\n"+ - "The import java.util.Map.Entry is never used\n"+ - "----------\n"+ - "2. ERROR in X.java (at line 6)\n" + - " * <li> {@link Entry} </li>\n" + - " ^^^^^\n" + - "Javadoc: Invalid member type qualification\n" + - "----------\n"); + "----------\n" + + "1. WARNING in X.java (at line 2)\n"+ + " import java.util.Map.Entry;\n"+ + " ^^^^^^^^^^^^^^^^^^^\n"+ + "The import java.util.Map.Entry is never used\n"+ + "----------\n"+ + "2. ERROR in X.java (at line 6)\n" + + " * <li> {@link Entry} </li>\n" + + " ^^^^^\n" + + "Javadoc: Invalid member type qualification\n" + + "----------\n"); return; } runNegativeTest( diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java index 53623c980..fd2d7ae5c 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java index d30c58622..8eb18b2e3 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,8 +12,9 @@ * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann - Contribution for - * bug 388795 - [compiler] detection of name clash depends on order of super interfaces * bug 388800 - [1.8] adjust tests to 1.8 JRE + * bug 388795 - [compiler] detection of name clash depends on order of super interfaces + * bug 388739 - [1.8][compiler] consider default methods when detecting whether a class needs to be declared abstract *******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.regression; @@ -1822,7 +1823,6 @@ public class MethodVerifyTest extends AbstractComparableTest { "public class X extends java.util.AbstractMap {\n" + " public java.util.Set entrySet() { return null; }\n" + MAP_RAW_IMPL_JRE8 + - MAP_STREAM_RAW_IMPL_JRE8 + "}\n" }, "" @@ -2041,7 +2041,7 @@ public class MethodVerifyTest extends AbstractComparableTest { "1. ERROR in X.java (at line 3)\n" + " public class X<T extends I&J> {}\n" + " ^\n" + - "The return types are incompatible for the inherited methods J.foo(), I.foo()\n" + + "The return types are incompatible for the inherited methods I.foo(), J.foo()\n" + "----------\n" // types J and I are incompatible; both define foo(), but with unrelated return types ); @@ -2367,7 +2367,7 @@ public class MethodVerifyTest extends AbstractComparableTest { "1. ERROR in Y.java (at line 1)\n" + " abstract class Y implements Equivalent<String>, EqualityComparable<Integer> {\n" + " ^\n" + - "Name clash: The method equalTo(T) of type Equivalent<T> has the same erasure as equalTo(T) of type EqualityComparable<T> but does not override it\n" + + "Name clash: The method equalTo(T) of type EqualityComparable<T> has the same erasure as equalTo(T) of type Equivalent<T> but does not override it\n" + "----------\n"); } } @@ -2387,29 +2387,29 @@ public class MethodVerifyTest extends AbstractComparableTest { "1. ERROR in Y.java (at line 2)\n" + " public abstract boolean equalTo(Object other);\n" + " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Name clash: The method equalTo(Object) of type Y has the same erasure as equalTo(T) of type Equivalent<T> but does not override it\n" + + "Name clash: The method equalTo(Object) of type Y has the same erasure as equalTo(T) of type EqualityComparable<T> but does not override it\n" + "----------\n" + "2. ERROR in Y.java (at line 2)\n" + " public abstract boolean equalTo(Object other);\n" + " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Name clash: The method equalTo(Object) of type Y has the same erasure as equalTo(T) of type EqualityComparable<T> but does not override it\n" + + "Name clash: The method equalTo(Object) of type Y has the same erasure as equalTo(T) of type Equivalent<T> but does not override it\n" + "----------\n" : // name clash: equalTo(java.lang.Object) in Y and equalTo(T) in Equivalent<java.lang.String> have the same erasure, yet neither overrides the other "----------\n" + "1. ERROR in Y.java (at line 1)\n" + " abstract class Y implements Equivalent<String>, EqualityComparable<Integer> {\n" + " ^\n" + - "Name clash: The method equalTo(T) of type Equivalent<T> has the same erasure as equalTo(T) of type EqualityComparable<T> but does not override it\n" + + "Name clash: The method equalTo(T) of type EqualityComparable<T> has the same erasure as equalTo(T) of type Equivalent<T> but does not override it\n" + "----------\n" + "2. ERROR in Y.java (at line 2)\n" + " public abstract boolean equalTo(Object other);\n" + " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Name clash: The method equalTo(Object) of type Y has the same erasure as equalTo(T) of type Equivalent<T> but does not override it\n" + + "Name clash: The method equalTo(Object) of type Y has the same erasure as equalTo(T) of type EqualityComparable<T> but does not override it\n" + "----------\n" + "3. ERROR in Y.java (at line 2)\n" + " public abstract boolean equalTo(Object other);\n" + " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Name clash: The method equalTo(Object) of type Y has the same erasure as equalTo(T) of type EqualityComparable<T> but does not override it\n" + + "Name clash: The method equalTo(Object) of type Y has the same erasure as equalTo(T) of type Equivalent<T> but does not override it\n" + "----------\n" ); } @@ -6878,7 +6878,7 @@ X.java:7: name clash: <T#1>foo2(T#1) in X and <T#2>foo2(A) in Y have the same er " public boolean hasNext() { return false; }\n" + " public Object next() { return null; }\n" + " public void remove() {}\n" + - ITERABLE_RAW_WITHOUT_IS_EMPTY_IMPL_JRE8 + + ITERABLE_RAW_IMPL_JRE8 + COLLECTION_RAW_IMPL_JRE8 + LIST_RAW_IMPL_JRE8 + "}\n", // ================= @@ -7001,7 +7001,7 @@ X.java:7: name clash: <T#1>foo2(T#1) in X and <T#2>foo2(A) in Y have the same er " public boolean hasNext() { return false; }\n" + " public Object next() { return null; }\n" + " public void remove() {}\n" + - ITERABLE_RAW_WITHOUT_IS_EMPTY_IMPL_JRE8 + + ITERABLE_RAW_IMPL_JRE8 + COLLECTION_RAW_IMPL_JRE8 + LIST_RAW_IMPL_JRE8 + "}\n", // ================= @@ -7114,7 +7114,7 @@ X.java:7: name clash: <T#1>foo2(T#1) in X and <T#2>foo2(A) in Y have the same er " public boolean hasNext() { return false; }\n" + " public Object next() { return null; }\n" + " public void remove() {}\n" + - ITERABLE_RAW_WITHOUT_IS_EMPTY_IMPL_JRE8 + + ITERABLE_RAW_IMPL_JRE8 + COLLECTION_RAW_IMPL_JRE8 + LIST_RAW_IMPL_JRE8 + "}\n", // ================= @@ -9101,7 +9101,7 @@ public void test140() { "1. ERROR in X.java (at line 1)\n" + " public abstract class X implements J, K {}\n" + " ^\n" + - "The return types are incompatible for the inherited methods K.foo(Number), J.foo(Number)\n" + + "The return types are incompatible for the inherited methods J.foo(Number), K.foo(Number)\n" + "----------\n" + "2. WARNING in X.java (at line 6)\n" + " XX foo(Number n);\n" + @@ -9715,7 +9715,7 @@ public void test155() { "1. ERROR in X.java (at line 9)\n" + " public abstract class X implements I, J {\n" + " ^\n" + - "The return types are incompatible for the inherited methods J.foo(), I.foo()\n" + + "The return types are incompatible for the inherited methods I.foo(), J.foo()\n" + "----------\n" ); } @@ -9740,7 +9740,7 @@ public void test156() { "1. ERROR in X.java (at line 10)\n" + " public abstract class X implements I, J {\n" + " ^\n" + - "The return types are incompatible for the inherited methods J.foo(), I.foo()\n" + + "The return types are incompatible for the inherited methods I.foo(), J.foo()\n" + "----------\n" ); } @@ -9767,7 +9767,7 @@ public void test157() { "1. ERROR in X.java (at line 7)\n" + " interface C extends A, B {}\n" + " ^\n" + - "The return types are incompatible for the inherited methods B.foo(), A.foo()\n" + + "The return types are incompatible for the inherited methods A.foo(), B.foo()\n" + "----------\n" ); } @@ -9799,7 +9799,7 @@ public void test158() { "1. ERROR in X.java (at line 17)\n" + " public abstract class X extends Root implements AFoo, BFoo {\n" + " ^\n" + - "The return types are incompatible for the inherited methods BFoo.bar(), AFoo.bar()\n" + + "The return types are incompatible for the inherited methods AFoo.bar(), BFoo.bar()\n" + "----------\n" ); } @@ -9830,17 +9830,17 @@ public void test159() { "1. ERROR in X.java (at line 15)\n" + " public abstract class X extends Root implements AFoo, BFoo {}\n" + " ^\n" + - "The return types are incompatible for the inherited methods BFoo.bar(), AFoo.bar()\n" + + "The return types are incompatible for the inherited methods AFoo.bar(), BFoo.bar()\n" + "----------\n" + "2. ERROR in X.java (at line 16)\n" + " abstract class Y extends X {}\n" + " ^\n" + - "The return types are incompatible for the inherited methods BFoo.bar(), AFoo.bar()\n" + + "The return types are incompatible for the inherited methods AFoo.bar(), BFoo.bar()\n" + "----------\n" + "3. ERROR in X.java (at line 17)\n" + " class Z extends X {}\n" + " ^\n" + - "The type Z must implement the inherited abstract method AFoo.bar()\n" + + "The type Z must implement the inherited abstract method BFoo.bar()\n" + "----------\n"); } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=208010 @@ -10810,7 +10810,7 @@ public void test185() { "1. ERROR in A.java (at line 3)\n" + " class A implements I, J {}\n" + " ^\n" + - "The type A must implement the inherited abstract method I.hello()\n" + + "The type A must implement the inherited abstract method J.hello()\n" + "----------\n" ); } @@ -13395,11 +13395,6 @@ public void testBug317719f() throws Exception { " Zork z;\n" + " ^^^^\n" + "Zork cannot be resolved to a type\n" + - "----------\n" + - "5. ERROR in X.java (at line 7)\n" + - " class ChildX<Z> extends X<Z>{}\n" + - " ^^^^^^\n" + - "Duplicate methods named forAccountSet with the parameters (List<R>) and (List) are defined by the type X<Z>\n" + "----------\n": "----------\n" + "1. ERROR in X.java (at line 3)\n" + @@ -13734,7 +13729,7 @@ public void test354229() { "1. ERROR in X.java (at line 8)\n" + " interface C extends A, B { \n" + " ^\n" + - "Name clash: The method get(List<String>) of type A has the same erasure as get(List<Integer>) of type B but does not override it\n" + + "Name clash: The method get(List<Integer>) of type B has the same erasure as get(List<String>) of type A but does not override it\n" + "----------\n" + "2. ERROR in X.java (at line 10)\n" + " Zork z;\n" + @@ -13800,7 +13795,7 @@ public void test354229c() { "1. ERROR in X.java (at line 7)\n" + " interface E extends X, Y {\n" + " ^\n" + - "Name clash: The method e(Action<T>) of type X has the same erasure as e(Action<S>) of type Y but does not override it\n" + + "Name clash: The method e(Action<S>) of type Y has the same erasure as e(Action<T>) of type X but does not override it\n" + "----------\n" + "2. ERROR in X.java (at line 10)\n" + " Zork z;\n" + diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java index 46144a5cd..6ff31fb70 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2012 IBM Corporation and others. + * Copyright (c) 2011, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,6 +11,8 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Jesper S Moller - Contributions for + * bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression *******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.regression; @@ -219,14 +221,14 @@ public void test009() { "}\n" + "public class X {\n" + " public void test1(int x) {\n" + - " ActionListener al = (public xyz) -> System.out.println(e); \n" + + " ActionListener al = (public xyz) -> System.out.println(xyz); \n" + " I f = (abstract final s, @Nullable t) -> System.out.println(s + t); \n" + " }\n" + "}\n", }, "----------\n" + "1. ERROR in X.java (at line 7)\n" + - " ActionListener al = (public xyz) -> System.out.println(e); \n" + + " ActionListener al = (public xyz) -> System.out.println(xyz); \n" + " ^^^\n" + "Syntax error, modifiers and annotations are not allowed for the lambda parameter xyz as its type is elided\n" + "----------\n" + @@ -264,6 +266,148 @@ public void test010() { "Zork cannot be resolved to a type\n" + "----------\n"); } +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=382701, [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expressions. +public void test011() { + // This test checks that common semantic checks are indeed + this.runNegativeTest( + new String[] { + "X.java", + "interface I {\n" + + " Object foo(int [] ia);\n" + + "}\n" + + "public class X {\n" + + " I i = (int [] ia) -> {\n" + + " Zork z;\n" + // Error: No such type + " unknown = 0;\n;" + // Error: No such variable + " int a = 42 + ia;\n" + // Error: int + int[] is wrong + " return ia.clone();\n" + + " };\n" + + " static void staticLambda() {\n" + + " I i = (int [] ia) -> this;\n" + // 'this' is static + " }\n" + + " I j = array -> {\n" + + " int a = array[2] + 3;\n" + // No error, ia must be correctly identifies as int[] + " int b = 42 + array;\n" + // Error: int + int[] is wrong - yes it is! + " System.out.println(\"i(array) = \" + i.foo(array));\n" + // fields are accessible! + " return;\n" + // Error here, expecting Object, not void + " };\n" + + " Runnable r = () -> { return 42; };\n" + // Runnable.run not expecting return value + " void anotherLambda() {\n" + + " final int beef = 0;\n" + + " I k = (int [] a) -> a.length + beef;\n" + // No error, beef is in scope + " }\n" + + "}\n", + }, + "----------\n" + + "1. ERROR in X.java (at line 6)\n" + + " Zork z;\n" + + " ^^^^\n" + + "Zork cannot be resolved to a type\n" + + "----------\n" + + "2. ERROR in X.java (at line 7)\n" + + " unknown = 0;\n" + + " ^^^^^^^\n" + + "unknown cannot be resolved to a variable\n" + + "----------\n" + + "3. ERROR in X.java (at line 8)\n" + + " ; int a = 42 + ia;\n" + + " ^^^^^^^\n" + + "The operator + is undefined for the argument type(s) int, int[]\n" + + "----------\n" + + "4. ERROR in X.java (at line 12)\n" + + " I i = (int [] ia) -> this;\n" + + " ^^^^\n" + + "Cannot use this in a static context\n" + + "----------\n" + + "5. ERROR in X.java (at line 16)\n" + + " int b = 42 + array;\n" + + " ^^^^^^^^^^\n" + + "The operator + is undefined for the argument type(s) int, int[]\n" + + "----------\n" + + "6. ERROR in X.java (at line 18)\n" + + " return;\n" + + " ^^^^^^^\n" + + "This method must return a result of type Object\n" + + "----------\n" + + "7. ERROR in X.java (at line 20)\n" + + " Runnable r = () -> { return 42; };\n" + + " ^^^^^^^^^^\n" + + "Void methods cannot return a value\n" + + "----------\n" +); +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=384600, [1.8] 'this' should not be allowed in lambda expressions in contexts that don't allow it +public void test012() { + // This test checks that common semantic checks are indeed + this.runNegativeTest( + new String[] { + "X.java", + "interface I {\n" + + " void doit();\n" + + "}\n" + + "public class X {\n" + + " static void foo() {\n" + + " I i = () -> {\n" + + " System.out.println(this);\n" + + " I j = () -> {\n" + + " System.out.println(this);\n" + + " I k = () -> {\n" + + " System.out.println(this);\n" + + " };\n" + + " };\n" + + " };\n" + + " }\n" + + "}\n" , + }, + "----------\n" + + "1. ERROR in X.java (at line 7)\n" + + " System.out.println(this);\n" + + " ^^^^\n" + + "Cannot use this in a static context\n" + + "----------\n" + + "2. ERROR in X.java (at line 9)\n" + + " System.out.println(this);\n" + + " ^^^^\n" + + "Cannot use this in a static context\n" + + "----------\n" + + "3. ERROR in X.java (at line 11)\n" + + " System.out.println(this);\n" + + " ^^^^\n" + + "Cannot use this in a static context\n" + + "----------\n" + ); +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=384600, [1.8] 'this' should not be allowed in lambda expressions in contexts that don't allow it +public void test013() { + // This test checks that common semantic checks are indeed + this.runNegativeTest( + new String[] { + "X.java", + "interface I {\n" + + " void doit();\n" + + "}\n" + + "public class X {\n" + + " void foo(Zork z) {\n" + + " I i = () -> {\n" + + " System.out.println(this);\n" + + " I j = () -> {\n" + + " System.out.println(this);\n" + + " I k = () -> {\n" + + " System.out.println(this);\n" + + " };\n" + + " };\n" + + " };\n" + + " }\n" + + "}\n" , + }, + "----------\n" + + "1. ERROR in X.java (at line 5)\n" + + " void foo(Zork z) {\n" + + " ^^^^\n" + + "Zork cannot be resolved to a type\n" + + "----------\n" + ); +} public static Class testClass() { return NegativeLambdaExpressionsTest.class; } diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java index 283bac762..692f21e27 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2012 IBM Corporation and others. + * Copyright (c) 2011, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -1120,7 +1120,7 @@ public class NegativeTypeAnnotationTest extends AbstractRegressionTest { "5. ERROR in Outer.java (at line 6)\n" + " InnerMost(Outer.Inner this) {}\n" + " ^^^^\n" + - "The explicit 'this' parameter is expected to be qualified with Outer.Inner\n" + + "The explicit 'this' parameter is expected to be qualified with Inner\n" + "----------\n" + "6. WARNING in Outer.java (at line 7)\n" + " InnerMost(Outer.Inner Outer.Inner.this, int i, float f) {}\n" + @@ -1132,35 +1132,40 @@ public class NegativeTypeAnnotationTest extends AbstractRegressionTest { " ^^^^^^^^^^^\n" + "The declared type of the explicit 'this' parameter is expected to be Outer.Inner<K,V>\n" + "----------\n" + - "8. ERROR in Outer.java (at line 8)\n" + + "8. ERROR in Outer.java (at line 7)\n" + + " InnerMost(Outer.Inner Outer.Inner.this, int i, float f) {}\n" + + " ^^^^^^^^^^^^^^^^\n" + + "The explicit 'this' parameter is expected to be qualified with Inner\n" + + "----------\n" + + "9. ERROR in Outer.java (at line 8)\n" + " InnerMost(Outer Outer.this, float f) {}\n" + " ^^^^^\n" + "The declared type of the explicit 'this' parameter is expected to be Outer.Inner<K,V>\n" + "----------\n" + - "9. ERROR in Outer.java (at line 8)\n" + + "10. ERROR in Outer.java (at line 8)\n" + " InnerMost(Outer Outer.this, float f) {}\n" + - " ^^^^\n" + - "The explicit 'this' parameter is expected to be qualified with Outer.Inner\n" + + " ^^^^^^^^^^\n" + + "The explicit 'this' parameter is expected to be qualified with Inner\n" + "----------\n" + - "10. ERROR in Outer.java (at line 9)\n" + + "11. ERROR in Outer.java (at line 9)\n" + " InnerMost(Outer.Inner<K,V>.InnerMost<T> Outer.Inner.InnerMost.this, Object obj) {}\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "The declared type of the explicit 'this' parameter is expected to be Outer.Inner<K,V>\n" + "----------\n" + - "11. ERROR in Outer.java (at line 9)\n" + + "12. ERROR in Outer.java (at line 9)\n" + " InnerMost(Outer.Inner<K,V>.InnerMost<T> Outer.Inner.InnerMost.this, Object obj) {}\n" + - " ^^^^\n" + - "The explicit 'this' parameter is expected to be qualified with Outer.Inner\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "The explicit 'this' parameter is expected to be qualified with Inner\n" + "----------\n" + - "12. ERROR in Outer.java (at line 10)\n" + + "13. ERROR in Outer.java (at line 10)\n" + " InnerMost(Inner<K,V> Outer.Inner.InnerMost.this, int i) {}\n" + - " ^^^^\n" + - "The explicit 'this' parameter is expected to be qualified with Outer.Inner\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "The explicit 'this' parameter is expected to be qualified with Inner\n" + "----------\n" + - "13. ERROR in Outer.java (at line 11)\n" + + "14. ERROR in Outer.java (at line 11)\n" + " InnerMost(Outer.Inner<K, V> this, float f, int i) {}\n" + " ^^^^\n" + - "The explicit 'this' parameter is expected to be qualified with Outer.Inner\n" + + "The explicit 'this' parameter is expected to be qualified with Inner\n" + "----------\n"); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=383913 @@ -1190,8 +1195,8 @@ public class NegativeTypeAnnotationTest extends AbstractRegressionTest { "----------\n" + "2. ERROR in Outer.java (at line 4)\n" + " public void foo(Outer Outer.this) {}\n" + - " ^^^^\n" + - "The explicit 'this' parameter is expected to be qualified with Outer.Inner.InnerMost\n" + + " ^^^^^^^^^^\n" + + "The explicit 'this' parameter for a method cannot have a qualifying name\n" + "----------\n" + "3. ERROR in Outer.java (at line 5)\n" + " public void foo(Inner<K,V> Inner.this, int i) {}\n" + @@ -1200,8 +1205,8 @@ public class NegativeTypeAnnotationTest extends AbstractRegressionTest { "----------\n" + "4. ERROR in Outer.java (at line 5)\n" + " public void foo(Inner<K,V> Inner.this, int i) {}\n" + - " ^^^^\n" + - "The explicit 'this' parameter is expected to be qualified with Outer.Inner.InnerMost\n" + + " ^^^^^^^^^^\n" + + "The explicit 'this' parameter for a method cannot have a qualifying name\n" + "----------\n" + "5. WARNING in Outer.java (at line 6)\n" + " public void foo(InnerMost this, int i, int j) {}\n" + @@ -1222,6 +1227,11 @@ public class NegativeTypeAnnotationTest extends AbstractRegressionTest { " public void foo(Inner.InnerMost<T> this, Object obj) {}\n" + " ^^^^^^^^^^^^^^^\n" + "The declared type of the explicit 'this' parameter is expected to be Outer.Inner<K,V>.InnerMost<T>\n" + + "----------\n" + + "9. ERROR in Outer.java (at line 11)\n" + + " public void foo(InnerMost<T> Outer.Inner.InnerMost.this, int i, float f) {}\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "The explicit 'this' parameter for a method cannot have a qualifying name\n" + "----------\n"); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=383913 @@ -1523,7 +1533,7 @@ public class NegativeTypeAnnotationTest extends AbstractRegressionTest { "public class X {\n" + " class Y {\n" + " class Z {\n" + - " Z(X. @Marker Y X.Y.this) {\n" + + " Z(X. @Marker Y Y.this) {\n" + " }\n" + " }\n" + " }\n" + @@ -1531,7 +1541,7 @@ public class NegativeTypeAnnotationTest extends AbstractRegressionTest { }, "----------\n" + "1. ERROR in X.java (at line 4)\n" + - " Z(X. @Marker Y X.Y.this) {\n" + + " Z(X. @Marker Y Y.this) {\n" + " ^^^^^^\n" + "Marker cannot be resolved to a type\n" + "----------\n"); @@ -3107,4 +3117,40 @@ public class NegativeTypeAnnotationTest extends AbstractRegressionTest { "The annotation @Marker2 is disallowed for this location\n" + "----------\n"); } + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=399453 + public void testBug399453() { + this.runNegativeTest( + new String[]{ + "X.java", + "import java.lang.annotation.Target;\n" + + "import static java.lang.annotation.ElementType.*;\n" + + "public class X {\n" + + " public void foo() {\n" + + " int @Marker [][][] i = new @Marker2 int @Marker @Marker2 [2] @Marker @Marker2 [@Marker bar()] @Marker @Marker2 [];\n" + + " int @Marker [][][] j = new @Marker2 int @Marker @Marker2 [2] @Marker @Marker2 [@Marker X.bar2(2)] @Marker @Marker2 [];\n" + + " }\n" + + " public int bar() {\n" + + " return 2;\n" + + " }\n" + + " public static int bar2(int k) {\n" + + " return k;\n" + + " }\n" + + "}\n" + + "@Target (java.lang.annotation.ElementType.TYPE_USE)\n" + + "@interface Marker {}\n" + + "@Target (java.lang.annotation.ElementType.TYPE_USE)\n" + + "@interface Marker2 {}\n" + }, + "----------\n" + + "1. ERROR in X.java (at line 5)\n" + + " int @Marker [][][] i = new @Marker2 int @Marker @Marker2 [2] @Marker @Marker2 [@Marker bar()] @Marker @Marker2 [];\n" + + " ^^^^^^^\n" + + "Syntax error, type annotations are illegal here\n" + + "----------\n" + + "2. ERROR in X.java (at line 6)\n" + + " int @Marker [][][] j = new @Marker2 int @Marker @Marker2 [2] @Marker @Marker2 [@Marker X.bar2(2)] @Marker @Marker2 [];\n" + + " ^^^^^^^\n" + + "Syntax error, type annotations are illegal here\n" + + "----------\n"); + } }
\ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java index 4e0489061..188347fe2 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2012 IBM Corporation and others. + * Copyright (c) 2006, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java index e2752d067..347bbe60e 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java @@ -1,10 +1,14 @@ /******************************************************************************* - * Copyright (c) 2005, 2012 IBM Corporation and others. + * Copyright (c) 2005, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -2478,6 +2482,7 @@ public class VarargsTest extends AbstractComparableTest { " public void remove() {\n" + " throw new UnsupportedOperationException();\n" + " }\n" + + ITERATOR_IMPL_JRE8.replaceAll("\\*", "T") + " }\n" + " public static void main(String[] args) {\n" + " new IteratorChain<Number>(null, null);\n" + @@ -2486,7 +2491,7 @@ public class VarargsTest extends AbstractComparableTest { }, this.complianceLevel < ClassFileConstants.JDK1_7 ? "----------\n" + - "1. WARNING in X.java (at line 18)\n" + + "1. WARNING in X.java (at line 19)\n" + " new IteratorChain<Number>(null, null);\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Type safety: A generic array of Collection<? extends Number> is created for a varargs parameter\n" + @@ -2497,7 +2502,7 @@ public class VarargsTest extends AbstractComparableTest { " ^^^^^^^^^^^\n" + "Type safety: Potential heap pollution via varargs parameter collections\n" + "----------\n" + - "2. WARNING in X.java (at line 18)\n" + + "2. WARNING in X.java (at line 19)\n" + " new IteratorChain<Number>(null, null);\n" + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + "Type safety: A generic array of Collection<? extends Number> is created for a varargs parameter\n" + |