Produced by Araxis Merge on 9/25/2018 2:13:28 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\sun\tools\tree | VarDeclarationStatement.java | Mon Jan 22 14:46:56 2018 UTC |
2 | build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\sun\tools\tree | VarDeclarationStatement.java | Wed Sep 12 18:02:10 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 550 |
Changed | 2 | 4 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | /* | |
2 | * Copyrig ht (c) 199 4, 2003, O racle and/ or its aff iliates. A ll rights reserved. | |
3 | * DO NOT ALTER OR R EMOVE COPY RIGHT NOTI CES OR THI S FILE HEA DER. | |
4 | * | |
5 | * This co de is free software; you can r edistribut e it and/o r modify i t | |
6 | * under t he terms o f the GNU General Pu blic Licen se version 2 only, a s | |
7 | * publish ed by the Free Softw are Founda tion. Ora cle design ates this | |
8 | * particu lar file a s subject to the "Cl asspath" e xception a s provided | |
9 | * by Orac le in the LICENSE fi le that ac companied this code. | |
10 | * | |
11 | * This co de is dist ributed in the hope that it wi ll be usef ul, but WI THOUT | |
12 | * ANY WAR RANTY; wit hout even the implie d warranty of MERCHA NTABILITY or | |
13 | * FITNESS FOR A PAR TICULAR PU RPOSE. Se e the GNU General Pu blic Licen se | |
14 | * version 2 for mor e details (a copy is included in the LIC ENSE file that | |
15 | * accompa nied this code). | |
16 | * | |
17 | * You sho uld have r eceived a copy of th e GNU Gene ral Public License v ersion | |
18 | * 2 along with this work; if not, write to the Fr ee Softwar e Foundati on, | |
19 | * Inc., 5 1 Franklin St, Fifth Floor, Bo ston, MA 0 2110-1301 USA. | |
20 | * | |
21 | * Please contact Or acle, 500 Oracle Par kway, Redw ood Shores , CA 94065 USA | |
22 | * or visi t www.orac le.com if you need a dditional informatio n or have any | |
23 | * questio ns. | |
24 | */ | |
25 | ||
26 | package su n.tools.tr ee; | |
27 | ||
28 | import sun .tools.jav a.*; | |
29 | import sun .tools.asm .Assembler ; | |
30 | import sun .tools.asm .LocalVari able; | |
31 | import jav a.io.Print Stream; | |
32 | import jav a.util.Has htable; | |
33 | ||
34 | /** | |
35 | * WARNING : The cont ents of th is source file are n ot part of any | |
36 | * support ed API. C ode that d epends on them does so at its own risk: | |
37 | * they ar e subject to change or removal without n otice. | |
38 | */ | |
39 | public | |
40 | class VarD eclaration Statement extends St atement { | |
41 | LocalM ember fiel d; | |
42 | Expres sion expr; | |
43 | ||
44 | /** | |
45 | * Con structor | |
46 | */ | |
47 | public VarDeclar ationState ment(long where, Exp ression ex pr) { | |
48 | super(
|
|
49 | th is.expr = expr; | |
50 | } | |
51 | public VarDeclar ationState ment(long where, Loc alMember f ield, Expr ession exp r) { | |
52 | super(
|
|
53 | th is.field = field; | |
54 | th is.expr = expr; | |
55 | } | |
56 | ||
57 | /** | |
58 | * Che ck stateme nt | |
59 | */ | |
60 | Vset c heckDeclar ation(Envi ronment en v, Context ctx, Vset vset, int mod, Type t, Hashta ble exp) { | |
61 | if (labels ! = null) { | |
62 | env.erro r(where, " declaratio n.with.lab el", label s[0]); | |
63 | } | |
64 | if (field != null) { | |
65 | if (ctx. getLocalCl ass(field. getName()) != null | |
66 | && f ield.isInn erClass()) { | |
67 | env. error(wher e, "local. class.rede fined", fi eld.getNam e()); | |
68 | } | |
69 | ||
70 | ctx.decl are(env, f ield); | |
71 | if (fiel d.isInnerC lass()) { | |
72 | Clas sDefinitio n body = f ield.getIn nerClass() ; | |
73 | try { | |
74 | vset = bod y.checkLoc alClass(en v, ctx, vs et, | |
75 | nu ll, null, null); | |
76 | } ca tch (Class NotFound e e) { | |
77 | env.error( where, "cl ass.not.fo und", ee.n ame, opNam es[op]); | |
78 | } | |
79 | retu rn vset; | |
80 | } | |
81 | vset.add Var(field. number); | |
82 | return ( expr != nu ll) ? expr .checkValu e(env, ctx , vset, ex p) : vset; | |
83 | } | |
84 | ||
85 | // Argument 'expr' is either an Identifier Expression for a dec laration o f | |
86 | // the form 'type x' o r an Assig nmentExpre ssion for a declarat ion of the | |
87 | // form 'typ e x = init value'. N ote that t hese expre ssions are treated | |
88 | // specially in this c ontext, an d don't ha ve much co nnection t o their or dinary | |
89 | // meaning. | |
90 | ||
91 | Ex pression e = expr; | |
92 | ||
93 | if (e.op == ASSIGN) { | |
94 | expr = ( (AssignExp ression)e) .right; | |
95 | e = ((As signExpres sion)e).le ft; | |
96 | } else { | |
97 | expr = n ull; | |
98 | } | |
99 | ||
100 | bo olean decl Error = t. isType(TC_ ERROR); | |
101 | wh ile (e.op == ARRAYAC CESS) { | |
102 | ArrayAcc essExpress ion array = (ArrayAc cessExpres sion)e; | |
103 | if (arra y.index != null) { | |
104 | env. error(arra y.index.wh ere, "arra y.dim.in.t ype"); | |
105 | decl Error = tr ue; | |
106 | } | |
107 | e = arra y.right; | |
108 | t = Type .tArray(t) ; | |
109 | } | |
110 | if (e.op == IDENT) { | |
111 | Identifi er id = (( Identifier Expression )e).id; | |
112 | if (ctx. getLocalFi eld(id) != null) { | |
113 | env. error(wher e, "local. redefined" , id); | |
114 | } | |
115 | ||
116 | field = new LocalM ember(e.wh ere, ctx.f ield.getCl assDefinit ion(), mod , t, id); | |
117 | ctx.decl are(env, f ield); | |
118 | ||
119 | if (expr != null) { | |
120 | vset = expr.ch eckInitial izer(env, ctx, vset, t, exp); | |
121 | expr = convert (env, ctx, t, expr); | |
122 | fiel d.setValue (expr); // for the s ake of non -blank fin als | |
123 | if ( field.isCo nstant()) { | |
124 | // Keep in mind that isConstan t() only m eans expre ssions | |
125 | // that ar e constant according to the JL S. They m ight | |
126 | // not be either con stants or evaluable (eg. 1/0). | |
127 | field.addM odifiers(M _INLINEABL E); | |
128 | } | |
129 | vset .addVar(fi eld.number ); | |
130 | } else i f (declErr or) { | |
131 | vset .addVar(fi eld.number ); | |
132 | } else { | |
133 | vset .addVarUna ssigned(fi eld.number ); | |
134 | } | |
135 | return v set; | |
136 | } | |
137 | en v.error(e. where, "in valid.decl "); | |
138 | re turn vset; | |
139 | } | |
140 | ||
141 | /** | |
142 | * Inl ine | |
143 | */ | |
144 | public Statement inline(En vironment env, Conte xt ctx) { | |
145 | if (field.is InnerClass ()) { | |
146 | ClassDef inition bo dy = field .getInnerC lass(); | |
147 | body.inl ineLocalCl ass(env); | |
148 | return n ull; | |
149 | } | |
150 | ||
151 | // Don't gen erate code for varia ble if unu sed and | |
152 | // optimizat ion is on, whether o r not debu gging is o n | |
153 | if (env.opt( ) && !fiel d.isUsed() ) { | |
154 | return n ew Express ionStateme nt(where, expr).inli ne(env, ct x); | |
155 | } | |
156 | ||
157 | ct x.declare( env, field ); | |
158 | ||
159 | if (expr != null) { | |
160 | expr = e xpr.inline Value(env, ctx); | |
161 | field.se tValue(exp r); // for the sake of non-bla nk finals | |
162 | if (env. opt() && ( field.writ ecount == 0)) { | |
163 | if ( expr.op == IDENT) { | |
164 | ||
165 | // This co de looks l ike it tes ts whether a final v ariable | |
166 | // is bein g initiali zed by an identifier expressio n. | |
167 | // Then if the ident ifier is a local of the same m ethod | |
168 | // it make s the fina l variable eligible to be inli ned. | |
169 | // BUT: wh y isn't th e local al so checked to make s ure | |
170 | // it is i tself fina l? Unknow n. | |
171 | ||
172 | Identifier Expression e = (Iden tifierExpr ession)exp r; | |
173 | if (e.fiel d.isLocal( ) && ((ctx = ctx.get InlineCont ext()) != null) && | |
174 | (((Loc alMember)e .field).nu mber < ctx .varNumber )) { | |
175 | //Syst em.out.pri ntln("FINA L IDENT = " + field + " in " + ctx.field ); | |
176 | field. setValue(e xpr); | |
177 | field. addModifie rs(M_INLIN EABLE); | |
178 | ||
179 | // The two lines below use d to elide the decla ration | |
180 | // of inlineable variables , on the t heory that there | |
181 | // wou ldn't be a ny referen ces. But this break s the | |
182 | // tra nslation o f nested c lasses, wh ich might refer to | |
183 | // the variable. | |
184 | ||
185 | //expr = null; | |
186 | //retu rn null; | |
187 | } | |
188 | } | |
189 | if ( expr.isCon stant() || (expr.op == THIS) | | (expr.op == SUPER) ) { | |
190 | //System.o ut.println ("FINAL = " + field + " in " + ctx.field ); | |
191 | field.setV alue(expr) ; | |
192 | field.addM odifiers(M _INLINEABL E); | |
193 | ||
194 | // The two lines bel ow used to elide the declarati on | |
195 | // of inli neable var iables, on the theor y that the re | |
196 | // wouldn' t be any r eferences. But this breaks th e | |
197 | // transla tion of ne sted class es, which might refe r to | |
198 | // the var iable. Fi x for 4073 244. | |
199 | ||
200 | //expr = n ull; | |
201 | //return n ull; | |
202 | } | |
203 | } | |
204 | } | |
205 | re turn this; | |
206 | } | |
207 | ||
208 | /** | |
209 | * Cre ate a copy of the st atement fo r method i nlining | |
210 | */ | |
211 | public Statement copyInlin e(Context ctx, boole an valNeed ed) { | |
212 | Va rDeclarati onStatemen t s = (Var Declaratio nStatement )clone(); | |
213 | if (expr != null) { | |
214 | s.expr = expr.copy Inline(ctx ); | |
215 | } | |
216 | re turn s; | |
217 | } | |
218 | ||
219 | /** | |
220 | * The cost of i nlining th is stateme nt | |
221 | */ | |
222 | public int costI nline(int thresh, En vironment env, Conte xt ctx) { | |
223 | if (field != null && f ield.isInn erClass()) { | |
224 | return t hresh; // don't copy clas ses... | |
225 | } | |
226 | re turn (expr != null) ? expr.cos tInline(th resh, env, ctx) : 0; | |
227 | } | |
228 | ||
229 | /** | |
230 | * Cod e | |
231 | */ | |
232 | public void code (Environme nt env, Co ntext ctx, Assembler asm) { | |
233 | if (expr != null && !e xpr.type.i sType(TC_V OID)) { | |
234 | // The t wo lines o f code dir ectly foll owing this comment u sed | |
235 | // to be in the op posite ord er. They were switc hed so tha t | |
236 | // lines like the following: | |
237 | // | |
238 | // i nt j = (j = 4); | |
239 | // | |
240 | // will compile co rrectly. (Construct ions like the above are | |
241 | // legal . JLS 14. 3.2 says t hat the sc ope of a l ocal varia ble | |
242 | // inclu des its ow n initiali zer.) It is importa nt that we | |
243 | // decla re `field' before we code `exp r', becaus e otherwis e | |
244 | // situa tions can arise wher e `field' thinks it is assigne d | |
245 | // a loc al variabl e slot tha t is, in a ctuality, assigned t o | |
246 | // an en tirely dif ferent var iable. (B ug id 4076 729) | |
247 | ctx.decl are(env, f ield); | |
248 | expr.cod eValue(env , ctx, asm ); | |
249 | ||
250 | asm.add( where, opc _istore + field.getT ype().getT ypeCodeOff set(), | |
251 | new LocalV ariable(fi eld, field .number)); | |
252 | } else { | |
253 | ctx.decl are(env, f ield); | |
254 | if (expr != null) { | |
255 | // a n initial side effec t, rather than an in itial valu e | |
256 | expr .code(env, ctx, asm) ; | |
257 | } | |
258 | } | |
259 | } | |
260 | ||
261 | /** | |
262 | * Pri nt | |
263 | */ | |
264 | public void prin t(PrintStr eam out, i nt indent) { | |
265 | ou t.print("l ocal "); | |
266 | if (field != null) { | |
267 | out.prin t(field + "#" + fiel d.hashCode ()); | |
268 | if (expr != null) { | |
269 | out. print(" = "); | |
270 | expr .print(out ); | |
271 | } | |
272 | } else { | |
273 | expr.pri nt(out); | |
274 | out.prin t(";"); | |
275 | } | |
276 | } | |
277 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.