langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java
changeset 21041 99f5e5e97425
parent 21005 4db633bd7696
child 21708 9642be503906
equal deleted inserted replaced
21040:3e32f68d2151 21041:99f5e5e97425
  2832         // tree.annotations = translate(tree.annotations);
  2832         // tree.annotations = translate(tree.annotations);
  2833         tree.annotations = List.nil();
  2833         tree.annotations = List.nil();
  2834         tree.underlyingType = translate(tree.underlyingType);
  2834         tree.underlyingType = translate(tree.underlyingType);
  2835         // but maintain type annotations in the type.
  2835         // but maintain type annotations in the type.
  2836         if (tree.type.isAnnotated()) {
  2836         if (tree.type.isAnnotated()) {
  2837             if (tree.underlyingType.type.isAnnotated()) {
  2837             tree.type = tree.underlyingType.type.unannotatedType().annotatedType(tree.type.getAnnotationMirrors());
  2838                 // The erasure of a type variable might be annotated.
  2838         } else if (tree.underlyingType.type.isAnnotated()) {
  2839                 // Merge all annotations.
  2839             tree.type = tree.underlyingType.type;
  2840                 AnnotatedType newat = (AnnotatedType) tree.underlyingType.type;
       
  2841                 AnnotatedType at = (AnnotatedType) tree.type;
       
  2842                 at.underlyingType = newat.underlyingType;
       
  2843                 newat.typeAnnotations = at.typeAnnotations.appendList(newat.typeAnnotations);
       
  2844                 tree.type = newat;
       
  2845             } else {
       
  2846                 // Create a new AnnotatedType to have the correct tag.
       
  2847                 AnnotatedType oldat = (AnnotatedType) tree.type;
       
  2848                 tree.type = new AnnotatedType(tree.underlyingType.type);
       
  2849                 ((AnnotatedType) tree.type).typeAnnotations = oldat.typeAnnotations;
       
  2850             }
       
  2851         }
  2840         }
  2852         result = tree;
  2841         result = tree;
  2853     }
  2842     }
  2854 
  2843 
  2855     public void visitTypeCast(JCTypeCast tree) {
  2844     public void visitTypeCast(JCTypeCast tree) {