Knowledge (XXG)

Heap pollution

Source 📝

503: 76:
Under certain conditions, a variable of a parameterized type may refer to an object that is not of that parameterized type. The variable will always refer to an object that is an instance of a class that implements the parameterized type.
568: 544: 416: 389: 344: 365: 58: 40: 446: 54: 537: 472: 530: 563: 31:
refers to an object that is not of that parameterized type. This situation is normally detected during
510: 399:
Stenzel, Kurt; Grandy, Holger; Reif, Wolfgang (2008). "Verification of Java Programs with Generics".
376: 47: 502: 412: 385: 361: 355: 340: 82: 22: 514: 332: 404: 70: 66: 62: 17: 44: 557: 32: 36: 28: 408: 331:
Gosling, James; Joy, Bill; Steele, Guy; Bracha, Gilad; Buckley, Alex (2014).
53:
Heap pollution in Java can occur when type arguments and variables are not
403:. Lecture Notes in Computer Science. Vol. 5140. pp. 315–329. 57:
at run-time. As a result, different parameterized types are
518: 73:. This results in the possibility of heap pollution. 337:The Java Language Specification, Java SE 8 Edition 27:is a situation that arises when a variable of a 360:. Expert's voice in Java. Apress. p. 211. 538: 401:Algebraic Methodology and Software Technology 8: 545: 531: 466: 464: 375:Reese, Richard; Reese, Jennifer (2012). 65:at run time. All invocations of a given 435: 441: 439: 7: 499: 497: 473:"Java Generics FAQs: Heap pollution" 384:. Packt Publishing. pp. 38–40. 517:. You can help Knowledge (XXG) by 339:. Addison-Wesley. pp. 81–82. 43:heap pollution will often cause a 14: 569:Programming language topic stubs 501: 71:single run-time implementation 1: 378:Java 7 New Features Cookbook 286:// ClassCastException thrown 211:// another unchecked warning 585: 496: 409:10.1007/978-3-540-79980-1 69:type declaration share a 88: 81:Heap Pollution in a non- 447:"The Java SE Tutorials" 424:(subscription required) 513:-related article is a 354:Friesen, Jeff (2011). 35:and indicated with an 61:by the same class or 511:programming-language 181:// unchecked warning 477:angelikalanger.com/ 471:Langer, Angelika. 29:parameterized type 526: 525: 418:978-3-540-79979-5 391:978-1-84968-562-7 346:978-0-13-390069-9 97:HeapPollutionDemo 37:unchecked warning 576: 547: 540: 533: 505: 498: 488: 487: 485: 483: 468: 459: 458: 456: 454: 443: 425: 422: 395: 383: 371: 357:Beginning Java 7 350: 320: 317: 314: 311: 308: 305: 302: 299: 296: 293: 290: 287: 284: 281: 278: 275: 272: 269: 266: 263: 260: 257: 254: 251: 248: 245: 242: 239: 236: 233: 230: 227: 224: 221: 218: 215: 212: 209: 206: 203: 200: 197: 194: 191: 188: 185: 182: 179: 176: 173: 170: 167: 164: 161: 158: 155: 152: 149: 146: 143: 140: 137: 134: 131: 128: 125: 122: 119: 116: 113: 110: 107: 104: 101: 98: 95: 92: 39:. Later, during 18:Java programming 584: 583: 579: 578: 577: 575: 574: 573: 554: 553: 552: 551: 494: 492: 491: 481: 479: 470: 469: 462: 452: 450: 445: 444: 437: 432: 423: 419: 398: 392: 381: 374: 368: 353: 347: 330: 327: 325:Further reading 322: 321: 318: 315: 312: 309: 306: 303: 300: 297: 294: 291: 288: 285: 282: 279: 276: 273: 270: 267: 264: 261: 258: 255: 252: 249: 246: 243: 240: 237: 234: 231: 228: 225: 222: 219: 216: 213: 210: 207: 204: 201: 198: 195: 192: 189: 186: 183: 180: 177: 174: 171: 168: 165: 162: 159: 156: 153: 150: 147: 144: 141: 138: 135: 132: 129: 126: 123: 120: 117: 114: 111: 108: 105: 102: 99: 96: 93: 90: 12: 11: 5: 582: 580: 572: 571: 566: 556: 555: 550: 549: 542: 535: 527: 524: 523: 506: 490: 489: 460: 434: 433: 431: 428: 427: 426: 417: 396: 390: 372: 367:978-1430239093 366: 351: 345: 326: 323: 89: 13: 10: 9: 6: 4: 3: 2: 581: 570: 567: 565: 564:Java platform 562: 561: 559: 548: 543: 541: 536: 534: 529: 528: 522: 520: 516: 512: 507: 504: 500: 495: 478: 474: 467: 465: 461: 448: 442: 440: 436: 429: 420: 414: 410: 406: 402: 397: 393: 387: 380: 379: 373: 369: 363: 359: 358: 352: 348: 342: 338: 334: 329: 328: 324: 87: 86: 84: 78: 74: 72: 68: 64: 60: 56: 51: 49: 46: 42: 38: 34: 30: 26: 24: 19: 519:expanding it 508: 493: 480:. Retrieved 476: 451:. Retrieved 400: 377: 356: 336: 80: 79: 75: 52: 21: 15: 59:implemented 33:compilation 558:Categories 430:References 20:language, 63:interface 48:Exception 45:ClassCast 25:pollution 449:. Oracle 333:"4.12.2" 238:iterator 214:Iterator 482:15 July 453:16 July 301:println 256:hasNext 199:Integer 148:Integer 142:TreeSet 85:context 83:varargs 67:generic 55:reified 41:runtime 16:In the 415:  388:  364:  343:  289:System 265:String 220:String 163:String 118:String 106:static 103:public 91:public 509:This 382:(PDF) 244:while 94:class 515:stub 484:2014 455:2014 413:ISBN 386:ISBN 362:ISBN 341:ISBN 280:next 274:iter 250:iter 226:iter 223:> 217:< 166:> 160:< 151:> 145:< 121:args 112:main 109:void 23:heap 405:doi 307:str 295:out 283:(); 268:str 259:()) 241:(); 208:)); 196:new 190:add 157:Set 154:(); 139:new 130:Set 560:: 475:. 463:^ 438:^ 411:. 335:. 310:); 232:ss 205:42 169:ss 50:. 546:e 539:t 532:v 521:. 486:. 457:. 421:. 407:: 394:. 370:. 349:. 319:} 316:} 313:} 304:( 298:. 292:. 277:. 271:= 262:{ 253:. 247:( 235:. 229:= 202:( 193:( 187:. 184:s 178:; 175:s 172:= 136:= 133:s 127:{ 124:) 115:( 100:{

Index

Java programming
heap
parameterized type
compilation
unchecked warning
runtime
ClassCast
Exception
reified
implemented
interface
generic
single run-time implementation
varargs
"4.12.2"
ISBN
978-0-13-390069-9
Beginning Java 7
ISBN
978-1430239093
Java 7 New Features Cookbook
ISBN
978-1-84968-562-7
doi
10.1007/978-3-540-79980-1
ISBN
978-3-540-79979-5


"The Java SE Tutorials"

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.