1.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java Mon Nov 14 08:09:47 2011 -0800 1.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java Mon Nov 14 15:11:10 2011 -0800 1.3 @@ -26,8 +26,6 @@ 1.4 package com.sun.tools.javac.jvm; 1.5 import java.util.*; 1.6 1.7 -import javax.lang.model.element.ElementKind; 1.8 - 1.9 import com.sun.tools.javac.util.*; 1.10 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; 1.11 import com.sun.tools.javac.util.List; 1.12 @@ -39,6 +37,7 @@ 1.13 import com.sun.tools.javac.code.Type.*; 1.14 import com.sun.tools.javac.jvm.Code.*; 1.15 import com.sun.tools.javac.jvm.Items.*; 1.16 +import com.sun.tools.javac.parser.EndPosTable; 1.17 import com.sun.tools.javac.tree.JCTree.*; 1.18 1.19 import static com.sun.tools.javac.code.Flags.*; 1.20 @@ -197,9 +196,10 @@ 1.21 */ 1.22 private int nerrs = 0; 1.23 1.24 - /** A hash table mapping syntax trees to their ending source positions. 1.25 + /** An object containing mappings of syntax trees to their 1.26 + * ending source positions. 1.27 */ 1.28 - private Map<JCTree, Integer> endPositions; 1.29 + EndPosTable endPosTable; 1.30 1.31 /** Generate code to load an integer constant. 1.32 * @param n The integer to be loaded. 1.33 @@ -482,20 +482,14 @@ 1.34 JCStatement init = make.at(vdef.pos()). 1.35 Assignment(sym, vdef.init); 1.36 initCode.append(init); 1.37 - if (endPositions != null) { 1.38 - Integer endPos = endPositions.remove(vdef); 1.39 - if (endPos != null) endPositions.put(init, endPos); 1.40 - } 1.41 + endPosTable.replaceTree(vdef, init); 1.42 } else if (sym.getConstValue() == null) { 1.43 // Initialize class (static) variables only if 1.44 // they are not compile-time constants. 1.45 JCStatement init = make.at(vdef.pos). 1.46 Assignment(sym, vdef.init); 1.47 clinitCode.append(init); 1.48 - if (endPositions != null) { 1.49 - Integer endPos = endPositions.remove(vdef); 1.50 - if (endPos != null) endPositions.put(init, endPos); 1.51 - } 1.52 + endPosTable.replaceTree(vdef, init); 1.53 } else { 1.54 checkStringConstant(vdef.init.pos(), sym.getConstValue()); 1.55 } 1.56 @@ -2217,7 +2211,7 @@ 1.57 attrEnv = env; 1.58 ClassSymbol c = cdef.sym; 1.59 this.toplevel = env.toplevel; 1.60 - this.endPositions = toplevel.endPositions; 1.61 + this.endPosTable = toplevel.endPositions; 1.62 // If this is a class definition requiring Miranda methods, 1.63 // add them. 1.64 if (generateIproxies && 1.65 @@ -2253,7 +2247,7 @@ 1.66 attrEnv = null; 1.67 this.env = null; 1.68 toplevel = null; 1.69 - endPositions = null; 1.70 + endPosTable = null; 1.71 nerrs = 0; 1.72 } 1.73 }