213 void emitMinusOne(int tc) {
214 if (tc == LONGcode) {
215 items.makeImmediateItem(syms.longType, Long.valueOf(-1)).load();
216 } else {
217 code.emitop0(iconst_m1);
218 }
219 }
220
221 /** Construct a symbol to reflect the qualifying type that should
222 * appear in the byte code as per JLS 13.1.
223 *
224 * For {@literal target >= 1.2}: Clone a method with the qualifier as owner (except
225 * for those cases where we need to work around VM bugs).
226 *
227 * For {@literal target <= 1.1}: If qualified variable or method is defined in a
228 * non-accessible class, clone it with the qualifier class as owner.
229 *
230 * @param sym The accessed symbol
231 * @param site The qualifier's type.
232 */
233 Symbol binaryQualifier(Symbol sym, Type site) {
234
235 if (site.hasTag(ARRAY)) {
236 if (sym == syms.lengthVar ||
237 sym.owner != syms.arrayClass)
238 return sym;
239 // array clone can be qualified by the array type in later targets
240 Symbol qualifier;
241 if ((qualifier = qualifiedSymbolCache.get(site)) == null) {
242 qualifier = new ClassSymbol(Flags.PUBLIC, site.tsym.name, site, syms.noSymbol);
243 qualifiedSymbolCache.put(site, qualifier);
244 }
245 return sym.clone(qualifier);
246 }
247
248 if (sym.owner == site.tsym ||
249 (sym.flags() & (STATIC | SYNTHETIC)) == (STATIC | SYNTHETIC)) {
250 return sym;
251 }
252
253 // leave alone methods inherited from Object
|
213 void emitMinusOne(int tc) {
214 if (tc == LONGcode) {
215 items.makeImmediateItem(syms.longType, Long.valueOf(-1)).load();
216 } else {
217 code.emitop0(iconst_m1);
218 }
219 }
220
221 /** Construct a symbol to reflect the qualifying type that should
222 * appear in the byte code as per JLS 13.1.
223 *
224 * For {@literal target >= 1.2}: Clone a method with the qualifier as owner (except
225 * for those cases where we need to work around VM bugs).
226 *
227 * For {@literal target <= 1.1}: If qualified variable or method is defined in a
228 * non-accessible class, clone it with the qualifier class as owner.
229 *
230 * @param sym The accessed symbol
231 * @param site The qualifier's type.
232 */
233 public Symbol binaryQualifier(Symbol sym, Type site) {
234
235 if (site.hasTag(ARRAY)) {
236 if (sym == syms.lengthVar ||
237 sym.owner != syms.arrayClass)
238 return sym;
239 // array clone can be qualified by the array type in later targets
240 Symbol qualifier;
241 if ((qualifier = qualifiedSymbolCache.get(site)) == null) {
242 qualifier = new ClassSymbol(Flags.PUBLIC, site.tsym.name, site, syms.noSymbol);
243 qualifiedSymbolCache.put(site, qualifier);
244 }
245 return sym.clone(qualifier);
246 }
247
248 if (sym.owner == site.tsym ||
249 (sym.flags() & (STATIC | SYNTHETIC)) == (STATIC | SYNTHETIC)) {
250 return sym;
251 }
252
253 // leave alone methods inherited from Object
|