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