Tue, 09 Nov 2010 22:54:48 -0800
Merge
1.1 --- a/src/share/classes/com/sun/source/tree/AnnotatedTypeTree.java Thu Nov 04 15:54:46 2010 -0700 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,47 +0,0 @@ 1.4 -/* 1.5 - * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. 1.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 - * 1.8 - * This code is free software; you can redistribute it and/or modify it 1.9 - * under the terms of the GNU General Public License version 2 only, as 1.10 - * published by the Free Software Foundation. Oracle designates this 1.11 - * particular file as subject to the "Classpath" exception as provided 1.12 - * by Oracle in the LICENSE file that accompanied this code. 1.13 - * 1.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 - * version 2 for more details (a copy is included in the LICENSE file that 1.18 - * accompanied this code). 1.19 - * 1.20 - * You should have received a copy of the GNU General Public License version 1.21 - * 2 along with this work; if not, write to the Free Software Foundation, 1.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 - * 1.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 - * or visit www.oracle.com if you need additional information or have any 1.26 - * questions. 1.27 - */ 1.28 - 1.29 -package com.sun.source.tree; 1.30 - 1.31 -import java.util.List; 1.32 - 1.33 -/** 1.34 - * A tree node for an annotated type 1.35 - * 1.36 - * For example: 1.37 - * <pre> 1.38 - * {@code @}<em>annotationType String</em> 1.39 - * {@code @}<em>annotationType</em> ( <em>arguments</em> ) <em>Date</em> 1.40 - * </pre> 1.41 - * 1.42 - * @see "JSR 308: Annotations on Java Types" 1.43 - * 1.44 - * @author Mahmood Ali 1.45 - * @since 1.7 1.46 - */ 1.47 -public interface AnnotatedTypeTree extends ExpressionTree { 1.48 - List<? extends AnnotationTree> getAnnotations(); 1.49 - ExpressionTree getUnderlyingType(); 1.50 -}
2.1 --- a/src/share/classes/com/sun/source/tree/DisjointTypeTree.java Thu Nov 04 15:54:46 2010 -0700 2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 2.3 @@ -1,40 +0,0 @@ 2.4 -/* 2.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 2.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.7 - * 2.8 - * This code is free software; you can redistribute it and/or modify it 2.9 - * under the terms of the GNU General Public License version 2 only, as 2.10 - * published by the Free Software Foundation. Oracle designates this 2.11 - * particular file as subject to the "Classpath" exception as provided 2.12 - * by Oracle in the LICENSE file that accompanied this code. 2.13 - * 2.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 2.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 2.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 2.17 - * version 2 for more details (a copy is included in the LICENSE file that 2.18 - * accompanied this code). 2.19 - * 2.20 - * You should have received a copy of the GNU General Public License version 2.21 - * 2 along with this work; if not, write to the Free Software Foundation, 2.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2.23 - * 2.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2.25 - * or visit www.oracle.com if you need additional information or have any 2.26 - * questions. 2.27 - */ 2.28 - 2.29 -package com.sun.source.tree; 2.30 - 2.31 -import java.util.List; 2.32 - 2.33 -/** 2.34 - * A tree node for a disjoint type expression in a multicatch var declaration. 2.35 - * 2.36 - * 2.37 - * @author Maurizio Cimadamore 2.38 - * 2.39 - * @since 1.7 2.40 - */ 2.41 -public interface DisjointTypeTree extends Tree { 2.42 - List<? extends Tree> getTypeComponents(); 2.43 -}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/src/share/classes/com/sun/source/tree/DisjunctiveTypeTree.java Tue Nov 09 22:54:48 2010 -0800 3.3 @@ -0,0 +1,40 @@ 3.4 +/* 3.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.7 + * 3.8 + * This code is free software; you can redistribute it and/or modify it 3.9 + * under the terms of the GNU General Public License version 2 only, as 3.10 + * published by the Free Software Foundation. Oracle designates this 3.11 + * particular file as subject to the "Classpath" exception as provided 3.12 + * by Oracle in the LICENSE file that accompanied this code. 3.13 + * 3.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 3.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 3.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3.17 + * version 2 for more details (a copy is included in the LICENSE file that 3.18 + * accompanied this code). 3.19 + * 3.20 + * You should have received a copy of the GNU General Public License version 3.21 + * 2 along with this work; if not, write to the Free Software Foundation, 3.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3.23 + * 3.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 3.25 + * or visit www.oracle.com if you need additional information or have any 3.26 + * questions. 3.27 + */ 3.28 + 3.29 +package com.sun.source.tree; 3.30 + 3.31 +import java.util.List; 3.32 + 3.33 +/** 3.34 + * A tree node for a disjunctive type expression in a multicatch var declaration. 3.35 + * 3.36 + * 3.37 + * @author Maurizio Cimadamore 3.38 + * 3.39 + * @since 1.7 3.40 + */ 3.41 +public interface DisjunctiveTypeTree extends Tree { 3.42 + List<? extends Tree> getTypeAlternatives(); 3.43 +}
4.1 --- a/src/share/classes/com/sun/source/tree/MethodTree.java Thu Nov 04 15:54:46 2010 -0700 4.2 +++ b/src/share/classes/com/sun/source/tree/MethodTree.java Tue Nov 09 22:54:48 2010 -0800 4.3 @@ -53,7 +53,7 @@ 4.4 Tree getReturnType(); 4.5 List<? extends TypeParameterTree> getTypeParameters(); 4.6 List<? extends VariableTree> getParameters(); 4.7 - List<? extends AnnotationTree> getReceiverAnnotations(); 4.8 +//308 List<? extends AnnotationTree> getReceiverAnnotations(); 4.9 List<? extends ExpressionTree> getThrows(); 4.10 BlockTree getBody(); 4.11 Tree getDefaultValue(); // for annotation types
5.1 --- a/src/share/classes/com/sun/source/tree/Tree.java Thu Nov 04 15:54:46 2010 -0700 5.2 +++ b/src/share/classes/com/sun/source/tree/Tree.java Tue Nov 09 22:54:48 2010 -0800 5.3 @@ -46,7 +46,7 @@ 5.4 */ 5.5 public enum Kind { 5.6 5.7 - ANNOTATED_TYPE(AnnotatedTypeTree.class), 5.8 +//308 ANNOTATED_TYPE(AnnotatedTypeTree.class), 5.9 5.10 /** 5.11 * Used for instances of {@link AnnotationTree}. 5.12 @@ -234,9 +234,9 @@ 5.13 PARAMETERIZED_TYPE(ParameterizedTypeTree.class), 5.14 5.15 /** 5.16 - * Used for instances of {@link DisjointTypeTree}. 5.17 + * Used for instances of {@link DisjunctiveTypeTree}. 5.18 */ 5.19 - DISJOINT_TYPE(DisjointTypeTree.class), 5.20 + DISJUNCTIVE_TYPE(DisjunctiveTypeTree.class), 5.21 5.22 /** 5.23 * Used for instances of {@link TypeCastTree}.
6.1 --- a/src/share/classes/com/sun/source/tree/TreeVisitor.java Thu Nov 04 15:54:46 2010 -0700 6.2 +++ b/src/share/classes/com/sun/source/tree/TreeVisitor.java Tue Nov 09 22:54:48 2010 -0800 6.3 @@ -57,7 +57,7 @@ 6.4 * @since 1.6 6.5 */ 6.6 public interface TreeVisitor<R,P> { 6.7 - R visitAnnotatedType(AnnotatedTypeTree node, P p); 6.8 +//308 R visitAnnotatedType(AnnotatedTypeTree node, P p); 6.9 R visitAnnotation(AnnotationTree node, P p); 6.10 R visitMethodInvocation(MethodInvocationTree node, P p); 6.11 R visitAssert(AssertTree node, P p); 6.12 @@ -96,7 +96,7 @@ 6.13 R visitCompilationUnit(CompilationUnitTree node, P p); 6.14 R visitTry(TryTree node, P p); 6.15 R visitParameterizedType(ParameterizedTypeTree node, P p); 6.16 - R visitDisjointType(DisjointTypeTree node, P p); 6.17 + R visitDisjunctiveType(DisjunctiveTypeTree node, P p); 6.18 R visitArrayType(ArrayTypeTree node, P p); 6.19 R visitTypeCast(TypeCastTree node, P p); 6.20 R visitPrimitiveType(PrimitiveTypeTree node, P p);
7.1 --- a/src/share/classes/com/sun/source/tree/TypeParameterTree.java Thu Nov 04 15:54:46 2010 -0700 7.2 +++ b/src/share/classes/com/sun/source/tree/TypeParameterTree.java Tue Nov 09 22:54:48 2010 -0800 7.3 @@ -47,5 +47,5 @@ 7.4 public interface TypeParameterTree extends Tree { 7.5 Name getName(); 7.6 List<? extends Tree> getBounds(); 7.7 - List<? extends AnnotationTree> getAnnotations(); 7.8 +//308 List<? extends AnnotationTree> getAnnotations(); 7.9 }
8.1 --- a/src/share/classes/com/sun/source/util/AbstractTypeProcessor.java Thu Nov 04 15:54:46 2010 -0700 8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 8.3 @@ -1,245 +0,0 @@ 8.4 -/* 8.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 8.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.7 - * 8.8 - * This code is free software; you can redistribute it and/or modify it 8.9 - * under the terms of the GNU General Public License version 2 only, as 8.10 - * published by the Free Software Foundation. Oracle designates this 8.11 - * particular file as subject to the "Classpath" exception as provided 8.12 - * by Oracle in the LICENSE file that accompanied this code. 8.13 - * 8.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 8.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 8.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 8.17 - * version 2 for more details (a copy is included in the LICENSE file that 8.18 - * accompanied this code). 8.19 - * 8.20 - * You should have received a copy of the GNU General Public License version 8.21 - * 2 along with this work; if not, write to the Free Software Foundation, 8.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 8.23 - * 8.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 8.25 - * or visit www.oracle.com if you need additional information or have any 8.26 - * questions. 8.27 - */ 8.28 - 8.29 -package com.sun.source.util; 8.30 - 8.31 -import java.util.ArrayList; 8.32 -import java.util.HashSet; 8.33 -import java.util.List; 8.34 -import java.util.Set; 8.35 - 8.36 -import javax.annotation.processing.*; 8.37 -import javax.lang.model.element.Name; 8.38 -import javax.lang.model.element.TypeElement; 8.39 -import javax.lang.model.util.ElementFilter; 8.40 - 8.41 -import com.sun.tools.javac.processing.JavacProcessingEnvironment; 8.42 -import com.sun.tools.javac.util.Context; 8.43 -import com.sun.tools.javac.util.Log; 8.44 - 8.45 -import com.sun.source.tree.ClassTree; 8.46 - 8.47 -/** 8.48 - * This class is an abstract annotation processor designed to be a 8.49 - * convenient superclass for concrete "type processors", processors that 8.50 - * require the type information in the processed source. 8.51 - * 8.52 - * <p>Type processing occurs in one round after the tool (e.g. java compiler) 8.53 - * analyzes the source (all sources taken as input to the tool and sources 8.54 - * generated by other annotation processors). 8.55 - * 8.56 - * <p>The tool infrastructure will interact with classes extending this abstract 8.57 - * class as follows: 8.58 - * 8.59 - * <ol> 8.60 - * [1-3: Identical to {@link Processor} life cycle] 8.61 - * 8.62 - * <li>If an existing {@code Processor} object is not being used, to 8.63 - * create an instance of a processor the tool calls the no-arg 8.64 - * constructor of the processor class. 8.65 - * 8.66 - * <li>Next, the tool calls the {@link #init init} method with 8.67 - * an appropriate {@code ProcessingEnvironment}. 8.68 - * 8.69 - * <li>Afterwards, the tool calls {@link #getSupportedAnnotationTypes 8.70 - * getSupportedAnnotationTypes}, {@link #getSupportedOptions 8.71 - * getSupportedOptions}, and {@link #getSupportedSourceVersion 8.72 - * getSupportedSourceVersion}. These methods are only called once per 8.73 - * run, not on each round. 8.74 - * 8.75 - * [4-5Unique to {@code AbstractTypeProcessor} subclasses] 8.76 - * 8.77 - * <li>For each class containing a supported annotation, the tool calls 8.78 - * {@link #typeProcess(TypeElement, TreePath) typeProcess} method on the 8.79 - * {@code Processor}. The class is guaranteed to be type-checked Java code 8.80 - * and all the tree type and symbol information is resolved. 8.81 - * 8.82 - * <li>Finally, the tools calls the 8.83 - * {@link #typeProcessingOver() typeProcessingOver} method 8.84 - * on the {@code Processor}. 8.85 - * 8.86 - * </ol> 8.87 - * 8.88 - * <p>The tool is permitted to ask type processors to process a class once 8.89 - * it is analyzed before the rest of classes are analyzed. The tool is also 8.90 - * permitted to stop type processing immediately if any errors are raised, 8.91 - * without invoking {@code typeProcessingOver} 8.92 - * 8.93 - * <p>A subclass may override any of the methods in this class, as long as the 8.94 - * general {@link javax.annotation.processing.Processor Processor} 8.95 - * contract is obeyed, with one notable exception. 8.96 - * {@link #process(Set, RoundEnvironment)} may not be overridden, as it 8.97 - * is called during the regular annotation phase before classes are analyzed. 8.98 - * 8.99 - * @author Mahmood Ali 8.100 - * @since 1.7 8.101 - */ 8.102 -public abstract class AbstractTypeProcessor extends AbstractProcessor { 8.103 - private final Set<Name> elements = new HashSet<Name>(); 8.104 - private boolean hasInvokedTypeProcessingOver = false; 8.105 - private JavacProcessingEnvironment env; 8.106 - private final AttributionTaskListener listener = new AttributionTaskListener(); 8.107 - 8.108 - /** 8.109 - * Constructor for subclasses to call. 8.110 - */ 8.111 - protected AbstractTypeProcessor() { } 8.112 - 8.113 - /** 8.114 - * {@inheritDoc} 8.115 - */ 8.116 - @Override 8.117 - public void init(ProcessingEnvironment env) { 8.118 - super.init(env); 8.119 - this.env = (JavacProcessingEnvironment)env; 8.120 - prepareContext(this.env.getContext()); 8.121 - } 8.122 - 8.123 - /** 8.124 - * The use of this method is obsolete in type processors. The method is 8.125 - * called during regular annotation processing phase only. 8.126 - */ 8.127 - @Override 8.128 - public final boolean process(Set<? extends TypeElement> annotations, 8.129 - RoundEnvironment roundEnv) { 8.130 - for (TypeElement elem : ElementFilter.typesIn(roundEnv.getRootElements())) { 8.131 - elements.add(elem.getQualifiedName()); 8.132 - } 8.133 - return false; 8.134 - } 8.135 - 8.136 - /** 8.137 - * Processes a fully analyzed class that contains a supported annotation 8.138 - * (look {@link #getSupportedAnnotationTypes()}). 8.139 - * 8.140 - * <p>The passed class is always a valid type-checked Java code. 8.141 - * 8.142 - * @param element element of the analyzed class 8.143 - * @param tree the tree path to the element, with the leaf being a 8.144 - * {@link ClassTree} 8.145 - */ 8.146 - public abstract void typeProcess(TypeElement element, TreePath tree); 8.147 - 8.148 - /** 8.149 - * A method to be called once all the classes are processed and no error 8.150 - * is reported. 8.151 - * 8.152 - * <p>Subclasses may override this method to do any aggregate analysis 8.153 - * (e.g. generate report, persistence) or resource deallocation. 8.154 - * 8.155 - * <p>If an error (a Java error or a processor error) is reported, this 8.156 - * method is not guaranteed to be invoked. 8.157 - */ 8.158 - public void typeProcessingOver() { } 8.159 - 8.160 - /** 8.161 - * adds a listener for attribution. 8.162 - */ 8.163 - private void prepareContext(Context context) { 8.164 - TaskListener otherListener = context.get(TaskListener.class); 8.165 - if (otherListener == null) { 8.166 - context.put(TaskListener.class, listener); 8.167 - } else { 8.168 - // handle cases of multiple listeners 8.169 - context.put(TaskListener.class, (TaskListener)null); 8.170 - TaskListeners listeners = new TaskListeners(); 8.171 - listeners.add(otherListener); 8.172 - listeners.add(listener); 8.173 - context.put(TaskListener.class, listeners); 8.174 - } 8.175 - } 8.176 - 8.177 - /** 8.178 - * A task listener that invokes the processor whenever a class is fully 8.179 - * analyzed. 8.180 - */ 8.181 - private final class AttributionTaskListener implements TaskListener { 8.182 - 8.183 - @Override 8.184 - public void finished(TaskEvent e) { 8.185 - Log log = Log.instance(env.getContext()); 8.186 - 8.187 - if (!hasInvokedTypeProcessingOver && elements.isEmpty() && log.nerrors == 0) { 8.188 - typeProcessingOver(); 8.189 - hasInvokedTypeProcessingOver = true; 8.190 - } 8.191 - 8.192 - if (e.getKind() != TaskEvent.Kind.ANALYZE) 8.193 - return; 8.194 - 8.195 - if (e.getTypeElement() == null) 8.196 - throw new AssertionError("event task without a type element"); 8.197 - if (e.getCompilationUnit() == null) 8.198 - throw new AssertionError("even task without compilation unit"); 8.199 - 8.200 - if (!elements.remove(e.getTypeElement().getQualifiedName())) 8.201 - return; 8.202 - 8.203 - if (log.nerrors != 0) 8.204 - return; 8.205 - 8.206 - TypeElement elem = e.getTypeElement(); 8.207 - TreePath p = Trees.instance(env).getPath(elem); 8.208 - 8.209 - typeProcess(elem, p); 8.210 - 8.211 - if (!hasInvokedTypeProcessingOver && elements.isEmpty() && log.nerrors == 0) { 8.212 - typeProcessingOver(); 8.213 - hasInvokedTypeProcessingOver = true; 8.214 - } 8.215 - } 8.216 - 8.217 - @Override 8.218 - public void started(TaskEvent e) { } 8.219 - 8.220 - } 8.221 - 8.222 - /** 8.223 - * A task listener multiplexer. 8.224 - */ 8.225 - private static class TaskListeners implements TaskListener { 8.226 - private final List<TaskListener> listeners = new ArrayList<TaskListener>(); 8.227 - 8.228 - public void add(TaskListener listener) { 8.229 - listeners.add(listener); 8.230 - } 8.231 - 8.232 - public void remove(TaskListener listener) { 8.233 - listeners.remove(listener); 8.234 - } 8.235 - 8.236 - @Override 8.237 - public void finished(TaskEvent e) { 8.238 - for (TaskListener listener : listeners) 8.239 - listener.finished(e); 8.240 - } 8.241 - 8.242 - @Override 8.243 - public void started(TaskEvent e) { 8.244 - for (TaskListener listener : listeners) 8.245 - listener.started(e); 8.246 - } 8.247 - } 8.248 -}
9.1 --- a/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java Thu Nov 04 15:54:46 2010 -0700 9.2 +++ b/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java Tue Nov 09 22:54:48 2010 -0800 9.3 @@ -228,7 +228,7 @@ 9.4 return defaultAction(node, p); 9.5 } 9.6 9.7 - public R visitDisjointType(DisjointTypeTree node, P p) { 9.8 + public R visitDisjunctiveType(DisjunctiveTypeTree node, P p) { 9.9 return defaultAction(node, p); 9.10 } 9.11 9.12 @@ -248,9 +248,9 @@ 9.13 return defaultAction(node, p); 9.14 } 9.15 9.16 - public R visitAnnotatedType(AnnotatedTypeTree node, P p) { 9.17 - return defaultAction(node, p); 9.18 - } 9.19 +//308 public R visitAnnotatedType(AnnotatedTypeTree node, P p) { 9.20 +//308 return defaultAction(node, p); 9.21 +//308 } 9.22 9.23 public R visitErroneous(ErroneousTree node, P p) { 9.24 return defaultAction(node, p);
10.1 --- a/src/share/classes/com/sun/source/util/TreeScanner.java Thu Nov 04 15:54:46 2010 -0700 10.2 +++ b/src/share/classes/com/sun/source/util/TreeScanner.java Tue Nov 09 22:54:48 2010 -0800 10.3 @@ -138,7 +138,7 @@ 10.4 r = scanAndReduce(node.getReturnType(), p, r); 10.5 r = scanAndReduce(node.getTypeParameters(), p, r); 10.6 r = scanAndReduce(node.getParameters(), p, r); 10.7 - r = scanAndReduce(node.getReceiverAnnotations(), p, r); 10.8 +//308 r = scanAndReduce(node.getReceiverAnnotations(), p, r); 10.9 r = scanAndReduce(node.getThrows(), p, r); 10.10 r = scanAndReduce(node.getBody(), p, r); 10.11 r = scanAndReduce(node.getDefaultValue(), p, r); 10.12 @@ -356,13 +356,13 @@ 10.13 return r; 10.14 } 10.15 10.16 - public R visitDisjointType(DisjointTypeTree node, P p) { 10.17 - return scan(node.getTypeComponents(), p); 10.18 + public R visitDisjunctiveType(DisjunctiveTypeTree node, P p) { 10.19 + return scan(node.getTypeAlternatives(), p); 10.20 } 10.21 10.22 public R visitTypeParameter(TypeParameterTree node, P p) { 10.23 - R r = scan(node.getAnnotations(), p); 10.24 - r = scanAndReduce(node.getBounds(), p, r); 10.25 + R r = scan(node.getBounds(), p); 10.26 +//308 R r = scanAndReduce(node.getAnnotations(), p, r); 10.27 return r; 10.28 } 10.29 10.30 @@ -380,11 +380,11 @@ 10.31 return r; 10.32 } 10.33 10.34 - public R visitAnnotatedType(AnnotatedTypeTree node, P p) { 10.35 - R r = scan(node.getAnnotations(), p); 10.36 - r = scanAndReduce(node.getUnderlyingType(), p, r); 10.37 - return r; 10.38 - } 10.39 +//308 public R visitAnnotatedType(AnnotatedTypeTree node, P p) { 10.40 +//308 R r = scan(node.getAnnotations(), p); 10.41 +//308 r = scanAndReduce(node.getUnderlyingType(), p, r); 10.42 +//308 return r; 10.43 +//308 } 10.44 10.45 public R visitOther(Tree node, P p) { 10.46 return null;
11.1 --- a/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Thu Nov 04 15:54:46 2010 -0700 11.2 +++ b/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Tue Nov 09 22:54:48 2010 -0800 11.3 @@ -282,9 +282,10 @@ 11.4 // System.err.println("COMP: " + ((JCCompilationUnit)tree).sourcefile); 11.5 env = enter.getTopLevelEnv((JCCompilationUnit)tree); 11.6 break; 11.7 + case ANNOTATION_TYPE: 11.8 case CLASS: 11.9 + case ENUM: 11.10 case INTERFACE: 11.11 - case ENUM: 11.12 // System.err.println("CLASS: " + ((JCClassDecl)tree).sym.getSimpleName()); 11.13 env = enter.getClassEnv(((JCClassDecl)tree).sym); 11.14 break;
12.1 --- a/src/share/classes/com/sun/tools/javac/code/Flags.java Thu Nov 04 15:54:46 2010 -0700 12.2 +++ b/src/share/classes/com/sun/tools/javac/code/Flags.java Tue Nov 09 22:54:48 2010 -0800 12.3 @@ -231,9 +231,9 @@ 12.4 public static final long PROPRIETARY = 1L<<38; 12.5 12.6 /** 12.7 - * Flag that marks a disjoint var in a multi-catch clause 12.8 + * Flag that marks a disjunction var in a multi-catch clause 12.9 */ 12.10 - public static final long DISJOINT = 1L<<39; 12.11 + public static final long DISJUNCTION = 1L<<39; 12.12 12.13 /** 12.14 * Flag that marks a signature-polymorphic invoke method.
13.1 --- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Thu Nov 04 15:54:46 2010 -0700 13.2 +++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Tue Nov 09 22:54:48 2010 -0800 13.3 @@ -55,8 +55,8 @@ 13.4 } 13.5 13.6 public void taFillAndLift(JCClassDecl tree, boolean visitBodies) { 13.7 - new TypeAnnotationPositions().scan(tree); 13.8 - new TypeAnnotationLift().scan(tree); 13.9 +//308 new TypeAnnotationPositions().scan(tree); 13.10 +//308 new TypeAnnotationLift().scan(tree); 13.11 } 13.12 13.13 private static class TypeAnnotationPositions extends TreeScanner { 13.14 @@ -113,9 +113,10 @@ 13.15 p.pos = frame.pos; 13.16 return p; 13.17 13.18 + case ANNOTATION_TYPE: 13.19 case CLASS: 13.20 + case ENUM: 13.21 case INTERFACE: 13.22 - case ENUM: 13.23 p.pos = frame.pos; 13.24 if (((JCClassDecl)frame).extending == tree) { 13.25 p.type = TargetType.CLASS_EXTENDS; 13.26 @@ -208,11 +209,11 @@ 13.27 } 13.28 return p; 13.29 13.30 - case ANNOTATED_TYPE: { 13.31 - List<JCTree> newPath = path.tail; 13.32 - return resolveFrame(newPath.head, newPath.tail.head, 13.33 - newPath, p); 13.34 - } 13.35 +//308 case ANNOTATED_TYPE: { 13.36 +//308 List<JCTree> newPath = path.tail; 13.37 +//308 return resolveFrame(newPath.head, newPath.tail.head, 13.38 +//308 newPath, p); 13.39 +//308 } 13.40 13.41 case METHOD_INVOCATION: { 13.42 JCMethodInvocation invocation = (JCMethodInvocation)frame;
14.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Nov 04 15:54:46 2010 -0700 14.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Tue Nov 09 22:54:48 2010 -0800 14.3 @@ -121,6 +121,8 @@ 14.4 sourceName = source.name; 14.5 relax = (options.isSet("-retrofit") || 14.6 options.isSet("-relax")); 14.7 + findDiamonds = options.get("findDiamond") != null && 14.8 + source.allowDiamond(); 14.9 useBeforeDeclarationWarning = options.isSet("useBeforeDeclarationWarning"); 14.10 enableSunApiLintControl = options.isSet("enableSunApiLintControl"); 14.11 } 14.12 @@ -154,6 +156,16 @@ 14.13 */ 14.14 boolean allowAnonOuterThis; 14.15 14.16 + /** Switch: generates a warning if diamond can be safely applied 14.17 + * to a given new expression 14.18 + */ 14.19 + boolean findDiamonds; 14.20 + 14.21 + /** 14.22 + * Internally enables/disables diamond finder feature 14.23 + */ 14.24 + static final boolean allowDiamondFinder = true; 14.25 + 14.26 /** 14.27 * Switch: warn about use of variable before declaration? 14.28 * RFE: 6425594 14.29 @@ -1053,9 +1065,9 @@ 14.30 if ((c.param.sym.flags() & FINAL) == 0) { 14.31 log.error(c.param.pos(), "multicatch.param.must.be.final", c.param.sym); 14.32 } 14.33 - c.param.sym.flags_field = c.param.sym.flags() | DISJOINT; 14.34 + c.param.sym.flags_field = c.param.sym.flags() | DISJUNCTION; 14.35 } 14.36 - if (c.param.type.tsym.kind == Kinds.VAR) { 14.37 + if (c.param.sym.kind == Kinds.VAR) { 14.38 c.param.sym.setData(ElementKind.EXCEPTION_PARAMETER); 14.39 } 14.40 chk.checkType(c.param.vartype.pos(), 14.41 @@ -1572,6 +1584,24 @@ 14.42 if (TreeInfo.isDiamond(tree)) { 14.43 clazztype = attribDiamond(localEnv, tree, clazztype, mapping, argtypes, typeargtypes); 14.44 clazz.type = clazztype; 14.45 + } else if (allowDiamondFinder && 14.46 + clazztype.getTypeArguments().nonEmpty() && 14.47 + findDiamonds) { 14.48 + Type inferred = attribDiamond(localEnv, 14.49 + tree, 14.50 + clazztype, 14.51 + mapping, 14.52 + argtypes, 14.53 + typeargtypes); 14.54 + if (!inferred.isErroneous() && 14.55 + inferred.tag == CLASS && 14.56 + types.isAssignable(inferred, pt.tag == NONE ? clazztype : pt, Warner.noWarnings) && 14.57 + chk.checkDiamond((ClassType)inferred).isEmpty()) { 14.58 + String key = types.isSameType(clazztype, inferred) ? 14.59 + "diamond.redundant.args" : 14.60 + "diamond.redundant.args.1"; 14.61 + log.warning(tree.clazz.pos(), key, clazztype, inferred); 14.62 + } 14.63 } 14.64 14.65 // If we have made no mistakes in the class type... 14.66 @@ -2839,9 +2869,9 @@ 14.67 result = check(tree, owntype, TYP, pkind, pt); 14.68 } 14.69 14.70 - public void visitTypeDisjoint(JCTypeDisjoint tree) { 14.71 - List<Type> componentTypes = attribTypes(tree.components, env); 14.72 - tree.type = result = check(tree, types.lub(componentTypes), TYP, pkind, pt); 14.73 + public void visitTypeDisjunction(JCTypeDisjunction tree) { 14.74 + List<Type> alternatives = attribTypes(tree.alternatives, env); 14.75 + tree.type = result = check(tree, types.lub(alternatives), TYP, pkind, pt); 14.76 } 14.77 14.78 public void visitTypeParameter(JCTypeParameter tree) {
15.1 --- a/src/share/classes/com/sun/tools/javac/comp/Flow.java Thu Nov 04 15:54:46 2010 -0700 15.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java Tue Nov 09 22:54:48 2010 -0800 15.3 @@ -371,7 +371,7 @@ 15.4 if (sym.adr >= firstadr && trackable(sym)) { 15.5 if ((sym.flags() & FINAL) != 0) { 15.6 if ((sym.flags() & PARAMETER) != 0) { 15.7 - if ((sym.flags() & DISJOINT) != 0) { //multi-catch parameter 15.8 + if ((sym.flags() & DISJUNCTION) != 0) { //multi-catch parameter 15.9 log.error(pos, "multicatch.parameter.may.not.be.assigned", 15.10 sym); 15.11 } 15.12 @@ -983,7 +983,7 @@ 15.13 thrown = List.nil(); 15.14 for (List<JCCatch> l = tree.catchers; l.nonEmpty(); l = l.tail) { 15.15 List<JCExpression> subClauses = TreeInfo.isMultiCatch(l.head) ? 15.16 - ((JCTypeDisjoint)l.head.param.vartype).components : 15.17 + ((JCTypeDisjunction)l.head.param.vartype).alternatives : 15.18 List.of(l.head.param.vartype); 15.19 for (JCExpression ct : subClauses) { 15.20 caught = chk.incl(ct.type, caught); 15.21 @@ -1049,7 +1049,7 @@ 15.22 alive = true; 15.23 JCVariableDecl param = l.head.param; 15.24 List<JCExpression> subClauses = TreeInfo.isMultiCatch(l.head) ? 15.25 - ((JCTypeDisjoint)l.head.param.vartype).components : 15.26 + ((JCTypeDisjunction)l.head.param.vartype).alternatives : 15.27 List.of(l.head.param.vartype); 15.28 List<Type> ctypes = List.nil(); 15.29 List<Type> rethrownTypes = chk.diff(thrownInTry, caughtInTry);
16.1 --- a/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Thu Nov 04 15:54:46 2010 -0700 16.2 +++ b/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Tue Nov 09 22:54:48 2010 -0800 16.3 @@ -876,7 +876,8 @@ 16.4 make.at(tree.pos); 16.5 if (addBridges) { 16.6 ListBuffer<JCTree> bridges = new ListBuffer<JCTree>(); 16.7 - bridges.appendList(addOverrideBridgesIfNeeded(tree, c)); 16.8 + if (false) //see CR: 6996415 16.9 + bridges.appendList(addOverrideBridgesIfNeeded(tree, c)); 16.10 if ((tree.sym.flags() & INTERFACE) == 0) 16.11 addBridges(tree.pos(), tree.sym, bridges); 16.12 tree.defs = bridges.toList().prependList(tree.defs);
17.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Nov 04 15:54:46 2010 -0700 17.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java Tue Nov 09 22:54:48 2010 -0800 17.3 @@ -1456,7 +1456,7 @@ 17.4 List<Integer> gaps) { 17.5 if (startpc != endpc) { 17.6 List<JCExpression> subClauses = TreeInfo.isMultiCatch(tree) ? 17.7 - ((JCTypeDisjoint)tree.param.vartype).components : 17.8 + ((JCTypeDisjunction)tree.param.vartype).alternatives : 17.9 List.of(tree.param.vartype); 17.10 while (gaps.nonEmpty()) { 17.11 for (JCExpression subCatch : subClauses) {
18.1 --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Thu Nov 04 15:54:46 2010 -0700 18.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Tue Nov 09 22:54:48 2010 -0800 18.3 @@ -1090,7 +1090,7 @@ 18.4 18.5 private boolean unrecoverableError() { 18.6 for (JCDiagnostic d: log.deferredDiagnostics) { 18.7 - if (d.getKind() == JCDiagnostic.Kind.ERROR && !d.isFlagSet(RESOLVE_ERROR)) 18.8 + if (d.getKind() == JCDiagnostic.Kind.ERROR && !d.isFlagSet(RECOVERABLE)) 18.9 return true; 18.10 } 18.11 return false;
19.1 --- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Thu Nov 04 15:54:46 2010 -0700 19.2 +++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Tue Nov 09 22:54:48 2010 -0800 19.3 @@ -30,6 +30,7 @@ 19.4 import com.sun.tools.javac.tree.*; 19.5 import com.sun.tools.javac.code.*; 19.6 import com.sun.tools.javac.util.*; 19.7 +import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag; 19.8 import com.sun.tools.javac.util.List; 19.9 import static com.sun.tools.javac.util.ListBuffer.lb; 19.10 19.11 @@ -75,42 +76,6 @@ 19.12 /** The name table. */ 19.13 private Names names; 19.14 19.15 - // Because of javac's limited lookahead, some contexts are ambiguous in 19.16 - // the presence of type annotations even though they are not ambiguous 19.17 - // in the absence of type annotations. Consider this code: 19.18 - // void m(String [] m) { } 19.19 - // void m(String ... m) { } 19.20 - // After parsing "String", javac calls bracketsOpt which immediately 19.21 - // returns if the next character is not '['. Similarly, javac can see 19.22 - // if the next token is ... and in that case parse an ellipsis. But in 19.23 - // the presence of type annotations: 19.24 - // void m(String @A [] m) { } 19.25 - // void m(String @A ... m) { } 19.26 - // no finite lookahead is enough to determine whether to read array 19.27 - // levels or an ellipsis. Furthermore, if you call bracketsOpt, then 19.28 - // bracketsOpt first reads all the leading annotations and only then 19.29 - // discovers that it needs to fail. bracketsOpt needs a way to push 19.30 - // back the extra annotations that it read. (But, bracketsOpt should 19.31 - // not *always* be allowed to push back extra annotations that it finds 19.32 - // -- in most contexts, any such extra annotation is an error. 19.33 - // Another similar case occurs with arrays and receiver annotations: 19.34 - // String b() @Array [] @Receiver { } 19.35 - // String b() @Receiver { } 19.36 - // 19.37 - // The following two variables permit type annotations that have 19.38 - // already been read to be stored for later use. Alternate 19.39 - // implementations are possible but would cause much larger changes to 19.40 - // the parser. 19.41 - /** Type annotations that have already been read but have not yet been used. **/ 19.42 - private List<JCTypeAnnotation> typeAnnotationsPushedBack = null; 19.43 - /** 19.44 - * If the parser notices extra annotations, then it either immediately 19.45 - * issues an error (if this variable is false) or places the extra 19.46 - * annotations in variable typeAnnotationsPushedBack (if this variable 19.47 - * is true). 19.48 - */ 19.49 - private boolean permitTypeAnnotationsPushBack = false; 19.50 - 19.51 /** Construct a parser from a given scanner, tree factory and log. 19.52 */ 19.53 protected JavacParser(ParserFactory fac, 19.54 @@ -134,19 +99,13 @@ 19.55 this.allowTWR = source.allowTryWithResources(); 19.56 this.allowDiamond = source.allowDiamond(); 19.57 this.allowMulticatch = source.allowMulticatch(); 19.58 - this.allowTypeAnnotations = source.allowTypeAnnotations(); 19.59 this.keepDocComments = keepDocComments; 19.60 if (keepDocComments) 19.61 docComments = new HashMap<JCTree,String>(); 19.62 this.keepLineMap = keepLineMap; 19.63 this.errorTree = F.Erroneous(); 19.64 - this.debugJSR308 = fac.options.get("TA:parser") != null; 19.65 } 19.66 19.67 - /** Switch: debug output for type-annotations operations 19.68 - */ 19.69 - boolean debugJSR308; 19.70 - 19.71 /** Switch: Should generics be recognized? 19.72 */ 19.73 boolean allowGenerics; 19.74 @@ -183,10 +142,6 @@ 19.75 */ 19.76 boolean allowAnnotations; 19.77 19.78 - /** Switch: should we recognize type annotations? 19.79 - */ 19.80 - boolean allowTypeAnnotations; 19.81 - 19.82 /** Switch: should we recognize automatic resource management? 19.83 */ 19.84 boolean allowTWR; 19.85 @@ -312,9 +267,9 @@ 19.86 private void reportSyntaxError(int pos, String key, Object... args) { 19.87 if (pos > S.errPos() || pos == Position.NOPOS) { 19.88 if (S.token() == EOF) 19.89 - log.error(pos, "premature.eof"); 19.90 + error(pos, "premature.eof"); 19.91 else 19.92 - log.error(pos, key, args); 19.93 + error(pos, key, args); 19.94 } 19.95 S.errPos(pos); 19.96 if (S.pos() == errorPos) 19.97 @@ -370,7 +325,7 @@ 19.98 void checkNoMods(long mods) { 19.99 if (mods != 0) { 19.100 long lowestMod = mods & -mods; 19.101 - log.error(S.pos(), "mod.not.allowed.here", 19.102 + error(S.pos(), "mod.not.allowed.here", 19.103 Flags.asFlagSet(lowestMod)); 19.104 } 19.105 } 19.106 @@ -464,22 +419,22 @@ 19.107 return name; 19.108 } else if (S.token() == ASSERT) { 19.109 if (allowAsserts) { 19.110 - log.error(S.pos(), "assert.as.identifier"); 19.111 + error(S.pos(), "assert.as.identifier"); 19.112 S.nextToken(); 19.113 return names.error; 19.114 } else { 19.115 - log.warning(S.pos(), "assert.as.identifier"); 19.116 + warning(S.pos(), "assert.as.identifier"); 19.117 Name name = S.name(); 19.118 S.nextToken(); 19.119 return name; 19.120 } 19.121 } else if (S.token() == ENUM) { 19.122 if (allowEnums) { 19.123 - log.error(S.pos(), "enum.as.identifier"); 19.124 + error(S.pos(), "enum.as.identifier"); 19.125 S.nextToken(); 19.126 return names.error; 19.127 } else { 19.128 - log.warning(S.pos(), "enum.as.identifier"); 19.129 + warning(S.pos(), "enum.as.identifier"); 19.130 Name name = S.name(); 19.131 S.nextToken(); 19.132 return name; 19.133 @@ -525,7 +480,7 @@ 19.134 TypeTags.INT, 19.135 Convert.string2int(strval(prefix), S.radix())); 19.136 } catch (NumberFormatException ex) { 19.137 - log.error(S.pos(), "int.number.too.large", strval(prefix)); 19.138 + error(S.pos(), "int.number.too.large", strval(prefix)); 19.139 } 19.140 break; 19.141 case LONGLITERAL: 19.142 @@ -534,7 +489,7 @@ 19.143 TypeTags.LONG, 19.144 new Long(Convert.string2long(strval(prefix), S.radix()))); 19.145 } catch (NumberFormatException ex) { 19.146 - log.error(S.pos(), "int.number.too.large", strval(prefix)); 19.147 + error(S.pos(), "int.number.too.large", strval(prefix)); 19.148 } 19.149 break; 19.150 case FLOATLITERAL: { 19.151 @@ -547,9 +502,9 @@ 19.152 n = Float.NaN; 19.153 } 19.154 if (n.floatValue() == 0.0f && !isZero(proper)) 19.155 - log.error(S.pos(), "fp.number.too.small"); 19.156 + error(S.pos(), "fp.number.too.small"); 19.157 else if (n.floatValue() == Float.POSITIVE_INFINITY) 19.158 - log.error(S.pos(), "fp.number.too.large"); 19.159 + error(S.pos(), "fp.number.too.large"); 19.160 else 19.161 t = F.at(pos).Literal(TypeTags.FLOAT, n); 19.162 break; 19.163 @@ -564,9 +519,9 @@ 19.164 n = Double.NaN; 19.165 } 19.166 if (n.doubleValue() == 0.0d && !isZero(proper)) 19.167 - log.error(S.pos(), "fp.number.too.small"); 19.168 + error(S.pos(), "fp.number.too.small"); 19.169 else if (n.doubleValue() == Double.POSITIVE_INFINITY) 19.170 - log.error(S.pos(), "fp.number.too.large"); 19.171 + error(S.pos(), "fp.number.too.large"); 19.172 else 19.173 t = F.at(pos).Literal(TypeTags.DOUBLE, n); 19.174 break; 19.175 @@ -620,33 +575,7 @@ 19.176 return term(EXPR); 19.177 } 19.178 19.179 - /** 19.180 - * parses (optional) type annotations followed by a type. If the 19.181 - * annotations are present before the type and are not consumed during array 19.182 - * parsing, this method returns a {@link JCAnnotatedType} consisting of 19.183 - * these annotations and the underlying type. Otherwise, it returns the 19.184 - * underlying type. 19.185 - * 19.186 - * <p> 19.187 - * 19.188 - * Note that this method sets {@code mode} to {@code TYPE} first, before 19.189 - * parsing annotations. 19.190 - */ 19.191 public JCExpression parseType() { 19.192 - List<JCTypeAnnotation> annotations = typeAnnotationsOpt(); 19.193 - return parseType(annotations); 19.194 - } 19.195 - 19.196 - public JCExpression parseType(List<JCTypeAnnotation> annotations) { 19.197 - JCExpression result = unannotatedType(); 19.198 - 19.199 - if (!annotations.isEmpty()) 19.200 - result = F.AnnotatedType(annotations, result); 19.201 - 19.202 - return result; 19.203 - } 19.204 - 19.205 - public JCExpression unannotatedType() { 19.206 return term(TYPE); 19.207 } 19.208 19.209 @@ -895,8 +824,8 @@ 19.210 * | [TypeArguments] THIS [Arguments] 19.211 * | [TypeArguments] SUPER SuperSuffix 19.212 * | NEW [TypeArguments] Creator 19.213 - * | [Annotations] Ident { "." Ident } 19.214 - * [ [Annotations] "[" ( "]" BracketsOpt "." CLASS | Expression "]" ) 19.215 + * | Ident { "." Ident } 19.216 + * [ "[" ( "]" BracketsOpt "." CLASS | Expression "]" ) 19.217 * | Arguments 19.218 * | "." ( CLASS | THIS | [TypeArguments] SUPER Arguments | NEW [TypeArguments] InnerCreator ) 19.219 * ] 19.220 @@ -1047,62 +976,23 @@ 19.221 typeArgs = null; 19.222 } else return illegal(); 19.223 break; 19.224 - case MONKEYS_AT: 19.225 - 19.226 - // only annotated targetting class literals or cast types are valid 19.227 - List<JCTypeAnnotation> typeAnnos = typeAnnotationsOpt(); 19.228 - if (typeAnnos.isEmpty()) { 19.229 - // else there would be no '@' 19.230 - throw new AssertionError("type annos is empty"); 19.231 - } 19.232 - 19.233 - JCExpression expr = term3(); 19.234 - 19.235 - // Type annotations: If term3 just parsed a non-type, expect a 19.236 - // class literal (and issue a syntax error if there is no class 19.237 - // literal). Otherwise, create a JCAnnotatedType. 19.238 - if ((mode & TYPE) == 0) { 19.239 - if (expr.getTag() != JCTree.SELECT) 19.240 - return illegal(typeAnnos.head.pos); 19.241 - JCFieldAccess sel = (JCFieldAccess)expr; 19.242 - if (sel.name != names._class) 19.243 - return illegal(); 19.244 - else { 19.245 - sel.selected = F.AnnotatedType(typeAnnos, sel.selected); 19.246 - t = expr; 19.247 - } 19.248 - } else { 19.249 - // type annotation targeting a cast 19.250 - t = toP(F.at(S.pos()).AnnotatedType(typeAnnos, expr)); 19.251 - } 19.252 - break; 19.253 case IDENTIFIER: case ASSERT: case ENUM: 19.254 if (typeArgs != null) return illegal(); 19.255 t = toP(F.at(S.pos()).Ident(ident())); 19.256 loop: while (true) { 19.257 pos = S.pos(); 19.258 - final List<JCTypeAnnotation> annos = typeAnnotationsOpt(); 19.259 - 19.260 - // need to report an error later if LBRACKET is for array 19.261 - // index access rather than array creation level 19.262 - if (!annos.isEmpty() && S.token() != LBRACKET && S.token() != ELLIPSIS) 19.263 - return illegal(annos.head.pos); 19.264 switch (S.token()) { 19.265 case LBRACKET: 19.266 S.nextToken(); 19.267 - 19.268 if (S.token() == RBRACKET) { 19.269 - 19.270 S.nextToken(); 19.271 - 19.272 - t = bracketsOpt(t, annos); 19.273 + t = bracketsOpt(t); 19.274 t = toP(F.at(pos).TypeArray(t)); 19.275 t = bracketsSuffix(t); 19.276 } else { 19.277 if ((mode & EXPR) != 0) { 19.278 mode = EXPR; 19.279 JCExpression t1 = term(); 19.280 - if (!annos.isEmpty()) t = illegal(annos.head.pos); 19.281 t = to(F.at(pos).Indexed(t, t1)); 19.282 } 19.283 accept(RBRACKET); 19.284 @@ -1155,14 +1045,6 @@ 19.285 // typeArgs saved for next loop iteration. 19.286 t = toP(F.at(pos).Select(t, ident())); 19.287 break; 19.288 - case ELLIPSIS: 19.289 - if (this.permitTypeAnnotationsPushBack) { 19.290 - this.typeAnnotationsPushedBack = annos; 19.291 - } else if (annos.nonEmpty()) { 19.292 - // Don't return here -- error recovery attempt 19.293 - illegal(annos.head.pos); 19.294 - } 19.295 - break loop; 19.296 default: 19.297 break loop; 19.298 } 19.299 @@ -1201,18 +1083,14 @@ 19.300 if (typeArgs != null) illegal(); 19.301 while (true) { 19.302 int pos1 = S.pos(); 19.303 - 19.304 - final List<JCTypeAnnotation> annos = typeAnnotationsOpt(); 19.305 - 19.306 if (S.token() == LBRACKET) { 19.307 S.nextToken(); 19.308 - 19.309 if ((mode & TYPE) != 0) { 19.310 int oldmode = mode; 19.311 mode = TYPE; 19.312 if (S.token() == RBRACKET) { 19.313 S.nextToken(); 19.314 - t = bracketsOpt(t, annos); 19.315 + t = bracketsOpt(t); 19.316 t = toP(F.at(pos1).TypeArray(t)); 19.317 return t; 19.318 } 19.319 @@ -1247,12 +1125,6 @@ 19.320 typeArgs = null; 19.321 } 19.322 } else { 19.323 - if (!annos.isEmpty()) { 19.324 - if (permitTypeAnnotationsPushBack) 19.325 - typeAnnotationsPushedBack = annos; 19.326 - else 19.327 - return illegal(annos.head.pos); 19.328 - } 19.329 break; 19.330 } 19.331 } 19.332 @@ -1262,7 +1134,6 @@ 19.333 S.token() == PLUSPLUS ? JCTree.POSTINC : JCTree.POSTDEC, t)); 19.334 S.nextToken(); 19.335 } 19.336 - 19.337 return toP(t); 19.338 } 19.339 19.340 @@ -1400,26 +1271,24 @@ 19.341 } 19.342 19.343 /** TypeArgument = Type 19.344 - * | [Annotations] "?" 19.345 - * | [Annotations] "?" EXTENDS Type {"&" Type} 19.346 - * | [Annotations] "?" SUPER Type 19.347 + * | "?" 19.348 + * | "?" EXTENDS Type {"&" Type} 19.349 + * | "?" SUPER Type 19.350 */ 19.351 JCExpression typeArgument() { 19.352 - List<JCTypeAnnotation> annotations = typeAnnotationsOpt(); 19.353 - if (S.token() != QUES) return parseType(annotations); 19.354 + if (S.token() != QUES) return parseType(); 19.355 int pos = S.pos(); 19.356 S.nextToken(); 19.357 - JCExpression result; 19.358 if (S.token() == EXTENDS) { 19.359 TypeBoundKind t = to(F.at(pos).TypeBoundKind(BoundKind.EXTENDS)); 19.360 S.nextToken(); 19.361 JCExpression bound = parseType(); 19.362 - result = F.at(pos).Wildcard(t, bound); 19.363 + return F.at(pos).Wildcard(t, bound); 19.364 } else if (S.token() == SUPER) { 19.365 TypeBoundKind t = to(F.at(pos).TypeBoundKind(BoundKind.SUPER)); 19.366 S.nextToken(); 19.367 JCExpression bound = parseType(); 19.368 - result = F.at(pos).Wildcard(t, bound); 19.369 + return F.at(pos).Wildcard(t, bound); 19.370 } else if (S.token() == IDENTIFIER) { 19.371 //error recovery 19.372 reportSyntaxError(S.prevEndPos(), "expected3", 19.373 @@ -1427,14 +1296,11 @@ 19.374 TypeBoundKind t = F.at(Position.NOPOS).TypeBoundKind(BoundKind.UNBOUND); 19.375 JCExpression wc = toP(F.at(pos).Wildcard(t, null)); 19.376 JCIdent id = toP(F.at(S.pos()).Ident(ident())); 19.377 - result = F.at(pos).Erroneous(List.<JCTree>of(wc, id)); 19.378 + return F.at(pos).Erroneous(List.<JCTree>of(wc, id)); 19.379 } else { 19.380 TypeBoundKind t = toP(F.at(pos).TypeBoundKind(BoundKind.UNBOUND)); 19.381 - result = toP(F.at(pos).Wildcard(t, null)); 19.382 + return toP(F.at(pos).Wildcard(t, null)); 19.383 } 19.384 - if (!annotations.isEmpty()) 19.385 - result = toP(F.at(annotations.head.pos).AnnotatedType(annotations,result)); 19.386 - return result; 19.387 } 19.388 19.389 JCTypeApply typeArguments(JCExpression t) { 19.390 @@ -1443,47 +1309,21 @@ 19.391 return toP(F.at(pos).TypeApply(t, args)); 19.392 } 19.393 19.394 - /** 19.395 - * BracketsOpt = { [Annotations] "[" "]" } 19.396 - * 19.397 - * <p> 19.398 - * 19.399 - * <code>annotations</code> is the list of annotations targeting 19.400 - * the expression <code>t</code>. 19.401 + /** BracketsOpt = {"[" "]"} 19.402 */ 19.403 - private JCExpression bracketsOpt(JCExpression t, 19.404 - List<JCTypeAnnotation> annotations) { 19.405 - List<JCTypeAnnotation> nextLevelAnnotations = typeAnnotationsOpt(); 19.406 - 19.407 + private JCExpression bracketsOpt(JCExpression t) { 19.408 if (S.token() == LBRACKET) { 19.409 int pos = S.pos(); 19.410 S.nextToken(); 19.411 - 19.412 - JCExpression orig = t; 19.413 - t = bracketsOptCont(t, pos, nextLevelAnnotations); 19.414 - } else if (!nextLevelAnnotations.isEmpty()) { 19.415 - if (permitTypeAnnotationsPushBack) { 19.416 - this.typeAnnotationsPushedBack = nextLevelAnnotations; 19.417 - } else 19.418 - return illegal(nextLevelAnnotations.head.pos); 19.419 + t = bracketsOptCont(t, pos); 19.420 + F.at(pos); 19.421 } 19.422 - 19.423 - int apos = S.pos(); 19.424 - if (!annotations.isEmpty()) 19.425 - t = F.at(apos).AnnotatedType(annotations, t); 19.426 return t; 19.427 } 19.428 19.429 - /** BracketsOpt = {"[" TypeAnnotations "]"} 19.430 - */ 19.431 - private JCExpression bracketsOpt(JCExpression t) { 19.432 - return bracketsOpt(t, List.<JCTypeAnnotation>nil()); 19.433 - } 19.434 - 19.435 - private JCArrayTypeTree bracketsOptCont(JCExpression t, int pos, 19.436 - List<JCTypeAnnotation> annotations) { 19.437 + private JCArrayTypeTree bracketsOptCont(JCExpression t, int pos) { 19.438 accept(RBRACKET); 19.439 - t = bracketsOpt(t, annotations); 19.440 + t = bracketsOpt(t); 19.441 return toP(F.at(pos).TypeArray(t)); 19.442 } 19.443 19.444 @@ -1517,29 +1357,18 @@ 19.445 return t; 19.446 } 19.447 19.448 - /** Creator = [Annotations] Qualident [TypeArguments] ( ArrayCreatorRest | ClassCreatorRest ) 19.449 + /** Creator = Qualident [TypeArguments] ( ArrayCreatorRest | ClassCreatorRest ) 19.450 */ 19.451 JCExpression creator(int newpos, List<JCExpression> typeArgs) { 19.452 - 19.453 - List<JCTypeAnnotation> newAnnotations = typeAnnotationsOpt(); 19.454 - 19.455 switch (S.token()) { 19.456 case BYTE: case SHORT: case CHAR: case INT: case LONG: case FLOAT: 19.457 case DOUBLE: case BOOLEAN: 19.458 - if (typeArgs == null) { 19.459 - if (newAnnotations.isEmpty()) 19.460 - return arrayCreatorRest(newpos, basicType()); 19.461 - else 19.462 - return arrayCreatorRest(newpos, F.AnnotatedType(newAnnotations, basicType())); 19.463 - } 19.464 + if (typeArgs == null) 19.465 + return arrayCreatorRest(newpos, basicType()); 19.466 break; 19.467 default: 19.468 } 19.469 JCExpression t = qualident(); 19.470 - // handle type annotations for non primitive arrays 19.471 - if (!newAnnotations.isEmpty()) 19.472 - t = F.AnnotatedType(newAnnotations, t); 19.473 - 19.474 int oldmode = mode; 19.475 mode = TYPE | DIAMOND; 19.476 if (S.token() == LT) { 19.477 @@ -1556,7 +1385,7 @@ 19.478 } 19.479 } 19.480 mode = oldmode; 19.481 - if (S.token() == LBRACKET || S.token() == MONKEYS_AT) { 19.482 + if (S.token() == LBRACKET) { 19.483 JCExpression e = arrayCreatorRest(newpos, t); 19.484 if (typeArgs != null) { 19.485 int pos = newpos; 19.486 @@ -1572,15 +1401,7 @@ 19.487 } 19.488 return e; 19.489 } else if (S.token() == LPAREN) { 19.490 - JCNewClass newClass = classCreatorRest(newpos, null, typeArgs, t); 19.491 - if (newClass.def != null) { 19.492 - assert newClass.def.mods.annotations.isEmpty(); 19.493 - if (newAnnotations.nonEmpty()) { 19.494 - newClass.def.mods.pos = earlier(newClass.def.mods.pos, newAnnotations.head.pos); 19.495 - newClass.def.mods.annotations = List.convert(JCAnnotation.class, newAnnotations); 19.496 - } 19.497 - } 19.498 - return newClass; 19.499 + return classCreatorRest(newpos, null, typeArgs, t); 19.500 } else { 19.501 reportSyntaxError(S.pos(), "expected2", 19.502 LPAREN, LBRACKET); 19.503 @@ -1603,67 +1424,34 @@ 19.504 return classCreatorRest(newpos, encl, typeArgs, t); 19.505 } 19.506 19.507 - /** ArrayCreatorRest = [Annotations] "[" ( "]" BracketsOpt ArrayInitializer 19.508 - * | Expression "]" {[Annotations] "[" Expression "]"} BracketsOpt ) 19.509 + /** ArrayCreatorRest = "[" ( "]" BracketsOpt ArrayInitializer 19.510 + * | Expression "]" {"[" Expression "]"} BracketsOpt ) 19.511 */ 19.512 JCExpression arrayCreatorRest(int newpos, JCExpression elemtype) { 19.513 - 19.514 - List<JCTypeAnnotation> topAnnos = List.nil(); 19.515 - if (elemtype.getTag() == JCTree.ANNOTATED_TYPE) { 19.516 - JCAnnotatedType atype = (JCAnnotatedType) elemtype; 19.517 - topAnnos = atype.annotations; 19.518 - elemtype = atype.underlyingType; 19.519 - } 19.520 - 19.521 - List<JCTypeAnnotation> annos = typeAnnotationsOpt(); 19.522 - 19.523 accept(LBRACKET); 19.524 - 19.525 if (S.token() == RBRACKET) { 19.526 accept(RBRACKET); 19.527 - 19.528 - elemtype = bracketsOpt(elemtype, annos); 19.529 - 19.530 + elemtype = bracketsOpt(elemtype); 19.531 if (S.token() == LBRACE) { 19.532 - JCNewArray na = (JCNewArray)arrayInitializer(newpos, elemtype); 19.533 - 19.534 - na.annotations = topAnnos; 19.535 - 19.536 - return na; 19.537 + return arrayInitializer(newpos, elemtype); 19.538 } else { 19.539 return syntaxError(S.pos(), "array.dimension.missing"); 19.540 } 19.541 } else { 19.542 ListBuffer<JCExpression> dims = new ListBuffer<JCExpression>(); 19.543 - 19.544 - // maintain array dimension type annotations 19.545 - ListBuffer<List<JCTypeAnnotation>> dimAnnotations = ListBuffer.lb(); 19.546 - dimAnnotations.append(annos); 19.547 - 19.548 dims.append(parseExpression()); 19.549 accept(RBRACKET); 19.550 - while (S.token() == LBRACKET 19.551 - || (S.token() == MONKEYS_AT)) { 19.552 - List<JCTypeAnnotation> maybeDimAnnos = typeAnnotationsOpt(); 19.553 + while (S.token() == LBRACKET) { 19.554 int pos = S.pos(); 19.555 S.nextToken(); 19.556 if (S.token() == RBRACKET) { 19.557 - elemtype = bracketsOptCont(elemtype, pos, maybeDimAnnos); 19.558 + elemtype = bracketsOptCont(elemtype, pos); 19.559 } else { 19.560 - if (S.token() == RBRACKET) { // no dimension 19.561 - elemtype = bracketsOptCont(elemtype, pos, maybeDimAnnos); 19.562 - } else { 19.563 - dimAnnotations.append(maybeDimAnnos); 19.564 - dims.append(parseExpression()); 19.565 - accept(RBRACKET); 19.566 - } 19.567 + dims.append(parseExpression()); 19.568 + accept(RBRACKET); 19.569 } 19.570 } 19.571 - 19.572 - JCNewArray na = toP(F.at(newpos).NewArray(elemtype, dims.toList(), null)); 19.573 - na.annotations = topAnnos; 19.574 - na.dimAnnotations = dimAnnotations.toList(); 19.575 - return na; 19.576 + return toP(F.at(newpos).NewArray(elemtype, dims.toList(), null)); 19.577 } 19.578 } 19.579 19.580 @@ -1794,7 +1582,7 @@ 19.581 case ENUM: 19.582 case ASSERT: 19.583 if (allowEnums && S.token() == ENUM) { 19.584 - log.error(S.pos(), "local.enum"); 19.585 + error(S.pos(), "local.enum"); 19.586 stats. 19.587 append(classOrInterfaceOrEnumDeclaration(modifiersOpt(), 19.588 S.docComment())); 19.589 @@ -1941,9 +1729,9 @@ 19.590 } else { 19.591 if (allowTWR) { 19.592 if (resources.isEmpty()) 19.593 - log.error(pos, "try.without.catch.finally.or.resource.decls"); 19.594 + error(pos, "try.without.catch.finally.or.resource.decls"); 19.595 } else 19.596 - log.error(pos, "try.without.catch.or.finally"); 19.597 + error(pos, "try.without.catch.or.finally"); 19.598 } 19.599 return F.at(pos).Try(resources, body, catchers.toList(), finalizer); 19.600 } 19.601 @@ -2040,7 +1828,7 @@ 19.602 JCModifiers mods = optFinal(Flags.PARAMETER); 19.603 List<JCExpression> catchTypes = catchTypes(); 19.604 JCExpression paramType = catchTypes.size() > 1 ? 19.605 - toP(F.at(catchTypes.head.getStartPosition()).TypeDisjoint(catchTypes)) : 19.606 + toP(F.at(catchTypes.head.getStartPosition()).TypeDisjunction(catchTypes)) : 19.607 catchTypes.head; 19.608 JCVariableDecl formal = variableDeclaratorId(mods, paramType); 19.609 accept(RPAREN); 19.610 @@ -2142,32 +1930,17 @@ 19.611 new ListBuffer<JCExpressionStatement>()).toList(); 19.612 } 19.613 19.614 - enum AnnotationKind { DEFAULT_ANNO, TYPE_ANNO }; 19.615 - 19.616 /** AnnotationsOpt = { '@' Annotation } 19.617 */ 19.618 - List<JCAnnotation> annotationsOpt(AnnotationKind kind) { 19.619 + List<JCAnnotation> annotationsOpt() { 19.620 if (S.token() != MONKEYS_AT) return List.nil(); // optimization 19.621 ListBuffer<JCAnnotation> buf = new ListBuffer<JCAnnotation>(); 19.622 - int prevmode = mode; 19.623 while (S.token() == MONKEYS_AT) { 19.624 int pos = S.pos(); 19.625 S.nextToken(); 19.626 - buf.append(annotation(pos, kind)); 19.627 + buf.append(annotation(pos)); 19.628 } 19.629 - lastmode = mode; 19.630 - mode = prevmode; 19.631 - List<JCAnnotation> annotations = buf.toList(); 19.632 - 19.633 - if (debugJSR308 && kind == AnnotationKind.TYPE_ANNO) 19.634 - System.out.println("TA: parsing " + annotations 19.635 - + " in " + log.currentSourceFile()); 19.636 - return annotations; 19.637 - } 19.638 - 19.639 - List<JCTypeAnnotation> typeAnnotationsOpt() { 19.640 - List<JCAnnotation> annotations = annotationsOpt(AnnotationKind.TYPE_ANNO); 19.641 - return List.convert(JCTypeAnnotation.class, annotations); 19.642 + return buf.toList(); 19.643 } 19.644 19.645 /** ModifiersOpt = { Modifier } 19.646 @@ -2213,13 +1986,13 @@ 19.647 case MONKEYS_AT : flag = Flags.ANNOTATION; break; 19.648 default: break loop; 19.649 } 19.650 - if ((flags & flag) != 0) log.error(S.pos(), "repeated.modifier"); 19.651 + if ((flags & flag) != 0) error(S.pos(), "repeated.modifier"); 19.652 lastPos = S.pos(); 19.653 S.nextToken(); 19.654 if (flag == Flags.ANNOTATION) { 19.655 checkAnnotations(); 19.656 if (S.token() != INTERFACE) { 19.657 - JCAnnotation ann = annotation(lastPos, AnnotationKind.DEFAULT_ANNO); 19.658 + JCAnnotation ann = annotation(lastPos); 19.659 // if first modifier is an annotation, set pos to annotation's. 19.660 if (flags == 0 && annotations.isEmpty()) 19.661 pos = ann.pos; 19.662 @@ -2250,18 +2023,12 @@ 19.663 /** Annotation = "@" Qualident [ "(" AnnotationFieldValues ")" ] 19.664 * @param pos position of "@" token 19.665 */ 19.666 - JCAnnotation annotation(int pos, AnnotationKind kind) { 19.667 + JCAnnotation annotation(int pos) { 19.668 // accept(AT); // AT consumed by caller 19.669 checkAnnotations(); 19.670 - if (kind == AnnotationKind.TYPE_ANNO) 19.671 - checkTypeAnnotations(); 19.672 JCTree ident = qualident(); 19.673 List<JCExpression> fieldValues = annotationFieldValuesOpt(); 19.674 - JCAnnotation ann; 19.675 - if (kind == AnnotationKind.DEFAULT_ANNO) 19.676 - ann = F.at(pos).Annotation(ident, fieldValues); 19.677 - else 19.678 - ann = F.at(pos).TypeAnnotation(ident, fieldValues); 19.679 + JCAnnotation ann = F.at(pos).Annotation(ident, fieldValues); 19.680 storeEnd(ann, S.prevEndPos()); 19.681 return ann; 19.682 } 19.683 @@ -2314,7 +2081,7 @@ 19.684 case MONKEYS_AT: 19.685 pos = S.pos(); 19.686 S.nextToken(); 19.687 - return annotation(pos, AnnotationKind.DEFAULT_ANNO); 19.688 + return annotation(pos); 19.689 case LBRACE: 19.690 pos = S.pos(); 19.691 accept(LBRACE); 19.692 @@ -2565,7 +2332,7 @@ 19.693 } 19.694 } else { 19.695 if (S.token() == ENUM) { 19.696 - log.error(S.pos(), "enums.not.supported.in.source", source.name); 19.697 + error(S.pos(), "enums.not.supported.in.source", source.name); 19.698 allowEnums = true; 19.699 return enumDeclaration(mods, dc); 19.700 } 19.701 @@ -2705,7 +2472,7 @@ 19.702 S.resetDeprecatedFlag(); 19.703 } 19.704 int pos = S.pos(); 19.705 - List<JCAnnotation> annotations = annotationsOpt(AnnotationKind.DEFAULT_ANNO); 19.706 + List<JCAnnotation> annotations = annotationsOpt(); 19.707 JCModifiers mods = F.at(annotations.isEmpty() ? Position.NOPOS : pos).Modifiers(flags, annotations); 19.708 List<JCExpression> typeArgs = typeArgumentsOpt(); 19.709 int identPos = S.pos(); 19.710 @@ -2802,29 +2569,19 @@ 19.711 } else { 19.712 pos = S.pos(); 19.713 List<JCTypeParameter> typarams = typeParametersOpt(); 19.714 - List<JCAnnotation> annosAfterParams = annotationsOpt(AnnotationKind.DEFAULT_ANNO); 19.715 - 19.716 Name name = S.name(); 19.717 pos = S.pos(); 19.718 JCExpression type; 19.719 boolean isVoid = S.token() == VOID; 19.720 if (isVoid) { 19.721 - if (annosAfterParams.nonEmpty()) 19.722 - illegal(annosAfterParams.head.pos); 19.723 type = to(F.at(pos).TypeIdent(TypeTags.VOID)); 19.724 S.nextToken(); 19.725 } else { 19.726 - if (annosAfterParams.nonEmpty()) { 19.727 - mods.annotations = mods.annotations.appendList(annosAfterParams); 19.728 - if (mods.pos == Position.NOPOS) 19.729 - mods.pos = mods.annotations.head.pos; 19.730 - } 19.731 - // method returns types are un-annotated types 19.732 - type = unannotatedType(); 19.733 + type = parseType(); 19.734 } 19.735 if (S.token() == LPAREN && !isInterface && type.getTag() == JCTree.IDENT) { 19.736 if (isInterface || name != className) 19.737 - log.error(pos, "invalid.meth.decl.ret.type.req"); 19.738 + error(pos, "invalid.meth.decl.ret.type.req"); 19.739 return List.of(methodDeclaratorRest( 19.740 pos, mods, null, names.init, typarams, 19.741 isInterface, true, dc)); 19.742 @@ -2856,15 +2613,15 @@ 19.743 } 19.744 19.745 /** MethodDeclaratorRest = 19.746 - * FormalParameters BracketsOpt [Annotations] [Throws TypeList] ( MethodBody | [DEFAULT AnnotationValue] ";") 19.747 + * FormalParameters BracketsOpt [Throws TypeList] ( MethodBody | [DEFAULT AnnotationValue] ";") 19.748 * VoidMethodDeclaratorRest = 19.749 - * FormalParameters [Annotations] [Throws TypeList] ( MethodBody | ";") 19.750 + * FormalParameters [Throws TypeList] ( MethodBody | ";") 19.751 * InterfaceMethodDeclaratorRest = 19.752 - * FormalParameters BracketsOpt [Annotations] [THROWS TypeList] ";" 19.753 + * FormalParameters BracketsOpt [THROWS TypeList] ";" 19.754 * VoidInterfaceMethodDeclaratorRest = 19.755 - * FormalParameters [Annotations] [THROWS TypeList] ";" 19.756 + * FormalParameters [THROWS TypeList] ";" 19.757 * ConstructorDeclaratorRest = 19.758 - * "(" FormalParameterListOpt ")" [Annotations] [THROWS TypeList] MethodBody 19.759 + * "(" FormalParameterListOpt ")" [THROWS TypeList] MethodBody 19.760 */ 19.761 JCTree methodDeclaratorRest(int pos, 19.762 JCModifiers mods, 19.763 @@ -2874,22 +2631,7 @@ 19.764 boolean isInterface, boolean isVoid, 19.765 String dc) { 19.766 List<JCVariableDecl> params = formalParameters(); 19.767 - 19.768 - List<JCTypeAnnotation> receiverAnnotations; 19.769 - if (!isVoid) { 19.770 - // need to distinguish between receiver anno and array anno 19.771 - // look at typeAnnotationsPushedBack comment 19.772 - this.permitTypeAnnotationsPushBack = true; 19.773 - type = methodReturnArrayRest(type); 19.774 - this.permitTypeAnnotationsPushBack = false; 19.775 - if (typeAnnotationsPushedBack == null) 19.776 - receiverAnnotations = List.nil(); 19.777 - else 19.778 - receiverAnnotations = typeAnnotationsPushedBack; 19.779 - typeAnnotationsPushedBack = null; 19.780 - } else 19.781 - receiverAnnotations = typeAnnotationsOpt(); 19.782 - 19.783 + if (!isVoid) type = bracketsOpt(type); 19.784 List<JCExpression> thrown = List.nil(); 19.785 if (S.token() == THROWS) { 19.786 S.nextToken(); 19.787 @@ -2919,51 +2661,20 @@ 19.788 19.789 JCMethodDecl result = 19.790 toP(F.at(pos).MethodDef(mods, name, type, typarams, 19.791 - params, receiverAnnotations, thrown, 19.792 + params, thrown, 19.793 body, defaultValue)); 19.794 attach(result, dc); 19.795 return result; 19.796 } 19.797 19.798 - /** Parses the array levels after the format parameters list, and append 19.799 - * them to the return type, while preseving the order of type annotations 19.800 - */ 19.801 - private JCExpression methodReturnArrayRest(JCExpression type) { 19.802 - if (type.getTag() != JCTree.TYPEARRAY) 19.803 - return bracketsOpt(type); 19.804 - 19.805 - JCArrayTypeTree baseArray = (JCArrayTypeTree)type; 19.806 - while (TreeInfo.typeIn(baseArray.elemtype) instanceof JCArrayTypeTree) 19.807 - baseArray = (JCArrayTypeTree)TreeInfo.typeIn(baseArray.elemtype); 19.808 - 19.809 - if (baseArray.elemtype.getTag() == JCTree.ANNOTATED_TYPE) { 19.810 - JCAnnotatedType at = (JCAnnotatedType)baseArray.elemtype; 19.811 - at.underlyingType = bracketsOpt(at.underlyingType); 19.812 - } else { 19.813 - baseArray.elemtype = bracketsOpt(baseArray.elemtype); 19.814 - } 19.815 - 19.816 - return type; 19.817 - } 19.818 - 19.819 - /** QualidentList = [Annotations] Qualident {"," [Annotations] Qualident} 19.820 + /** QualidentList = Qualident {"," Qualident} 19.821 */ 19.822 List<JCExpression> qualidentList() { 19.823 ListBuffer<JCExpression> ts = new ListBuffer<JCExpression>(); 19.824 - 19.825 - List<JCTypeAnnotation> typeAnnos = typeAnnotationsOpt(); 19.826 - if (!typeAnnos.isEmpty()) 19.827 - ts.append(F.AnnotatedType(typeAnnos, qualident())); 19.828 - else 19.829 - ts.append(qualident()); 19.830 + ts.append(qualident()); 19.831 while (S.token() == COMMA) { 19.832 S.nextToken(); 19.833 - 19.834 - typeAnnos = typeAnnotationsOpt(); 19.835 - if (!typeAnnos.isEmpty()) 19.836 - ts.append(F.AnnotatedType(typeAnnos, qualident())); 19.837 - else 19.838 - ts.append(qualident()); 19.839 + ts.append(qualident()); 19.840 } 19.841 return ts.toList(); 19.842 } 19.843 @@ -2987,13 +2698,12 @@ 19.844 } 19.845 } 19.846 19.847 - /** TypeParameter = [Annotations] TypeVariable [TypeParameterBound] 19.848 + /** TypeParameter = TypeVariable [TypeParameterBound] 19.849 * TypeParameterBound = EXTENDS Type {"&" Type} 19.850 * TypeVariable = Ident 19.851 */ 19.852 JCTypeParameter typeParameter() { 19.853 int pos = S.pos(); 19.854 - List<JCTypeAnnotation> annos = typeAnnotationsOpt(); 19.855 Name name = ident(); 19.856 ListBuffer<JCExpression> bounds = new ListBuffer<JCExpression>(); 19.857 if (S.token() == EXTENDS) { 19.858 @@ -3004,7 +2714,7 @@ 19.859 bounds.append(parseType()); 19.860 } 19.861 } 19.862 - return toP(F.at(pos).TypeParameter(name, bounds.toList(), annos)); 19.863 + return toP(F.at(pos).TypeParameter(name, bounds.toList())); 19.864 } 19.865 19.866 /** FormalParameters = "(" [ FormalParameterList ] ")" 19.867 @@ -3038,37 +2748,26 @@ 19.868 */ 19.869 JCVariableDecl formalParameter() { 19.870 JCModifiers mods = optFinal(Flags.PARAMETER); 19.871 - // need to distinguish between vararg annos and array annos 19.872 - // look at typeAnnotaitonsPushedBack comment 19.873 - this.permitTypeAnnotationsPushBack = true; 19.874 JCExpression type = parseType(); 19.875 - this.permitTypeAnnotationsPushBack = false; 19.876 - 19.877 if (S.token() == ELLIPSIS) { 19.878 - List<JCTypeAnnotation> varargsAnnos = typeAnnotationsPushedBack; 19.879 - typeAnnotationsPushedBack = null; 19.880 checkVarargs(); 19.881 mods.flags |= Flags.VARARGS; 19.882 - // insert var arg type annotations 19.883 - if (varargsAnnos != null && varargsAnnos.nonEmpty()) 19.884 - type = F.at(S.pos()).AnnotatedType(varargsAnnos, type); 19.885 type = to(F.at(S.pos()).TypeArray(type)); 19.886 - 19.887 S.nextToken(); 19.888 - } else { 19.889 - // if not a var arg, then typeAnnotationsPushedBack should be null 19.890 - if (typeAnnotationsPushedBack != null 19.891 - && !typeAnnotationsPushedBack.isEmpty()) { 19.892 - reportSyntaxError(typeAnnotationsPushedBack.head.pos, 19.893 - "illegal.start.of.type"); 19.894 - } 19.895 - typeAnnotationsPushedBack = null; 19.896 } 19.897 return variableDeclaratorId(mods, type); 19.898 } 19.899 19.900 /* ---------- auxiliary methods -------------- */ 19.901 19.902 + void error(int pos, String key, Object ... args) { 19.903 + log.error(DiagnosticFlag.SYNTAX, pos, key, args); 19.904 + } 19.905 + 19.906 + void warning(int pos, String key, Object ... args) { 19.907 + log.warning(pos, key, args); 19.908 + } 19.909 + 19.910 /** Check that given tree is a legal expression statement. 19.911 */ 19.912 protected JCExpression checkExprStat(JCExpression t) { 19.913 @@ -3084,7 +2783,7 @@ 19.914 case JCTree.ERRONEOUS: 19.915 return t; 19.916 default: 19.917 - log.error(t.pos, "not.stmt"); 19.918 + error(t.pos, "not.stmt"); 19.919 return F.at(t.pos).Erroneous(List.<JCTree>of(t)); 19.920 } 19.921 } 19.922 @@ -3231,55 +2930,49 @@ 19.923 19.924 void checkGenerics() { 19.925 if (!allowGenerics) { 19.926 - log.error(S.pos(), "generics.not.supported.in.source", source.name); 19.927 + error(S.pos(), "generics.not.supported.in.source", source.name); 19.928 allowGenerics = true; 19.929 } 19.930 } 19.931 void checkVarargs() { 19.932 if (!allowVarargs) { 19.933 - log.error(S.pos(), "varargs.not.supported.in.source", source.name); 19.934 + error(S.pos(), "varargs.not.supported.in.source", source.name); 19.935 allowVarargs = true; 19.936 } 19.937 } 19.938 void checkForeach() { 19.939 if (!allowForeach) { 19.940 - log.error(S.pos(), "foreach.not.supported.in.source", source.name); 19.941 + error(S.pos(), "foreach.not.supported.in.source", source.name); 19.942 allowForeach = true; 19.943 } 19.944 } 19.945 void checkStaticImports() { 19.946 if (!allowStaticImport) { 19.947 - log.error(S.pos(), "static.import.not.supported.in.source", source.name); 19.948 + error(S.pos(), "static.import.not.supported.in.source", source.name); 19.949 allowStaticImport = true; 19.950 } 19.951 } 19.952 void checkAnnotations() { 19.953 if (!allowAnnotations) { 19.954 - log.error(S.pos(), "annotations.not.supported.in.source", source.name); 19.955 + error(S.pos(), "annotations.not.supported.in.source", source.name); 19.956 allowAnnotations = true; 19.957 } 19.958 } 19.959 - void checkTypeAnnotations() { 19.960 - if (!allowTypeAnnotations) { 19.961 - log.error(S.pos(), "type.annotations.not.supported.in.source", source.name); 19.962 - allowTypeAnnotations = true; 19.963 - } 19.964 - } 19.965 void checkDiamond() { 19.966 if (!allowDiamond) { 19.967 - log.error(S.pos(), "diamond.not.supported.in.source", source.name); 19.968 + error(S.pos(), "diamond.not.supported.in.source", source.name); 19.969 allowDiamond = true; 19.970 } 19.971 } 19.972 void checkMulticatch() { 19.973 if (!allowMulticatch) { 19.974 - log.error(S.pos(), "multicatch.not.supported.in.source", source.name); 19.975 + error(S.pos(), "multicatch.not.supported.in.source", source.name); 19.976 allowMulticatch = true; 19.977 } 19.978 } 19.979 void checkAutomaticResourceManagement() { 19.980 if (!allowTWR) { 19.981 - log.error(S.pos(), "automatic.resource.management.not.supported.in.source", source.name); 19.982 + error(S.pos(), "automatic.resource.management.not.supported.in.source", source.name); 19.983 allowTWR = true; 19.984 } 19.985 }
20.1 --- a/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Thu Nov 04 15:54:46 2010 -0700 20.2 +++ b/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Tue Nov 09 22:54:48 2010 -0800 20.3 @@ -49,11 +49,11 @@ 20.4 import javax.tools.JavaFileObject; 20.5 import javax.tools.DiagnosticListener; 20.6 20.7 -import com.sun.tools.javac.api.JavacTrees; 20.8 -import com.sun.source.util.AbstractTypeProcessor; 20.9 +//308 import com.sun.source.util.AbstractTypeProcessor; 20.10 import com.sun.source.util.TaskEvent; 20.11 import com.sun.source.util.TaskListener; 20.12 import com.sun.tools.javac.api.JavacTaskImpl; 20.13 +import com.sun.tools.javac.api.JavacTrees; 20.14 import com.sun.tools.javac.code.*; 20.15 import com.sun.tools.javac.code.Symbol.*; 20.16 import com.sun.tools.javac.file.JavacFileManager; 20.17 @@ -712,7 +712,7 @@ 20.18 } 20.19 20.20 if (matchedNames.size() > 0 || ps.contributed) { 20.21 - foundTypeProcessors = foundTypeProcessors || (ps.processor instanceof AbstractTypeProcessor); 20.22 +//308 foundTypeProcessors = foundTypeProcessors || (ps.processor instanceof AbstractTypeProcessor); 20.23 boolean processingResult = callProcessor(ps.processor, typeElements, renv); 20.24 ps.contributed = true; 20.25 ps.removeSupportedOptions(unmatchedProcessorOptions); 20.26 @@ -939,7 +939,7 @@ 20.27 break; 20.28 20.29 case ERROR: 20.30 - if (fatalErrors || !d.isFlagSet(RESOLVE_ERROR)) 20.31 + if (fatalErrors || !d.isFlagSet(RECOVERABLE)) 20.32 return true; 20.33 break; 20.34 }
21.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Nov 04 15:54:46 2010 -0700 21.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties Tue Nov 09 22:54:48 2010 -0800 21.3 @@ -873,6 +873,13 @@ 21.4 found raw type: {0}\n\ 21.5 missing type parameters for generic class {1} 21.6 21.7 +compiler.warn.diamond.redundant.args=\ 21.8 + redundant type arguments in new expression (use diamond operator instead). 21.9 +compiler.warn.diamond.redundant.args.1=\ 21.10 + redundant type arguments in new expression (use diamond operator instead).\n\ 21.11 + explicit: {0}\n\ 21.12 + inferred: {1} 21.13 + 21.14 ##### 21.15 21.16 ## The following are tokens which are non-terminals in the language. They should 21.17 @@ -1299,9 +1306,9 @@ 21.18 annotations are not supported in -source {0}\n\ 21.19 (use -source 5 or higher to enable annotations) 21.20 21.21 -compiler.err.type.annotations.not.supported.in.source=\ 21.22 - type annotations are not supported in -source {0}\n\ 21.23 -(use -source 7 or higher to enable type annotations) 21.24 +#308 compiler.err.type.annotations.not.supported.in.source=\ 21.25 +#308 type annotations are not supported in -source {0}\n\ 21.26 +#308 (use -source 7 or higher to enable type annotations) 21.27 21.28 compiler.err.foreach.not.supported.in.source=\ 21.29 for-each loops are not supported in -source {0}\n\
22.1 --- a/src/share/classes/com/sun/tools/javac/tree/JCTree.java Thu Nov 04 15:54:46 2010 -0700 22.2 +++ b/src/share/classes/com/sun/tools/javac/tree/JCTree.java Tue Nov 09 22:54:48 2010 -0800 22.3 @@ -236,13 +236,13 @@ 22.4 */ 22.5 public static final int TYPEAPPLY = TYPEARRAY + 1; 22.6 22.7 - /** Disjunctive types, of type TypeDisjoint. 22.8 + /** Disjunction types, of type TypeDisjunction 22.9 */ 22.10 - public static final int TYPEDISJOINT = TYPEAPPLY + 1; 22.11 + public static final int TYPEDISJUNCTION = TYPEAPPLY + 1; 22.12 22.13 /** Formal type parameters, of type TypeParameter. 22.14 */ 22.15 - public static final int TYPEPARAMETER = TYPEDISJOINT + 1; 22.16 + public static final int TYPEPARAMETER = TYPEDISJUNCTION + 1; 22.17 22.18 /** Type argument. 22.19 */ 22.20 @@ -1888,30 +1888,30 @@ 22.21 } 22.22 22.23 /** 22.24 - * A disjoint type, T1 | T2 | ... Tn (used in multicatch statements) 22.25 + * A disjunction type, T1 | T2 | ... Tn (used in multicatch statements) 22.26 */ 22.27 - public static class JCTypeDisjoint extends JCExpression implements DisjointTypeTree { 22.28 + public static class JCTypeDisjunction extends JCExpression implements DisjunctiveTypeTree { 22.29 22.30 - public List<JCExpression> components; 22.31 + public List<JCExpression> alternatives; 22.32 22.33 - protected JCTypeDisjoint(List<JCExpression> components) { 22.34 - this.components = components; 22.35 + protected JCTypeDisjunction(List<JCExpression> components) { 22.36 + this.alternatives = components; 22.37 } 22.38 @Override 22.39 - public void accept(Visitor v) { v.visitTypeDisjoint(this); } 22.40 + public void accept(Visitor v) { v.visitTypeDisjunction(this); } 22.41 22.42 - public Kind getKind() { return Kind.DISJOINT_TYPE; } 22.43 + public Kind getKind() { return Kind.DISJUNCTIVE_TYPE; } 22.44 22.45 - public List<JCExpression> getTypeComponents() { 22.46 - return components; 22.47 + public List<JCExpression> getTypeAlternatives() { 22.48 + return alternatives; 22.49 } 22.50 @Override 22.51 public <R,D> R accept(TreeVisitor<R,D> v, D d) { 22.52 - return v.visitDisjointType(this, d); 22.53 + return v.visitDisjunctiveType(this, d); 22.54 } 22.55 @Override 22.56 public int getTag() { 22.57 - return TYPEDISJOINT; 22.58 + return TYPEDISJUNCTION; 22.59 } 22.60 } 22.61 22.62 @@ -2067,17 +2067,23 @@ 22.63 } 22.64 } 22.65 22.66 - public static class JCAnnotatedType extends JCExpression implements com.sun.source.tree.AnnotatedTypeTree { 22.67 + public static class JCAnnotatedType extends JCExpression 22.68 +//308 implements com.sun.source.tree.AnnotatedTypeTree 22.69 + { 22.70 public List<JCTypeAnnotation> annotations; 22.71 public JCExpression underlyingType; 22.72 protected JCAnnotatedType(List<JCTypeAnnotation> annotations, JCExpression underlyingType) { 22.73 - this.annotations = annotations; 22.74 - this.underlyingType = underlyingType; 22.75 + throw new UnsupportedOperationException(); 22.76 +//308 this.annotations = annotations; 22.77 +//308 this.underlyingType = underlyingType; 22.78 } 22.79 @Override 22.80 public void accept(Visitor v) { v.visitAnnotatedType(this); } 22.81 22.82 - public Kind getKind() { return Kind.ANNOTATED_TYPE; } 22.83 + public Kind getKind() { 22.84 + throw new UnsupportedOperationException(); 22.85 +//308 return Kind.ANNOTATED_TYPE; 22.86 + } 22.87 public List<JCTypeAnnotation> getAnnotations() { 22.88 return annotations; 22.89 } 22.90 @@ -2086,7 +2092,8 @@ 22.91 } 22.92 @Override 22.93 public <R,D> R accept(TreeVisitor<R,D> v, D d) { 22.94 - return v.visitAnnotatedType(this, d); 22.95 + throw new UnsupportedOperationException(); 22.96 +//308 return v.visitAnnotatedType(this, d); 22.97 } 22.98 @Override 22.99 public int getTag() { 22.100 @@ -2277,7 +2284,7 @@ 22.101 public void visitTypeIdent(JCPrimitiveTypeTree that) { visitTree(that); } 22.102 public void visitTypeArray(JCArrayTypeTree that) { visitTree(that); } 22.103 public void visitTypeApply(JCTypeApply that) { visitTree(that); } 22.104 - public void visitTypeDisjoint(JCTypeDisjoint that) { visitTree(that); } 22.105 + public void visitTypeDisjunction(JCTypeDisjunction that) { visitTree(that); } 22.106 public void visitTypeParameter(JCTypeParameter that) { visitTree(that); } 22.107 public void visitWildcard(JCWildcard that) { visitTree(that); } 22.108 public void visitTypeBoundKind(TypeBoundKind that) { visitTree(that); }
23.1 --- a/src/share/classes/com/sun/tools/javac/tree/Pretty.java Thu Nov 04 15:54:46 2010 -0700 23.2 +++ b/src/share/classes/com/sun/tools/javac/tree/Pretty.java Tue Nov 09 22:54:48 2010 -0800 23.3 @@ -1195,9 +1195,9 @@ 23.4 } 23.5 } 23.6 23.7 - public void visitTypeDisjoint(JCTypeDisjoint tree) { 23.8 + public void visitTypeDisjunction(JCTypeDisjunction tree) { 23.9 try { 23.10 - printExprs(tree.components, " | "); 23.11 + printExprs(tree.alternatives, " | "); 23.12 } catch (IOException e) { 23.13 throw new UncheckedIOException(e); 23.14 }
24.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java Thu Nov 04 15:54:46 2010 -0700 24.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java Tue Nov 09 22:54:48 2010 -0800 24.3 @@ -71,12 +71,12 @@ 24.4 return lb.toList(); 24.5 } 24.6 24.7 - public JCTree visitAnnotatedType(AnnotatedTypeTree node, P p) { 24.8 - JCAnnotatedType t = (JCAnnotatedType) node; 24.9 - List<JCTypeAnnotation> annotations = copy(t.annotations, p); 24.10 - JCExpression underlyingType = copy(t.underlyingType, p); 24.11 - return M.at(t.pos).AnnotatedType(annotations, underlyingType); 24.12 - } 24.13 +//308 public JCTree visitAnnotatedType(AnnotatedTypeTree node, P p) { 24.14 +//308 JCAnnotatedType t = (JCAnnotatedType) node; 24.15 +//308 List<JCTypeAnnotation> annotations = copy(t.annotations, p); 24.16 +//308 JCExpression underlyingType = copy(t.underlyingType, p); 24.17 +//308 return M.at(t.pos).AnnotatedType(annotations, underlyingType); 24.18 +//308 } 24.19 24.20 public JCTree visitAnnotation(AnnotationTree node, P p) { 24.21 JCAnnotation t = (JCAnnotation) node; 24.22 @@ -346,10 +346,10 @@ 24.23 return M.at(t.pos).TypeApply(clazz, arguments); 24.24 } 24.25 24.26 - public JCTree visitDisjointType(DisjointTypeTree node, P p) { 24.27 - JCTypeDisjoint t = (JCTypeDisjoint) node; 24.28 - List<JCExpression> components = copy(t.components, p); 24.29 - return M.at(t.pos).TypeDisjoint(components); 24.30 + public JCTree visitDisjunctiveType(DisjunctiveTypeTree node, P p) { 24.31 + JCTypeDisjunction t = (JCTypeDisjunction) node; 24.32 + List<JCExpression> components = copy(t.alternatives, p); 24.33 + return M.at(t.pos).TypeDisjunction(components); 24.34 } 24.35 24.36 public JCTree visitArrayType(ArrayTypeTree node, P p) {
25.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Thu Nov 04 15:54:46 2010 -0700 25.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Tue Nov 09 22:54:48 2010 -0800 25.3 @@ -119,7 +119,7 @@ 25.4 } 25.5 25.6 public static boolean isMultiCatch(JCCatch catchClause) { 25.7 - return catchClause.param.vartype.getTag() == JCTree.TYPEDISJOINT; 25.8 + return catchClause.param.vartype.getTag() == JCTree.TYPEDISJUNCTION; 25.9 } 25.10 25.11 /** Is statement an initializer for a synthetic field?
26.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Thu Nov 04 15:54:46 2010 -0700 26.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Tue Nov 09 22:54:48 2010 -0800 26.3 @@ -451,8 +451,8 @@ 26.4 return tree; 26.5 } 26.6 26.7 - public JCTypeDisjoint TypeDisjoint(List<JCExpression> components) { 26.8 - JCTypeDisjoint tree = new JCTypeDisjoint(components); 26.9 + public JCTypeDisjunction TypeDisjunction(List<JCExpression> components) { 26.10 + JCTypeDisjunction tree = new JCTypeDisjunction(components); 26.11 tree.pos = pos; 26.12 return tree; 26.13 }
27.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java Thu Nov 04 15:54:46 2010 -0700 27.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java Tue Nov 09 22:54:48 2010 -0800 27.3 @@ -276,8 +276,8 @@ 27.4 scan(tree.arguments); 27.5 } 27.6 27.7 - public void visitTypeDisjoint(JCTypeDisjoint tree) { 27.8 - scan(tree.components); 27.9 + public void visitTypeDisjunction(JCTypeDisjunction tree) { 27.10 + scan(tree.alternatives); 27.11 } 27.12 27.13 public void visitTypeParameter(JCTypeParameter tree) {
28.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java Thu Nov 04 15:54:46 2010 -0700 28.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java Tue Nov 09 22:54:48 2010 -0800 28.3 @@ -368,8 +368,8 @@ 28.4 result = tree; 28.5 } 28.6 28.7 - public void visitTypeDisjoint(JCTypeDisjoint tree) { 28.8 - tree.components = translate(tree.components); 28.9 + public void visitTypeDisjunction(JCTypeDisjunction tree) { 28.10 + tree.alternatives = translate(tree.alternatives); 28.11 result = tree; 28.12 } 28.13
29.1 --- a/src/share/classes/com/sun/tools/javac/util/AbstractLog.java Thu Nov 04 15:54:46 2010 -0700 29.2 +++ b/src/share/classes/com/sun/tools/javac/util/AbstractLog.java Tue Nov 09 22:54:48 2010 -0800 29.3 @@ -30,6 +30,7 @@ 29.4 import javax.tools.JavaFileObject; 29.5 29.6 import com.sun.tools.javac.code.Lint.LintCategory; 29.7 +import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag; 29.8 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; 29.9 import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition; 29.10 29.11 @@ -103,6 +104,19 @@ 29.12 report(diags.error(source, wrap(pos), key, args)); 29.13 } 29.14 29.15 + /** Report an error, unless another error was already reported at same 29.16 + * source position. 29.17 + * @param flag A flag to set on the diagnostic 29.18 + * @param pos The source position at which to report the error. 29.19 + * @param key The key for the localized error message. 29.20 + * @param args Fields of the error message. 29.21 + */ 29.22 + public void error(DiagnosticFlag flag, int pos, String key, Object ... args) { 29.23 + JCDiagnostic d = diags.error(source, wrap(pos), key, args); 29.24 + d.setFlag(flag); 29.25 + report(d); 29.26 + } 29.27 + 29.28 /** Report a warning, unless suppressed by the -nowarn option or the 29.29 * maximum number of warnings has been reached. 29.30 * @param pos The source position at which to report the warning.
30.1 --- a/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java Thu Nov 04 15:54:46 2010 -0700 30.2 +++ b/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java Tue Nov 09 22:54:48 2010 -0800 30.3 @@ -63,17 +63,23 @@ 30.4 30.5 DiagnosticFormatter<JCDiagnostic> formatter; 30.6 final String prefix; 30.7 + final Set<DiagnosticFlag> defaultErrorFlags; 30.8 30.9 /** Create a new diagnostic factory. */ 30.10 protected Factory(Context context) { 30.11 this(JavacMessages.instance(context), "compiler"); 30.12 context.put(diagnosticFactoryKey, this); 30.13 + 30.14 + Options options = Options.instance(context); 30.15 + if (options.isSet("onlySyntaxErrorsUnrecoverable")) 30.16 + defaultErrorFlags.add(DiagnosticFlag.RECOVERABLE); 30.17 } 30.18 30.19 /** Create a new diagnostic factory. */ 30.20 public Factory(JavacMessages messages, String prefix) { 30.21 this.prefix = prefix; 30.22 this.formatter = new BasicDiagnosticFormatter(messages); 30.23 + defaultErrorFlags = EnumSet.of(DiagnosticFlag.MANDATORY); 30.24 } 30.25 30.26 /** 30.27 @@ -85,7 +91,7 @@ 30.28 */ 30.29 public JCDiagnostic error( 30.30 DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) { 30.31 - return create(ERROR, null, EnumSet.of(DiagnosticFlag.MANDATORY), source, pos, key, args); 30.32 + return create(ERROR, null, defaultErrorFlags, source, pos, key, args); 30.33 } 30.34 30.35 /** 30.36 @@ -331,7 +337,9 @@ 30.37 30.38 public enum DiagnosticFlag { 30.39 MANDATORY, 30.40 - RESOLVE_ERROR 30.41 + RESOLVE_ERROR, 30.42 + SYNTAX, 30.43 + RECOVERABLE 30.44 } 30.45 30.46 private final DiagnosticType type; 30.47 @@ -547,6 +555,17 @@ 30.48 30.49 public void setFlag(DiagnosticFlag flag) { 30.50 flags.add(flag); 30.51 + 30.52 + if (type == DiagnosticType.ERROR) { 30.53 + switch (flag) { 30.54 + case SYNTAX: 30.55 + flags.remove(DiagnosticFlag.RECOVERABLE); 30.56 + break; 30.57 + case RESOLVE_ERROR: 30.58 + flags.add(DiagnosticFlag.RECOVERABLE); 30.59 + break; 30.60 + } 30.61 + } 30.62 } 30.63 30.64 public boolean isFlagSet(DiagnosticFlag flag) {
31.1 --- a/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Thu Nov 04 15:54:46 2010 -0700 31.2 +++ b/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Tue Nov 09 22:54:48 2010 -0800 31.3 @@ -850,6 +850,12 @@ 31.4 String[] paramTypes, Set<ClassDocImpl> searched) { 31.5 //### Note that this search is not necessarily what the compiler would do! 31.6 31.7 + Names names = tsym.name.table.names; 31.8 + // do not match constructors 31.9 + if (names.init.contentEquals(methodName)) { 31.10 + return null; 31.11 + } 31.12 + 31.13 ClassDocImpl cdi; 31.14 MethodDocImpl mdi; 31.15 31.16 @@ -876,7 +882,6 @@ 31.17 *---------------------------------*/ 31.18 31.19 // search current class 31.20 - Names names = tsym.name.table.names; 31.21 Scope.Entry e = tsym.members().lookup(names.fromString(methodName)); 31.22 31.23 //### Using modifier filter here isn't really correct,
32.1 --- a/src/share/classes/com/sun/tools/javadoc/DocEnv.java Thu Nov 04 15:54:46 2010 -0700 32.2 +++ b/src/share/classes/com/sun/tools/javadoc/DocEnv.java Tue Nov 09 22:54:48 2010 -0800 32.3 @@ -637,6 +637,7 @@ 32.4 * Should be called only on symbols representing methods. 32.5 */ 32.6 public MethodDocImpl getMethodDoc(MethodSymbol meth) { 32.7 + assert !meth.isConstructor() : "not expecting a constructor symbol"; 32.8 MethodDocImpl result = (MethodDocImpl)methodMap.get(meth); 32.9 if (result != null) return result; 32.10 result = new MethodDocImpl(this, meth); 32.11 @@ -665,6 +666,7 @@ 32.12 * Should be called only on symbols representing constructors. 32.13 */ 32.14 public ConstructorDocImpl getConstructorDoc(MethodSymbol meth) { 32.15 + assert meth.isConstructor() : "expecting a constructor symbol"; 32.16 ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth); 32.17 if (result != null) return result; 32.18 result = new ConstructorDocImpl(this, meth);
33.1 --- a/src/share/classes/com/sun/tools/javah/JavahTask.java Thu Nov 04 15:54:46 2010 -0700 33.2 +++ b/src/share/classes/com/sun/tools/javah/JavahTask.java Tue Nov 09 22:54:48 2010 -0800 33.3 @@ -26,6 +26,7 @@ 33.4 package com.sun.tools.javah; 33.5 33.6 import java.io.File; 33.7 +import java.io.FileNotFoundException; 33.8 import java.io.IOException; 33.9 import java.io.OutputStream; 33.10 import java.io.PrintWriter; 33.11 @@ -74,6 +75,7 @@ 33.12 import static javax.tools.Diagnostic.Kind.*; 33.13 33.14 import com.sun.tools.javac.code.Symbol.CompletionFailure; 33.15 +import com.sun.tools.javac.main.CommandLine; 33.16 33.17 /** 33.18 * Javah generates support files for native methods. 33.19 @@ -362,7 +364,7 @@ 33.20 if (fileManager == null) 33.21 fileManager = getDefaultFileManager(diagnosticListener, log); 33.22 33.23 - Iterator<String> iter = args.iterator(); 33.24 + Iterator<String> iter = expandAtArgs(args).iterator(); 33.25 noArgs = !iter.hasNext(); 33.26 33.27 while (iter.hasNext()) { 33.28 @@ -416,6 +418,18 @@ 33.29 throw new BadArgs("err.unknown.option", name).showUsage(true); 33.30 } 33.31 33.32 + private Iterable<String> expandAtArgs(Iterable<String> args) throws BadArgs { 33.33 + try { 33.34 + List<String> l = new ArrayList<String>(); 33.35 + for (String arg: args) l.add(arg); 33.36 + return Arrays.asList(CommandLine.parse(l.toArray(new String[l.size()]))); 33.37 + } catch (FileNotFoundException e) { 33.38 + throw new BadArgs("at.args.file.not.found", e.getLocalizedMessage()); 33.39 + } catch (IOException e) { 33.40 + throw new BadArgs("at.args.io.exception", e.getLocalizedMessage()); 33.41 + } 33.42 + } 33.43 + 33.44 public Boolean call() { 33.45 return run(); 33.46 } 33.47 @@ -607,8 +621,8 @@ 33.48 } 33.49 33.50 }; 33.51 + } 33.52 33.53 - } 33.54 private String getMessage(String key, Object... args) { 33.55 return getMessage(task_locale, key, args); 33.56 }
34.1 --- a/src/share/classes/com/sun/tools/javah/resources/l10n.properties Thu Nov 04 15:54:46 2010 -0700 34.2 +++ b/src/share/classes/com/sun/tools/javah/resources/l10n.properties Tue Nov 09 22:54:48 2010 -0800 34.3 @@ -30,6 +30,8 @@ 34.4 The directory {0} could not be create for output. 34.5 at.args.cant.read=\ 34.6 Can''t read command line arguments from file {1}. 34.7 +at.args.file.not.found=\ 34.8 + Can''t find file {0}. 34.9 at.args.io.exception=\ 34.10 The following I/O problem was encountered when processing an @ \ 34.11 argument on the command line: {0}.
35.1 --- a/test/tools/javac/T6985181.java Thu Nov 04 15:54:46 2010 -0700 35.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 35.3 @@ -1,86 +0,0 @@ 35.4 -/* 35.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 35.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 35.7 - * 35.8 - * This code is free software; you can redistribute it and/or modify it 35.9 - * under the terms of the GNU General Public License version 2 only, as 35.10 - * published by the Free Software Foundation. 35.11 - * 35.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 35.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 35.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 35.15 - * version 2 for more details (a copy is included in the LICENSE file that 35.16 - * accompanied this code). 35.17 - * 35.18 - * You should have received a copy of the GNU General Public License version 35.19 - * 2 along with this work; if not, write to the Free Software Foundation, 35.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 35.21 - * 35.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 35.23 - * or visit www.oracle.com if you need additional information or have any 35.24 - * questions. 35.25 - */ 35.26 - 35.27 -/* 35.28 - * @test 35.29 - * @bug 6985181 35.30 - * @summary Annotations lost from classfile 35.31 - */ 35.32 - 35.33 -import java.io.*; 35.34 -import java.util.*; 35.35 - 35.36 -public class T6985181 { 35.37 - public static void main(String... args) throws Exception{ 35.38 - new T6985181().run(); 35.39 - } 35.40 - 35.41 - public void run() throws Exception { 35.42 - String code = "@interface Simple { }\ninterface Test<@Simple T> { }"; 35.43 - 35.44 - File srcFile = writeFile("Test.java", code); 35.45 - File classesDir = new File("classes"); 35.46 - classesDir.mkdirs(); 35.47 - compile("-d", classesDir.getPath(), srcFile.getPath()); 35.48 - String out = javap(new File(classesDir, srcFile.getName().replace(".java", ".class"))); 35.49 - if (!out.contains("RuntimeInvisibleTypeAnnotations")) 35.50 - throw new Exception("RuntimeInvisibleTypeAnnotations not found"); 35.51 - } 35.52 - 35.53 - void compile(String... args) throws Exception { 35.54 - StringWriter sw = new StringWriter(); 35.55 - PrintWriter pw = new PrintWriter(sw); 35.56 - int rc = com.sun.tools.javac.Main.compile(args, pw); 35.57 - pw.close(); 35.58 - String out = sw.toString(); 35.59 - if (out.length() > 0) 35.60 - System.err.println(out); 35.61 - if (rc != 0) 35.62 - throw new Exception("Compilation failed: rc=" + rc); 35.63 - } 35.64 - 35.65 - String javap(File classFile) throws Exception { 35.66 - StringWriter sw = new StringWriter(); 35.67 - PrintWriter pw = new PrintWriter(sw); 35.68 - String[] args = { "-v", classFile.getPath() }; 35.69 - int rc = com.sun.tools.javap.Main.run(args, pw); 35.70 - pw.close(); 35.71 - String out = sw.toString(); 35.72 - if (out.length() > 0) 35.73 - System.err.println(out); 35.74 - if (rc != 0) 35.75 - throw new Exception("javap failed: rc=" + rc); 35.76 - return out; 35.77 - } 35.78 - 35.79 - File writeFile(String path, String body) throws IOException { 35.80 - File f = new File(path); 35.81 - FileWriter out = new FileWriter(f); 35.82 - try { 35.83 - out.write(body); 35.84 - } finally { 35.85 - out.close(); 35.86 - } 35.87 - return f; 35.88 - } 35.89 -}
36.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 36.2 +++ b/test/tools/javac/T6993301.java Tue Nov 09 22:54:48 2010 -0800 36.3 @@ -0,0 +1,105 @@ 36.4 +/* 36.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 36.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 36.7 + * 36.8 + * This code is free software; you can redistribute it and/or modify it 36.9 + * under the terms of the GNU General Public License version 2 only, as 36.10 + * published by the Free Software Foundation. 36.11 + * 36.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 36.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 36.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 36.15 + * version 2 for more details (a copy is included in the LICENSE file that 36.16 + * accompanied this code). 36.17 + * 36.18 + * You should have received a copy of the GNU General Public License version 36.19 + * 2 along with this work; if not, write to the Free Software Foundation, 36.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 36.21 + * 36.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 36.23 + * or visit www.oracle.com if you need additional information or have any 36.24 + * questions. 36.25 + */ 36.26 + 36.27 +/* 36.28 + * @test 36.29 + * @bug 6993301 36.30 + * @summary catch parameters do not have correct kind (i.e. ElementKind.EXCEPTION_PARAMETER) 36.31 + */ 36.32 + 36.33 +import com.sun.source.tree.CompilationUnitTree; 36.34 +import com.sun.source.tree.IdentifierTree; 36.35 +import com.sun.source.tree.VariableTree; 36.36 +import com.sun.source.util.TreePathScanner; 36.37 +import com.sun.source.util.Trees; 36.38 +import com.sun.tools.javac.api.JavacTaskImpl; 36.39 +import java.io.IOException; 36.40 +import java.net.URI; 36.41 +import java.util.Arrays; 36.42 +import javax.lang.model.element.Element; 36.43 +import javax.lang.model.element.ElementKind; 36.44 +import javax.tools.JavaCompiler; 36.45 +import javax.tools.JavaFileObject; 36.46 +import javax.tools.SimpleJavaFileObject; 36.47 +import javax.tools.ToolProvider; 36.48 + 36.49 +/** 36.50 + * 36.51 + * @author Jan Lahoda 36.52 + */ 36.53 +public class T6993301 { 36.54 + public static void main(String... args) throws Exception { 36.55 + new T6993301().testExceptionParameterCorrectKind(); 36.56 + } 36.57 + 36.58 + static class MyFileObject extends SimpleJavaFileObject { 36.59 + private String text; 36.60 + public MyFileObject(String text) { 36.61 + super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); 36.62 + this.text = text; 36.63 + } 36.64 + @Override 36.65 + public CharSequence getCharContent(boolean ignoreEncodingErrors) { 36.66 + return text; 36.67 + } 36.68 + } 36.69 + 36.70 + public void testExceptionParameterCorrectKind() throws IOException { 36.71 + final String bootPath = System.getProperty("sun.boot.class.path"); 36.72 + final JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); 36.73 + assert tool != null; 36.74 + 36.75 + String code = "package test; public class Test { { try { } catch (NullPointerException ex) {} } }"; 36.76 + 36.77 + final JavacTaskImpl ct = (JavacTaskImpl)tool.getTask(null, null, null, 36.78 + Arrays.asList("-bootclasspath", bootPath), 36.79 + null, Arrays.asList(new MyFileObject(code))); 36.80 + CompilationUnitTree cut = ct.parse().iterator().next(); 36.81 + 36.82 + ct.analyze(); 36.83 + 36.84 + new TreePathScanner<Void, Void>() { 36.85 + @Override 36.86 + public Void visitVariable(VariableTree node, Void p) { 36.87 + Element el = Trees.instance(ct).getElement(getCurrentPath()); 36.88 + 36.89 + assertNotNull(el); 36.90 + assertEquals(ElementKind.EXCEPTION_PARAMETER, el.getKind()); 36.91 + 36.92 + return super.visitVariable(node, p); 36.93 + } 36.94 + }.scan(cut, null); 36.95 + } 36.96 + 36.97 + private void assertNotNull(Object o) { 36.98 + if (o == null) 36.99 + throw new AssertionError(); 36.100 + } 36.101 + 36.102 + private <T> void assertEquals(T expected, T actual) { 36.103 + if (expected == null ? actual == null : expected.equals(actual)) 36.104 + return; 36.105 + throw new AssertionError("expected: " + expected + ", actual: " + actual); 36.106 + } 36.107 + 36.108 +}
37.1 --- a/test/tools/javac/annotations/6881115/T6881115.java Thu Nov 04 15:54:46 2010 -0700 37.2 +++ b/test/tools/javac/annotations/6881115/T6881115.java Tue Nov 09 22:54:48 2010 -0800 37.3 @@ -16,5 +16,5 @@ 37.4 } 37.5 @A(b = @B(b2 = 1, b2 = 2), 37.6 b_arr = {@B(), @B(b2 = 1, b2 = 2)}) 37.7 -class T6881115<@A(b = @B(b2 = 1, b2 = 2), 37.8 - b_arr = {@B(), @B(b2 = 1, b2 = 2)}) X> {} 37.9 +class T6881115</*308 @A(b = @B(b2 = 1, b2 = 2), 37.10 + b_arr = {@B(), @B(b2 = 1, b2 = 2)})*/ X> {}
38.1 --- a/test/tools/javac/annotations/6881115/T6881115.out Thu Nov 04 15:54:46 2010 -0700 38.2 +++ b/test/tools/javac/annotations/6881115/T6881115.out Tue Nov 09 22:54:48 2010 -0800 38.3 @@ -8,9 +8,4 @@ 38.4 T6881115.java:18:13: compiler.err.annotation.missing.default.value.1: B, b1,b2 38.5 T6881115.java:18:30: compiler.err.duplicate.annotation.member.value: b2, B 38.6 T6881115.java:18:19: compiler.err.annotation.missing.default.value: B, b1 38.7 -T6881115.java:19:34: compiler.err.duplicate.annotation.member.value: b2, B 38.8 -T6881115.java:19:23: compiler.err.annotation.missing.default.value: B, b1 38.9 -T6881115.java:20:28: compiler.err.annotation.missing.default.value.1: B, b1,b2 38.10 -T6881115.java:20:45: compiler.err.duplicate.annotation.member.value: b2, B 38.11 -T6881115.java:20:34: compiler.err.annotation.missing.default.value: B, b1 38.12 -15 errors 38.13 +10 errors
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 39.2 +++ b/test/tools/javac/diags/examples/DiamondRedundantArgs.java Tue Nov 09 22:54:48 2010 -0800 39.3 @@ -0,0 +1,29 @@ 39.4 +/* 39.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 39.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 39.7 + * 39.8 + * This code is free software; you can redistribute it and/or modify it 39.9 + * under the terms of the GNU General Public License version 2 only, as 39.10 + * published by the Free Software Foundation. 39.11 + * 39.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 39.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 39.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 39.15 + * version 2 for more details (a copy is included in the LICENSE file that 39.16 + * accompanied this code). 39.17 + * 39.18 + * You should have received a copy of the GNU General Public License version 39.19 + * 2 along with this work; if not, write to the Free Software Foundation, 39.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 39.21 + * 39.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 39.23 + * or visit www.oracle.com if you need additional information or have any 39.24 + * questions. 39.25 + */ 39.26 + 39.27 +// key: compiler.warn.diamond.redundant.args 39.28 +// options: -XDfindDiamond 39.29 + 39.30 +class Foo<X> { 39.31 + Foo<String> fs = new Foo<String>(); 39.32 +}
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 40.2 +++ b/test/tools/javac/diags/examples/DiamondRedundantArgs1.java Tue Nov 09 22:54:48 2010 -0800 40.3 @@ -0,0 +1,29 @@ 40.4 +/* 40.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 40.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 40.7 + * 40.8 + * This code is free software; you can redistribute it and/or modify it 40.9 + * under the terms of the GNU General Public License version 2 only, as 40.10 + * published by the Free Software Foundation. 40.11 + * 40.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 40.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 40.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 40.15 + * version 2 for more details (a copy is included in the LICENSE file that 40.16 + * accompanied this code). 40.17 + * 40.18 + * You should have received a copy of the GNU General Public License version 40.19 + * 2 along with this work; if not, write to the Free Software Foundation, 40.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 40.21 + * 40.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 40.23 + * or visit www.oracle.com if you need additional information or have any 40.24 + * questions. 40.25 + */ 40.26 + 40.27 +// key: compiler.warn.diamond.redundant.args.1 40.28 +// options: -XDfindDiamond 40.29 + 40.30 +class Foo<X> { 40.31 + Foo<?> fs = new Foo<String>(); 40.32 +}
41.1 --- a/test/tools/javac/diags/examples/TypeAnnotationsNotSupported.java Thu Nov 04 15:54:46 2010 -0700 41.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 41.3 @@ -1,33 +0,0 @@ 41.4 -/* 41.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 41.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41.7 - * 41.8 - * This code is free software; you can redistribute it and/or modify it 41.9 - * under the terms of the GNU General Public License version 2 only, as 41.10 - * published by the Free Software Foundation. 41.11 - * 41.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 41.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 41.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 41.15 - * version 2 for more details (a copy is included in the LICENSE file that 41.16 - * accompanied this code). 41.17 - * 41.18 - * You should have received a copy of the GNU General Public License version 41.19 - * 2 along with this work; if not, write to the Free Software Foundation, 41.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 41.21 - * 41.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 41.23 - * or visit www.oracle.com if you need additional information or have any 41.24 - * questions. 41.25 - */ 41.26 - 41.27 -// key: compiler.err.type.annotations.not.supported.in.source 41.28 -// options: -source 6 41.29 - 41.30 -@interface Anno { } 41.31 - 41.32 -class TypeAnnotationsNotSupported { 41.33 - void m() { 41.34 - int i = (@Anno int) 3.14; 41.35 - } 41.36 -}
42.1 --- a/test/tools/javac/generics/OverrideBridge.java Thu Nov 04 15:54:46 2010 -0700 42.2 +++ b/test/tools/javac/generics/OverrideBridge.java Tue Nov 09 22:54:48 2010 -0800 42.3 @@ -23,7 +23,8 @@ 42.4 42.5 /* 42.6 * @test 42.7 - * @bug 6337171 42.8 + * @bug 6337171 6996415 42.9 + * @ignore fix has been disabled as a consequence of 6996415 42.10 * @summary javac should create bridge methods when type variable bounds restricted 42.11 * @run main OverrideBridge 42.12 */
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 43.2 +++ b/test/tools/javac/generics/diamond/T6939780.java Tue Nov 09 22:54:48 2010 -0800 43.3 @@ -0,0 +1,25 @@ 43.4 +/* 43.5 + * @test /nodynamiccopyright/ 43.6 + * @bug 6939780 43.7 + * 43.8 + * @summary add a warning to detect diamond sites 43.9 + * @author mcimadamore 43.10 + * @compile/ref=T6939780.out T6939780.java -XDrawDiagnostics -XDfindDiamond 43.11 + * 43.12 + */ 43.13 + 43.14 +class T6939780 { 43.15 + 43.16 + void test() { 43.17 + class Foo<X extends Number> { 43.18 + Foo() {} 43.19 + Foo(X x) {} 43.20 + } 43.21 + Foo<Number> f1 = new Foo<Number>(1); 43.22 + Foo<?> f2 = new Foo<Number>(); 43.23 + Foo<?> f3 = new Foo<Integer>(); 43.24 + Foo<Number> f4 = new Foo<Number>(1) {}; 43.25 + Foo<?> f5 = new Foo<Number>() {}; 43.26 + Foo<?> f6 = new Foo<Integer>() {}; 43.27 + } 43.28 +}
44.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 44.2 +++ b/test/tools/javac/generics/diamond/T6939780.out Tue Nov 09 22:54:48 2010 -0800 44.3 @@ -0,0 +1,5 @@ 44.4 +T6939780.java:19:28: compiler.warn.diamond.redundant.args: Foo<java.lang.Number>, Foo<java.lang.Number> 44.5 +T6939780.java:20:28: compiler.warn.diamond.redundant.args.1: Foo<java.lang.Integer>, Foo<java.lang.Number> 44.6 +T6939780.java:22:28: compiler.warn.diamond.redundant.args: Foo<java.lang.Number>, Foo<java.lang.Number> 44.7 +T6939780.java:23:28: compiler.warn.diamond.redundant.args.1: Foo<java.lang.Integer>, Foo<java.lang.Number> 44.8 +4 warnings
45.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 45.2 +++ b/test/tools/javac/processing/6994946/SemanticErrorTest.1.out Tue Nov 09 22:54:48 2010 -0800 45.3 @@ -0,0 +1,2 @@ 45.4 +SemanticErrorTest.java:11:46: compiler.err.repeated.interface 45.5 +1 error
46.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 46.2 +++ b/test/tools/javac/processing/6994946/SemanticErrorTest.2.out Tue Nov 09 22:54:48 2010 -0800 46.3 @@ -0,0 +1,4 @@ 46.4 +SemanticErrorTest.java:11:46: compiler.err.repeated.interface 46.5 +- compiler.err.proc.messager: Deliberate Error 46.6 +SemanticErrorTest.java:11:46: compiler.err.repeated.interface 46.7 +1 error
47.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 47.2 +++ b/test/tools/javac/processing/6994946/SemanticErrorTest.java Tue Nov 09 22:54:48 2010 -0800 47.3 @@ -0,0 +1,13 @@ 47.4 +/* 47.5 + * @test /nodynamiccopyright/ 47.6 + * @bug 6994946 47.7 + * @summary option to specify only syntax errors as unrecoverable 47.8 + * @library ../../lib 47.9 + * @build JavacTestingAbstractProcessor TestProcessor 47.10 + * @compile/fail/ref=SemanticErrorTest.1.out -XDrawDiagnostics -processor TestProcessor SemanticErrorTest.java 47.11 + * @compile/fail/ref=SemanticErrorTest.2.out -XDrawDiagnostics -XDonlySyntaxErrorsUnrecoverable -processor TestProcessor SemanticErrorTest.java 47.12 + */ 47.13 + 47.14 +class SemanticErrorTest implements Runnable, Runnable { 47.15 + public void run() { } 47.16 +}
48.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 48.2 +++ b/test/tools/javac/processing/6994946/SyntaxErrorTest.java Tue Nov 09 22:54:48 2010 -0800 48.3 @@ -0,0 +1,13 @@ 48.4 +/* 48.5 + * @test /nodynamiccopyright/ 48.6 + * @bug 6994946 48.7 + * @summary option to specify only syntax errors as unrecoverable 48.8 + * @library ../../lib 48.9 + * @build JavacTestingAbstractProcessor TestProcessor 48.10 + * @compile/fail/ref=SyntaxErrorTest.out -XDrawDiagnostics -processor TestProcessor SyntaxErrorTest.java 48.11 + * @compile/fail/ref=SyntaxErrorTest.out -XDrawDiagnostics -XDonlySyntaxErrorsUnrecoverable -processor TestProcessor SyntaxErrorTest.java 48.12 + */ 48.13 + 48.14 +class SyntaxErrorTest { 48.15 + int i 48.16 +}
49.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 49.2 +++ b/test/tools/javac/processing/6994946/SyntaxErrorTest.out Tue Nov 09 22:54:48 2010 -0800 49.3 @@ -0,0 +1,2 @@ 49.4 +SyntaxErrorTest.java:12:10: compiler.err.expected: ';' 49.5 +1 error
50.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 50.2 +++ b/test/tools/javac/processing/6994946/TestProcessor.java Tue Nov 09 22:54:48 2010 -0800 50.3 @@ -0,0 +1,40 @@ 50.4 +/* 50.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 50.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 50.7 + * 50.8 + * This code is free software; you can redistribute it and/or modify it 50.9 + * under the terms of the GNU General Public License version 2 only, as 50.10 + * published by the Free Software Foundation. 50.11 + * 50.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 50.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 50.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 50.15 + * version 2 for more details (a copy is included in the LICENSE file that 50.16 + * accompanied this code). 50.17 + * 50.18 + * You should have received a copy of the GNU General Public License version 50.19 + * 2 along with this work; if not, write to the Free Software Foundation, 50.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 50.21 + * 50.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 50.23 + * or visit www.oracle.com if you need additional information or have any 50.24 + * questions. 50.25 + */ 50.26 + 50.27 +import java.util.*; 50.28 +import javax.annotation.processing.*; 50.29 +import javax.lang.model.*; 50.30 +import javax.lang.model.element.*; 50.31 +import static javax.tools.Diagnostic.Kind.*; 50.32 + 50.33 +public class TestProcessor extends JavacTestingAbstractProcessor { 50.34 + private int round = 0; 50.35 + 50.36 + public boolean process(Set<? extends TypeElement> annotations, 50.37 + RoundEnvironment roundEnv) { 50.38 + if (++round == 1) 50.39 + messager.printMessage(ERROR, "Deliberate Error"); 50.40 + return false; 50.41 + } 50.42 +} 50.43 +
51.1 --- a/test/tools/javac/processing/model/element/TestAnonClassNames.java Thu Nov 04 15:54:46 2010 -0700 51.2 +++ b/test/tools/javac/processing/model/element/TestAnonClassNames.java Tue Nov 09 22:54:48 2010 -0800 51.3 @@ -78,7 +78,7 @@ 51.4 @Nesting(LOCAL) 51.5 class LocalClass{}; 51.6 51.7 - Object o = new @Nesting(ANONYMOUS) Object() { // An anonymous annotated class 51.8 + Object o = new /*@Nesting(ANONYMOUS)*/ Object() { // An anonymous annotated class 51.9 public String toString() { 51.10 return "I have no name!"; 51.11 } 51.12 @@ -95,9 +95,10 @@ 51.13 51.14 for(Class<?> clazz : classes) { 51.15 String name = clazz.getName(); 51.16 + Nesting anno = clazz.getAnnotation(Nesting.class); 51.17 System.out.format("%s is %s%n", 51.18 clazz.getName(), 51.19 - clazz.getAnnotation(Nesting.class).value()); 51.20 + anno == null ? "(unset/ANONYMOUS)" : anno.value()); 51.21 testClassName(name); 51.22 } 51.23 } 51.24 @@ -161,8 +162,8 @@ 51.25 typeElt.getQualifiedName().toString(), 51.26 typeElt.getKind().toString(), 51.27 nestingKind.toString()); 51.28 - 51.29 - if (typeElt.getAnnotation(Nesting.class).value() != nestingKind) { 51.30 + Nesting anno = typeElt.getAnnotation(Nesting.class); 51.31 + if ((anno == null ? NestingKind.ANONYMOUS : anno.value()) != nestingKind) { 51.32 throw new RuntimeException("Mismatch of expected and reported nesting kind."); 51.33 } 51.34 }
52.1 --- a/test/tools/javac/tree/TreePosTest.java Thu Nov 04 15:54:46 2010 -0700 52.2 +++ b/test/tools/javac/tree/TreePosTest.java Tue Nov 09 22:54:48 2010 -0800 52.3 @@ -357,7 +357,9 @@ 52.4 check("encl.start <= start", encl, self, encl.start <= self.start); 52.5 check("start <= pos", encl, self, self.start <= self.pos); 52.6 if (!(self.tag == JCTree.TYPEARRAY 52.7 - && (encl.tag == JCTree.VARDEF || encl.tag == JCTree.TYPEARRAY))) { 52.8 + && (encl.tag == JCTree.VARDEF || 52.9 + encl.tag == JCTree.METHODDEF || 52.10 + encl.tag == JCTree.TYPEARRAY))) { 52.11 check("encl.pos <= start || end <= encl.pos", 52.12 encl, self, encl.pos <= self.start || self.end <= encl.pos); 52.13 }
53.1 --- a/test/tools/javac/treeannotests/AnnoTreeTests.java Thu Nov 04 15:54:46 2010 -0700 53.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 53.3 @@ -1,44 +0,0 @@ 53.4 -/* 53.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 53.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 53.7 - * 53.8 - * This code is free software; you can redistribute it and/or modify it 53.9 - * under the terms of the GNU General Public License version 2 only, as 53.10 - * published by the Free Software Foundation. 53.11 - * 53.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 53.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 53.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 53.15 - * version 2 for more details (a copy is included in the LICENSE file that 53.16 - * accompanied this code). 53.17 - * 53.18 - * You should have received a copy of the GNU General Public License version 53.19 - * 2 along with this work; if not, write to the Free Software Foundation, 53.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 53.21 - * 53.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 53.23 - * or visit www.oracle.com if you need additional information or have any 53.24 - * questions. 53.25 - */ 53.26 - 53.27 -/* 53.28 - * @test 53.29 - * @build DA TA Test TestProcessor 53.30 - * @compile -proc:only -processor TestProcessor AnnoTreeTests.java 53.31 - */ 53.32 - 53.33 -@Test(6) 53.34 -class AnnoTreeTests { 53.35 - // primitive types 53.36 - @DA("int") int i1; 53.37 - int i2 = (@TA("int") int) 0; 53.38 - 53.39 - // simple array types 53.40 - @DA("int[]") int[] a1; 53.41 - int @TA("int") [] a2; 53.42 - int[] a3 = (@TA("int[]") int[]) a1; 53.43 - int[] a4 = (int @TA("int") []) a1; 53.44 - 53.45 - // multi-dimensional array types 53.46 - // (still to come) 53.47 -}
54.1 --- a/test/tools/javac/typeAnnotations/6967002/T6967002.java Thu Nov 04 15:54:46 2010 -0700 54.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 54.3 @@ -1,35 +0,0 @@ 54.4 -/* 54.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 54.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 54.7 - * 54.8 - * This code is free software; you can redistribute it and/or modify it 54.9 - * under the terms of the GNU General Public License version 2 only, as 54.10 - * published by the Free Software Foundation. 54.11 - * 54.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 54.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 54.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 54.15 - * version 2 for more details (a copy is included in the LICENSE file that 54.16 - * accompanied this code). 54.17 - * 54.18 - * You should have received a copy of the GNU General Public License version 54.19 - * 2 along with this work; if not, write to the Free Software Foundation, 54.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 54.21 - * 54.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 54.23 - * or visit www.oracle.com if you need additional information or have any 54.24 - * questions. 54.25 - */ 54.26 - 54.27 -/* 54.28 - * @test 54.29 - * @bug 6967002 54.30 - * @summary JDK7 b99 javac compilation error (java.lang.AssertionError) 54.31 - * @author Maurizio Cimadamore 54.32 - * @compile/fail/ref=T6967002.out -XDrawDiagnostics T6967002.java 54.33 - */ 54.34 -class Test { 54.35 - private static void m(byte[] octets) { 54.36 - return m(octets..., ?); 54.37 - } 54.38 -}
55.1 --- a/test/tools/javac/typeAnnotations/6967002/T6967002.out Thu Nov 04 15:54:46 2010 -0700 55.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 55.3 @@ -1,8 +0,0 @@ 55.4 -T6967002.java:33:22: compiler.err.expected: ')' 55.5 -T6967002.java:33:25: compiler.err.illegal.start.of.expr 55.6 -T6967002.java:33:28: compiler.err.illegal.start.of.expr 55.7 -T6967002.java:33:29: compiler.err.illegal.start.of.expr 55.8 -T6967002.java:33:27: compiler.err.not.stmt 55.9 -T6967002.java:33:30: compiler.err.expected: ';' 55.10 -T6967002.java:35:2: compiler.err.premature.eof 55.11 -7 errors
56.1 --- a/test/tools/javac/typeAnnotations/InnerClass.java Thu Nov 04 15:54:46 2010 -0700 56.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 56.3 @@ -1,59 +0,0 @@ 56.4 -/* 56.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 56.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 56.7 - * 56.8 - * This code is free software; you can redistribute it and/or modify it 56.9 - * under the terms of the GNU General Public License version 2 only, as 56.10 - * published by the Free Software Foundation. 56.11 - * 56.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 56.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 56.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 56.15 - * version 2 for more details (a copy is included in the LICENSE file that 56.16 - * accompanied this code). 56.17 - * 56.18 - * You should have received a copy of the GNU General Public License version 56.19 - * 2 along with this work; if not, write to the Free Software Foundation, 56.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 56.21 - * 56.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 56.23 - * or visit www.oracle.com if you need additional information or have any 56.24 - * questions. 56.25 - */ 56.26 - 56.27 -/* 56.28 - * @test 56.29 - * @bug 6843077 56.30 - * @summary compiler crashes when visiting inner classes 56.31 - * @author Mahmood Ali 56.32 - * @compile -source 1.7 InnerClass.java 56.33 - */ 56.34 - 56.35 -class InnerClass { 56.36 - 56.37 - InnerClass() {} 56.38 - InnerClass(Object o) {} 56.39 - 56.40 - private void a() { 56.41 - new Object() { 56.42 - public <R> void method() { } 56.43 - }; 56.44 - } 56.45 - 56.46 - Object f1 = new InnerClass() { 56.47 - <R> void method() { } 56.48 - }; 56.49 - 56.50 - Object f2 = new InnerClass() { 56.51 - <@A R> void method() { } 56.52 - }; 56.53 - 56.54 - Object f3 = new InnerClass(null) { 56.55 - <R> void method() { } 56.56 - }; 56.57 - 56.58 - Object f4 = new InnerClass(null) { 56.59 - <@A R> void method() { } 56.60 - }; 56.61 - @interface A { } 56.62 -}
57.1 --- a/test/tools/javac/typeAnnotations/MultipleTargets.java Thu Nov 04 15:54:46 2010 -0700 57.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 57.3 @@ -1,41 +0,0 @@ 57.4 -/* 57.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 57.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 57.7 - * 57.8 - * This code is free software; you can redistribute it and/or modify it 57.9 - * under the terms of the GNU General Public License version 2 only, as 57.10 - * published by the Free Software Foundation. 57.11 - * 57.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 57.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 57.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 57.15 - * version 2 for more details (a copy is included in the LICENSE file that 57.16 - * accompanied this code). 57.17 - * 57.18 - * You should have received a copy of the GNU General Public License version 57.19 - * 2 along with this work; if not, write to the Free Software Foundation, 57.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 57.21 - * 57.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 57.23 - * or visit www.oracle.com if you need additional information or have any 57.24 - * questions. 57.25 - */ 57.26 - 57.27 -/* 57.28 - * @test 57.29 - * @bug 6843077 57.30 - * @summary check that type annotations may appear on void method if it is a 57.31 - * method annotation too. 57.32 - * @author Mahmood Ali 57.33 - * @compile -source 1.7 MultipleTargets.java 57.34 - */ 57.35 - 57.36 -import java.lang.annotation.Target; 57.37 -import java.lang.annotation.ElementType; 57.38 - 57.39 -class TypeUseTarget<K extends @A Object> { 57.40 - @A void voidMethod() { } 57.41 -} 57.42 - 57.43 -@Target({ElementType.TYPE_USE, ElementType.METHOD}) 57.44 -@interface A { }
58.1 --- a/test/tools/javac/typeAnnotations/TypeParameterTarget.java Thu Nov 04 15:54:46 2010 -0700 58.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 58.3 @@ -1,46 +0,0 @@ 58.4 -/* 58.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 58.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 58.7 - * 58.8 - * This code is free software; you can redistribute it and/or modify it 58.9 - * under the terms of the GNU General Public License version 2 only, as 58.10 - * published by the Free Software Foundation. 58.11 - * 58.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 58.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 58.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 58.15 - * version 2 for more details (a copy is included in the LICENSE file that 58.16 - * accompanied this code). 58.17 - * 58.18 - * You should have received a copy of the GNU General Public License version 58.19 - * 2 along with this work; if not, write to the Free Software Foundation, 58.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 58.21 - * 58.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 58.23 - * or visit www.oracle.com if you need additional information or have any 58.24 - * questions. 58.25 - */ 58.26 - 58.27 -/* 58.28 - * @test 58.29 - * @bug 6843077 58.30 - * @summary check that type annotations may appear on all type parameter 58.31 - * @author Mahmood Ali 58.32 - * @compile -source 1.7 TypeParameterTarget.java 58.33 - */ 58.34 - 58.35 -import java.lang.annotation.Target; 58.36 -import java.lang.annotation.ElementType; 58.37 - 58.38 -class TypeUseTarget<@A K extends Object> { 58.39 - String[] field; 58.40 - 58.41 - <@A K, @A V> String genericMethod(K k) { return null; } 58.42 -} 58.43 - 58.44 -interface MyInterface { } 58.45 - 58.46 -@interface MyAnnotation { } 58.47 - 58.48 -@Target(ElementType.TYPE_PARAMETER) 58.49 -@interface A { }
59.1 --- a/test/tools/javac/typeAnnotations/TypeUseTarget.java Thu Nov 04 15:54:46 2010 -0700 59.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 59.3 @@ -1,55 +0,0 @@ 59.4 -/* 59.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 59.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 59.7 - * 59.8 - * This code is free software; you can redistribute it and/or modify it 59.9 - * under the terms of the GNU General Public License version 2 only, as 59.10 - * published by the Free Software Foundation. 59.11 - * 59.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 59.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 59.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 59.15 - * version 2 for more details (a copy is included in the LICENSE file that 59.16 - * accompanied this code). 59.17 - * 59.18 - * You should have received a copy of the GNU General Public License version 59.19 - * 2 along with this work; if not, write to the Free Software Foundation, 59.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 59.21 - * 59.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 59.23 - * or visit www.oracle.com if you need additional information or have any 59.24 - * questions. 59.25 - */ 59.26 - 59.27 -/* 59.28 - * @test 59.29 - * @bug 6843077 59.30 - * @summary check that type annotations may appear on all type declarations 59.31 - * @author Mahmood Ali 59.32 - * @compile -source 1.7 TypeUseTarget.java 59.33 - */ 59.34 - 59.35 -import java.lang.annotation.Target; 59.36 -import java.lang.annotation.ElementType; 59.37 - 59.38 -@A 59.39 -class TypeUseTarget<K extends @A Object> { 59.40 - @A String @A [] field; 59.41 - 59.42 - @A String test(@A String param, @A String @A ... vararg) @A { 59.43 - @A Object o = new @A String @A [3]; 59.44 - TypeUseTarget<@A String> target; 59.45 - return (@A String) null; 59.46 - } 59.47 - 59.48 - <K> @A String genericMethod(K k) { return null; } 59.49 -} 59.50 - 59.51 -@A 59.52 -interface MyInterface { } 59.53 - 59.54 -@A 59.55 -@interface MyAnnotation { } 59.56 - 59.57 -@Target(ElementType.TYPE_USE) 59.58 -@interface A { }
60.1 --- a/test/tools/javac/typeAnnotations/attribution/Scopes.java Thu Nov 04 15:54:46 2010 -0700 60.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 60.3 @@ -1,38 +0,0 @@ 60.4 -/* 60.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 60.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 60.7 - * 60.8 - * This code is free software; you can redistribute it and/or modify it 60.9 - * under the terms of the GNU General Public License version 2 only, as 60.10 - * published by the Free Software Foundation. 60.11 - * 60.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 60.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 60.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 60.15 - * version 2 for more details (a copy is included in the LICENSE file that 60.16 - * accompanied this code). 60.17 - * 60.18 - * You should have received a copy of the GNU General Public License version 60.19 - * 2 along with this work; if not, write to the Free Software Foundation, 60.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 60.21 - * 60.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 60.23 - * or visit www.oracle.com if you need additional information or have any 60.24 - * questions. 60.25 - */ 60.26 - 60.27 -/* 60.28 - * @test 60.29 - * @bug 6843077 60.30 - * @summary test scopes of attribution 60.31 - * @author Mahmood Ali 60.32 - * @compile -source 1.7 Scopes.java 60.33 - */ 60.34 -class Scopes { 60.35 - 60.36 - void test() @A(VALUE) { } 60.37 - void test1() @A(value=VALUE) { } 60.38 - 60.39 - private static final int VALUE = 1; 60.40 - @interface A { int value(); } 60.41 -}
61.1 --- a/test/tools/javac/typeAnnotations/classfile/DeadCode.java Thu Nov 04 15:54:46 2010 -0700 61.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 61.3 @@ -1,181 +0,0 @@ 61.4 -/* 61.5 - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 61.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 61.7 - * 61.8 - * This code is free software; you can redistribute it and/or modify it 61.9 - * under the terms of the GNU General Public License version 2 only, as 61.10 - * published by the Free Software Foundation. 61.11 - * 61.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 61.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 61.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 61.15 - * version 2 for more details (a copy is included in the LICENSE file that 61.16 - * accompanied this code). 61.17 - * 61.18 - * You should have received a copy of the GNU General Public License version 61.19 - * 2 along with this work; if not, write to the Free Software Foundation, 61.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 61.21 - * 61.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 61.23 - * or visit www.oracle.com if you need additional information or have any 61.24 - * questions. 61.25 - */ 61.26 - 61.27 -import java.io.*; 61.28 -import java.net.URL; 61.29 -import java.util.List; 61.30 - 61.31 -import com.sun.tools.classfile.*; 61.32 - 61.33 -/* 61.34 - * @test 61.35 - * @bug 6917130 61.36 - * @summary test that optimized away annotations are not emited to classfile 61.37 - */ 61.38 - 61.39 -public class DeadCode { 61.40 - public static void main(String[] args) throws Exception { 61.41 - new DeadCode().run(); 61.42 - } 61.43 - 61.44 - public void run() throws Exception { 61.45 - ClassFile cf = getClassFile("DeadCode$Test.class"); 61.46 - test(cf); 61.47 - for (Field f : cf.fields) { 61.48 - test(cf, f); 61.49 - } 61.50 - for (Method m: cf.methods) { 61.51 - test(cf, m); 61.52 - } 61.53 - 61.54 - countAnnotations(); 61.55 - 61.56 - if (errors > 0) 61.57 - throw new Exception(errors + " errors found"); 61.58 - System.out.println("PASSED"); 61.59 - } 61.60 - 61.61 - ClassFile getClassFile(String name) throws IOException, ConstantPoolException { 61.62 - URL url = getClass().getResource(name); 61.63 - InputStream in = url.openStream(); 61.64 - try { 61.65 - return ClassFile.read(in); 61.66 - } finally { 61.67 - in.close(); 61.68 - } 61.69 - } 61.70 - 61.71 - /************ Helper annotations counting methods ******************/ 61.72 - void test(ClassFile cf) { 61.73 - test(cf, Attribute.RuntimeVisibleTypeAnnotations, true); 61.74 - test(cf, Attribute.RuntimeInvisibleTypeAnnotations, false); 61.75 - } 61.76 - 61.77 - void test(ClassFile cf, Method m) { 61.78 - test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true); 61.79 - test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false); 61.80 - } 61.81 - 61.82 - void test(ClassFile cf, Field m) { 61.83 - test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true); 61.84 - test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false); 61.85 - } 61.86 - 61.87 - // test the result of Attributes.getIndex according to expectations 61.88 - // encoded in the method's name 61.89 - void test(ClassFile cf, String name, boolean visible) { 61.90 - int index = cf.attributes.getIndex(cf.constant_pool, name); 61.91 - if (index != -1) { 61.92 - Attribute attr = cf.attributes.get(index); 61.93 - assert attr instanceof RuntimeTypeAnnotations_attribute; 61.94 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 61.95 - all += tAttr.annotations.length; 61.96 - if (visible) 61.97 - visibles += tAttr.annotations.length; 61.98 - else 61.99 - invisibles += tAttr.annotations.length; 61.100 - } 61.101 - } 61.102 - 61.103 - // test the result of Attributes.getIndex according to expectations 61.104 - // encoded in the method's name 61.105 - void test(ClassFile cf, Method m, String name, boolean visible) { 61.106 - int index = m.attributes.getIndex(cf.constant_pool, name); 61.107 - if (index != -1) { 61.108 - Attribute attr = m.attributes.get(index); 61.109 - assert attr instanceof RuntimeTypeAnnotations_attribute; 61.110 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 61.111 - all += tAttr.annotations.length; 61.112 - if (visible) 61.113 - visibles += tAttr.annotations.length; 61.114 - else 61.115 - invisibles += tAttr.annotations.length; 61.116 - } 61.117 - } 61.118 - 61.119 - // test the result of Attributes.getIndex according to expectations 61.120 - // encoded in the method's name 61.121 - void test(ClassFile cf, Field m, String name, boolean visible) { 61.122 - int index = m.attributes.getIndex(cf.constant_pool, name); 61.123 - if (index != -1) { 61.124 - Attribute attr = m.attributes.get(index); 61.125 - assert attr instanceof RuntimeTypeAnnotations_attribute; 61.126 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 61.127 - all += tAttr.annotations.length; 61.128 - if (visible) 61.129 - visibles += tAttr.annotations.length; 61.130 - else 61.131 - invisibles += tAttr.annotations.length; 61.132 - } 61.133 - } 61.134 - 61.135 - void countAnnotations() { 61.136 - int expected_all = expected_visibles + expected_invisibles; 61.137 - 61.138 - if (expected_all != all) { 61.139 - errors++; 61.140 - System.err.println("expected " + expected_all 61.141 - + " annotations but found " + all); 61.142 - } 61.143 - 61.144 - if (expected_visibles != visibles) { 61.145 - errors++; 61.146 - System.err.println("expected " + expected_visibles 61.147 - + " visibles annotations but found " + visibles); 61.148 - } 61.149 - 61.150 - if (expected_invisibles != invisibles) { 61.151 - errors++; 61.152 - System.err.println("expected " + expected_invisibles 61.153 - + " invisibles annotations but found " + invisibles); 61.154 - } 61.155 - 61.156 - } 61.157 - 61.158 - int errors; 61.159 - int all; 61.160 - int visibles; 61.161 - int invisibles; 61.162 - 61.163 - /*********************** Test class *************************/ 61.164 - static int expected_invisibles = 1; 61.165 - static int expected_visibles = 0; 61.166 - static class Test { 61.167 - @interface A {} 61.168 - 61.169 - void test() { 61.170 - List<? extends @A Object> o = null; 61.171 - o.toString(); 61.172 - 61.173 - @A String m; 61.174 - if (false) { 61.175 - @A String a; 61.176 - @A String b = "m"; 61.177 - b.toString(); 61.178 - List<? extends @A Object> c = null; 61.179 - c.toString(); 61.180 - } 61.181 - } 61.182 - } 61.183 - 61.184 -}
62.1 --- a/test/tools/javac/typeAnnotations/failures/AnnotationVersion.java Thu Nov 04 15:54:46 2010 -0700 62.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 62.3 @@ -1,12 +0,0 @@ 62.4 -/* 62.5 - * @test /nodynamiccopyright/ 62.6 - * @bug 6843077 62.7 - * @summary test that only java 7 allows type annotations 62.8 - * @author Mahmood Ali 62.9 - * @compile/fail/ref=AnnotationVersion.out -XDrawDiagnostics -source 1.6 AnnotationVersion.java 62.10 - */ 62.11 -class AnnotationVersion { 62.12 - public void method() @A { } 62.13 -} 62.14 - 62.15 -@interface A { }
63.1 --- a/test/tools/javac/typeAnnotations/failures/AnnotationVersion.out Thu Nov 04 15:54:46 2010 -0700 63.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 63.3 @@ -1,2 +0,0 @@ 63.4 -AnnotationVersion.java:9:25: compiler.err.type.annotations.not.supported.in.source: 1.6 63.5 -1 error
64.1 --- a/test/tools/javac/typeAnnotations/failures/IncompleteArray.java Thu Nov 04 15:54:46 2010 -0700 64.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 64.3 @@ -1,12 +0,0 @@ 64.4 -/* 64.5 - * @test /nodynamiccopyright/ 64.6 - * @bug 6843077 64.7 - * @summary test incomplete array declaration 64.8 - * @author Mahmood Ali 64.9 - * @compile/fail/ref=IncompleteArray.out -XDrawDiagnostics -source 1.7 IncompleteArray.java 64.10 - */ 64.11 -class IncompleteArray { 64.12 - int @A [] @A var; 64.13 -} 64.14 - 64.15 -@interface A { }
65.1 --- a/test/tools/javac/typeAnnotations/failures/IncompleteArray.out Thu Nov 04 15:54:46 2010 -0700 65.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 65.3 @@ -1,2 +0,0 @@ 65.4 -IncompleteArray.java:9:13: compiler.err.illegal.start.of.type 65.5 -1 error
66.1 --- a/test/tools/javac/typeAnnotations/failures/IncompleteVararg.java Thu Nov 04 15:54:46 2010 -0700 66.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 66.3 @@ -1,13 +0,0 @@ 66.4 -/* 66.5 - * @test /nodynamiccopyright/ 66.6 - * @bug 6843077 66.7 - * @summary test incomplete vararg declaration 66.8 - * @author Mahmood Ali 66.9 - * @compile/fail/ref=IncompleteVararg.out -XDrawDiagnostics -source 1.7 IncompleteVararg.java 66.10 - */ 66.11 -class IncompleteArray { 66.12 - // the last variable may be vararg 66.13 - void method(int @A test) { } 66.14 -} 66.15 - 66.16 -@interface A { }
67.1 --- a/test/tools/javac/typeAnnotations/failures/IncompleteVararg.out Thu Nov 04 15:54:46 2010 -0700 67.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 67.3 @@ -1,2 +0,0 @@ 67.4 -IncompleteVararg.java:10:19: compiler.err.illegal.start.of.type 67.5 -1 error
68.1 --- a/test/tools/javac/typeAnnotations/failures/IndexArray.java Thu Nov 04 15:54:46 2010 -0700 68.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 68.3 @@ -1,13 +0,0 @@ 68.4 -/* 68.5 - * @test /nodynamiccopyright/ 68.6 - * @bug 6843077 68.7 - * @summary test indexing of an array 68.8 - * @author Mahmood Ali 68.9 - * @compile/fail/ref=IndexArray.out -XDrawDiagnostics -source 1.7 IndexArray.java 68.10 - */ 68.11 -class IndexArray { 68.12 - int[] var; 68.13 - int a = var @A [1]; 68.14 -} 68.15 - 68.16 -@interface A { }
69.1 --- a/test/tools/javac/typeAnnotations/failures/IndexArray.out Thu Nov 04 15:54:46 2010 -0700 69.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 69.3 @@ -1,2 +0,0 @@ 69.4 -IndexArray.java:10:15: compiler.err.illegal.start.of.expr 69.5 -1 error
70.1 --- a/test/tools/javac/typeAnnotations/failures/LintCast.java Thu Nov 04 15:54:46 2010 -0700 70.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 70.3 @@ -1,42 +0,0 @@ 70.4 -import java.util.List; 70.5 - 70.6 -/* 70.7 - * @test /nodynamiccopyright/ 70.8 - * @bug 6843077 70.9 - * @summary test that compiler doesn't warn about annotated redundant casts 70.10 - * @author Mahmood Ali 70.11 - * @compile/ref=LintCast.out -Xlint:cast -XDrawDiagnostics -source 1.7 LintCast.java 70.12 - */ 70.13 -class LintCast { 70.14 - void unparameterized() { 70.15 - String s = "m"; 70.16 - String s1 = (String)s; 70.17 - String s2 = (@A String)s; 70.18 - } 70.19 - 70.20 - void parameterized() { 70.21 - List<String> l = null; 70.22 - List<String> l1 = (List<String>)l; 70.23 - List<String> l2 = (List<@A String>)l; 70.24 - } 70.25 - 70.26 - void array() { 70.27 - int @A [] a = null; 70.28 - int[] a1 = (int[])a; 70.29 - int[] a2 = (int @A [])a; 70.30 - } 70.31 - 70.32 - void sameAnnotations() { 70.33 - @A String annotated = null; 70.34 - String unannotated = null; 70.35 - 70.36 - // compiler ignore annotated casts even if redundant 70.37 - @A String anno1 = (@A String)annotated; 70.38 - 70.39 - // warn if redundant without an annotation 70.40 - String anno2 = (String)annotated; 70.41 - String unanno2 = (String)unannotated; 70.42 - } 70.43 -} 70.44 - 70.45 -@interface A { }
71.1 --- a/test/tools/javac/typeAnnotations/failures/LintCast.out Thu Nov 04 15:54:46 2010 -0700 71.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 71.3 @@ -1,6 +0,0 @@ 71.4 -LintCast.java:13:21: compiler.warn.redundant.cast: java.lang.String 71.5 -LintCast.java:19:27: compiler.warn.redundant.cast: java.util.List<java.lang.String> 71.6 -LintCast.java:25:20: compiler.warn.redundant.cast: int[] 71.7 -LintCast.java:37:24: compiler.warn.redundant.cast: java.lang.String 71.8 -LintCast.java:38:26: compiler.warn.redundant.cast: java.lang.String 71.9 -5 warnings
72.1 --- a/test/tools/javac/typeAnnotations/failures/OldArray.java Thu Nov 04 15:54:46 2010 -0700 72.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 72.3 @@ -1,35 +0,0 @@ 72.4 -/* 72.5 - * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. 72.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 72.7 - * 72.8 - * This code is free software; you can redistribute it and/or modify it 72.9 - * under the terms of the GNU General Public License version 2 only, as 72.10 - * published by the Free Software Foundation. 72.11 - * 72.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 72.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 72.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 72.15 - * version 2 for more details (a copy is included in the LICENSE file that 72.16 - * accompanied this code). 72.17 - * 72.18 - * You should have received a copy of the GNU General Public License version 72.19 - * 2 along with this work; if not, write to the Free Software Foundation, 72.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 72.21 - * 72.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 72.23 - * or visit www.oracle.com if you need additional information or have any 72.24 - * questions. 72.25 - */ 72.26 - 72.27 -/* 72.28 - * @test 72.29 - * @bug 6843077 72.30 - * @summary test old array syntax 72.31 - * @author Mahmood Ali 72.32 - * @compile/fail -XDrawDiagnostics -source 1.7 OldArray.java 72.33 - */ 72.34 -class OldArray { 72.35 - String [@A] s() { return null; } 72.36 -} 72.37 - 72.38 -@interface A { }
73.1 --- a/test/tools/javac/typeAnnotations/failures/Scopes.java Thu Nov 04 15:54:46 2010 -0700 73.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 73.3 @@ -1,10 +0,0 @@ 73.4 -/* 73.5 - * @test /nodynamiccopyright/ 73.6 - * @bug 6843077 73.7 - * @summary check that A is accessible in the class type parameters 73.8 - * @author Mahmood Ali 73.9 - * @compile/fail/ref=Scopes.out -XDrawDiagnostics -source 1.7 Scopes.java 73.10 - */ 73.11 -class Scopes<T extends @UniqueInner Object> { 73.12 - @interface UniqueInner { }; 73.13 -}
74.1 --- a/test/tools/javac/typeAnnotations/failures/Scopes.out Thu Nov 04 15:54:46 2010 -0700 74.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 74.3 @@ -1,2 +0,0 @@ 74.4 -Scopes.java:8:25: compiler.err.cant.resolve: kindname.class, UniqueInner, , 74.5 -1 error
75.1 --- a/test/tools/javac/typeAnnotations/failures/StaticFields.java Thu Nov 04 15:54:46 2010 -0700 75.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 75.3 @@ -1,13 +0,0 @@ 75.4 -/* 75.5 - * @test /nodynamiccopyright/ 75.6 - * @bug 6843077 75.7 - * @summary static field access isn't a valid location 75.8 - * @author Mahmood Ali 75.9 - * @compile/fail/ref=StaticFields.out -XDrawDiagnostics -source 1.7 StaticFields.java 75.10 - */ 75.11 -class C { 75.12 - int f; 75.13 - int a = @A C.f; 75.14 -} 75.15 - 75.16 -@interface A { }
76.1 --- a/test/tools/javac/typeAnnotations/failures/StaticFields.out Thu Nov 04 15:54:46 2010 -0700 76.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 76.3 @@ -1,2 +0,0 @@ 76.4 -StaticFields.java:10:17: compiler.err.illegal.start.of.expr 76.5 -1 error
77.1 --- a/test/tools/javac/typeAnnotations/failures/StaticMethods.java Thu Nov 04 15:54:46 2010 -0700 77.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 77.3 @@ -1,12 +0,0 @@ 77.4 -/* 77.5 - * @test /nodynamiccopyright/ 77.6 - * @bug 6843077 77.7 - * @summary static methods don't have receivers 77.8 - * @author Mahmood Ali 77.9 - * @compile/fail/ref=StaticMethods.out -XDrawDiagnostics -source 1.7 StaticMethods.java 77.10 - */ 77.11 -class StaticMethods { 77.12 - static void main() @A { } 77.13 -} 77.14 - 77.15 -@interface A { }
78.1 --- a/test/tools/javac/typeAnnotations/failures/StaticMethods.out Thu Nov 04 15:54:46 2010 -0700 78.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 78.3 @@ -1,2 +0,0 @@ 78.4 -StaticMethods.java:9:22: compiler.err.annotation.type.not.applicable 78.5 -1 error
79.1 --- a/test/tools/javac/typeAnnotations/failures/VoidGenericMethod.java Thu Nov 04 15:54:46 2010 -0700 79.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 79.3 @@ -1,35 +0,0 @@ 79.4 -/* 79.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 79.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 79.7 - * 79.8 - * This code is free software; you can redistribute it and/or modify it 79.9 - * under the terms of the GNU General Public License version 2 only, as 79.10 - * published by the Free Software Foundation. 79.11 - * 79.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 79.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 79.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 79.15 - * version 2 for more details (a copy is included in the LICENSE file that 79.16 - * accompanied this code). 79.17 - * 79.18 - * You should have received a copy of the GNU General Public License version 79.19 - * 2 along with this work; if not, write to the Free Software Foundation, 79.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 79.21 - * 79.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 79.23 - * or visit www.oracle.com if you need additional information or have any 79.24 - * questions. 79.25 - */ 79.26 - 79.27 -/* 79.28 - * @test 79.29 - * @bug 6843077 79.30 - * @summary test type annotation on void generic methods 79.31 - * @author Mahmood Ali 79.32 - * @compile/fail -source 1.7 VoidGenericMethod.java 79.33 - */ 79.34 -class VoidGenericMethod { 79.35 - public <T> @A void method() { } 79.36 -} 79.37 - 79.38 -@interface A { }
80.1 --- a/test/tools/javac/typeAnnotations/failures/common/arrayclass/DuplicateAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 80.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 80.3 @@ -1,14 +0,0 @@ 80.4 -/* 80.5 - * @test /nodynamiccopyright/ 80.6 - * @bug 6843077 6919944 80.7 - * @summary check for duplicate annotation values 80.8 - * @author Mahmood Ali 80.9 - * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics -source 1.7 DuplicateAnnotationValue.java 80.10 - */ 80.11 -class DuplicateAnnotationValue { 80.12 - void test() { 80.13 - Object a = String @A(value = 2, value = 1) [].class; 80.14 - } 80.15 -} 80.16 - 80.17 -@interface A { int value(); }
81.1 --- a/test/tools/javac/typeAnnotations/failures/common/arrayclass/DuplicateAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 81.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 81.3 @@ -1,2 +0,0 @@ 81.4 -DuplicateAnnotationValue.java:10:37: compiler.err.duplicate.annotation.member.value: value, A 81.5 -1 error
82.1 --- a/test/tools/javac/typeAnnotations/failures/common/arrayclass/DuplicateTypeAnnotation.java Thu Nov 04 15:54:46 2010 -0700 82.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 82.3 @@ -1,15 +0,0 @@ 82.4 -/* 82.5 - * @test /nodynamiccopyright/ 82.6 - * @bug 6843077 82.7 - * @summary check for duplicate annotations 82.8 - * @author Mahmood Ali 82.9 - * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics -source 1.7 DuplicateTypeAnnotation.java 82.10 - */ 82.11 - 82.12 -class DuplicateTypeAnnotation { 82.13 - void test() { 82.14 - Object a = String @A @A [].class; 82.15 - } 82.16 -} 82.17 - 82.18 -@interface A { }
83.1 --- a/test/tools/javac/typeAnnotations/failures/common/arrayclass/DuplicateTypeAnnotation.out Thu Nov 04 15:54:46 2010 -0700 83.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 83.3 @@ -1,2 +0,0 @@ 83.4 -DuplicateTypeAnnotation.java:11:26: compiler.err.duplicate.annotation 83.5 -1 error
84.1 --- a/test/tools/javac/typeAnnotations/failures/common/arrayclass/InvalidLocation.java Thu Nov 04 15:54:46 2010 -0700 84.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 84.3 @@ -1,16 +0,0 @@ 84.4 -/* 84.5 - * @test /nodynamiccopyright/ 84.6 - * @bug 6843077 84.7 - * @summary check for invalid annotatins given the target 84.8 - * @author Mahmood Ali 84.9 - * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics -source 1.7 InvalidLocation.java 84.10 - */ 84.11 - 84.12 -class InvalidLocation { 84.13 - void test() { 84.14 - Object a = String @A [].class; 84.15 - } 84.16 -} 84.17 - 84.18 -@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE) 84.19 -@interface A { }
85.1 --- a/test/tools/javac/typeAnnotations/failures/common/arrayclass/InvalidLocation.out Thu Nov 04 15:54:46 2010 -0700 85.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 85.3 @@ -1,2 +0,0 @@ 85.4 -InvalidLocation.java:11:23: compiler.err.annotation.type.not.applicable 85.5 -1 error
86.1 --- a/test/tools/javac/typeAnnotations/failures/common/arrayclass/MissingAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 86.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 86.3 @@ -1,14 +0,0 @@ 86.4 -/* 86.5 - * @test /nodynamiccopyright/ 86.6 - * @bug 6843077 86.7 - * @summary check for missing annotation value 86.8 - * @author Mahmood Ali 86.9 - * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics -source 1.7 MissingAnnotationValue.java 86.10 - */ 86.11 -class MissingAnnotationValue { 86.12 - void test() { 86.13 - Object a = String @A [].class; 86.14 - } 86.15 -} 86.16 - 86.17 -@interface A { int field(); }
87.1 --- a/test/tools/javac/typeAnnotations/failures/common/arrayclass/MissingAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 87.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 87.3 @@ -1,2 +0,0 @@ 87.4 -MissingAnnotationValue.java:10:23: compiler.err.annotation.missing.default.value: A, field 87.5 -1 error
88.1 --- a/test/tools/javac/typeAnnotations/failures/common/arrays/DuplicateAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 88.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 88.3 @@ -1,14 +0,0 @@ 88.4 -/* 88.5 - * @test /nodynamiccopyright/ 88.6 - * @bug 6843077 6919944 88.7 - * @summary check for duplicate annotation values 88.8 - * @author Mahmood Ali 88.9 - * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics -source 1.7 DuplicateAnnotationValue.java 88.10 - */ 88.11 -class DuplicateAnnotationValue { 88.12 - void test() { 88.13 - String @A(value = 2, value = 1) [] s; 88.14 - } 88.15 -} 88.16 - 88.17 -@interface A { int value(); }
89.1 --- a/test/tools/javac/typeAnnotations/failures/common/arrays/DuplicateAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 89.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 89.3 @@ -1,2 +0,0 @@ 89.4 -DuplicateAnnotationValue.java:10:26: compiler.err.duplicate.annotation.member.value: value, A 89.5 -1 error
90.1 --- a/test/tools/javac/typeAnnotations/failures/common/arrays/DuplicateTypeAnnotation.java Thu Nov 04 15:54:46 2010 -0700 90.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 90.3 @@ -1,15 +0,0 @@ 90.4 -/* 90.5 - * @test /nodynamiccopyright/ 90.6 - * @bug 6843077 90.7 - * @summary check for duplicate annotations 90.8 - * @author Mahmood Ali 90.9 - * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics -source 1.7 DuplicateTypeAnnotation.java 90.10 - */ 90.11 - 90.12 -class DuplicateTypeAnnotation { 90.13 - void test() { 90.14 - String @A @A [] s; 90.15 - } 90.16 -} 90.17 - 90.18 -@interface A { }
91.1 --- a/test/tools/javac/typeAnnotations/failures/common/arrays/DuplicateTypeAnnotation.out Thu Nov 04 15:54:46 2010 -0700 91.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 91.3 @@ -1,2 +0,0 @@ 91.4 -DuplicateTypeAnnotation.java:11:15: compiler.err.duplicate.annotation 91.5 -1 error
92.1 --- a/test/tools/javac/typeAnnotations/failures/common/arrays/InvalidLocation.java Thu Nov 04 15:54:46 2010 -0700 92.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 92.3 @@ -1,16 +0,0 @@ 92.4 -/* 92.5 - * @test /nodynamiccopyright/ 92.6 - * @bug 6843077 92.7 - * @summary check for invalid annotatins given the target 92.8 - * @author Mahmood Ali 92.9 - * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics -source 1.7 InvalidLocation.java 92.10 - */ 92.11 - 92.12 -class InvalidLocation { 92.13 - void test() { 92.14 - String @A [] s; 92.15 - } 92.16 -} 92.17 - 92.18 -@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE) 92.19 -@interface A { }
93.1 --- a/test/tools/javac/typeAnnotations/failures/common/arrays/InvalidLocation.out Thu Nov 04 15:54:46 2010 -0700 93.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 93.3 @@ -1,2 +0,0 @@ 93.4 -InvalidLocation.java:11:12: compiler.err.annotation.type.not.applicable 93.5 -1 error
94.1 --- a/test/tools/javac/typeAnnotations/failures/common/arrays/MissingAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 94.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 94.3 @@ -1,14 +0,0 @@ 94.4 -/* 94.5 - * @test /nodynamiccopyright/ 94.6 - * @bug 6843077 94.7 - * @summary check for missing annotation value 94.8 - * @author Mahmood Ali 94.9 - * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics -source 1.7 MissingAnnotationValue.java 94.10 - */ 94.11 -class MissingAnnotationValue { 94.12 - void test() { 94.13 - String @A [] s; 94.14 - } 94.15 -} 94.16 - 94.17 -@interface A { int field(); }
95.1 --- a/test/tools/javac/typeAnnotations/failures/common/arrays/MissingAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 95.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 95.3 @@ -1,2 +0,0 @@ 95.4 -MissingAnnotationValue.java:10:12: compiler.err.annotation.missing.default.value: A, field 95.5 -1 error
96.1 --- a/test/tools/javac/typeAnnotations/failures/common/innertypeparams/DuplicateAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 96.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 96.3 @@ -1,14 +0,0 @@ 96.4 -/* 96.5 - * @test /nodynamiccopyright/ 96.6 - * @bug 6843077 6919944 96.7 - * @summary check for duplicate annotation values for type parameter 96.8 - * @author Mahmood Ali 96.9 - * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics -source 1.7 DuplicateAnnotationValue.java 96.10 - */ 96.11 -class DuplicateAnnotationValue { 96.12 - void method() { 96.13 - class Inner<@A(value = 2, value = 1) K> {} 96.14 - } 96.15 -} 96.16 - 96.17 -@interface A { int value(); }
97.1 --- a/test/tools/javac/typeAnnotations/failures/common/innertypeparams/DuplicateAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 97.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 97.3 @@ -1,2 +0,0 @@ 97.4 -DuplicateAnnotationValue.java:10:31: compiler.err.duplicate.annotation.member.value: value, A 97.5 -1 error
98.1 --- a/test/tools/javac/typeAnnotations/failures/common/innertypeparams/DuplicateTypeAnnotation.java Thu Nov 04 15:54:46 2010 -0700 98.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 98.3 @@ -1,14 +0,0 @@ 98.4 -/* 98.5 - * @test /nodynamiccopyright/ 98.6 - * @bug 6843077 98.7 - * @summary check for duplicate annotations 98.8 - * @author Mahmood Ali 98.9 - * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics -source 1.7 DuplicateTypeAnnotation.java 98.10 - */ 98.11 -class DuplicateTypeAnno { 98.12 - void innermethod() { 98.13 - class Inner<@A @A K> { } 98.14 - } 98.15 -} 98.16 - 98.17 -@interface A { }
99.1 --- a/test/tools/javac/typeAnnotations/failures/common/innertypeparams/DuplicateTypeAnnotation.out Thu Nov 04 15:54:46 2010 -0700 99.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 99.3 @@ -1,2 +0,0 @@ 99.4 -DuplicateTypeAnnotation.java:10:20: compiler.err.duplicate.annotation 99.5 -1 error
100.1 --- a/test/tools/javac/typeAnnotations/failures/common/innertypeparams/InvalidLocation.java Thu Nov 04 15:54:46 2010 -0700 100.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 100.3 @@ -1,15 +0,0 @@ 100.4 -/* 100.5 - * @test /nodynamiccopyright/ 100.6 - * @bug 6843077 100.7 - * @summary check for invalid annotatins given the target 100.8 - * @author Mahmood Ali 100.9 - * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics -source 1.7 InvalidLocation.java 100.10 - */ 100.11 -class InvalidLocation { 100.12 - void innermethod() { 100.13 - class Inner<@A K> {} 100.14 - } 100.15 -} 100.16 - 100.17 -@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE) 100.18 -@interface A { }
101.1 --- a/test/tools/javac/typeAnnotations/failures/common/innertypeparams/InvalidLocation.out Thu Nov 04 15:54:46 2010 -0700 101.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 101.3 @@ -1,2 +0,0 @@ 101.4 -InvalidLocation.java:10:17: compiler.err.annotation.type.not.applicable 101.5 -1 error
102.1 --- a/test/tools/javac/typeAnnotations/failures/common/innertypeparams/MissingAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 102.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 102.3 @@ -1,14 +0,0 @@ 102.4 -/* 102.5 - * @test /nodynamiccopyright/ 102.6 - * @bug 6843077 102.7 - * @summary check for missing annotation value 102.8 - * @author Mahmood Ali 102.9 - * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics -source 1.7 MissingAnnotationValue.java 102.10 - */ 102.11 -class MissingAnnotationValue { 102.12 - void innermethod() { 102.13 - class Inner<@A K> { } 102.14 - } 102.15 -} 102.16 - 102.17 -@interface A { int field(); }
103.1 --- a/test/tools/javac/typeAnnotations/failures/common/innertypeparams/MissingAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 103.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 103.3 @@ -1,2 +0,0 @@ 103.4 -MissingAnnotationValue.java:10:17: compiler.err.annotation.missing.default.value: A, field 103.5 -1 error
104.1 --- a/test/tools/javac/typeAnnotations/failures/common/newarray/DuplicateAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 104.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 104.3 @@ -1,14 +0,0 @@ 104.4 -/* 104.5 - * @test /nodynamiccopyright/ 104.6 - * @bug 6843077 6919944 104.7 - * @summary check for duplicate annotation values 104.8 - * @author Mahmood Ali 104.9 - * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics -source 1.7 DuplicateAnnotationValue.java 104.10 - */ 104.11 -class DuplicateAnnotationValue { 104.12 - void test() { 104.13 - String[] a = new String @A(value = 2, value = 1) [5] ; 104.14 - } 104.15 -} 104.16 - 104.17 -@interface A { int value(); }
105.1 --- a/test/tools/javac/typeAnnotations/failures/common/newarray/DuplicateAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 105.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 105.3 @@ -1,2 +0,0 @@ 105.4 -DuplicateAnnotationValue.java:10:43: compiler.err.duplicate.annotation.member.value: value, A 105.5 -1 error
106.1 --- a/test/tools/javac/typeAnnotations/failures/common/newarray/DuplicateTypeAnnotation.java Thu Nov 04 15:54:46 2010 -0700 106.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 106.3 @@ -1,15 +0,0 @@ 106.4 -/* 106.5 - * @test /nodynamiccopyright/ 106.6 - * @bug 6843077 106.7 - * @summary check for duplicate annotations 106.8 - * @author Mahmood Ali 106.9 - * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics -source 1.7 DuplicateTypeAnnotation.java 106.10 - */ 106.11 - 106.12 -class DuplicateTypeAnnotation { 106.13 - void test() { 106.14 - String[] a = new String @A @A [5] ; 106.15 - } 106.16 -} 106.17 - 106.18 -@interface A { }
107.1 --- a/test/tools/javac/typeAnnotations/failures/common/newarray/DuplicateTypeAnnotation.out Thu Nov 04 15:54:46 2010 -0700 107.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 107.3 @@ -1,2 +0,0 @@ 107.4 -DuplicateTypeAnnotation.java:11:32: compiler.err.duplicate.annotation 107.5 -1 error
108.1 --- a/test/tools/javac/typeAnnotations/failures/common/newarray/InvalidLocation.java Thu Nov 04 15:54:46 2010 -0700 108.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 108.3 @@ -1,16 +0,0 @@ 108.4 -/* 108.5 - * @test /nodynamiccopyright/ 108.6 - * @bug 6843077 108.7 - * @summary check for invalid annotatins given the target 108.8 - * @author Mahmood Ali 108.9 - * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics -source 1.7 InvalidLocation.java 108.10 - */ 108.11 - 108.12 -class InvalidLocation { 108.13 - void test() { 108.14 - String[] s = new String @A [5] ; 108.15 - } 108.16 -} 108.17 - 108.18 -@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE) 108.19 -@interface A { }
109.1 --- a/test/tools/javac/typeAnnotations/failures/common/newarray/InvalidLocation.out Thu Nov 04 15:54:46 2010 -0700 109.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 109.3 @@ -1,2 +0,0 @@ 109.4 -InvalidLocation.java:11:29: compiler.err.annotation.type.not.applicable 109.5 -1 error
110.1 --- a/test/tools/javac/typeAnnotations/failures/common/newarray/MissingAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 110.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 110.3 @@ -1,14 +0,0 @@ 110.4 -/* 110.5 - * @test /nodynamiccopyright/ 110.6 - * @bug 6843077 110.7 - * @summary check for missing annotation value 110.8 - * @author Mahmood Ali 110.9 - * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics -source 1.7 MissingAnnotationValue.java 110.10 - */ 110.11 -class MissingAnnotationValue { 110.12 - void test() { 110.13 - String[] a = new String @A [5]; 110.14 - } 110.15 -} 110.16 - 110.17 -@interface A { int field(); }
111.1 --- a/test/tools/javac/typeAnnotations/failures/common/newarray/MissingAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 111.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 111.3 @@ -1,2 +0,0 @@ 111.4 -MissingAnnotationValue.java:10:29: compiler.err.annotation.missing.default.value: A, field 111.5 -1 error
112.1 --- a/test/tools/javac/typeAnnotations/failures/common/parambounds/DuplicateAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 112.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 112.3 @@ -1,11 +0,0 @@ 112.4 -/* 112.5 - * @test /nodynamiccopyright/ 112.6 - * @bug 6843077 6919944 112.7 - * @summary check for duplicate annotation values for type parameter 112.8 - * @author Mahmood Ali 112.9 - * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics -source 1.7 DuplicateAnnotationValue.java 112.10 - */ 112.11 -class DuplicateAnnotationValue<K extends @A(value = 2, value = 1) Object> { 112.12 -} 112.13 - 112.14 -@interface A { int value(); }
113.1 --- a/test/tools/javac/typeAnnotations/failures/common/parambounds/DuplicateAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 113.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 113.3 @@ -1,2 +0,0 @@ 113.4 -DuplicateAnnotationValue.java:8:56: compiler.err.duplicate.annotation.member.value: value, A 113.5 -1 error
114.1 --- a/test/tools/javac/typeAnnotations/failures/common/parambounds/DuplicateTypeAnnotation.java Thu Nov 04 15:54:46 2010 -0700 114.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 114.3 @@ -1,12 +0,0 @@ 114.4 -/* 114.5 - * @test /nodynamiccopyright/ 114.6 - * @bug 6843077 114.7 - * @summary check for duplicate annotations 114.8 - * @author Mahmood Ali 114.9 - * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics -source 1.7 DuplicateTypeAnnotation.java 114.10 - */ 114.11 - 114.12 -class DuplicateTypeAnno<K extends @A @A Object> { 114.13 -} 114.14 - 114.15 -@interface A { }
115.1 --- a/test/tools/javac/typeAnnotations/failures/common/parambounds/DuplicateTypeAnnotation.out Thu Nov 04 15:54:46 2010 -0700 115.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 115.3 @@ -1,2 +0,0 @@ 115.4 -DuplicateTypeAnnotation.java:9:38: compiler.err.duplicate.annotation 115.5 -1 error
116.1 --- a/test/tools/javac/typeAnnotations/failures/common/parambounds/InvalidLocation.java Thu Nov 04 15:54:46 2010 -0700 116.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 116.3 @@ -1,13 +0,0 @@ 116.4 -/* 116.5 - * @test /nodynamiccopyright/ 116.6 - * @bug 6843077 116.7 - * @summary check for invalid annotatins given the target 116.8 - * @author Mahmood Ali 116.9 - * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics -source 1.7 InvalidLocation.java 116.10 - */ 116.11 - 116.12 -class InvalidLocation<K extends @A Object> { 116.13 -} 116.14 - 116.15 -@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE) 116.16 -@interface A { }
117.1 --- a/test/tools/javac/typeAnnotations/failures/common/parambounds/InvalidLocation.out Thu Nov 04 15:54:46 2010 -0700 117.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 117.3 @@ -1,2 +0,0 @@ 117.4 -InvalidLocation.java:9:33: compiler.err.annotation.type.not.applicable 117.5 -1 error
118.1 --- a/test/tools/javac/typeAnnotations/failures/common/parambounds/MissingAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 118.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 118.3 @@ -1,11 +0,0 @@ 118.4 -/* 118.5 - * @test /nodynamiccopyright/ 118.6 - * @bug 6843077 118.7 - * @summary check for missing annotation value 118.8 - * @author Mahmood Ali 118.9 - * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics -source 1.7 MissingAnnotationValue.java 118.10 - */ 118.11 -class MissingAnnotationValue<K extends @A Object> { 118.12 -} 118.13 - 118.14 -@interface A { int field(); }
119.1 --- a/test/tools/javac/typeAnnotations/failures/common/parambounds/MissingAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 119.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 119.3 @@ -1,2 +0,0 @@ 119.4 -MissingAnnotationValue.java:8:40: compiler.err.annotation.missing.default.value: A, field 119.5 -1 error
120.1 --- a/test/tools/javac/typeAnnotations/failures/common/receiver/DuplicateAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 120.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 120.3 @@ -1,12 +0,0 @@ 120.4 -/* 120.5 - * @test /nodynamiccopyright/ 120.6 - * @bug 6843077 6919944 120.7 - * @summary check for duplicate annotation values in receiver 120.8 - * @author Mahmood Ali 120.9 - * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics -source 1.7 DuplicateAnnotationValue.java 120.10 - */ 120.11 -class DuplicateAnnotationValue { 120.12 - void test() @A(value = 2, value = 1) { } 120.13 -} 120.14 - 120.15 -@interface A { int value(); }
121.1 --- a/test/tools/javac/typeAnnotations/failures/common/receiver/DuplicateAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 121.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 121.3 @@ -1,2 +0,0 @@ 121.4 -DuplicateAnnotationValue.java:9:29: compiler.err.duplicate.annotation.member.value: value, A 121.5 -1 error
122.1 --- a/test/tools/javac/typeAnnotations/failures/common/receiver/DuplicateTypeAnnotation.java Thu Nov 04 15:54:46 2010 -0700 122.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 122.3 @@ -1,13 +0,0 @@ 122.4 -/* 122.5 - * @test /nodynamiccopyright/ 122.6 - * @bug 6843077 122.7 - * @summary check for duplicate annotations in receiver 122.8 - * @author Mahmood Ali 122.9 - * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics -source 1.7 DuplicateTypeAnnotation.java 122.10 - */ 122.11 - 122.12 -class DuplicateTypeAnnotation { 122.13 - void test() @A @A { } 122.14 -} 122.15 - 122.16 -@interface A { }
123.1 --- a/test/tools/javac/typeAnnotations/failures/common/receiver/DuplicateTypeAnnotation.out Thu Nov 04 15:54:46 2010 -0700 123.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 123.3 @@ -1,2 +0,0 @@ 123.4 -DuplicateTypeAnnotation.java:10:18: compiler.err.duplicate.annotation 123.5 -1 error
124.1 --- a/test/tools/javac/typeAnnotations/failures/common/receiver/InvalidLocation.java Thu Nov 04 15:54:46 2010 -0700 124.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 124.3 @@ -1,15 +0,0 @@ 124.4 -/* 124.5 - * @test /nodynamiccopyright/ 124.6 - * @bug 6843077 124.7 - * @summary check for invalid annotatins given the target 124.8 - * @author Mahmood Ali 124.9 - * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics -source 1.7 InvalidLocation.java 124.10 - */ 124.11 - 124.12 -class InvalidLocation { 124.13 - void test() @A { 124.14 - } 124.15 -} 124.16 - 124.17 -@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE) 124.18 -@interface A { }
125.1 --- a/test/tools/javac/typeAnnotations/failures/common/receiver/InvalidLocation.out Thu Nov 04 15:54:46 2010 -0700 125.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 125.3 @@ -1,2 +0,0 @@ 125.4 -InvalidLocation.java:10:15: compiler.err.annotation.type.not.applicable 125.5 -1 error
126.1 --- a/test/tools/javac/typeAnnotations/failures/common/receiver/MissingAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 126.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 126.3 @@ -1,12 +0,0 @@ 126.4 -/* 126.5 - * @test /nodynamiccopyright/ 126.6 - * @bug 6843077 126.7 - * @summary check for missing annotation value 126.8 - * @author Mahmood Ali 126.9 - * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics -source 1.7 MissingAnnotationValue.java 126.10 - */ 126.11 -class MissingAnnotationValue { 126.12 - void test() @A { } 126.13 -} 126.14 - 126.15 -@interface A { int field(); }
127.1 --- a/test/tools/javac/typeAnnotations/failures/common/receiver/MissingAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 127.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 127.3 @@ -1,2 +0,0 @@ 127.4 -MissingAnnotationValue.java:9:15: compiler.err.annotation.missing.default.value: A, field 127.5 -1 error
128.1 --- a/test/tools/javac/typeAnnotations/failures/common/rest/DuplicateAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 128.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 128.3 @@ -1,14 +0,0 @@ 128.4 -/* 128.5 - * @test /nodynamiccopyright/ 128.6 - * @bug 6843077 128.7 - * @summary check for Duplicate annotation value 128.8 - * @author Mahmood Ali 128.9 - * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics -source 1.7 DuplicateAnnotationValue.java 128.10 - */ 128.11 -class DuplicateAnnotationValue { 128.12 - void test() { 128.13 - new @A String(); 128.14 - } 128.15 -} 128.16 - 128.17 -@interface A { int field(); }
129.1 --- a/test/tools/javac/typeAnnotations/failures/common/rest/DuplicateAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 129.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 129.3 @@ -1,2 +0,0 @@ 129.4 -DuplicateAnnotationValue.java:10:9: compiler.err.annotation.missing.default.value: A, field 129.5 -1 error
130.1 --- a/test/tools/javac/typeAnnotations/failures/common/rest/DuplicateTypeAnnotation.java Thu Nov 04 15:54:46 2010 -0700 130.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 130.3 @@ -1,15 +0,0 @@ 130.4 -/* 130.5 - * @test /nodynamiccopyright/ 130.6 - * @bug 6843077 130.7 - * @summary check for duplicate annotations 130.8 - * @author Mahmood Ali 130.9 - * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics -source 1.7 DuplicateTypeAnnotation.java 130.10 - */ 130.11 - 130.12 -class DuplicateTypeAnnotation { 130.13 - void test() { 130.14 - new @A @A String(); 130.15 - } 130.16 -} 130.17 - 130.18 -@interface A { }
131.1 --- a/test/tools/javac/typeAnnotations/failures/common/rest/DuplicateTypeAnnotation.out Thu Nov 04 15:54:46 2010 -0700 131.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 131.3 @@ -1,2 +0,0 @@ 131.4 -DuplicateTypeAnnotation.java:11:12: compiler.err.duplicate.annotation 131.5 -1 error
132.1 --- a/test/tools/javac/typeAnnotations/failures/common/rest/InvalidLocation.java Thu Nov 04 15:54:46 2010 -0700 132.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 132.3 @@ -1,16 +0,0 @@ 132.4 -/* 132.5 - * @test /nodynamiccopyright/ 132.6 - * @bug 6843077 132.7 - * @summary check for invalid annotatins given the target 132.8 - * @author Mahmood Ali 132.9 - * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics -source 1.7 InvalidLocation.java 132.10 - */ 132.11 - 132.12 -class InvalidLocation { 132.13 - void test() { 132.14 - new @A String(); 132.15 - } 132.16 -} 132.17 - 132.18 -@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE) 132.19 -@interface A { }
133.1 --- a/test/tools/javac/typeAnnotations/failures/common/rest/InvalidLocation.out Thu Nov 04 15:54:46 2010 -0700 133.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 133.3 @@ -1,2 +0,0 @@ 133.4 -InvalidLocation.java:11:9: compiler.err.annotation.type.not.applicable 133.5 -1 error
134.1 --- a/test/tools/javac/typeAnnotations/failures/common/rest/MissingAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 134.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 134.3 @@ -1,14 +0,0 @@ 134.4 -/* 134.5 - * @test /nodynamiccopyright/ 134.6 - * @bug 6843077 134.7 - * @summary check for missing annotation value 134.8 - * @author Mahmood Ali 134.9 - * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics -source 1.7 MissingAnnotationValue.java 134.10 - */ 134.11 -class MissingAnnotationValue { 134.12 - void test() { 134.13 - new @A String(); 134.14 - } 134.15 -} 134.16 - 134.17 -@interface A { int field(); }
135.1 --- a/test/tools/javac/typeAnnotations/failures/common/rest/MissingAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 135.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 135.3 @@ -1,2 +0,0 @@ 135.4 -MissingAnnotationValue.java:10:9: compiler.err.annotation.missing.default.value: A, field 135.5 -1 error
136.1 --- a/test/tools/javac/typeAnnotations/failures/common/typeArgs/DuplicateAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 136.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 136.3 @@ -1,12 +0,0 @@ 136.4 -/* 136.5 - * @test /nodynamiccopyright/ 136.6 - * @bug 6843077 6919944 136.7 - * @summary check for duplicate annotation values for type parameter 136.8 - * @author Mahmood Ali 136.9 - * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics -source 1.7 DuplicateAnnotationValue.java 136.10 - */ 136.11 -class DuplicateAnnotationValue<K> { 136.12 - DuplicateAnnotationValue<@A(value = 2, value = 1) String> l; 136.13 -} 136.14 - 136.15 -@interface A { int value(); }
137.1 --- a/test/tools/javac/typeAnnotations/failures/common/typeArgs/DuplicateAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 137.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 137.3 @@ -1,2 +0,0 @@ 137.4 -DuplicateAnnotationValue.java:9:42: compiler.err.duplicate.annotation.member.value: value, A 137.5 -1 error
138.1 --- a/test/tools/javac/typeAnnotations/failures/common/typeArgs/DuplicateTypeAnnotation.java Thu Nov 04 15:54:46 2010 -0700 138.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 138.3 @@ -1,13 +0,0 @@ 138.4 -/* 138.5 - * @test /nodynamiccopyright/ 138.6 - * @bug 6843077 138.7 - * @summary check for duplicate annotations 138.8 - * @author Mahmood Ali 138.9 - * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics -source 1.7 DuplicateTypeAnnotation.java 138.10 - */ 138.11 - 138.12 -class DuplicateTypeAnno<K> { 138.13 - DuplicateTypeAnno<@A @A String> l; 138.14 -} 138.15 - 138.16 -@interface A { }
139.1 --- a/test/tools/javac/typeAnnotations/failures/common/typeArgs/DuplicateTypeAnnotation.out Thu Nov 04 15:54:46 2010 -0700 139.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 139.3 @@ -1,2 +0,0 @@ 139.4 -DuplicateTypeAnnotation.java:10:24: compiler.err.duplicate.annotation 139.5 -1 error
140.1 --- a/test/tools/javac/typeAnnotations/failures/common/typeArgs/InvalidLocation.java Thu Nov 04 15:54:46 2010 -0700 140.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 140.3 @@ -1,14 +0,0 @@ 140.4 -/* 140.5 - * @test /nodynamiccopyright/ 140.6 - * @bug 6843077 140.7 - * @summary check for invalid annotatins given the target 140.8 - * @author Mahmood Ali 140.9 - * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics -source 1.7 InvalidLocation.java 140.10 - */ 140.11 - 140.12 -class InvalidLocation<K> { 140.13 - InvalidLocation<@A String> l; 140.14 -} 140.15 - 140.16 -@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE) 140.17 -@interface A { }
141.1 --- a/test/tools/javac/typeAnnotations/failures/common/typeArgs/InvalidLocation.out Thu Nov 04 15:54:46 2010 -0700 141.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 141.3 @@ -1,2 +0,0 @@ 141.4 -InvalidLocation.java:10:19: compiler.err.annotation.type.not.applicable 141.5 -1 error
142.1 --- a/test/tools/javac/typeAnnotations/failures/common/typeArgs/MissingAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 142.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 142.3 @@ -1,12 +0,0 @@ 142.4 -/* 142.5 - * @test /nodynamiccopyright/ 142.6 - * @bug 6843077 142.7 - * @summary check for missing annotation value 142.8 - * @author Mahmood Ali 142.9 - * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics -source 1.7 MissingAnnotationValue.java 142.10 - */ 142.11 -class MissingAnnotationValue<K> { 142.12 - MissingAnnotationValue<@A String> l; 142.13 -} 142.14 - 142.15 -@interface A { int field(); }
143.1 --- a/test/tools/javac/typeAnnotations/failures/common/typeArgs/MissingAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 143.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 143.3 @@ -1,2 +0,0 @@ 143.4 -MissingAnnotationValue.java:9:26: compiler.err.annotation.missing.default.value: A, field 143.5 -1 error
144.1 --- a/test/tools/javac/typeAnnotations/failures/common/typeparams/DuplicateAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 144.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 144.3 @@ -1,11 +0,0 @@ 144.4 -/* 144.5 - * @test /nodynamiccopyright/ 144.6 - * @bug 6843077 6919944 144.7 - * @summary check for duplicate annotation values for type parameter 144.8 - * @author Mahmood Ali 144.9 - * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics -source 1.7 DuplicateAnnotationValue.java 144.10 - */ 144.11 -class DuplicateAnnotationValue<@A(value = 2, value = 1) K> { 144.12 -} 144.13 - 144.14 -@interface A { int value(); }
145.1 --- a/test/tools/javac/typeAnnotations/failures/common/typeparams/DuplicateAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 145.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 145.3 @@ -1,2 +0,0 @@ 145.4 -DuplicateAnnotationValue.java:8:46: compiler.err.duplicate.annotation.member.value: value, A 145.5 -1 error
146.1 --- a/test/tools/javac/typeAnnotations/failures/common/typeparams/DuplicateTypeAnnotation.java Thu Nov 04 15:54:46 2010 -0700 146.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 146.3 @@ -1,12 +0,0 @@ 146.4 -/* 146.5 - * @test /nodynamiccopyright/ 146.6 - * @bug 6843077 146.7 - * @summary check for duplicate annotations 146.8 - * @author Mahmood Ali 146.9 - * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics -source 1.7 DuplicateTypeAnnotation.java 146.10 - */ 146.11 - 146.12 -class DuplicateTypeAnno<@A @A K> { 146.13 -} 146.14 - 146.15 -@interface A { }
147.1 --- a/test/tools/javac/typeAnnotations/failures/common/typeparams/DuplicateTypeAnnotation.out Thu Nov 04 15:54:46 2010 -0700 147.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 147.3 @@ -1,2 +0,0 @@ 147.4 -DuplicateTypeAnnotation.java:9:28: compiler.err.duplicate.annotation 147.5 -1 error
148.1 --- a/test/tools/javac/typeAnnotations/failures/common/typeparams/InvalidLocation.java Thu Nov 04 15:54:46 2010 -0700 148.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 148.3 @@ -1,13 +0,0 @@ 148.4 -/* 148.5 - * @test /nodynamiccopyright/ 148.6 - * @bug 6843077 148.7 - * @summary check for invalid annotatins given the target 148.8 - * @author Mahmood Ali 148.9 - * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics -source 1.7 InvalidLocation.java 148.10 - */ 148.11 - 148.12 -class InvalidLocation<@A K> { 148.13 -} 148.14 - 148.15 -@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE) 148.16 -@interface A { }
149.1 --- a/test/tools/javac/typeAnnotations/failures/common/typeparams/InvalidLocation.out Thu Nov 04 15:54:46 2010 -0700 149.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 149.3 @@ -1,2 +0,0 @@ 149.4 -InvalidLocation.java:9:23: compiler.err.annotation.type.not.applicable 149.5 -1 error
150.1 --- a/test/tools/javac/typeAnnotations/failures/common/typeparams/MissingAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 150.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 150.3 @@ -1,11 +0,0 @@ 150.4 -/* 150.5 - * @test /nodynamiccopyright/ 150.6 - * @bug 6843077 150.7 - * @summary check for missing annotation value 150.8 - * @author Mahmood Ali 150.9 - * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics -source 1.7 MissingAnnotationValue.java 150.10 - */ 150.11 -class MissingAnnotationValue<@A K> { 150.12 -} 150.13 - 150.14 -@interface A { int field(); }
151.1 --- a/test/tools/javac/typeAnnotations/failures/common/typeparams/MissingAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 151.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 151.3 @@ -1,2 +0,0 @@ 151.4 -MissingAnnotationValue.java:8:30: compiler.err.annotation.missing.default.value: A, field 151.5 -1 error
152.1 --- a/test/tools/javac/typeAnnotations/failures/common/wildcards/DuplicateAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 152.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 152.3 @@ -1,12 +0,0 @@ 152.4 -/* 152.5 - * @test /nodynamiccopyright/ 152.6 - * @bug 6843077 6919944 152.7 - * @summary check for duplicate annotation values for type parameter 152.8 - * @author Mahmood Ali 152.9 - * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics -source 1.7 DuplicateAnnotationValue.java 152.10 - */ 152.11 -class DuplicateAnnotationValue<K> { 152.12 - DuplicateAnnotationValue<@A(value = 2, value = 1) ?> l; 152.13 -} 152.14 - 152.15 -@interface A { int value(); }
153.1 --- a/test/tools/javac/typeAnnotations/failures/common/wildcards/DuplicateAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 153.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 153.3 @@ -1,2 +0,0 @@ 153.4 -DuplicateAnnotationValue.java:9:42: compiler.err.duplicate.annotation.member.value: value, A 153.5 -1 error
154.1 --- a/test/tools/javac/typeAnnotations/failures/common/wildcards/DuplicateTypeAnnotation.java Thu Nov 04 15:54:46 2010 -0700 154.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 154.3 @@ -1,13 +0,0 @@ 154.4 -/* 154.5 - * @test /nodynamiccopyright/ 154.6 - * @bug 6843077 154.7 - * @summary check for duplicate annotations 154.8 - * @author Mahmood Ali 154.9 - * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics -source 1.7 DuplicateTypeAnnotation.java 154.10 - */ 154.11 - 154.12 -class DuplicateTypeAnno<K> { 154.13 - DuplicateTypeAnno<@A @A ?> l; 154.14 -} 154.15 - 154.16 -@interface A { }
155.1 --- a/test/tools/javac/typeAnnotations/failures/common/wildcards/DuplicateTypeAnnotation.out Thu Nov 04 15:54:46 2010 -0700 155.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 155.3 @@ -1,2 +0,0 @@ 155.4 -DuplicateTypeAnnotation.java:10:24: compiler.err.duplicate.annotation 155.5 -1 error
156.1 --- a/test/tools/javac/typeAnnotations/failures/common/wildcards/InvalidLocation.java Thu Nov 04 15:54:46 2010 -0700 156.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 156.3 @@ -1,14 +0,0 @@ 156.4 -/* 156.5 - * @test /nodynamiccopyright/ 156.6 - * @bug 6843077 156.7 - * @summary check for invalid annotatins given the target 156.8 - * @author Mahmood Ali 156.9 - * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics -source 1.7 InvalidLocation.java 156.10 - */ 156.11 - 156.12 -class InvalidLocation<K> { 156.13 - InvalidLocation<@A ?> l; 156.14 -} 156.15 - 156.16 -@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE) 156.17 -@interface A { }
157.1 --- a/test/tools/javac/typeAnnotations/failures/common/wildcards/InvalidLocation.out Thu Nov 04 15:54:46 2010 -0700 157.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 157.3 @@ -1,2 +0,0 @@ 157.4 -InvalidLocation.java:10:19: compiler.err.annotation.type.not.applicable 157.5 -1 error
158.1 --- a/test/tools/javac/typeAnnotations/failures/common/wildcards/MissingAnnotationValue.java Thu Nov 04 15:54:46 2010 -0700 158.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 158.3 @@ -1,12 +0,0 @@ 158.4 -/* 158.5 - * @test /nodynamiccopyright/ 158.6 - * @bug 6843077 158.7 - * @summary check for missing annotation value 158.8 - * @author Mahmood Ali 158.9 - * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics -source 1.7 MissingAnnotationValue.java 158.10 - */ 158.11 -class MissingAnnotationValue<K> { 158.12 - MissingAnnotationValue<@A ?> l; 158.13 -} 158.14 - 158.15 -@interface A { int field(); }
159.1 --- a/test/tools/javac/typeAnnotations/failures/common/wildcards/MissingAnnotationValue.out Thu Nov 04 15:54:46 2010 -0700 159.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 159.3 @@ -1,2 +0,0 @@ 159.4 -MissingAnnotationValue.java:9:26: compiler.err.annotation.missing.default.value: A, field 159.5 -1 error
160.1 --- a/test/tools/javac/typeAnnotations/failures/target/Constructor.java Thu Nov 04 15:54:46 2010 -0700 160.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 160.3 @@ -1,17 +0,0 @@ 160.4 -/* 160.5 - * @test /nodynamiccopyright/ 160.6 - * @bug 6843077 160.7 - * @summary test invalid location of TypeUse 160.8 - * @author Mahmood Ali 160.9 - * @compile/fail/ref=Constructor.out -XDrawDiagnostics -source 1.7 Constructor.java 160.10 - */ 160.11 - 160.12 -import java.lang.annotation.Target; 160.13 -import java.lang.annotation.ElementType; 160.14 - 160.15 -class Constructor { 160.16 - @A Constructor() { } 160.17 -} 160.18 - 160.19 -@Target(ElementType.TYPE_USE) 160.20 -@interface A { }
161.1 --- a/test/tools/javac/typeAnnotations/failures/target/Constructor.out Thu Nov 04 15:54:46 2010 -0700 161.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 161.3 @@ -1,2 +0,0 @@ 161.4 -Constructor.java:13:3: compiler.err.annotation.type.not.applicable 161.5 -1 error
162.1 --- a/test/tools/javac/typeAnnotations/failures/target/IncompleteArray.java Thu Nov 04 15:54:46 2010 -0700 162.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 162.3 @@ -1,12 +0,0 @@ 162.4 -/* 162.5 - * @test /nodynamiccopyright/ 162.6 - * @bug 6843077 162.7 - * @summary test incomplete array declaration 162.8 - * @author Mahmood Ali 162.9 - * @compile/fail/ref=IncompleteArray.out -XDrawDiagnostics -source 1.7 IncompleteArray.java 162.10 - */ 162.11 -class IncompleteArray { 162.12 - int @A [] @A var; 162.13 -} 162.14 - 162.15 -@interface A { }
163.1 --- a/test/tools/javac/typeAnnotations/failures/target/IncompleteArray.out Thu Nov 04 15:54:46 2010 -0700 163.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 163.3 @@ -1,2 +0,0 @@ 163.4 -IncompleteArray.java:9:13: compiler.err.illegal.start.of.type 163.5 -1 error
164.1 --- a/test/tools/javac/typeAnnotations/failures/target/NotTypeParameter.java Thu Nov 04 15:54:46 2010 -0700 164.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 164.3 @@ -1,17 +0,0 @@ 164.4 -/* 164.5 - * @test /nodynamiccopyright/ 164.6 - * @bug 6843077 164.7 - * @summary test invalid location of TypeUse 164.8 - * @author Mahmood Ali 164.9 - * @compile/fail/ref=NotTypeParameter.out -XDrawDiagnostics -source 1.7 NotTypeParameter.java 164.10 - */ 164.11 - 164.12 -import java.lang.annotation.Target; 164.13 -import java.lang.annotation.ElementType; 164.14 - 164.15 -class VoidMethod<@A K> { 164.16 - @A void test() { } 164.17 -} 164.18 - 164.19 -@Target(ElementType.TYPE_USE) 164.20 -@interface A { }
165.1 --- a/test/tools/javac/typeAnnotations/failures/target/NotTypeParameter.out Thu Nov 04 15:54:46 2010 -0700 165.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 165.3 @@ -1,3 +0,0 @@ 165.4 -NotTypeParameter.java:13:3: compiler.err.annotation.type.not.applicable 165.5 -NotTypeParameter.java:12:18: compiler.err.annotation.type.not.applicable 165.6 -2 errors
166.1 --- a/test/tools/javac/typeAnnotations/failures/target/NotTypeUse.java Thu Nov 04 15:54:46 2010 -0700 166.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 166.3 @@ -1,17 +0,0 @@ 166.4 -/* 166.5 - * @test /nodynamiccopyright/ 166.6 - * @bug 6843077 166.7 - * @summary test invalid location of TypeUse 166.8 - * @author Mahmood Ali 166.9 - * @compile/fail/ref=NotTypeUse.out -XDrawDiagnostics -source 1.7 NotTypeUse.java 166.10 - */ 166.11 - 166.12 -import java.lang.annotation.Target; 166.13 -import java.lang.annotation.ElementType; 166.14 - 166.15 -class VoidMethod { 166.16 - @A void test() { } 166.17 -} 166.18 - 166.19 -@Target(ElementType.TYPE) 166.20 -@interface A { }
167.1 --- a/test/tools/javac/typeAnnotations/failures/target/NotTypeUse.out Thu Nov 04 15:54:46 2010 -0700 167.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 167.3 @@ -1,2 +0,0 @@ 167.4 -NotTypeUse.java:13:3: compiler.err.annotation.type.not.applicable 167.5 -1 error
168.1 --- a/test/tools/javac/typeAnnotations/failures/target/VoidMethod.java Thu Nov 04 15:54:46 2010 -0700 168.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 168.3 @@ -1,17 +0,0 @@ 168.4 -/* 168.5 - * @test /nodynamiccopyright/ 168.6 - * @bug 6843077 168.7 - * @summary test invalid location of TypeUse 168.8 - * @author Mahmood Ali 168.9 - * @compile/fail/ref=VoidMethod.out -XDrawDiagnostics -source 1.7 VoidMethod.java 168.10 - */ 168.11 - 168.12 -import java.lang.annotation.Target; 168.13 -import java.lang.annotation.ElementType; 168.14 - 168.15 -class VoidMethod { 168.16 - @A void test() { } 168.17 -} 168.18 - 168.19 -@Target(ElementType.TYPE_USE) 168.20 -@interface A { }
169.1 --- a/test/tools/javac/typeAnnotations/failures/target/VoidMethod.out Thu Nov 04 15:54:46 2010 -0700 169.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 169.3 @@ -1,2 +0,0 @@ 169.4 -VoidMethod.java:13:3: compiler.err.annotation.type.not.applicable 169.5 -1 error
170.1 --- a/test/tools/javac/typeAnnotations/newlocations/BasicTest.java Thu Nov 04 15:54:46 2010 -0700 170.2 +++ b/test/tools/javac/typeAnnotations/newlocations/BasicTest.java Tue Nov 09 22:54:48 2010 -0800 170.3 @@ -27,7 +27,7 @@ 170.4 * @bug 6843077 170.5 * @summary random tests for new locations 170.6 * @author Matt Papi 170.7 - * @compile -source 1.7 BasicTest.java 170.8 + * @compile/fail/ref=BasicTest.out -XDrawDiagnostics BasicTest.java 170.9 */ 170.10 170.11 import java.util.*; 170.12 @@ -38,6 +38,8 @@ 170.13 @interface C {} 170.14 @interface D {} 170.15 170.16 +//308: Test inverted to verify that type annotations can not be parsed yet. 170.17 + 170.18 /** 170.19 * Tests basic JSR 308 parser functionality. We don't really care about what 170.20 * the parse tree looks like, just that these annotations can be parsed.
171.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 171.2 +++ b/test/tools/javac/typeAnnotations/newlocations/BasicTest.out Tue Nov 09 22:54:48 2010 -0800 171.3 @@ -0,0 +1,66 @@ 171.4 +BasicTest.java:47:27: compiler.err.illegal.start.of.type 171.5 +BasicTest.java:47:28: compiler.err.expected: '{' 171.6 +BasicTest.java:47:36: compiler.err.expected: token.identifier 171.7 +BasicTest.java:47:38: compiler.err.illegal.start.of.type 171.8 +BasicTest.java:47:45: compiler.err.expected: token.identifier 171.9 +BasicTest.java:47:47: compiler.err.expected: ';' 171.10 +BasicTest.java:47:62: compiler.err.expected: token.identifier 171.11 +BasicTest.java:47:84: compiler.err.expected: token.identifier 171.12 +BasicTest.java:52:22: compiler.err.illegal.start.of.expr 171.13 +BasicTest.java:52:31: compiler.err.expected: ';' 171.14 +BasicTest.java:52:37: compiler.err.expected: token.identifier 171.15 +BasicTest.java:53:21: compiler.err.illegal.start.of.expr 171.16 +BasicTest.java:53:23: compiler.err.expected: ';' 171.17 +BasicTest.java:53:30: compiler.err.expected: token.identifier 171.18 +BasicTest.java:53:32: compiler.err.illegal.start.of.type 171.19 +BasicTest.java:53:37: compiler.err.expected: token.identifier 171.20 +BasicTest.java:53:38: compiler.err.expected: ';' 171.21 +BasicTest.java:56:17: compiler.err.expected: token.identifier 171.22 +BasicTest.java:56:23: compiler.err.expected: token.identifier 171.23 +BasicTest.java:56:24: compiler.err.expected2: '(', '[' 171.24 +BasicTest.java:56:25: compiler.err.expected: ';' 171.25 +BasicTest.java:56:27: compiler.err.invalid.meth.decl.ret.type.req 171.26 +BasicTest.java:56:34: compiler.err.illegal.start.of.type 171.27 +BasicTest.java:58:34: compiler.err.illegal.start.of.type 171.28 +BasicTest.java:61:16: compiler.err.illegal.start.of.type 171.29 +BasicTest.java:61:18: compiler.err.expected: ';' 171.30 +BasicTest.java:61:24: compiler.err.illegal.start.of.type 171.31 +BasicTest.java:61:26: compiler.err.expected: ';' 171.32 +BasicTest.java:61:33: compiler.err.expected: token.identifier 171.33 +BasicTest.java:61:34: compiler.err.illegal.start.of.type 171.34 +BasicTest.java:61:35: compiler.err.expected: token.identifier 171.35 +BasicTest.java:61:37: compiler.err.expected: ';' 171.36 +BasicTest.java:61:45: compiler.err.expected: token.identifier 171.37 +BasicTest.java:61:50: compiler.err.expected: token.identifier 171.38 +BasicTest.java:62:16: compiler.err.expected: token.identifier 171.39 +BasicTest.java:62:17: compiler.err.expected2: '(', '[' 171.40 +BasicTest.java:62:18: compiler.err.expected: ';' 171.41 +BasicTest.java:62:28: compiler.err.illegal.start.of.type 171.42 +BasicTest.java:62:30: compiler.err.expected: ';' 171.43 +BasicTest.java:62:36: compiler.err.illegal.start.of.type 171.44 +BasicTest.java:62:38: compiler.err.expected: ';' 171.45 +BasicTest.java:62:45: compiler.err.expected: token.identifier 171.46 +BasicTest.java:62:46: compiler.err.illegal.start.of.type 171.47 +BasicTest.java:62:47: compiler.err.expected: token.identifier 171.48 +BasicTest.java:62:49: compiler.err.expected: ';' 171.49 +BasicTest.java:62:57: compiler.err.expected: token.identifier 171.50 +BasicTest.java:62:58: compiler.err.illegal.start.of.type 171.51 +BasicTest.java:62:59: compiler.err.expected: token.identifier 171.52 +BasicTest.java:64:25: compiler.err.illegal.start.of.type 171.53 +BasicTest.java:64:27: compiler.err.expected: ';' 171.54 +BasicTest.java:64:34: compiler.err.expected: token.identifier 171.55 +BasicTest.java:64:38: compiler.err.expected: token.identifier 171.56 +BasicTest.java:64:41: compiler.err.illegal.start.of.expr 171.57 +BasicTest.java:64:50: compiler.err.expected: ';' 171.58 +BasicTest.java:64:56: compiler.err.expected: token.identifier 171.59 +BasicTest.java:69:17: compiler.err.expected: ';' 171.60 +BasicTest.java:69:24: compiler.err.illegal.start.of.type 171.61 +BasicTest.java:69:30: compiler.err.expected: ';' 171.62 +BasicTest.java:69:59: compiler.err.expected: token.identifier 171.63 +BasicTest.java:69:74: compiler.err.expected: ';' 171.64 +BasicTest.java:74:22: compiler.err.expected: token.identifier 171.65 +BasicTest.java:74:24: compiler.err.expected: ';' 171.66 +BasicTest.java:74:25: compiler.err.illegal.start.of.type 171.67 +BasicTest.java:74:33: compiler.err.expected: ';' 171.68 +BasicTest.java:77:2: compiler.err.premature.eof 171.69 +65 errors
172.1 --- a/test/tools/javac/typeAnnotations/newlocations/ClassExtends.java Thu Nov 04 15:54:46 2010 -0700 172.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 172.3 @@ -1,40 +0,0 @@ 172.4 -/* 172.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 172.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 172.7 - * 172.8 - * This code is free software; you can redistribute it and/or modify it 172.9 - * under the terms of the GNU General Public License version 2 only, as 172.10 - * published by the Free Software Foundation. 172.11 - * 172.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 172.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 172.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 172.15 - * version 2 for more details (a copy is included in the LICENSE file that 172.16 - * accompanied this code). 172.17 - * 172.18 - * You should have received a copy of the GNU General Public License version 172.19 - * 2 along with this work; if not, write to the Free Software Foundation, 172.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 172.21 - * 172.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 172.23 - * or visit www.oracle.com if you need additional information or have any 172.24 - * questions. 172.25 - */ 172.26 - 172.27 -/* 172.28 - * @test 172.29 - * @bug 6843077 172.30 - * @summary new type annotation location: class extends/implements 172.31 - * @author Mahmood Ali 172.32 - * @compile -source 1.7 ClassExtends.java 172.33 - */ 172.34 -abstract class MyClass extends @A ParameterizedClass<@B String> 172.35 - implements @B CharSequence, @A ParameterizedInterface<@B String> { } 172.36 - 172.37 -interface MyInterface extends @A ParameterizedInterface<@A String>, 172.38 - @B CharSequence { } 172.39 - 172.40 -class ParameterizedClass<K> {} 172.41 -interface ParameterizedInterface<K> {} 172.42 -@interface A {} 172.43 -@interface B {}
173.1 --- a/test/tools/javac/typeAnnotations/newlocations/ClassLiterals.java Thu Nov 04 15:54:46 2010 -0700 173.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 173.3 @@ -1,48 +0,0 @@ 173.4 -/* 173.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 173.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 173.7 - * 173.8 - * This code is free software; you can redistribute it and/or modify it 173.9 - * under the terms of the GNU General Public License version 2 only, as 173.10 - * published by the Free Software Foundation. 173.11 - * 173.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 173.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 173.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 173.15 - * version 2 for more details (a copy is included in the LICENSE file that 173.16 - * accompanied this code). 173.17 - * 173.18 - * You should have received a copy of the GNU General Public License version 173.19 - * 2 along with this work; if not, write to the Free Software Foundation, 173.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 173.21 - * 173.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 173.23 - * or visit www.oracle.com if you need additional information or have any 173.24 - * questions. 173.25 - */ 173.26 - 173.27 -/* 173.28 - * @test 173.29 - * @bug 6843077 173.30 - * @summary new type annotation location: class literals 173.31 - * @author Mahmood Ali 173.32 - * @compile -source 1.7 ClassLiterals.java 173.33 - */ 173.34 - 173.35 -class ClassLiterals { 173.36 - 173.37 - public static void main(String[] args) { 173.38 - if (String.class != @A String.class) throw new Error(); 173.39 - if (@A int.class != int.class) throw new Error(); 173.40 - if (@A int.class != Integer.TYPE) throw new Error(); 173.41 - if (@A int @B(0) [].class != int[].class) throw new Error(); 173.42 - 173.43 - if (String[].class != @A String[].class) throw new Error(); 173.44 - if (String[].class != String @A [].class) throw new Error(); 173.45 - if (@A int[].class != int[].class) throw new Error(); 173.46 - if (@A int @B(0) [].class != int[].class) throw new Error(); 173.47 - } 173.48 -} 173.49 - 173.50 -@interface A {} 173.51 -@interface B { int value(); }
174.1 --- a/test/tools/javac/typeAnnotations/newlocations/ClassParameters.java Thu Nov 04 15:54:46 2010 -0700 174.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 174.3 @@ -1,56 +0,0 @@ 174.4 -/* 174.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 174.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 174.7 - * 174.8 - * This code is free software; you can redistribute it and/or modify it 174.9 - * under the terms of the GNU General Public License version 2 only, as 174.10 - * published by the Free Software Foundation. 174.11 - * 174.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 174.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 174.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 174.15 - * version 2 for more details (a copy is included in the LICENSE file that 174.16 - * accompanied this code). 174.17 - * 174.18 - * You should have received a copy of the GNU General Public License version 174.19 - * 2 along with this work; if not, write to the Free Software Foundation, 174.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 174.21 - * 174.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 174.23 - * or visit www.oracle.com if you need additional information or have any 174.24 - * questions. 174.25 - */ 174.26 - 174.27 -/* 174.28 - * @test 174.29 - * @bug 6843077 174.30 - * @summary new type annotation location: class type parameter bounds 174.31 - * @author Mahmood Ali 174.32 - * @compile -source 1.7 ClassParameters.java 174.33 - */ 174.34 -class Unannotated<K> { } 174.35 - 174.36 -class ExtendsBound<K extends @A String> { } 174.37 -class ExtendsGeneric<K extends @A Unannotated<@B String>> { } 174.38 -class TwoBounds<K extends @A String, V extends @B String> { } 174.39 - 174.40 -class Complex1<K extends @A String&Runnable> { } 174.41 -class Complex2<K extends String & @B Runnable> { } 174.42 -class ComplexBoth<K extends @A String & @A Runnable> { } 174.43 - 174.44 -class Outer { 174.45 - void inner() { 174.46 - class Unannotated<K> { } 174.47 - 174.48 - class ExtendsBound<K extends @A String> { } 174.49 - class ExtendsGeneric<K extends @A Unannotated<@B String>> { } 174.50 - class TwoBounds<K extends @A String, V extends @B String> { } 174.51 - 174.52 - class Complex1<K extends @A String&Runnable> { } 174.53 - class Complex2<K extends String & @B Runnable> { } 174.54 - class ComplexBoth<K extends @A String & @A Runnable> { } 174.55 - } 174.56 -} 174.57 - 174.58 -@interface A { } 174.59 -@interface B { }
175.1 --- a/test/tools/javac/typeAnnotations/newlocations/ConstructorTypeArgs.java Thu Nov 04 15:54:46 2010 -0700 175.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 175.3 @@ -1,55 +0,0 @@ 175.4 -/* 175.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 175.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 175.7 - * 175.8 - * This code is free software; you can redistribute it and/or modify it 175.9 - * under the terms of the GNU General Public License version 2 only, as 175.10 - * published by the Free Software Foundation. 175.11 - * 175.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 175.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 175.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 175.15 - * version 2 for more details (a copy is included in the LICENSE file that 175.16 - * accompanied this code). 175.17 - * 175.18 - * You should have received a copy of the GNU General Public License version 175.19 - * 2 along with this work; if not, write to the Free Software Foundation, 175.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 175.21 - * 175.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 175.23 - * or visit www.oracle.com if you need additional information or have any 175.24 - * questions. 175.25 - */ 175.26 - 175.27 -/* 175.28 - * @test 175.29 - * @bug 6843077 175.30 - * @summary new type annotation location: constructor type args 175.31 - * @author Mahmood Ali 175.32 - * @compile -source 1.7 ConstructorTypeArgs.java 175.33 - */ 175.34 - 175.35 -class ConstructorTypeArgs { 175.36 - void oneArg() { 175.37 - new @A MyList<@A String>(); 175.38 - new MyList<@A MyList<@B(0) String>>(); 175.39 - } 175.40 - 175.41 - void twoArg() { 175.42 - new MyMap<String, String>(); 175.43 - new MyMap<@A String, @B(0) MyList<@A String>>(); 175.44 - } 175.45 - 175.46 - void withArraysIn() { 175.47 - new MyList<String[]>(); 175.48 - new MyList<@A String @B(0) [] @A []>(); 175.49 - 175.50 - new MyMap<@A String[], @B(0) MyList<@A String> @A []>(); 175.51 - } 175.52 -} 175.53 - 175.54 -class MyList<E> { } 175.55 -class MyMap<K, V> { } 175.56 - 175.57 -@interface A { } 175.58 -@interface B { int value(); }
176.1 --- a/test/tools/javac/typeAnnotations/newlocations/Expressions.java Thu Nov 04 15:54:46 2010 -0700 176.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 176.3 @@ -1,75 +0,0 @@ 176.4 -/* 176.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 176.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 176.7 - * 176.8 - * This code is free software; you can redistribute it and/or modify it 176.9 - * under the terms of the GNU General Public License version 2 only, as 176.10 - * published by the Free Software Foundation. 176.11 - * 176.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 176.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 176.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 176.15 - * version 2 for more details (a copy is included in the LICENSE file that 176.16 - * accompanied this code). 176.17 - * 176.18 - * You should have received a copy of the GNU General Public License version 176.19 - * 2 along with this work; if not, write to the Free Software Foundation, 176.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 176.21 - * 176.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 176.23 - * or visit www.oracle.com if you need additional information or have any 176.24 - * questions. 176.25 - */ 176.26 - 176.27 -/* 176.28 - * @test 176.29 - * @bug 6843077 176.30 - * @summary new type annotation location: expressions 176.31 - * @author Mahmood Ali 176.32 - * @compile -source 1.7 Expressions.java 176.33 - */ 176.34 -class Expressions { 176.35 - void instanceOf() { 176.36 - Object o = null; 176.37 - boolean a = o instanceof @A String; 176.38 - boolean b = o instanceof @B(0) String; 176.39 - } 176.40 - 176.41 - void instanceOfArray() { 176.42 - Object o = null; 176.43 - boolean a1 = o instanceof @A String []; 176.44 - boolean a2 = o instanceof @B(0) String []; 176.45 - 176.46 - boolean b1 = o instanceof String @A []; 176.47 - boolean b2 = o instanceof String @B(0) []; 176.48 - } 176.49 - 176.50 - void objectCreation() { 176.51 - new @A String(); 176.52 - new @B(0) String(); 176.53 - } 176.54 - 176.55 - void objectCreationArray() { 176.56 - Object a1 = new @A String [] [] { }; 176.57 - Object a2 = new @A String [1] []; 176.58 - Object a3 = new @A String [1] [2]; 176.59 - 176.60 - Object b1 = new @A String @B(0) [] [] { }; 176.61 - Object b2 = new @A String @B(0) [1] []; 176.62 - Object b3 = new @A String @B(0) [1] [2]; 176.63 - 176.64 - Object c1 = new @A String [] @B(0) [] { }; 176.65 - Object c2 = new @A String [1] @B(0) []; 176.66 - Object c3 = new @A String [1] @B(0) [2]; 176.67 - 176.68 - Object d1 = new @A String @B(0) [] @B(0) [] { }; 176.69 - Object d2 = new @A String @B(0) [1] @B(0) []; 176.70 - Object d3 = new @A String @B(0) [1] @B(0) [2]; 176.71 - 176.72 - Object rand = new @A String @B(value = 0) [1] @B(value = 0) [2]; 176.73 - 176.74 - } 176.75 -} 176.76 - 176.77 -@interface A { } 176.78 -@interface B { int value(); }
177.1 --- a/test/tools/javac/typeAnnotations/newlocations/Fields.java Thu Nov 04 15:54:46 2010 -0700 177.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 177.3 @@ -1,69 +0,0 @@ 177.4 -/* 177.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 177.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 177.7 - * 177.8 - * This code is free software; you can redistribute it and/or modify it 177.9 - * under the terms of the GNU General Public License version 2 only, as 177.10 - * published by the Free Software Foundation. 177.11 - * 177.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 177.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 177.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 177.15 - * version 2 for more details (a copy is included in the LICENSE file that 177.16 - * accompanied this code). 177.17 - * 177.18 - * You should have received a copy of the GNU General Public License version 177.19 - * 2 along with this work; if not, write to the Free Software Foundation, 177.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 177.21 - * 177.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 177.23 - * or visit www.oracle.com if you need additional information or have any 177.24 - * questions. 177.25 - */ 177.26 - 177.27 -/* 177.28 - * @test 177.29 - * @bug 6843077 177.30 - * @summary new type annotation location: field type array/generics 177.31 - * @author Mahmood Ali 177.32 - * @compile -source 1.7 Fields.java 177.33 - */ 177.34 - 177.35 -class DefaultScope { 177.36 - Parameterized<String, String> unannotated; 177.37 - Parameterized<@A String, String> firstTypeArg; 177.38 - Parameterized<String, @A String> secondTypeArg; 177.39 - Parameterized<@A String, @B String> bothTypeArgs; 177.40 - 177.41 - Parameterized<@A Parameterized<@A String, @B String>, @B String> 177.42 - nestedParameterized; 177.43 - 177.44 - @A String [] array1; 177.45 - @A String @B [] array1Deep; 177.46 - @A String [] [] array2; 177.47 - @A String @A [] @B [] array2Deep; 177.48 - String @A [] [] array2First; 177.49 - String [] @B [] array2Second; 177.50 -} 177.51 - 177.52 -class ModifiedScoped { 177.53 - public final Parameterized<String, String> unannotated = null; 177.54 - public final Parameterized<@A String, String> firstTypeArg = null; 177.55 - public final Parameterized<String, @A String> secondTypeArg = null; 177.56 - public final Parameterized<@A String, @B String> bothTypeArgs = null; 177.57 - 177.58 - public final Parameterized<@A Parameterized<@A String, @B String>, @B String> 177.59 - nestedParameterized = null; 177.60 - 177.61 - public final @A String [] array1 = null; 177.62 - public final @A String @B [] array1Deep = null; 177.63 - public final @A String [] [] array2 = null; 177.64 - public final @A String @A [] @B [] array2Deep = null; 177.65 - public final String @A [] [] array2First = null; 177.66 - public final String [] @B [] array2Second = null; 177.67 -} 177.68 - 177.69 -class Parameterized<K, V> { } 177.70 - 177.71 -@interface A { } 177.72 -@interface B { }
178.1 --- a/test/tools/javac/typeAnnotations/newlocations/LocalVariables.java Thu Nov 04 15:54:46 2010 -0700 178.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 178.3 @@ -1,77 +0,0 @@ 178.4 -/* 178.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 178.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 178.7 - * 178.8 - * This code is free software; you can redistribute it and/or modify it 178.9 - * under the terms of the GNU General Public License version 2 only, as 178.10 - * published by the Free Software Foundation. 178.11 - * 178.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 178.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 178.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 178.15 - * version 2 for more details (a copy is included in the LICENSE file that 178.16 - * accompanied this code). 178.17 - * 178.18 - * You should have received a copy of the GNU General Public License version 178.19 - * 2 along with this work; if not, write to the Free Software Foundation, 178.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 178.21 - * 178.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 178.23 - * or visit www.oracle.com if you need additional information or have any 178.24 - * questions. 178.25 - */ 178.26 - 178.27 -/* 178.28 - * @test 178.29 - * @bug 6843077 178.30 - * @summary new type annotation location: local variables array/generics 178.31 - * @author Mahmood Ali 178.32 - * @compile -source 1.7 LocalVariables.java 178.33 - */ 178.34 - 178.35 -class DefaultScope { 178.36 - void parameterized() { 178.37 - Parameterized<String, String> unannotated; 178.38 - Parameterized<@A String, String> firstTypeArg; 178.39 - Parameterized<String, @A String> secondTypeArg; 178.40 - Parameterized<@A String, @B String> bothTypeArgs; 178.41 - 178.42 - Parameterized<@A Parameterized<@A String, @B String>, @B String> 178.43 - nestedParameterized; 178.44 - } 178.45 - 178.46 - void arrays() { 178.47 - @A String [] array1; 178.48 - @A String @B [] array1Deep; 178.49 - @A String [] [] array2; 178.50 - @A String @A [] @B [] array2Deep; 178.51 - String @A [] [] array2First; 178.52 - String [] @B [] array2Second; 178.53 - } 178.54 -} 178.55 - 178.56 -class ModifiedVars { 178.57 - void parameterized() { 178.58 - final Parameterized<String, String> unannotated = null; 178.59 - final Parameterized<@A String, String> firstTypeArg = null; 178.60 - final Parameterized<String, @A String> secondTypeArg = null; 178.61 - final Parameterized<@A String, @B String> bothTypeArgs = null; 178.62 - 178.63 - final Parameterized<@A Parameterized<@A String, @B String>, @B String> 178.64 - nestedParameterized = null; 178.65 - } 178.66 - 178.67 - void arrays() { 178.68 - final @A String [] array1 = null; 178.69 - final @A String @B [] array1Deep = null; 178.70 - final @A String [] [] array2 = null; 178.71 - final @A String @A [] @B [] array2Deep = null; 178.72 - final String @A [] [] array2First = null; 178.73 - final String [] @B [] array2Second = null; 178.74 - } 178.75 -} 178.76 - 178.77 -class Parameterized<K, V> { } 178.78 - 178.79 -@interface A { } 178.80 -@interface B { }
179.1 --- a/test/tools/javac/typeAnnotations/newlocations/MethodReturnType.java Thu Nov 04 15:54:46 2010 -0700 179.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 179.3 @@ -1,71 +0,0 @@ 179.4 -/* 179.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 179.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 179.7 - * 179.8 - * This code is free software; you can redistribute it and/or modify it 179.9 - * under the terms of the GNU General Public License version 2 only, as 179.10 - * published by the Free Software Foundation. 179.11 - * 179.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 179.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 179.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 179.15 - * version 2 for more details (a copy is included in the LICENSE file that 179.16 - * accompanied this code). 179.17 - * 179.18 - * You should have received a copy of the GNU General Public License version 179.19 - * 2 along with this work; if not, write to the Free Software Foundation, 179.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 179.21 - * 179.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 179.23 - * or visit www.oracle.com if you need additional information or have any 179.24 - * questions. 179.25 - */ 179.26 - 179.27 -/* 179.28 - * @test 179.29 - * @bug 6843077 179.30 - * @summary new type annotation location: method return type array/generics 179.31 - * @author Mahmood Ali 179.32 - * @compile -source 1.7 MethodReturnType.java 179.33 - */ 179.34 - 179.35 -class DefaultScope { 179.36 - Parameterized<String, String> unannotated() { return null; } 179.37 - Parameterized<@A String, String> firstTypeArg() { return null; } 179.38 - Parameterized<String, @A String> secondTypeArg() { return null; } 179.39 - Parameterized<@A String, @B String> bothTypeArgs() { return null; } 179.40 - 179.41 - Parameterized<@A Parameterized<@A String, @B String>, @B String> 179.42 - nestedParameterized() { return null; } 179.43 - 179.44 - public <T> @A String method() { return null; } 179.45 - 179.46 - @A String [] array1() { return null; } 179.47 - @A String @B [] array1Deep() { return null; } 179.48 - @A String [] [] array2() { return null; } 179.49 - @A String @A [] @B [] array2Deep() { return null; } 179.50 - String @A [] [] array2First() { return null; } 179.51 - String [] @B [] array2Second() { return null; } 179.52 -} 179.53 - 179.54 -class ModifiedScoped { 179.55 - public final Parameterized<String, String> unannotated() { return null; } 179.56 - public final Parameterized<@A String, String> firstTypeArg() { return null; } 179.57 - public final Parameterized<String, @A String> secondTypeArg() { return null; } 179.58 - public final Parameterized<@A String, @B String> bothTypeArgs() { return null; } 179.59 - 179.60 - public final Parameterized<@A Parameterized<@A String, @B String>, @B String> 179.61 - nestedParameterized() { return null; } 179.62 - 179.63 - public final @A String [] array1() { return null; } 179.64 - public final @A String @B [] array1Deep() { return null; } 179.65 - public final @A String [] [] array2() { return null; } 179.66 - public final @A String @A [] @B [] array2Deep() { return null; } 179.67 - public final String @A [] [] array2First() { return null; } 179.68 - public final String [] @B [] array2Second() { return null; } 179.69 -} 179.70 - 179.71 -class Parameterized<K, V> { } 179.72 - 179.73 -@interface A { } 179.74 -@interface B { }
180.1 --- a/test/tools/javac/typeAnnotations/newlocations/MethodTypeArgs.java Thu Nov 04 15:54:46 2010 -0700 180.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 180.3 @@ -1,62 +0,0 @@ 180.4 -/* 180.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 180.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 180.7 - * 180.8 - * This code is free software; you can redistribute it and/or modify it 180.9 - * under the terms of the GNU General Public License version 2 only, as 180.10 - * published by the Free Software Foundation. 180.11 - * 180.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 180.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 180.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 180.15 - * version 2 for more details (a copy is included in the LICENSE file that 180.16 - * accompanied this code). 180.17 - * 180.18 - * You should have received a copy of the GNU General Public License version 180.19 - * 2 along with this work; if not, write to the Free Software Foundation, 180.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 180.21 - * 180.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 180.23 - * or visit www.oracle.com if you need additional information or have any 180.24 - * questions. 180.25 - */ 180.26 - 180.27 -/* 180.28 - * @test 180.29 - * @bug 6843077 180.30 - * @summary new type annotation location: method type args 180.31 - * @author Mahmood Ali 180.32 - * @compile -source 1.7 MethodTypeArgs.java 180.33 - */ 180.34 - 180.35 -class MethodTypeArgs { 180.36 - void oneArg() { 180.37 - this.<@A String>newList(); 180.38 - this.<@A MyList<@B(0) String>>newList(); 180.39 - 180.40 - MethodTypeArgs.<@A String>newList(); 180.41 - MethodTypeArgs.<@A MyList<@B(0) String>>newList(); 180.42 - } 180.43 - 180.44 - void twoArg() { 180.45 - this.<String, String>newMap(); 180.46 - this.<@A String, @B(0) MyList<@A String>>newMap(); 180.47 - 180.48 - MethodTypeArgs.<String, String>newMap(); 180.49 - MethodTypeArgs.<@A String, @B(0) MyList<@A String>>newMap(); 180.50 - } 180.51 - 180.52 - void withArraysIn() { 180.53 - this.<String[]>newList(); 180.54 - this.<@A String @B(0) [] @A []>newList(); 180.55 - 180.56 - this.<@A String[], @B(0) MyList<@A String> @A []>newMap(); 180.57 - } 180.58 - 180.59 - static <E> void newList() { } 180.60 - static <K, V> void newMap() { } 180.61 -} 180.62 - 180.63 -class MyList<E> { } 180.64 -@interface A { } 180.65 -@interface B { int value(); }
181.1 --- a/test/tools/javac/typeAnnotations/newlocations/MethodTypeParameters.java Thu Nov 04 15:54:46 2010 -0700 181.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 181.3 @@ -1,48 +0,0 @@ 181.4 -/* 181.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 181.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 181.7 - * 181.8 - * This code is free software; you can redistribute it and/or modify it 181.9 - * under the terms of the GNU General Public License version 2 only, as 181.10 - * published by the Free Software Foundation. 181.11 - * 181.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 181.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 181.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 181.15 - * version 2 for more details (a copy is included in the LICENSE file that 181.16 - * accompanied this code). 181.17 - * 181.18 - * You should have received a copy of the GNU General Public License version 181.19 - * 2 along with this work; if not, write to the Free Software Foundation, 181.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 181.21 - * 181.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 181.23 - * or visit www.oracle.com if you need additional information or have any 181.24 - * questions. 181.25 - */ 181.26 - 181.27 -/* 181.28 - * @test 181.29 - * @bug 6843077 181.30 - * @summary new type annotation location: method type parameter bounds 181.31 - * @author Mahmood Ali 181.32 - * @compile -source 1.7 MethodTypeParameters.java 181.33 - */ 181.34 - 181.35 -class UnscopedUnmodified { 181.36 - <K extends @A String> void methodExtends() {} 181.37 - <K extends @A Parameterized<@B String>> void nestedExtends() {} 181.38 - <K extends @A String, V extends @A Parameterized<@B String>> void dual() {} 181.39 - <K extends String, V extends Parameterized<@B String>> void dualOneAnno() {} 181.40 -} 181.41 - 181.42 -class PublicModifiedMethods { 181.43 - public final <K extends @A String> void methodExtends() {} 181.44 - public final <K extends @A Parameterized<@B String>> void nestedExtends() {} 181.45 - public final <K extends @A String, V extends @A Parameterized<@B String>> void dual() {} 181.46 - public final <K extends String, V extends Parameterized<@B String>> void dualOneAnno() {} 181.47 -} 181.48 - 181.49 -class Parameterized<K> { } 181.50 -@interface A { } 181.51 -@interface B { }
182.1 --- a/test/tools/javac/typeAnnotations/newlocations/Parameters.java Thu Nov 04 15:54:46 2010 -0700 182.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 182.3 @@ -1,51 +0,0 @@ 182.4 -/* 182.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 182.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 182.7 - * 182.8 - * This code is free software; you can redistribute it and/or modify it 182.9 - * under the terms of the GNU General Public License version 2 only, as 182.10 - * published by the Free Software Foundation. 182.11 - * 182.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 182.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 182.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 182.15 - * version 2 for more details (a copy is included in the LICENSE file that 182.16 - * accompanied this code). 182.17 - * 182.18 - * You should have received a copy of the GNU General Public License version 182.19 - * 2 along with this work; if not, write to the Free Software Foundation, 182.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 182.21 - * 182.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 182.23 - * or visit www.oracle.com if you need additional information or have any 182.24 - * questions. 182.25 - */ 182.26 - 182.27 -/* 182.28 - * @test 182.29 - * @bug 6843077 182.30 - * @summary new type annotation location: parameter type array/generics 182.31 - * @author Mahmood Ali 182.32 - * @compile -source 1.7 Parameters.java 182.33 - */ 182.34 - 182.35 -class Parameters { 182.36 - void unannotated(Parameterized<String, String> a) {} 182.37 - void firstTypeArg(Parameterized<@A String, String> a) {} 182.38 - void secondTypeArg(Parameterized<String, @A String> a) {} 182.39 - void bothTypeArgs(Parameterized<@A String, @B String> both) {} 182.40 - 182.41 - void nestedParameterized(Parameterized<@A Parameterized<@A String, @B String>, @B String> a) {} 182.42 - 182.43 - void array1(@A String [] a) {} 182.44 - void array1Deep(@A String @B [] a) {} 182.45 - void array2(@A String [] [] a) {} 182.46 - void array2Deep(@A String @A [] @B [] a) {} 182.47 - void array2First(String @A [] [] a) {} 182.48 - void array2Second(String [] @B [] a) {} 182.49 -} 182.50 - 182.51 -class Parameterized<K, V> { } 182.52 - 182.53 -@interface A { } 182.54 -@interface B { }
183.1 --- a/test/tools/javac/typeAnnotations/newlocations/Receivers.java Thu Nov 04 15:54:46 2010 -0700 183.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 183.3 @@ -1,56 +0,0 @@ 183.4 -/* 183.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 183.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 183.7 - * 183.8 - * This code is free software; you can redistribute it and/or modify it 183.9 - * under the terms of the GNU General Public License version 2 only, as 183.10 - * published by the Free Software Foundation. 183.11 - * 183.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 183.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 183.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 183.15 - * version 2 for more details (a copy is included in the LICENSE file that 183.16 - * accompanied this code). 183.17 - * 183.18 - * You should have received a copy of the GNU General Public License version 183.19 - * 2 along with this work; if not, write to the Free Software Foundation, 183.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 183.21 - * 183.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 183.23 - * or visit www.oracle.com if you need additional information or have any 183.24 - * questions. 183.25 - */ 183.26 - 183.27 -/* 183.28 - * @test 183.29 - * @bug 6843077 183.30 - * @summary new type annotation location: receivers 183.31 - * @author Mahmood Ali 183.32 - * @compile -source 1.7 Receivers.java 183.33 - */ 183.34 -class DefaultUnmodified { 183.35 - void plain() @A { } 183.36 - <T> void generic() @A { } 183.37 - void withException() @A throws Exception { } 183.38 - String nonVoid() @A { return null; } 183.39 - <T extends Runnable> void accept(T r) @A throws Exception { } 183.40 -} 183.41 - 183.42 -class PublicModified { 183.43 - public final void plain() @A { } 183.44 - public final <T> void generic() @A { } 183.45 - public final void withException() @A throws Exception { } 183.46 - public final String nonVoid() @A { return null; } 183.47 - public final <T extends Runnable> void accept(T r) @A throws Exception { } 183.48 -} 183.49 - 183.50 -class WithValue { 183.51 - void plain() @B("m") { } 183.52 - <T> void generic() @B("m") { } 183.53 - void withException() @B("m") throws Exception { } 183.54 - String nonVoid() @B("m") { return null; } 183.55 - <T extends Runnable> void accept(T r) @B("m") throws Exception { } 183.56 -} 183.57 - 183.58 -@interface A {} 183.59 -@interface B { String value(); }
184.1 --- a/test/tools/javac/typeAnnotations/newlocations/Throws.java Thu Nov 04 15:54:46 2010 -0700 184.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 184.3 @@ -1,47 +0,0 @@ 184.4 -/* 184.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 184.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 184.7 - * 184.8 - * This code is free software; you can redistribute it and/or modify it 184.9 - * under the terms of the GNU General Public License version 2 only, as 184.10 - * published by the Free Software Foundation. 184.11 - * 184.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 184.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 184.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 184.15 - * version 2 for more details (a copy is included in the LICENSE file that 184.16 - * accompanied this code). 184.17 - * 184.18 - * You should have received a copy of the GNU General Public License version 184.19 - * 2 along with this work; if not, write to the Free Software Foundation, 184.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 184.21 - * 184.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 184.23 - * or visit www.oracle.com if you need additional information or have any 184.24 - * questions. 184.25 - */ 184.26 - 184.27 -/* 184.28 - * @test 184.29 - * @bug 6843077 184.30 - * @summary new type annotation location: throw clauses 184.31 - * @author Mahmood Ali 184.32 - * @compile -source 1.7 Throws.java 184.33 - */ 184.34 -class DefaultUnmodified { 184.35 - void oneException() throws @A Exception {} 184.36 - void twoExceptions() throws @A RuntimeException, @A Exception {} 184.37 -} 184.38 - 184.39 -class PublicModified { 184.40 - public final void oneException(String a) throws @A Exception {} 184.41 - public final void twoExceptions(String a) throws @A RuntimeException, @A Exception {} 184.42 -} 184.43 - 184.44 -class WithValue { 184.45 - void oneException() throws @B("m") Exception {} 184.46 - void twoExceptions() throws @B(value="m") RuntimeException, @A Exception {} 184.47 -} 184.48 - 184.49 -@interface A {} 184.50 -@interface B { String value(); }
185.1 --- a/test/tools/javac/typeAnnotations/newlocations/TypeCasts.java Thu Nov 04 15:54:46 2010 -0700 185.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 185.3 @@ -1,44 +0,0 @@ 185.4 -/* 185.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 185.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 185.7 - * 185.8 - * This code is free software; you can redistribute it and/or modify it 185.9 - * under the terms of the GNU General Public License version 2 only, as 185.10 - * published by the Free Software Foundation. 185.11 - * 185.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 185.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 185.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 185.15 - * version 2 for more details (a copy is included in the LICENSE file that 185.16 - * accompanied this code). 185.17 - * 185.18 - * You should have received a copy of the GNU General Public License version 185.19 - * 2 along with this work; if not, write to the Free Software Foundation, 185.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 185.21 - * 185.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 185.23 - * or visit www.oracle.com if you need additional information or have any 185.24 - * questions. 185.25 - */ 185.26 - 185.27 -/* 185.28 - * @test 185.29 - * @bug 6843077 185.30 - * @summary new type annotation location: type casts 185.31 - * @author Mahmood Ali 185.32 - * @compile -source 1.7 TypeCasts.java 185.33 - */ 185.34 -class TypeCasts { 185.35 - void methodA() { 185.36 - String s = (@A String) null; 185.37 - Object o = (@A Class<@A String>) null; 185.38 - } 185.39 - 185.40 - void methodB() { 185.41 - String s = (@B("m") String) null; 185.42 - Object o = (@B("m") Class<@B("m") String>) null; 185.43 - } 185.44 -} 185.45 - 185.46 -@interface A { } 185.47 -@interface B { String value(); }
186.1 --- a/test/tools/javac/typeAnnotations/newlocations/TypeParameters.java Thu Nov 04 15:54:46 2010 -0700 186.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 186.3 @@ -1,50 +0,0 @@ 186.4 -/* 186.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 186.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 186.7 - * 186.8 - * This code is free software; you can redistribute it and/or modify it 186.9 - * under the terms of the GNU General Public License version 2 only, as 186.10 - * published by the Free Software Foundation. 186.11 - * 186.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 186.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 186.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 186.15 - * version 2 for more details (a copy is included in the LICENSE file that 186.16 - * accompanied this code). 186.17 - * 186.18 - * You should have received a copy of the GNU General Public License version 186.19 - * 2 along with this work; if not, write to the Free Software Foundation, 186.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 186.21 - * 186.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 186.23 - * or visit www.oracle.com if you need additional information or have any 186.24 - * questions. 186.25 - */ 186.26 - 186.27 -/* 186.28 - * @test 186.29 - * @bug 6843077 186.30 - * @summary new type annotation location: class and method type parameters 186.31 - * @author Mahmood Ali 186.32 - * @compile -source 1.7 TypeParameters.java 186.33 - */ 186.34 - 186.35 -class Unannotated<K> { } 186.36 -class OneAnnotated<@A K> { } 186.37 -class TwoAnnotated<@A K, @A V> { } 186.38 -class SecondAnnotated<K, @A V extends String> { } 186.39 - 186.40 -class TestMethods { 186.41 - <K> void unannotated() { } 186.42 - <@A K> void oneAnnotated() { } 186.43 - <@A K, @B("m") V> void twoAnnotated() { } 186.44 - <K, @A V extends @A String> void secondAnnotated() { } 186.45 -} 186.46 - 186.47 -class UnannotatedB<K> { } 186.48 -class OneAnnotatedB<@B("m") K> { } 186.49 -class TwoAnnotatedB<@B("m") K, @B("m") V> { } 186.50 -class SecondAnnotatedB<K, @B("m") V extends @B("m") String> { } 186.51 - 186.52 -@interface A { } 186.53 -@interface B { String value(); }
187.1 --- a/test/tools/javac/typeAnnotations/newlocations/Wildcards.java Thu Nov 04 15:54:46 2010 -0700 187.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 187.3 @@ -1,70 +0,0 @@ 187.4 -/* 187.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 187.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 187.7 - * 187.8 - * This code is free software; you can redistribute it and/or modify it 187.9 - * under the terms of the GNU General Public License version 2 only, as 187.10 - * published by the Free Software Foundation. 187.11 - * 187.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 187.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 187.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 187.15 - * version 2 for more details (a copy is included in the LICENSE file that 187.16 - * accompanied this code). 187.17 - * 187.18 - * You should have received a copy of the GNU General Public License version 187.19 - * 2 along with this work; if not, write to the Free Software Foundation, 187.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 187.21 - * 187.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 187.23 - * or visit www.oracle.com if you need additional information or have any 187.24 - * questions. 187.25 - */ 187.26 - 187.27 -/* 187.28 - * @test 187.29 - * @bug 6843077 187.30 - * @summary new type annotation location: wildcard bound 187.31 - * @author Mahmood Ali 187.32 - * @compile -source 1.7 Wildcards.java 187.33 - */ 187.34 -class BoundTest { 187.35 - void wcExtends(MyList<? extends @A String> l) { } 187.36 - void wcSuper(MyList<? super @A String> l) { } 187.37 - 187.38 - MyList<? extends @A String> returnWcExtends() { return null; } 187.39 - MyList<? super @A String> returnWcSuper() { return null; } 187.40 - MyList<? extends @A MyList<? super @B("m") String>> complex() { return null; } 187.41 -} 187.42 - 187.43 -class BoundWithValue { 187.44 - void wcExtends(MyList<? extends @B("m") String> l) { } 187.45 - void wcSuper(MyList<? super @B(value="m") String> l) { } 187.46 - 187.47 - MyList<? extends @B("m") String> returnWcExtends() { return null; } 187.48 - MyList<? super @B(value="m") String> returnWcSuper() { return null; } 187.49 - MyList<? extends @B("m") MyList<? super @B("m") String>> complex() { return null; } 187.50 -} 187.51 - 187.52 -class SelfTest { 187.53 - void wcExtends(MyList<@A ?> l) { } 187.54 - void wcSuper(MyList<@A ?> l) { } 187.55 - 187.56 - MyList<@A ?> returnWcExtends() { return null; } 187.57 - MyList<@A ?> returnWcSuper() { return null; } 187.58 - MyList<@A ? extends @A MyList<@B("m") ?>> complex() { return null; } 187.59 -} 187.60 - 187.61 -class SelfWithValue { 187.62 - void wcExtends(MyList<@B("m") ?> l) { } 187.63 - void wcSuper(MyList<@B(value="m") ?> l) { } 187.64 - 187.65 - MyList<@B("m") ?> returnWcExtends() { return null; } 187.66 - MyList<@B(value="m") ?> returnWcSuper() { return null; } 187.67 - MyList<@B("m") ? extends MyList<@B("m") ? super String>> complex() { return null; } 187.68 -} 187.69 - 187.70 -class MyList<K> { } 187.71 - 187.72 -@interface A { } 187.73 -@interface B { String value(); }
188.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 188.2 +++ b/test/tools/javadoc/T6551367.java Tue Nov 09 22:54:48 2010 -0800 188.3 @@ -0,0 +1,54 @@ 188.4 +/* 188.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 188.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 188.7 + * 188.8 + * This code is free software; you can redistribute it and/or modify it 188.9 + * under the terms of the GNU General Public License version 2 only, as 188.10 + * published by the Free Software Foundation. 188.11 + * 188.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 188.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 188.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 188.15 + * version 2 for more details (a copy is included in the LICENSE file that 188.16 + * accompanied this code). 188.17 + * 188.18 + * You should have received a copy of the GNU General Public License version 188.19 + * 2 along with this work; if not, write to the Free Software Foundation, 188.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 188.21 + * 188.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 188.23 + * or visit www.oracle.com if you need additional information or have any 188.24 + * questions. 188.25 + */ 188.26 + 188.27 +/** 188.28 + * @test 188.29 + * @bug 6551367 188.30 + * @summary javadoc throws ClassCastException when an link tag tries to reference constructor. 188.31 + * @author A. Sundararajan 188.32 + * @run main T6551367 T6551367.java 188.33 + */ 188.34 + 188.35 +import com.sun.javadoc.*; 188.36 +import java.io.File; 188.37 +import static com.sun.tools.javadoc.Main.execute; 188.38 + 188.39 +public class T6551367 extends com.sun.tools.doclets.standard.Standard { 188.40 + public T6551367() {} 188.41 + 188.42 + /** Here, in the javadoc for this method, I try to link to 188.43 + * {@link #<init> a constructor}. 188.44 + */ 188.45 + public static void main(String... args) { 188.46 + File testSrc = new File(System.getProperty("test.src", ".")); 188.47 + File destDir = new File(System.getProperty("user.dir", ".")); 188.48 + for (String file : args) { 188.49 + File source = new File(testSrc, file); 188.50 + int rc = execute("javadoc", "T6551367", 188.51 + T6551367.class.getClassLoader(), 188.52 + new String[]{source.getPath(), "-d", destDir.getAbsolutePath()}); 188.53 + if (rc != 0) 188.54 + throw new Error("unexpected exit from javadoc: " + rc); 188.55 + } 188.56 + } 188.57 +}
189.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 189.2 +++ b/test/tools/javah/T6994608.java Tue Nov 09 22:54:48 2010 -0800 189.3 @@ -0,0 +1,89 @@ 189.4 +/* 189.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 189.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 189.7 + * 189.8 + * This code is free software; you can redistribute it and/or modify it 189.9 + * under the terms of the GNU General Public License version 2 only, as 189.10 + * published by the Free Software Foundation. 189.11 + * 189.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 189.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 189.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 189.15 + * version 2 for more details (a copy is included in the LICENSE file that 189.16 + * accompanied this code). 189.17 + * 189.18 + * You should have received a copy of the GNU General Public License version 189.19 + * 2 along with this work; if not, write to the Free Software Foundation, 189.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 189.21 + * 189.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 189.23 + * or visit www.oracle.com if you need additional information or have any 189.24 + * questions. 189.25 + */ 189.26 + 189.27 +/* 189.28 + * @test 189.29 + * @bug 6994608 189.30 + * @summary javah no longer accepts parameter files as input 189.31 + */ 189.32 + 189.33 +import java.io.*; 189.34 +import java.util.*; 189.35 + 189.36 +public class T6994608 { 189.37 + public static void main(String... args) throws Exception { 189.38 + new T6994608().run(); 189.39 + } 189.40 + 189.41 + void run() throws Exception { 189.42 + Locale prev = Locale.getDefault(); 189.43 + Locale.setDefault(Locale.ENGLISH); 189.44 + try { 189.45 + File f = writeFile(new File("classList"), "java.lang.Object"); 189.46 + test(Arrays.asList("@" + f.getPath()), 0, null); 189.47 + test(Arrays.asList("@badfile"), 1, "Can't find file badfile"); 189.48 + if (errors > 0) 189.49 + throw new Exception(errors + " errors occurred"); 189.50 + } finally { 189.51 + Locale.setDefault(prev); 189.52 + } 189.53 + } 189.54 + 189.55 + void test(List<String> args, int expectRC, String expectOut) { 189.56 + System.err.println("Test: " + args 189.57 + + " rc:" + expectRC 189.58 + + ((expectOut != null) ? " out:" + expectOut : "")); 189.59 + 189.60 + StringWriter sw = new StringWriter(); 189.61 + PrintWriter pw = new PrintWriter(sw); 189.62 + int rc = com.sun.tools.javah.Main.run(args.toArray(new String[args.size()]), pw); 189.63 + pw.close(); 189.64 + String out = sw.toString(); 189.65 + if (!out.isEmpty()) 189.66 + System.err.println(out); 189.67 + 189.68 + if (rc != expectRC) 189.69 + error("Unexpected exit code: " + rc + "; expected: " + expectRC); 189.70 + if (expectOut != null && !out.contains(expectOut)) 189.71 + error("Expected string not found: " + expectOut); 189.72 + 189.73 + System.err.println(); 189.74 + } 189.75 + 189.76 + File writeFile(File f, String s) throws IOException { 189.77 + if (f.getParentFile() != null) 189.78 + f.getParentFile().mkdirs(); 189.79 + try (FileWriter out = new FileWriter(f)) { 189.80 + out.write(s); 189.81 + } 189.82 + return f; 189.83 + } 189.84 + 189.85 + void error(String msg) { 189.86 + System.err.println(msg); 189.87 + errors++; 189.88 + } 189.89 + 189.90 + int errors; 189.91 +} 189.92 +
190.1 --- a/test/tools/javap/typeAnnotations/ArrayClassLiterals.java Thu Nov 04 15:54:46 2010 -0700 190.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 190.3 @@ -1,183 +0,0 @@ 190.4 -/* 190.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 190.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 190.7 - * 190.8 - * This code is free software; you can redistribute it and/or modify it 190.9 - * under the terms of the GNU General Public License version 2 only, as 190.10 - * published by the Free Software Foundation. 190.11 - * 190.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 190.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 190.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 190.15 - * version 2 for more details (a copy is included in the LICENSE file that 190.16 - * accompanied this code). 190.17 - * 190.18 - * You should have received a copy of the GNU General Public License version 190.19 - * 2 along with this work; if not, write to the Free Software Foundation, 190.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 190.21 - * 190.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 190.23 - * or visit www.oracle.com if you need additional information or have any 190.24 - * questions. 190.25 - */ 190.26 - 190.27 -import java.io.*; 190.28 -import com.sun.tools.classfile.*; 190.29 - 190.30 -/* 190.31 - * @test ArrayClassLiterals 190.32 - * @bug 6863814 190.33 - * @summary test that class literals array doesn't crash javap 190.34 - */ 190.35 - 190.36 -public class ArrayClassLiterals { 190.37 - public static void main(String[] args) throws Exception { 190.38 - new ArrayClassLiterals().run(); 190.39 - } 190.40 - 190.41 - public void run() throws Exception { 190.42 - File javaFile = writeTestFile(); 190.43 - File classFile = compileTestFile(javaFile); 190.44 - 190.45 - ClassFile cf = ClassFile.read(classFile); 190.46 - test(cf); 190.47 - for (Field f : cf.fields) { 190.48 - test(cf, f); 190.49 - } 190.50 - for (Method m: cf.methods) { 190.51 - test(cf, m); 190.52 - } 190.53 - 190.54 - countAnnotations(); 190.55 - 190.56 - if (errors > 0) 190.57 - throw new Exception(errors + " errors found"); 190.58 - System.out.println("PASSED"); 190.59 - } 190.60 - 190.61 - void test(ClassFile cf) { 190.62 - test(cf, Attribute.RuntimeVisibleTypeAnnotations, true); 190.63 - test(cf, Attribute.RuntimeInvisibleTypeAnnotations, false); 190.64 - } 190.65 - 190.66 - void test(ClassFile cf, Method m) { 190.67 - test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true); 190.68 - test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false); 190.69 - } 190.70 - 190.71 - void test(ClassFile cf, Field m) { 190.72 - test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true); 190.73 - test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false); 190.74 - } 190.75 - 190.76 - // test the result of Attributes.getIndex according to expectations 190.77 - // encoded in the method's name 190.78 - void test(ClassFile cf, String name, boolean visible) { 190.79 - int index = cf.attributes.getIndex(cf.constant_pool, name); 190.80 - if (index != -1) { 190.81 - Attribute attr = cf.attributes.get(index); 190.82 - assert attr instanceof RuntimeTypeAnnotations_attribute; 190.83 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 190.84 - all += tAttr.annotations.length; 190.85 - if (visible) 190.86 - visibles += tAttr.annotations.length; 190.87 - else 190.88 - invisibles += tAttr.annotations.length; 190.89 - 190.90 - for (ExtendedAnnotation anno : tAttr.annotations) 190.91 - anno.position.toString(); 190.92 - } 190.93 - } 190.94 - 190.95 - // test the result of Attributes.getIndex according to expectations 190.96 - // encoded in the method's name 190.97 - void test(ClassFile cf, Method m, String name, boolean visible) { 190.98 - int index = m.attributes.getIndex(cf.constant_pool, name); 190.99 - if (index != -1) { 190.100 - Attribute attr = m.attributes.get(index); 190.101 - assert attr instanceof RuntimeTypeAnnotations_attribute; 190.102 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 190.103 - all += tAttr.annotations.length; 190.104 - if (visible) 190.105 - visibles += tAttr.annotations.length; 190.106 - else 190.107 - invisibles += tAttr.annotations.length; 190.108 - 190.109 - for (ExtendedAnnotation anno : tAttr.annotations) 190.110 - anno.position.toString(); 190.111 - } 190.112 - } 190.113 - 190.114 - // test the result of Attributes.getIndex according to expectations 190.115 - // encoded in the method's name 190.116 - void test(ClassFile cf, Field m, String name, boolean visible) { 190.117 - int index = m.attributes.getIndex(cf.constant_pool, name); 190.118 - if (index != -1) { 190.119 - Attribute attr = m.attributes.get(index); 190.120 - assert attr instanceof RuntimeTypeAnnotations_attribute; 190.121 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 190.122 - all += tAttr.annotations.length; 190.123 - if (visible) 190.124 - visibles += tAttr.annotations.length; 190.125 - else 190.126 - invisibles += tAttr.annotations.length; 190.127 - 190.128 - for (ExtendedAnnotation anno : tAttr.annotations) 190.129 - anno.position.toString(); 190.130 - } 190.131 - } 190.132 - 190.133 - File writeTestFile() throws IOException { 190.134 - File f = new File("Testa.java"); 190.135 - PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f))); 190.136 - out.println("import java.util.*;"); 190.137 - out.println("class Testa { "); 190.138 - out.println(" @interface A { }"); 190.139 - 190.140 - out.println(" void test() {"); 190.141 - out.println(" Object a = @A String.class;"); 190.142 - out.println(" Object b = @A String @A [] @A [].class;"); 190.143 - out.println(" }"); 190.144 - out.println("}"); 190.145 - 190.146 - out.close(); 190.147 - return f; 190.148 - } 190.149 - 190.150 - File compileTestFile(File f) { 190.151 - int rc = com.sun.tools.javac.Main.compile(new String[] { "-source", "1.7", "-g", f.getPath() }); 190.152 - if (rc != 0) 190.153 - throw new Error("compilation failed. rc=" + rc); 190.154 - String path = f.getPath(); 190.155 - return new File(path.substring(0, path.length() - 5) + ".class"); 190.156 - } 190.157 - 190.158 - void countAnnotations() { 190.159 - int expected_visibles = 0, expected_invisibles = 4; 190.160 - int expected_all = expected_visibles + expected_invisibles; 190.161 - 190.162 - if (expected_all != all) { 190.163 - errors++; 190.164 - System.err.println("expected " + expected_all 190.165 - + " annotations but found " + all); 190.166 - } 190.167 - 190.168 - if (expected_visibles != visibles) { 190.169 - errors++; 190.170 - System.err.println("expected " + expected_visibles 190.171 - + " visibles annotations but found " + visibles); 190.172 - } 190.173 - 190.174 - if (expected_invisibles != invisibles) { 190.175 - errors++; 190.176 - System.err.println("expected " + expected_invisibles 190.177 - + " invisibles annotations but found " + invisibles); 190.178 - } 190.179 - 190.180 - } 190.181 - 190.182 - int errors; 190.183 - int all; 190.184 - int visibles; 190.185 - int invisibles; 190.186 -}
191.1 --- a/test/tools/javap/typeAnnotations/ArrayClassLiterals2.java Thu Nov 04 15:54:46 2010 -0700 191.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 191.3 @@ -1,82 +0,0 @@ 191.4 -/* 191.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 191.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 191.7 - * 191.8 - * This code is free software; you can redistribute it and/or modify it 191.9 - * under the terms of the GNU General Public License version 2 only, as 191.10 - * published by the Free Software Foundation. 191.11 - * 191.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 191.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 191.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 191.15 - * version 2 for more details (a copy is included in the LICENSE file that 191.16 - * accompanied this code). 191.17 - * 191.18 - * You should have received a copy of the GNU General Public License version 191.19 - * 2 along with this work; if not, write to the Free Software Foundation, 191.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 191.21 - * 191.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 191.23 - * or visit www.oracle.com if you need additional information or have any 191.24 - * questions. 191.25 - */ 191.26 - 191.27 -/* 191.28 - * @test 191.29 - * @bug 6918625 191.30 - * @summary javap dumps type information of array class literals 191.31 - */ 191.32 - 191.33 -import java.io.*; 191.34 - 191.35 -public class ArrayClassLiterals2 { 191.36 - public static void main(String[] args) throws Exception { 191.37 - new ArrayClassLiterals2().run(); 191.38 - } 191.39 - 191.40 - public void run() throws IOException { 191.41 - File classFile = new File(System.getProperty("test.classes"), "ArrayClassLiterals2$Test.class"); 191.42 - 191.43 - verify(classFile, 191.44 - "RuntimeInvisibleTypeAnnotations:", 191.45 - "CLASS_LITERAL_GENERIC_OR_ARRAY" 191.46 - ); 191.47 - 191.48 - if (errors > 0) 191.49 - throw new Error(errors + " found."); 191.50 - } 191.51 - 191.52 - String javap(File f) { 191.53 - StringWriter sw = new StringWriter(); 191.54 - PrintWriter out = new PrintWriter(sw); 191.55 - int rc = com.sun.tools.javap.Main.run(new String[] { "-v", f.getPath() }, out); 191.56 - if (rc != 0) 191.57 - throw new Error("javap failed. rc=" + rc); 191.58 - out.close(); 191.59 - return sw.toString(); 191.60 - } 191.61 - 191.62 - void verify(File classFile, String... expects) { 191.63 - String output = javap(classFile); 191.64 - for (String expect: expects) { 191.65 - if (output.indexOf(expect)< 0) 191.66 - error(expect + " not found"); 191.67 - } 191.68 - } 191.69 - 191.70 - void error(String msg) { 191.71 - System.err.println(msg); 191.72 - errors++; 191.73 - } 191.74 - 191.75 - int errors; 191.76 - 191.77 - 191.78 - /*********************** Test class *************************/ 191.79 - static class Test { 191.80 - @interface A { } 191.81 - void test() { 191.82 - Object a = @A String @A [] @A [].class; 191.83 - } 191.84 - } 191.85 -}
192.1 --- a/test/tools/javap/typeAnnotations/ClassLiterals.java Thu Nov 04 15:54:46 2010 -0700 192.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 192.3 @@ -1,174 +0,0 @@ 192.4 -/* 192.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 192.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 192.7 - * 192.8 - * This code is free software; you can redistribute it and/or modify it 192.9 - * under the terms of the GNU General Public License version 2 only, as 192.10 - * published by the Free Software Foundation. 192.11 - * 192.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 192.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 192.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 192.15 - * version 2 for more details (a copy is included in the LICENSE file that 192.16 - * accompanied this code). 192.17 - * 192.18 - * You should have received a copy of the GNU General Public License version 192.19 - * 2 along with this work; if not, write to the Free Software Foundation, 192.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 192.21 - * 192.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 192.23 - * or visit www.oracle.com if you need additional information or have any 192.24 - * questions. 192.25 - */ 192.26 - 192.27 -import java.io.*; 192.28 -import com.sun.tools.classfile.*; 192.29 - 192.30 -/* 192.31 - * @test ClassLiterals 192.32 - * @bug 6843077 192.33 - * @summary test that all type annotations are present in the classfile 192.34 - */ 192.35 - 192.36 -public class ClassLiterals { 192.37 - public static void main(String[] args) throws Exception { 192.38 - new ClassLiterals().run(); 192.39 - } 192.40 - 192.41 - public void run() throws Exception { 192.42 - File javaFile = writeTestFile(); 192.43 - File classFile = compileTestFile(javaFile); 192.44 - 192.45 - ClassFile cf = ClassFile.read(classFile); 192.46 - test(cf); 192.47 - for (Field f : cf.fields) { 192.48 - test(cf, f); 192.49 - } 192.50 - for (Method m: cf.methods) { 192.51 - test(cf, m); 192.52 - } 192.53 - 192.54 - countAnnotations(); 192.55 - 192.56 - if (errors > 0) 192.57 - throw new Exception(errors + " errors found"); 192.58 - System.out.println("PASSED"); 192.59 - } 192.60 - 192.61 - void test(ClassFile cf) { 192.62 - test(cf, Attribute.RuntimeVisibleTypeAnnotations, true); 192.63 - test(cf, Attribute.RuntimeInvisibleTypeAnnotations, false); 192.64 - } 192.65 - 192.66 - void test(ClassFile cf, Method m) { 192.67 - test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true); 192.68 - test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false); 192.69 - } 192.70 - 192.71 - void test(ClassFile cf, Field m) { 192.72 - test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true); 192.73 - test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false); 192.74 - } 192.75 - 192.76 - // test the result of Attributes.getIndex according to expectations 192.77 - // encoded in the method's name 192.78 - void test(ClassFile cf, String name, boolean visible) { 192.79 - int index = cf.attributes.getIndex(cf.constant_pool, name); 192.80 - if (index != -1) { 192.81 - Attribute attr = cf.attributes.get(index); 192.82 - assert attr instanceof RuntimeTypeAnnotations_attribute; 192.83 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 192.84 - all += tAttr.annotations.length; 192.85 - if (visible) 192.86 - visibles += tAttr.annotations.length; 192.87 - else 192.88 - invisibles += tAttr.annotations.length; 192.89 - } 192.90 - } 192.91 - 192.92 - // test the result of Attributes.getIndex according to expectations 192.93 - // encoded in the method's name 192.94 - void test(ClassFile cf, Method m, String name, boolean visible) { 192.95 - int index = m.attributes.getIndex(cf.constant_pool, name); 192.96 - if (index != -1) { 192.97 - Attribute attr = m.attributes.get(index); 192.98 - assert attr instanceof RuntimeTypeAnnotations_attribute; 192.99 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 192.100 - all += tAttr.annotations.length; 192.101 - if (visible) 192.102 - visibles += tAttr.annotations.length; 192.103 - else 192.104 - invisibles += tAttr.annotations.length; 192.105 - } 192.106 - } 192.107 - 192.108 - // test the result of Attributes.getIndex according to expectations 192.109 - // encoded in the method's name 192.110 - void test(ClassFile cf, Field m, String name, boolean visible) { 192.111 - int index = m.attributes.getIndex(cf.constant_pool, name); 192.112 - if (index != -1) { 192.113 - Attribute attr = m.attributes.get(index); 192.114 - assert attr instanceof RuntimeTypeAnnotations_attribute; 192.115 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 192.116 - all += tAttr.annotations.length; 192.117 - if (visible) 192.118 - visibles += tAttr.annotations.length; 192.119 - else 192.120 - invisibles += tAttr.annotations.length; 192.121 - } 192.122 - } 192.123 - 192.124 - File writeTestFile() throws IOException { 192.125 - File f = new File("Testa.java"); 192.126 - PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f))); 192.127 - out.println("import java.util.*;"); 192.128 - out.println("class Testa { "); 192.129 - out.println(" @interface A { }"); 192.130 - 192.131 - out.println(" void test() {"); 192.132 - out.println(" Object a = @A String.class;"); 192.133 - out.println(" Object b = @A String @A [] @A [].class;"); 192.134 - out.println(" }"); 192.135 - out.println("}"); 192.136 - 192.137 - out.close(); 192.138 - return f; 192.139 - } 192.140 - 192.141 - File compileTestFile(File f) { 192.142 - int rc = com.sun.tools.javac.Main.compile(new String[] { "-source", "1.7", "-g", f.getPath() }); 192.143 - if (rc != 0) 192.144 - throw new Error("compilation failed. rc=" + rc); 192.145 - String path = f.getPath(); 192.146 - return new File(path.substring(0, path.length() - 5) + ".class"); 192.147 - } 192.148 - 192.149 - void countAnnotations() { 192.150 - int expected_visibles = 0, expected_invisibles = 4; 192.151 - int expected_all = expected_visibles + expected_invisibles; 192.152 - 192.153 - if (expected_all != all) { 192.154 - errors++; 192.155 - System.err.println("expected " + expected_all 192.156 - + " annotations but found " + all); 192.157 - } 192.158 - 192.159 - if (expected_visibles != visibles) { 192.160 - errors++; 192.161 - System.err.println("expected " + expected_visibles 192.162 - + " visibles annotations but found " + visibles); 192.163 - } 192.164 - 192.165 - if (expected_invisibles != invisibles) { 192.166 - errors++; 192.167 - System.err.println("expected " + expected_invisibles 192.168 - + " invisibles annotations but found " + invisibles); 192.169 - } 192.170 - 192.171 - } 192.172 - 192.173 - int errors; 192.174 - int all; 192.175 - int visibles; 192.176 - int invisibles; 192.177 -}
193.1 --- a/test/tools/javap/typeAnnotations/JSR175Annotations.java Thu Nov 04 15:54:46 2010 -0700 193.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 193.3 @@ -1,152 +0,0 @@ 193.4 -/* 193.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 193.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 193.7 - * 193.8 - * This code is free software; you can redistribute it and/or modify it 193.9 - * under the terms of the GNU General Public License version 2 only, as 193.10 - * published by the Free Software Foundation. 193.11 - * 193.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 193.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 193.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 193.15 - * version 2 for more details (a copy is included in the LICENSE file that 193.16 - * accompanied this code). 193.17 - * 193.18 - * You should have received a copy of the GNU General Public License version 193.19 - * 2 along with this work; if not, write to the Free Software Foundation, 193.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 193.21 - * 193.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 193.23 - * or visit www.oracle.com if you need additional information or have any 193.24 - * questions. 193.25 - */ 193.26 - 193.27 -import java.io.*; 193.28 -import com.sun.tools.classfile.*; 193.29 - 193.30 -/* 193.31 - * @test JSR175Annotations 193.32 - * @bug 6843077 193.33 - * @summary test that only type annotations are recorded as such in classfile 193.34 - */ 193.35 - 193.36 -public class JSR175Annotations { 193.37 - public static void main(String[] args) throws Exception { 193.38 - new JSR175Annotations().run(); 193.39 - } 193.40 - 193.41 - public void run() throws Exception { 193.42 - File javaFile = writeTestFile(); 193.43 - File classFile = compileTestFile(javaFile); 193.44 - 193.45 - ClassFile cf = ClassFile.read(classFile); 193.46 - for (Field f : cf.fields) { 193.47 - test(cf, f); 193.48 - } 193.49 - for (Method m: cf.methods) { 193.50 - test(cf, m); 193.51 - } 193.52 - 193.53 - countAnnotations(); 193.54 - 193.55 - if (errors > 0) 193.56 - throw new Exception(errors + " errors found"); 193.57 - System.out.println("PASSED"); 193.58 - } 193.59 - 193.60 - void test(ClassFile cf, Method m) { 193.61 - test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true); 193.62 - test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false); 193.63 - } 193.64 - 193.65 - void test(ClassFile cf, Field m) { 193.66 - test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true); 193.67 - test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false); 193.68 - } 193.69 - 193.70 - // test the result of Attributes.getIndex according to expectations 193.71 - // encoded in the method's name 193.72 - void test(ClassFile cf, Method m, String name, boolean visible) { 193.73 - int index = m.attributes.getIndex(cf.constant_pool, name); 193.74 - if (index != -1) { 193.75 - Attribute attr = m.attributes.get(index); 193.76 - assert attr instanceof RuntimeTypeAnnotations_attribute; 193.77 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 193.78 - all += tAttr.annotations.length; 193.79 - if (visible) 193.80 - visibles += tAttr.annotations.length; 193.81 - else 193.82 - invisibles += tAttr.annotations.length; 193.83 - } 193.84 - } 193.85 - 193.86 - // test the result of Attributes.getIndex according to expectations 193.87 - // encoded in the method's name 193.88 - void test(ClassFile cf, Field m, String name, boolean visible) { 193.89 - int index = m.attributes.getIndex(cf.constant_pool, name); 193.90 - if (index != -1) { 193.91 - Attribute attr = m.attributes.get(index); 193.92 - assert attr instanceof RuntimeTypeAnnotations_attribute; 193.93 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 193.94 - all += tAttr.annotations.length; 193.95 - if (visible) 193.96 - visibles += tAttr.annotations.length; 193.97 - else 193.98 - invisibles += tAttr.annotations.length; 193.99 - } 193.100 - } 193.101 - 193.102 - File writeTestFile() throws IOException { 193.103 - File f = new File("Test.java"); 193.104 - PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f))); 193.105 - out.println("import java.lang.annotation.Retention;"); 193.106 - out.println("import java.lang.annotation.RetentionPolicy;"); 193.107 - out.println("abstract class Test { "); 193.108 - out.println(" @Retention(RetentionPolicy.RUNTIME)"); 193.109 - out.println(" @interface A { }"); 193.110 - out.println(" @A String m;"); 193.111 - out.println(" @A String method(@A String a) {"); 193.112 - out.println(" return a;"); 193.113 - out.println(" }"); 193.114 - out.println("}"); 193.115 - out.close(); 193.116 - return f; 193.117 - } 193.118 - 193.119 - File compileTestFile(File f) { 193.120 - int rc = com.sun.tools.javac.Main.compile(new String[] { "-source", "1.7", "-g", f.getPath() }); 193.121 - if (rc != 0) 193.122 - throw new Error("compilation failed. rc=" + rc); 193.123 - String path = f.getPath(); 193.124 - return new File(path.substring(0, path.length() - 5) + ".class"); 193.125 - } 193.126 - 193.127 - void countAnnotations() { 193.128 - int expected_visibles = 0, expected_invisibles = 0; 193.129 - int expected_all = expected_visibles + expected_invisibles; 193.130 - 193.131 - if (expected_all != all) { 193.132 - errors++; 193.133 - System.err.println("expected " + expected_all 193.134 - + " annotations but found " + all); 193.135 - } 193.136 - 193.137 - if (expected_visibles != visibles) { 193.138 - errors++; 193.139 - System.err.println("expected " + expected_visibles 193.140 - + " visibles annotations but found " + visibles); 193.141 - } 193.142 - 193.143 - if (expected_invisibles != invisibles) { 193.144 - errors++; 193.145 - System.err.println("expected " + expected_invisibles 193.146 - + " invisibles annotations but found " + invisibles); 193.147 - } 193.148 - 193.149 - } 193.150 - 193.151 - int errors; 193.152 - int all; 193.153 - int visibles; 193.154 - int invisibles; 193.155 -}
194.1 --- a/test/tools/javap/typeAnnotations/NewArray.java Thu Nov 04 15:54:46 2010 -0700 194.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 194.3 @@ -1,175 +0,0 @@ 194.4 -/* 194.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 194.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 194.7 - * 194.8 - * This code is free software; you can redistribute it and/or modify it 194.9 - * under the terms of the GNU General Public License version 2 only, as 194.10 - * published by the Free Software Foundation. 194.11 - * 194.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 194.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 194.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 194.15 - * version 2 for more details (a copy is included in the LICENSE file that 194.16 - * accompanied this code). 194.17 - * 194.18 - * You should have received a copy of the GNU General Public License version 194.19 - * 2 along with this work; if not, write to the Free Software Foundation, 194.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 194.21 - * 194.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 194.23 - * or visit www.oracle.com if you need additional information or have any 194.24 - * questions. 194.25 - */ 194.26 - 194.27 -import java.io.*; 194.28 -import com.sun.tools.classfile.*; 194.29 - 194.30 -/* 194.31 - * @test NewArray 194.32 - * @bug 6843077 194.33 - * @summary test that all type annotations are present in the classfile 194.34 - */ 194.35 - 194.36 -public class NewArray { 194.37 - public static void main(String[] args) throws Exception { 194.38 - new NewArray().run(); 194.39 - } 194.40 - 194.41 - public void run() throws Exception { 194.42 - File javaFile = writeTestFile(); 194.43 - File classFile = compileTestFile(javaFile); 194.44 - 194.45 - ClassFile cf = ClassFile.read(classFile); 194.46 - test(cf); 194.47 - for (Field f : cf.fields) { 194.48 - test(cf, f); 194.49 - } 194.50 - for (Method m: cf.methods) { 194.51 - test(cf, m); 194.52 - } 194.53 - 194.54 - countAnnotations(); 194.55 - 194.56 - if (errors > 0) 194.57 - throw new Exception(errors + " errors found"); 194.58 - System.out.println("PASSED"); 194.59 - } 194.60 - 194.61 - void test(ClassFile cf) { 194.62 - test(cf, Attribute.RuntimeVisibleTypeAnnotations, true); 194.63 - test(cf, Attribute.RuntimeInvisibleTypeAnnotations, false); 194.64 - } 194.65 - 194.66 - void test(ClassFile cf, Method m) { 194.67 - test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true); 194.68 - test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false); 194.69 - } 194.70 - 194.71 - void test(ClassFile cf, Field m) { 194.72 - test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true); 194.73 - test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false); 194.74 - } 194.75 - 194.76 - // test the result of Attributes.getIndex according to expectations 194.77 - // encoded in the method's name 194.78 - void test(ClassFile cf, String name, boolean visible) { 194.79 - int index = cf.attributes.getIndex(cf.constant_pool, name); 194.80 - if (index != -1) { 194.81 - Attribute attr = cf.attributes.get(index); 194.82 - assert attr instanceof RuntimeTypeAnnotations_attribute; 194.83 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 194.84 - all += tAttr.annotations.length; 194.85 - if (visible) 194.86 - visibles += tAttr.annotations.length; 194.87 - else 194.88 - invisibles += tAttr.annotations.length; 194.89 - } 194.90 - } 194.91 - 194.92 - // test the result of Attributes.getIndex according to expectations 194.93 - // encoded in the method's name 194.94 - void test(ClassFile cf, Method m, String name, boolean visible) { 194.95 - int index = m.attributes.getIndex(cf.constant_pool, name); 194.96 - if (index != -1) { 194.97 - Attribute attr = m.attributes.get(index); 194.98 - assert attr instanceof RuntimeTypeAnnotations_attribute; 194.99 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 194.100 - all += tAttr.annotations.length; 194.101 - if (visible) 194.102 - visibles += tAttr.annotations.length; 194.103 - else 194.104 - invisibles += tAttr.annotations.length; 194.105 - } 194.106 - } 194.107 - 194.108 - // test the result of Attributes.getIndex according to expectations 194.109 - // encoded in the method's name 194.110 - void test(ClassFile cf, Field m, String name, boolean visible) { 194.111 - int index = m.attributes.getIndex(cf.constant_pool, name); 194.112 - if (index != -1) { 194.113 - Attribute attr = m.attributes.get(index); 194.114 - assert attr instanceof RuntimeTypeAnnotations_attribute; 194.115 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 194.116 - all += tAttr.annotations.length; 194.117 - if (visible) 194.118 - visibles += tAttr.annotations.length; 194.119 - else 194.120 - invisibles += tAttr.annotations.length; 194.121 - } 194.122 - } 194.123 - 194.124 - File writeTestFile() throws IOException { 194.125 - File f = new File("Test.java"); 194.126 - PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f))); 194.127 - out.println("import java.util.*;"); 194.128 - out.println("class Test { "); 194.129 - out.println(" @interface A { }"); 194.130 - 194.131 - out.println(" void test() {"); 194.132 - out.println(" Object a = new @A String @A [5] @A [];"); 194.133 - out.println(" Object b = new @A String @A [5] @A [3];"); 194.134 - out.println(" Object c = new @A String @A [] @A [] {};"); 194.135 - out.println(" }"); 194.136 - out.println("}"); 194.137 - 194.138 - out.close(); 194.139 - return f; 194.140 - } 194.141 - 194.142 - File compileTestFile(File f) { 194.143 - int rc = com.sun.tools.javac.Main.compile(new String[] { "-source", "1.7", "-g", f.getPath() }); 194.144 - if (rc != 0) 194.145 - throw new Error("compilation failed. rc=" + rc); 194.146 - String path = f.getPath(); 194.147 - return new File(path.substring(0, path.length() - 5) + ".class"); 194.148 - } 194.149 - 194.150 - void countAnnotations() { 194.151 - int expected_visibles = 0, expected_invisibles = 9; 194.152 - int expected_all = expected_visibles + expected_invisibles; 194.153 - 194.154 - if (expected_all != all) { 194.155 - errors++; 194.156 - System.err.println("expected " + expected_all 194.157 - + " annotations but found " + all); 194.158 - } 194.159 - 194.160 - if (expected_visibles != visibles) { 194.161 - errors++; 194.162 - System.err.println("expected " + expected_visibles 194.163 - + " visibles annotations but found " + visibles); 194.164 - } 194.165 - 194.166 - if (expected_invisibles != invisibles) { 194.167 - errors++; 194.168 - System.err.println("expected " + expected_invisibles 194.169 - + " invisibles annotations but found " + invisibles); 194.170 - } 194.171 - 194.172 - } 194.173 - 194.174 - int errors; 194.175 - int all; 194.176 - int visibles; 194.177 - int invisibles; 194.178 -}
195.1 --- a/test/tools/javap/typeAnnotations/Presence.java Thu Nov 04 15:54:46 2010 -0700 195.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 195.3 @@ -1,189 +0,0 @@ 195.4 -/* 195.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 195.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 195.7 - * 195.8 - * This code is free software; you can redistribute it and/or modify it 195.9 - * under the terms of the GNU General Public License version 2 only, as 195.10 - * published by the Free Software Foundation. 195.11 - * 195.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 195.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 195.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 195.15 - * version 2 for more details (a copy is included in the LICENSE file that 195.16 - * accompanied this code). 195.17 - * 195.18 - * You should have received a copy of the GNU General Public License version 195.19 - * 2 along with this work; if not, write to the Free Software Foundation, 195.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 195.21 - * 195.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 195.23 - * or visit www.oracle.com if you need additional information or have any 195.24 - * questions. 195.25 - */ 195.26 - 195.27 -import java.io.*; 195.28 -import com.sun.tools.classfile.*; 195.29 - 195.30 -/* 195.31 - * @test Presence 195.32 - * @bug 6843077 195.33 - * @summary test that all type annotations are present in the classfile 195.34 - */ 195.35 - 195.36 -public class Presence { 195.37 - public static void main(String[] args) throws Exception { 195.38 - new Presence().run(); 195.39 - } 195.40 - 195.41 - public void run() throws Exception { 195.42 - File javaFile = writeTestFile(); 195.43 - File classFile = compileTestFile(javaFile); 195.44 - 195.45 - ClassFile cf = ClassFile.read(classFile); 195.46 - test(cf); 195.47 - for (Field f : cf.fields) { 195.48 - test(cf, f); 195.49 - } 195.50 - for (Method m: cf.methods) { 195.51 - test(cf, m); 195.52 - } 195.53 - 195.54 - countAnnotations(); 195.55 - 195.56 - if (errors > 0) 195.57 - throw new Exception(errors + " errors found"); 195.58 - System.out.println("PASSED"); 195.59 - } 195.60 - 195.61 - void test(ClassFile cf) { 195.62 - test(cf, Attribute.RuntimeVisibleTypeAnnotations, true); 195.63 - test(cf, Attribute.RuntimeInvisibleTypeAnnotations, false); 195.64 - } 195.65 - 195.66 - void test(ClassFile cf, Method m) { 195.67 - test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true); 195.68 - test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false); 195.69 - } 195.70 - 195.71 - void test(ClassFile cf, Field m) { 195.72 - test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true); 195.73 - test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false); 195.74 - } 195.75 - 195.76 - // test the result of Attributes.getIndex according to expectations 195.77 - // encoded in the method's name 195.78 - void test(ClassFile cf, String name, boolean visible) { 195.79 - int index = cf.attributes.getIndex(cf.constant_pool, name); 195.80 - if (index != -1) { 195.81 - Attribute attr = cf.attributes.get(index); 195.82 - assert attr instanceof RuntimeTypeAnnotations_attribute; 195.83 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 195.84 - all += tAttr.annotations.length; 195.85 - if (visible) 195.86 - visibles += tAttr.annotations.length; 195.87 - else 195.88 - invisibles += tAttr.annotations.length; 195.89 - } 195.90 - } 195.91 - 195.92 - // test the result of Attributes.getIndex according to expectations 195.93 - // encoded in the method's name 195.94 - void test(ClassFile cf, Method m, String name, boolean visible) { 195.95 - int index = m.attributes.getIndex(cf.constant_pool, name); 195.96 - if (index != -1) { 195.97 - Attribute attr = m.attributes.get(index); 195.98 - assert attr instanceof RuntimeTypeAnnotations_attribute; 195.99 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 195.100 - all += tAttr.annotations.length; 195.101 - if (visible) 195.102 - visibles += tAttr.annotations.length; 195.103 - else 195.104 - invisibles += tAttr.annotations.length; 195.105 - } 195.106 - } 195.107 - 195.108 - // test the result of Attributes.getIndex according to expectations 195.109 - // encoded in the method's name 195.110 - void test(ClassFile cf, Field m, String name, boolean visible) { 195.111 - int index = m.attributes.getIndex(cf.constant_pool, name); 195.112 - if (index != -1) { 195.113 - Attribute attr = m.attributes.get(index); 195.114 - assert attr instanceof RuntimeTypeAnnotations_attribute; 195.115 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 195.116 - all += tAttr.annotations.length; 195.117 - if (visible) 195.118 - visibles += tAttr.annotations.length; 195.119 - else 195.120 - invisibles += tAttr.annotations.length; 195.121 - } 195.122 - } 195.123 - 195.124 - File writeTestFile() throws IOException { 195.125 - File f = new File("Test.java"); 195.126 - PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f))); 195.127 - out.println("import java.util.*;"); 195.128 - out.println("class Test<@Test.A T extends @Test.A List<@Test.A String>> { "); 195.129 - out.println(" @interface A { }"); 195.130 - 195.131 - out.println(" Map<@A String, Map<@A String, @A String>> f1;"); 195.132 - 195.133 - out.println(" <@A T extends @A List<@A String>>"); 195.134 - out.println(" Map<@A String, @A List<@A String>>"); 195.135 - out.println(" method(List<@A String> @A [] param1, String @A [] @A ... param2) @A"); 195.136 - out.println(" throws @A Exception {"); 195.137 - out.println(" @A String lc1 = null;"); 195.138 - out.println(" @A List<@A String> lc2 = null;"); 195.139 - out.println(" @A String @A [] [] @A[] lc3 = null;"); 195.140 - out.println(" List<? extends @A List<@A String>> lc4 = null;"); 195.141 - out.println(" Object lc5 = (@A List<@A String>) null;"); 195.142 - out.println(" boolean lc6 = lc1 instanceof @A String;"); 195.143 - out.println(" boolean lc7 = lc5 instanceof @A String @A [] @A [];"); 195.144 - out.println(" new @A ArrayList<@A String>();"); 195.145 - out.println(" Object lc8 = new @A String @A [4];"); 195.146 - out.println(" Object lc9 = @A String.class;"); 195.147 - out.println(" Object lc10 = @A int.class;"); 195.148 - out.println(" return null;"); 195.149 - out.println(" }"); 195.150 - out.println(" void vararg1(String @A ... t) { } "); 195.151 - out.println("}"); 195.152 - out.close(); 195.153 - return f; 195.154 - } 195.155 - 195.156 - File compileTestFile(File f) { 195.157 - int rc = com.sun.tools.javac.Main.compile(new String[] { "-source", "1.7", "-g", f.getPath() }); 195.158 - if (rc != 0) 195.159 - throw new Error("compilation failed. rc=" + rc); 195.160 - String path = f.getPath(); 195.161 - return new File(path.substring(0, path.length() - 5) + ".class"); 195.162 - } 195.163 - 195.164 - void countAnnotations() { 195.165 - int expected_visibles = 0, expected_invisibles = 39; 195.166 - int expected_all = expected_visibles + expected_invisibles; 195.167 - 195.168 - if (expected_all != all) { 195.169 - errors++; 195.170 - System.err.println("expected " + expected_all 195.171 - + " annotations but found " + all); 195.172 - } 195.173 - 195.174 - if (expected_visibles != visibles) { 195.175 - errors++; 195.176 - System.err.println("expected " + expected_visibles 195.177 - + " visibles annotations but found " + visibles); 195.178 - } 195.179 - 195.180 - if (expected_invisibles != invisibles) { 195.181 - errors++; 195.182 - System.err.println("expected " + expected_invisibles 195.183 - + " invisibles annotations but found " + invisibles); 195.184 - } 195.185 - 195.186 - } 195.187 - 195.188 - int errors; 195.189 - int all; 195.190 - int visibles; 195.191 - int invisibles; 195.192 -}
196.1 --- a/test/tools/javap/typeAnnotations/PresenceInner.java Thu Nov 04 15:54:46 2010 -0700 196.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 196.3 @@ -1,185 +0,0 @@ 196.4 -/* 196.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 196.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 196.7 - * 196.8 - * This code is free software; you can redistribute it and/or modify it 196.9 - * under the terms of the GNU General Public License version 2 only, as 196.10 - * published by the Free Software Foundation. 196.11 - * 196.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 196.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 196.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 196.15 - * version 2 for more details (a copy is included in the LICENSE file that 196.16 - * accompanied this code). 196.17 - * 196.18 - * You should have received a copy of the GNU General Public License version 196.19 - * 2 along with this work; if not, write to the Free Software Foundation, 196.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 196.21 - * 196.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 196.23 - * or visit www.oracle.com if you need additional information or have any 196.24 - * questions. 196.25 - */ 196.26 - 196.27 -import java.io.*; 196.28 -import com.sun.tools.classfile.*; 196.29 - 196.30 -/* 196.31 - * @test PresenceInner 196.32 - * @bug 6843077 196.33 - * @summary test that annotations in inner types count only once 196.34 - */ 196.35 - 196.36 -public class PresenceInner { 196.37 - public static void main(String[] args) throws Exception { 196.38 - new PresenceInner().run(); 196.39 - } 196.40 - 196.41 - public void run() throws Exception { 196.42 - File javaFile = writeTestFile(); 196.43 - File classFile = compileTestFile(javaFile); 196.44 - 196.45 - ClassFile cf = ClassFile.read(classFile); 196.46 - test(cf); 196.47 - for (Field f : cf.fields) { 196.48 - test(cf, f); 196.49 - } 196.50 - for (Method m: cf.methods) { 196.51 - test(cf, m); 196.52 - } 196.53 - 196.54 - // counts are zero when vising outer class 196.55 - countAnnotations(0); 196.56 - 196.57 - // visit inner class 196.58 - File innerFile = new File("Test$1Inner.class"); 196.59 - ClassFile icf = ClassFile.read(innerFile); 196.60 - test(icf); 196.61 - for (Field f : icf.fields) { 196.62 - test(cf, f); 196.63 - } 196.64 - for (Method m: icf.methods) { 196.65 - test(cf, m); 196.66 - } 196.67 - 196.68 - countAnnotations(1); 196.69 - if (errors > 0) 196.70 - throw new Exception(errors + " errors found"); 196.71 - System.out.println("PASSED"); 196.72 - } 196.73 - 196.74 - void test(ClassFile cf) { 196.75 - test(cf, Attribute.RuntimeVisibleTypeAnnotations, true); 196.76 - test(cf, Attribute.RuntimeInvisibleTypeAnnotations, false); 196.77 - } 196.78 - 196.79 - void test(ClassFile cf, Method m) { 196.80 - test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true); 196.81 - test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false); 196.82 - } 196.83 - 196.84 - void test(ClassFile cf, Field m) { 196.85 - test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true); 196.86 - test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false); 196.87 - } 196.88 - 196.89 - // test the result of Attributes.getIndex according to expectations 196.90 - // encoded in the method's name 196.91 - void test(ClassFile cf, String name, boolean visible) { 196.92 - int index = cf.attributes.getIndex(cf.constant_pool, name); 196.93 - if (index != -1) { 196.94 - Attribute attr = cf.attributes.get(index); 196.95 - assert attr instanceof RuntimeTypeAnnotations_attribute; 196.96 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 196.97 - all += tAttr.annotations.length; 196.98 - if (visible) 196.99 - visibles += tAttr.annotations.length; 196.100 - else 196.101 - invisibles += tAttr.annotations.length; 196.102 - } 196.103 - } 196.104 - 196.105 - // test the result of Attributes.getIndex according to expectations 196.106 - // encoded in the method's name 196.107 - void test(ClassFile cf, Method m, String name, boolean visible) { 196.108 - int index = m.attributes.getIndex(cf.constant_pool, name); 196.109 - if (index != -1) { 196.110 - Attribute attr = m.attributes.get(index); 196.111 - assert attr instanceof RuntimeTypeAnnotations_attribute; 196.112 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 196.113 - all += tAttr.annotations.length; 196.114 - if (visible) 196.115 - visibles += tAttr.annotations.length; 196.116 - else 196.117 - invisibles += tAttr.annotations.length; 196.118 - } 196.119 - } 196.120 - 196.121 - // test the result of Attributes.getIndex according to expectations 196.122 - // encoded in the method's name 196.123 - void test(ClassFile cf, Field m, String name, boolean visible) { 196.124 - int index = m.attributes.getIndex(cf.constant_pool, name); 196.125 - if (index != -1) { 196.126 - Attribute attr = m.attributes.get(index); 196.127 - assert attr instanceof RuntimeTypeAnnotations_attribute; 196.128 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 196.129 - all += tAttr.annotations.length; 196.130 - if (visible) 196.131 - visibles += tAttr.annotations.length; 196.132 - else 196.133 - invisibles += tAttr.annotations.length; 196.134 - } 196.135 - } 196.136 - 196.137 - File writeTestFile() throws IOException { 196.138 - File f = new File("Test.java"); 196.139 - PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f))); 196.140 - 196.141 - out.println("class Test {"); 196.142 - out.println(" void method() {"); 196.143 - out.println(" class Inner<T extends @A Object> { }"); 196.144 - out.println(" }"); 196.145 - out.println("}"); 196.146 - out.println("@interface A { }"); 196.147 - out.close(); 196.148 - System.out.println(f.getAbsolutePath()); 196.149 - return f; 196.150 - } 196.151 - 196.152 - File compileTestFile(File f) { 196.153 - int rc = com.sun.tools.javac.Main.compile(new String[] { "-source", "1.7", "-g", f.getPath() }); 196.154 - if (rc != 0) 196.155 - throw new Error("compilation failed. rc=" + rc); 196.156 - String path = f.getPath(); 196.157 - return new File(path.substring(0, path.length() - 5) + ".class"); 196.158 - } 196.159 - 196.160 - void countAnnotations(int expected_invisibles) { 196.161 - int expected_visibles = 0; 196.162 - int expected_all = expected_visibles + expected_invisibles; 196.163 - 196.164 - if (expected_all != all) { 196.165 - errors++; 196.166 - System.err.println("expected " + expected_all 196.167 - + " annotations but found " + all); 196.168 - } 196.169 - 196.170 - if (expected_visibles != visibles) { 196.171 - errors++; 196.172 - System.err.println("expected " + expected_visibles 196.173 - + " visibles annotations but found " + visibles); 196.174 - } 196.175 - 196.176 - if (expected_invisibles != invisibles) { 196.177 - errors++; 196.178 - System.err.println("expected " + expected_invisibles 196.179 - + " invisibles annotations but found " + invisibles); 196.180 - } 196.181 - 196.182 - } 196.183 - 196.184 - int errors; 196.185 - int all; 196.186 - int visibles; 196.187 - int invisibles; 196.188 -}
197.1 --- a/test/tools/javap/typeAnnotations/T6855990.java Thu Nov 04 15:54:46 2010 -0700 197.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 197.3 @@ -1,51 +0,0 @@ 197.4 -/* 197.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 197.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 197.7 - * 197.8 - * This code is free software; you can redistribute it and/or modify it 197.9 - * under the terms of the GNU General Public License version 2 only, as 197.10 - * published by the Free Software Foundation. 197.11 - * 197.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 197.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 197.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 197.15 - * version 2 for more details (a copy is included in the LICENSE file that 197.16 - * accompanied this code). 197.17 - * 197.18 - * You should have received a copy of the GNU General Public License version 197.19 - * 2 along with this work; if not, write to the Free Software Foundation, 197.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 197.21 - * 197.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 197.23 - * or visit www.oracle.com if you need additional information or have any 197.24 - * questions. 197.25 - */ 197.26 - 197.27 -import java.io.*; 197.28 - 197.29 -/* 197.30 - * @test 197.31 - * @bug 6855990 197.32 - * @summary InstructionDetailWriter should support new 308 annotations attribute 197.33 - */ 197.34 - 197.35 -public class T6855990 { 197.36 - public static void main(String[] args) throws Exception { 197.37 - new T6855990().run(); 197.38 - } 197.39 - 197.40 - public void run() throws Exception { 197.41 - @Simple String[] args = { "-c", "-XDdetails:typeAnnotations", "T6855990" }; 197.42 - StringWriter sw = new StringWriter(); 197.43 - PrintWriter pw = new PrintWriter(sw); 197.44 - int rc = com.sun.tools.javap.Main.run(args, pw); 197.45 - pw.close(); 197.46 - String out = sw.toString(); 197.47 - System.out.println(out); 197.48 - if (out.indexOf("@Simple: LOCAL_VARIABLE") == -1) 197.49 - throw new Exception("expected output not found"); 197.50 - } 197.51 -} 197.52 - 197.53 -@interface Simple { } 197.54 -
198.1 --- a/test/tools/javap/typeAnnotations/Visibility.java Thu Nov 04 15:54:46 2010 -0700 198.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 198.3 @@ -1,139 +0,0 @@ 198.4 -/* 198.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 198.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 198.7 - * 198.8 - * This code is free software; you can redistribute it and/or modify it 198.9 - * under the terms of the GNU General Public License version 2 only, as 198.10 - * published by the Free Software Foundation. 198.11 - * 198.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 198.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 198.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 198.15 - * version 2 for more details (a copy is included in the LICENSE file that 198.16 - * accompanied this code). 198.17 - * 198.18 - * You should have received a copy of the GNU General Public License version 198.19 - * 2 along with this work; if not, write to the Free Software Foundation, 198.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 198.21 - * 198.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 198.23 - * or visit www.oracle.com if you need additional information or have any 198.24 - * questions. 198.25 - */ 198.26 - 198.27 -import java.io.*; 198.28 -import com.sun.tools.classfile.*; 198.29 - 198.30 -/* 198.31 - * @test Visibility 198.32 - * @bug 6843077 198.33 - * @summary test that type annotations are recorded in the classfile 198.34 - */ 198.35 - 198.36 -public class Visibility { 198.37 - public static void main(String[] args) throws Exception { 198.38 - new Visibility().run(); 198.39 - } 198.40 - 198.41 - public void run() throws Exception { 198.42 - File javaFile = writeTestFile(); 198.43 - File classFile = compileTestFile(javaFile); 198.44 - 198.45 - ClassFile cf = ClassFile.read(classFile); 198.46 - for (Method m: cf.methods) { 198.47 - test(cf, m); 198.48 - } 198.49 - 198.50 - countAnnotations(); 198.51 - 198.52 - if (errors > 0) 198.53 - throw new Exception(errors + " errors found"); 198.54 - System.out.println("PASSED"); 198.55 - } 198.56 - 198.57 - void test(ClassFile cf, Method m) { 198.58 - test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true); 198.59 - test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false); 198.60 - } 198.61 - 198.62 - // test the result of Attributes.getIndex according to expectations 198.63 - // encoded in the method's name 198.64 - void test(ClassFile cf, Method m, String name, boolean visible) { 198.65 - int index = m.attributes.getIndex(cf.constant_pool, name); 198.66 - if (index != -1) { 198.67 - Attribute attr = m.attributes.get(index); 198.68 - assert attr instanceof RuntimeTypeAnnotations_attribute; 198.69 - RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr; 198.70 - all += tAttr.annotations.length; 198.71 - if (visible) 198.72 - visibles += tAttr.annotations.length; 198.73 - else 198.74 - invisibles += tAttr.annotations.length; 198.75 - } 198.76 - } 198.77 - 198.78 - File writeTestFile() throws IOException { 198.79 - File f = new File("Test.java"); 198.80 - PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f))); 198.81 - out.println("import java.lang.annotation.Retention;"); 198.82 - out.println("import java.lang.annotation.RetentionPolicy;"); 198.83 - out.println("abstract class Test { "); 198.84 - // visible annotations: RUNTIME 198.85 - out.println(" @Retention(RetentionPolicy.RUNTIME)"); 198.86 - out.println(" @interface A { }"); 198.87 - out.println(" void visible() @A { }"); 198.88 - 198.89 - // invisible annotations: CLASS 198.90 - out.println(" @Retention(RetentionPolicy.CLASS)"); 198.91 - out.println(" @interface B { }"); 198.92 - out.println(" void invisible() @B { }"); 198.93 - 198.94 - // source annotations 198.95 - out.println(" @Retention(RetentionPolicy.SOURCE)"); 198.96 - out.println(" @interface C { }"); 198.97 - out.println(" void source() @C { }"); 198.98 - 198.99 - // default visibility: CLASS 198.100 - out.println(" @interface D { }"); 198.101 - out.println(" void def() @D { }"); 198.102 - out.println("}"); 198.103 - out.close(); 198.104 - return f; 198.105 - } 198.106 - 198.107 - File compileTestFile(File f) { 198.108 - int rc = com.sun.tools.javac.Main.compile(new String[] { "-source", "1.7", "-g", f.getPath() }); 198.109 - if (rc != 0) 198.110 - throw new Error("compilation failed. rc=" + rc); 198.111 - String path = f.getPath(); 198.112 - return new File(path.substring(0, path.length() - 5) + ".class"); 198.113 - } 198.114 - 198.115 - void countAnnotations() { 198.116 - int expected_all = 3, expected_visibles = 1, expected_invisibles = 2; 198.117 - 198.118 - if (expected_all != all) { 198.119 - errors++; 198.120 - System.err.println("expected " + expected_all 198.121 - + " annotations but found " + all); 198.122 - } 198.123 - 198.124 - if (expected_visibles != visibles) { 198.125 - errors++; 198.126 - System.err.println("expected " + expected_visibles 198.127 - + " visibles annotations but found " + visibles); 198.128 - } 198.129 - 198.130 - if (expected_invisibles != invisibles) { 198.131 - errors++; 198.132 - System.err.println("expected " + expected_invisibles 198.133 - + " invisibles annotations but found " + invisibles); 198.134 - } 198.135 - 198.136 - } 198.137 - 198.138 - int errors; 198.139 - int all; 198.140 - int visibles; 198.141 - int invisibles; 198.142 -}