src/share/classes/com/sun/tools/javac/jvm/Gen.java

Print this page




 293         }
 294 
 295         return sym.clone(site.tsym);
 296     }
 297 
 298     /** Insert a reference to given type in the constant pool,
 299      *  checking for an array with too many dimensions;
 300      *  return the reference's index.
 301      *  @param type   The type for which a reference is inserted.
 302      */
 303     int makeRef(DiagnosticPosition pos, Type type) {
 304         checkDimension(pos, type);
 305         return pool.put(type.tag == CLASS ? (Object)type.tsym : (Object)type);
 306     }
 307 
 308     /** Check if the given type is an array with too many dimensions.
 309      */
 310     private void checkDimension(DiagnosticPosition pos, Type t) {
 311         switch (t.tag) {
 312         case METHOD:

 313             checkDimension(pos, t.getReturnType());
 314             for (List<Type> args = t.getParameterTypes(); args.nonEmpty(); args = args.tail)
 315                 checkDimension(pos, args.head);
 316             break;
 317         case ARRAY:
 318             if (types.dimensions(t) > ClassFile.MAX_DIMENSIONS) {
 319                 log.error(pos, "limit.dimensions");
 320                 nerrs++;
 321             }
 322             break;
 323         default:
 324             break;
 325         }
 326     }
 327 
 328     /** Create a tempory variable.
 329      *  @param type   The variable's type.
 330      */
 331     LocalItem makeTemp(Type type) {
 332         VarSymbol v = new VarSymbol(Flags.SYNTHETIC,




 293         }
 294 
 295         return sym.clone(site.tsym);
 296     }
 297 
 298     /** Insert a reference to given type in the constant pool,
 299      *  checking for an array with too many dimensions;
 300      *  return the reference's index.
 301      *  @param type   The type for which a reference is inserted.
 302      */
 303     int makeRef(DiagnosticPosition pos, Type type) {
 304         checkDimension(pos, type);
 305         return pool.put(type.tag == CLASS ? (Object)type.tsym : (Object)type);
 306     }
 307 
 308     /** Check if the given type is an array with too many dimensions.
 309      */
 310     private void checkDimension(DiagnosticPosition pos, Type t) {
 311         switch (t.tag) {
 312         case METHOD:
 313         case FUNCTION:
 314             checkDimension(pos, t.getReturnType());
 315             for (List<Type> args = t.getParameterTypes(); args.nonEmpty(); args = args.tail)
 316                 checkDimension(pos, args.head);
 317             break;
 318         case ARRAY:
 319             if (types.dimensions(t) > ClassFile.MAX_DIMENSIONS) {
 320                 log.error(pos, "limit.dimensions");
 321                 nerrs++;
 322             }
 323             break;
 324         default:
 325             break;
 326         }
 327     }
 328 
 329     /** Create a tempory variable.
 330      *  @param type   The variable's type.
 331      */
 332     LocalItem makeTemp(Type type) {
 333         VarSymbol v = new VarSymbol(Flags.SYNTHETIC,