1.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Wed Jan 05 09:59:01 2011 +0000 1.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Mon Jan 10 14:57:59 2011 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -65,10 +65,6 @@ 1.11 1.12 private final Options options; 1.13 1.14 - /** Switch: debugging output for JSR 308-related operations. 1.15 - */ 1.16 - private boolean debugJSR308; 1.17 - 1.18 /** Switch: verbose output. 1.19 */ 1.20 private boolean verbose; 1.21 @@ -180,7 +176,6 @@ 1.22 types = Types.instance(context); 1.23 fileManager = context.get(JavaFileManager.class); 1.24 1.25 - debugJSR308 = options.isSet("TA:writer"); 1.26 verbose = options.isSet(VERBOSE); 1.27 scramble = options.isSet("-scramble"); 1.28 scrambleAll = options.isSet("-scrambleAll"); 1.29 @@ -677,7 +672,6 @@ 1.30 acount++; 1.31 } 1.32 acount += writeJavaAnnotations(sym.getAnnotationMirrors()); 1.33 - acount += writeTypeAnnotations(sym.typeAnnotations); 1.34 return acount; 1.35 } 1.36 1.37 @@ -772,46 +766,6 @@ 1.38 return attrCount; 1.39 } 1.40 1.41 - int writeTypeAnnotations(List<Attribute.TypeCompound> typeAnnos) { 1.42 - if (typeAnnos.isEmpty()) return 0; 1.43 - 1.44 - ListBuffer<Attribute.TypeCompound> visibles = ListBuffer.lb(); 1.45 - ListBuffer<Attribute.TypeCompound> invisibles = ListBuffer.lb(); 1.46 - 1.47 - for (Attribute.TypeCompound tc : typeAnnos) { 1.48 - if (tc.position.type == TargetType.UNKNOWN 1.49 - || !tc.position.emitToClassfile()) 1.50 - continue; 1.51 - switch (types.getRetention(tc)) { 1.52 - case SOURCE: break; 1.53 - case CLASS: invisibles.append(tc); break; 1.54 - case RUNTIME: visibles.append(tc); break; 1.55 - default: ;// /* fail soft */ throw new AssertionError(vis); 1.56 - } 1.57 - } 1.58 - 1.59 - int attrCount = 0; 1.60 - if (visibles.length() != 0) { 1.61 - int attrIndex = writeAttr(names.RuntimeVisibleTypeAnnotations); 1.62 - databuf.appendChar(visibles.length()); 1.63 - for (Attribute.TypeCompound p : visibles) 1.64 - writeTypeAnnotation(p); 1.65 - endAttr(attrIndex); 1.66 - attrCount++; 1.67 - } 1.68 - 1.69 - if (invisibles.length() != 0) { 1.70 - int attrIndex = writeAttr(names.RuntimeInvisibleTypeAnnotations); 1.71 - databuf.appendChar(invisibles.length()); 1.72 - for (Attribute.TypeCompound p : invisibles) 1.73 - writeTypeAnnotation(p); 1.74 - endAttr(attrIndex); 1.75 - attrCount++; 1.76 - } 1.77 - 1.78 - return attrCount; 1.79 - } 1.80 - 1.81 /** A visitor to write an attribute including its leading 1.82 * single-character marker. 1.83 */ 1.84 @@ -888,104 +842,6 @@ 1.85 p.snd.accept(awriter); 1.86 } 1.87 } 1.88 - 1.89 - void writeTypeAnnotation(Attribute.TypeCompound c) { 1.90 - if (debugJSR308) 1.91 - System.out.println("TA: writing " + c + " at " + c.position 1.92 - + " in " + log.currentSourceFile()); 1.93 - writeCompoundAttribute(c); 1.94 - writePosition(c.position); 1.95 - } 1.96 - 1.97 - void writePosition(TypeAnnotationPosition p) { 1.98 - databuf.appendByte(p.type.targetTypeValue()); 1.99 - switch (p.type) { 1.100 - // type case 1.101 - case TYPECAST: 1.102 - case TYPECAST_GENERIC_OR_ARRAY: 1.103 - // object creation 1.104 - case INSTANCEOF: 1.105 - case INSTANCEOF_GENERIC_OR_ARRAY: 1.106 - // new expression 1.107 - case NEW: 1.108 - case NEW_GENERIC_OR_ARRAY: 1.109 - databuf.appendChar(p.offset); 1.110 - break; 1.111 - // local variable 1.112 - case LOCAL_VARIABLE: 1.113 - case LOCAL_VARIABLE_GENERIC_OR_ARRAY: 1.114 - databuf.appendChar(p.lvarOffset.length); // for table length 1.115 - for (int i = 0; i < p.lvarOffset.length; ++i) { 1.116 - databuf.appendChar(p.lvarOffset[i]); 1.117 - databuf.appendChar(p.lvarLength[i]); 1.118 - databuf.appendChar(p.lvarIndex[i]); 1.119 - } 1.120 - break; 1.121 - // method receiver 1.122 - case METHOD_RECEIVER: 1.123 - // Do nothing 1.124 - break; 1.125 - // type parameters 1.126 - case CLASS_TYPE_PARAMETER: 1.127 - case METHOD_TYPE_PARAMETER: 1.128 - databuf.appendByte(p.parameter_index); 1.129 - break; 1.130 - // type parameters bounds 1.131 - case CLASS_TYPE_PARAMETER_BOUND: 1.132 - case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY: 1.133 - case METHOD_TYPE_PARAMETER_BOUND: 1.134 - case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY: 1.135 - databuf.appendByte(p.parameter_index); 1.136 - databuf.appendByte(p.bound_index); 1.137 - break; 1.138 - // wildcards 1.139 - case WILDCARD_BOUND: 1.140 - case WILDCARD_BOUND_GENERIC_OR_ARRAY: 1.141 - writePosition(p.wildcard_position); 1.142 - break; 1.143 - // Class extends and implements clauses 1.144 - case CLASS_EXTENDS: 1.145 - case CLASS_EXTENDS_GENERIC_OR_ARRAY: 1.146 - databuf.appendChar(p.type_index); 1.147 - break; 1.148 - // throws 1.149 - case THROWS: 1.150 - databuf.appendChar(p.type_index); 1.151 - break; 1.152 - case CLASS_LITERAL: 1.153 - case CLASS_LITERAL_GENERIC_OR_ARRAY: 1.154 - databuf.appendChar(p.offset); 1.155 - break; 1.156 - // method parameter: not specified 1.157 - case METHOD_PARAMETER_GENERIC_OR_ARRAY: 1.158 - databuf.appendByte(p.parameter_index); 1.159 - break; 1.160 - // method type argument: wasn't specified 1.161 - case NEW_TYPE_ARGUMENT: 1.162 - case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY: 1.163 - case METHOD_TYPE_ARGUMENT: 1.164 - case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY: 1.165 - databuf.appendChar(p.offset); 1.166 - databuf.appendByte(p.type_index); 1.167 - break; 1.168 - // We don't need to worry abut these 1.169 - case METHOD_RETURN_GENERIC_OR_ARRAY: 1.170 - case FIELD_GENERIC_OR_ARRAY: 1.171 - break; 1.172 - case UNKNOWN: 1.173 - break; 1.174 - default: 1.175 - throw new AssertionError("unknown position: " + p); 1.176 - } 1.177 - 1.178 - // Append location data for generics/arrays. 1.179 - if (p.type.hasLocation()) { 1.180 - databuf.appendChar(p.location.size()); 1.181 - for (int i : p.location) 1.182 - databuf.appendByte((byte)i); 1.183 - } 1.184 - } 1.185 - 1.186 /********************************************************************** 1.187 * Writing Objects 1.188 **********************************************************************/ 1.189 @@ -1698,7 +1554,6 @@ 1.190 1.191 acount += writeFlagAttrs(c.flags()); 1.192 acount += writeJavaAnnotations(c.getAnnotationMirrors()); 1.193 - acount += writeTypeAnnotations(c.typeAnnotations); 1.194 acount += writeEnclosingMethodAttribute(c); 1.195 1.196 poolbuf.appendInt(JAVA_MAGIC);