langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java
changeset 29050 76df9080086c
parent 27545 9b19c6e31489
child 29051 7244db2ab176
equal deleted inserted replaced
28895:6efe265424e3 29050:76df9080086c
  2642                       syms.intType, tree.sym);
  2642                       syms.intType, tree.sym);
  2643             ordParam.mods.flags |= SYNTHETIC; ordParam.sym.flags_field |= SYNTHETIC;
  2643             ordParam.mods.flags |= SYNTHETIC; ordParam.sym.flags_field |= SYNTHETIC;
  2644 
  2644 
  2645             MethodSymbol m = tree.sym;
  2645             MethodSymbol m = tree.sym;
  2646             tree.params = tree.params.prepend(ordParam).prepend(nameParam);
  2646             tree.params = tree.params.prepend(ordParam).prepend(nameParam);
  2647             incrementParamTypeAnnoIndexes(m, 2);
       
  2648 
  2647 
  2649             m.extraParams = m.extraParams.prepend(ordParam.sym);
  2648             m.extraParams = m.extraParams.prepend(ordParam.sym);
  2650             m.extraParams = m.extraParams.prepend(nameParam.sym);
  2649             m.extraParams = m.extraParams.prepend(nameParam.sym);
  2651             Type olderasure = m.erasure(types);
  2650             Type olderasure = m.erasure(types);
  2652             m.erasure_field = new MethodType(
  2651             m.erasure_field = new MethodType(
  2665         } finally {
  2664         } finally {
  2666             currentMethodDef = prevMethodDef;
  2665             currentMethodDef = prevMethodDef;
  2667             currentMethodSym = prevMethodSym;
  2666             currentMethodSym = prevMethodSym;
  2668         }
  2667         }
  2669     }
  2668     }
  2670     //where
       
  2671     private void incrementParamTypeAnnoIndexes(MethodSymbol m,
       
  2672                                                int amount) {
       
  2673         for (final Attribute.TypeCompound anno : m.getRawTypeAttributes()) {
       
  2674             // Increment the parameter_index of any existing formal
       
  2675             // parameter annotations.
       
  2676             if (anno.position.type == TargetType.METHOD_FORMAL_PARAMETER) {
       
  2677                 anno.position.parameter_index += amount;
       
  2678             }
       
  2679         }
       
  2680     }
       
  2681 
  2669 
  2682     private void visitMethodDefInternal(JCMethodDecl tree) {
  2670     private void visitMethodDefInternal(JCMethodDecl tree) {
  2683         if (tree.name == names.init &&
  2671         if (tree.name == names.init &&
  2684             (currentClass.isInner() || currentClass.isLocal())) {
  2672             (currentClass.isInner() || currentClass.isLocal())) {
  2685             // We are seeing a constructor of an inner class.
  2673             // We are seeing a constructor of an inner class.
  2709             // Add this$n (if needed) in front of and free variables behind
  2697             // Add this$n (if needed) in front of and free variables behind
  2710             // constructor parameter list.
  2698             // constructor parameter list.
  2711             tree.params = tree.params.appendList(fvdefs);
  2699             tree.params = tree.params.appendList(fvdefs);
  2712             if (currentClass.hasOuterInstance()) {
  2700             if (currentClass.hasOuterInstance()) {
  2713                 tree.params = tree.params.prepend(otdef);
  2701                 tree.params = tree.params.prepend(otdef);
  2714                 incrementParamTypeAnnoIndexes(m, 1);
       
  2715             }
  2702             }
  2716 
  2703 
  2717             // If this is an initial constructor, i.e., it does not start with
  2704             // If this is an initial constructor, i.e., it does not start with
  2718             // this(...), insert initializers for this$n and proxies
  2705             // this(...), insert initializers for this$n and proxies
  2719             // before (pre-1.4, after) the call to superclass constructor.
  2706             // before (pre-1.4, after) the call to superclass constructor.